mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-4327: changed InvalidParameterException with IntegrityException
This commit is contained in:
@@ -27,13 +27,13 @@
|
||||
|
||||
package org.alfresco.module.org_alfresco_module_rm.model;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl;
|
||||
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||
import org.alfresco.repo.policy.BehaviourFilter;
|
||||
import org.alfresco.repo.policy.annotation.BehaviourRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -99,9 +99,9 @@ public abstract class BaseBehaviourBean extends ServiceBaseImpl
|
||||
* @param childType the child node
|
||||
* @param acceptedUniqueChildType a list of node types that are accepted as children of the provided parent only once
|
||||
* @param acceptedMultipleChildType a list of node types that are accepted as children of the provided parent multiple times
|
||||
* @throws InvalidParameterException if the child association doesn't comply with the RM rules
|
||||
* @throws IntegrityException if the child association doesn't comply with the RM rules
|
||||
*/
|
||||
protected void validateNewChildAssociation(NodeRef parent, NodeRef child, List<QName> acceptedUniqueChildType, List<QName> acceptedMultipleChildType) throws InvalidParameterException
|
||||
protected void validateNewChildAssociation(NodeRef parent, NodeRef child, List<QName> acceptedUniqueChildType, List<QName> acceptedMultipleChildType) throws IntegrityException
|
||||
{
|
||||
QName childType = getInternalNodeService().getType(child);
|
||||
if(acceptedUniqueChildType.contains(childType))
|
||||
@@ -109,12 +109,12 @@ public abstract class BaseBehaviourBean extends ServiceBaseImpl
|
||||
// check the user is not trying to create multiple children of a type that is only accepted once
|
||||
if(nodeService.getChildAssocs(parent, Sets.newHashSet(childType)).size() > 1)
|
||||
{
|
||||
throw new InvalidParameterException("Operation failed. Multiple children of this type are not allowed.");
|
||||
throw new IntegrityException("Operation failed. Multiple children of this type are not allowed.", null);
|
||||
}
|
||||
}
|
||||
else if(!acceptedMultipleChildType.contains(childType))
|
||||
{
|
||||
throw new InvalidParameterException("Operation failed. Children of type " + childType + " are not allowed");
|
||||
throw new IntegrityException("Operation failed. Children of type " + childType + " are not allowed", null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,9 +122,9 @@ public abstract class BaseBehaviourBean extends ServiceBaseImpl
|
||||
* Helper method that checks if the newly created child association is between the sub-types of accepted types.
|
||||
* @param childType the child node
|
||||
* @param acceptedMultipleChildType a list of node types that are accepted as children of the provided parent multiple times
|
||||
* @throws InvalidParameterException if the child association isn't between the sub-types of accepted types
|
||||
* @throws IntegrityException if the child association isn't between the sub-types of accepted types
|
||||
*/
|
||||
protected void validateNewChildAssociationSubTypesIncluded(NodeRef child, List<QName> acceptedMultipleChildType) throws InvalidParameterException
|
||||
protected void validateNewChildAssociationSubTypesIncluded(NodeRef child, List<QName> acceptedMultipleChildType) throws IntegrityException
|
||||
{
|
||||
QName childType = getInternalNodeService().getType(child);
|
||||
for(QName type : acceptedMultipleChildType)
|
||||
@@ -135,6 +135,6 @@ public abstract class BaseBehaviourBean extends ServiceBaseImpl
|
||||
}
|
||||
}
|
||||
//no match was found in sub-types of permitted types list
|
||||
throw new InvalidParameterException("Operation failed. Children of type " + childType + " are not allowed");
|
||||
throw new IntegrityException("Operation failed. Children of type " + childType + " are not allowed", null);
|
||||
}
|
||||
}
|
||||
|
@@ -28,7 +28,6 @@
|
||||
package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@@ -41,6 +40,7 @@ import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
||||
import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService;
|
||||
import org.alfresco.repo.node.NodeServicePolicies;
|
||||
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
||||
import org.alfresco.repo.policy.annotation.Behaviour;
|
||||
import org.alfresco.repo.policy.annotation.BehaviourBean;
|
||||
@@ -343,14 +343,14 @@ public class RmSiteType extends BaseBehaviourBean
|
||||
*/
|
||||
@Override
|
||||
protected void validateNewChildAssociation(NodeRef parent, NodeRef child, List<QName> acceptedUniqueChildType,
|
||||
List<QName> acceptedMultipleChildType) throws InvalidParameterException
|
||||
List<QName> acceptedMultipleChildType) throws IntegrityException
|
||||
{
|
||||
super.validateNewChildAssociation(parent, child, acceptedUniqueChildType, acceptedMultipleChildType);
|
||||
|
||||
// check the user is not trying to create more than 2 folders that are created by default.
|
||||
if(nodeService.getChildAssocs(parent, Sets.newHashSet(ContentModel.TYPE_FOLDER)).size() > 2)
|
||||
{
|
||||
throw new InvalidParameterException("Operation failed. Children of type " + ContentModel.TYPE_FOLDER + " are not allowed");
|
||||
throw new IntegrityException("Operation failed. Children of type " + ContentModel.TYPE_FOLDER + " are not allowed", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -26,12 +26,11 @@
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
||||
import org.alfresco.repo.node.NodeServicePolicies;
|
||||
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||
import org.alfresco.repo.policy.annotation.Behaviour;
|
||||
import org.alfresco.repo.policy.annotation.BehaviourBean;
|
||||
import org.alfresco.repo.policy.annotation.BehaviourKind;
|
||||
@@ -84,7 +83,7 @@ public class TransferContainerType extends BaseBehaviourBean
|
||||
)
|
||||
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew)
|
||||
{
|
||||
throw new InvalidParameterException("Operation failed. Creation is not allowed in Transfer Container");
|
||||
throw new IntegrityException("Operation failed. Creation is not allowed in Transfer Container", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -27,10 +27,9 @@
|
||||
|
||||
package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
||||
import org.alfresco.repo.node.NodeServicePolicies;
|
||||
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||
import org.alfresco.repo.policy.annotation.Behaviour;
|
||||
import org.alfresco.repo.policy.annotation.BehaviourBean;
|
||||
import org.alfresco.repo.policy.annotation.BehaviourKind;
|
||||
@@ -76,6 +75,6 @@ public class TransferType extends BaseBehaviourBean implements NodeServicePolici
|
||||
)
|
||||
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode)
|
||||
{
|
||||
throw new InvalidParameterException("Operation failed. Creation is not allowed in Transfer Folders");
|
||||
throw new IntegrityException("Operation failed. Creation is not allowed in Transfer Folders", null);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user