mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-4312: added comments to unit tests
This commit is contained in:
@@ -127,28 +127,14 @@ public abstract class BaseBehaviourBean extends ServiceBaseImpl
|
||||
protected void validateNewChildAssociationSubTypesIncluded(NodeRef child, List<QName> acceptedMultipleChildType) throws InvalidParameterException
|
||||
{
|
||||
QName childType = getInternalNodeService().getType(child);
|
||||
if(!validateNodeRef(acceptedMultipleChildType, childType))
|
||||
{
|
||||
throw new InvalidParameterException("Operation failed. Children of type " + childType + " are not allowed");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the type of the provided nodeRef it is between the sub-types of accepted types
|
||||
*
|
||||
* @param acceptedMultipleChildType
|
||||
* @param nodeType
|
||||
* @return true if the type of the nodeRef is between the sub-types of accepted types, or false otherwise
|
||||
*/
|
||||
protected boolean validateNodeRef(List<QName> acceptedMultipleChildType, QName nodeType)
|
||||
{
|
||||
for(QName type : acceptedMultipleChildType)
|
||||
{
|
||||
if(instanceOf(nodeType, type))
|
||||
if(instanceOf(childType, type))
|
||||
{
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
//no match was found in sub-types of permitted types list
|
||||
throw new InvalidParameterException("Operation failed. Children of type " + childType + " are not allowed");
|
||||
}
|
||||
}
|
||||
|
@@ -63,8 +63,8 @@ public class FilePlanType extends BaseBehaviourBean
|
||||
NodeServicePolicies.OnCreateNodePolicy,
|
||||
NodeServicePolicies.OnDeleteNodePolicy
|
||||
{
|
||||
private static List<QName> ACCEPTED_UNIQUE_CHILD_TYPES = Arrays.asList(TYPE_HOLD_CONTAINER, TYPE_TRANSFER_CONTAINER, TYPE_UNFILED_RECORD_CONTAINER);
|
||||
private static List<QName> ACCEPTED_NON_UNIQUE_CHILD_TYPES = Arrays.asList(TYPE_RECORD_CATEGORY);
|
||||
private final static List<QName> ACCEPTED_UNIQUE_CHILD_TYPES = Arrays.asList(TYPE_HOLD_CONTAINER, TYPE_TRANSFER_CONTAINER, TYPE_UNFILED_RECORD_CONTAINER);
|
||||
private final static List<QName> ACCEPTED_NON_UNIQUE_CHILD_TYPES = Arrays.asList(TYPE_RECORD_CATEGORY);
|
||||
|
||||
/** file plan service */
|
||||
private FilePlanService filePlanService;
|
||||
|
Reference in New Issue
Block a user