mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
RM-4619 - convert the folder nodes before setting identifier
This commit is contained in:
@@ -137,7 +137,7 @@ public class RecordsManagementContainerType extends BaseBehaviourBean
|
||||
final NodeRef child = childAssocRef.getChildRef();
|
||||
if (nodeService.exists(child))
|
||||
{
|
||||
QName childType = nodeService.getType(child);
|
||||
QName childType = convertNodeToFileplanComponent(child, nodeService.getType(child), nodeService.getType(childAssocRef.getParentRef()));
|
||||
|
||||
// We only care about "folder" or sub-types that are not hidden.
|
||||
// Some modules use hidden files to store information (see RM-3283)
|
||||
@@ -205,4 +205,37 @@ public class RecordsManagementContainerType extends BaseBehaviourBean
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Converted the child node to a fileplan component
|
||||
* The conversion is needed here to be able to generate the identifier
|
||||
* If there is no conversion rule for the created type nothing happens and the current type is returned
|
||||
*
|
||||
* @param child ref to the new child
|
||||
* @param childType the type of the new child
|
||||
* @param parentType the type of the parent node
|
||||
* @return the new type of the child node
|
||||
*/
|
||||
protected QName convertNodeToFileplanComponent(final NodeRef child, final QName childType, final QName parentType)
|
||||
{
|
||||
if(childType.equals(ContentModel.TYPE_FOLDER))
|
||||
{
|
||||
if(parentType.equals(TYPE_FILE_PLAN))
|
||||
{
|
||||
nodeService.setType(child, TYPE_RECORD_CATEGORY);
|
||||
return TYPE_RECORD_CATEGORY;
|
||||
}
|
||||
if(parentType.equals(TYPE_RECORD_CATEGORY))
|
||||
{
|
||||
nodeService.setType(child, TYPE_RECORD_FOLDER);
|
||||
return TYPE_RECORD_FOLDER;
|
||||
}
|
||||
if(parentType.equals(TYPE_UNFILED_RECORD_CONTAINER) || parentType.equals(TYPE_UNFILED_RECORD_FOLDER))
|
||||
{
|
||||
nodeService.setType(child, TYPE_UNFILED_RECORD_FOLDER);
|
||||
return TYPE_UNFILED_RECORD_FOLDER;
|
||||
}
|
||||
}
|
||||
return childType;
|
||||
}
|
||||
}
|
||||
|
@@ -76,6 +76,15 @@ public class UnfiledRecordContainerType extends BaseBehaviourBean
|
||||
@Behaviour(kind = BehaviourKind.ASSOCIATION)
|
||||
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode)
|
||||
{
|
||||
// We need to automatically cast the created folder to record folder if it is a plain folder
|
||||
// This occurs if the RM folder has been created via IMap, WebDav, etc. Don't check subtypes.
|
||||
// Some modules use hidden folder subtypes to store information (see RM-3283).
|
||||
QName childType = nodeService.getType(childAssocRef.getChildRef());
|
||||
if (childType.equals(ContentModel.TYPE_FOLDER))
|
||||
{
|
||||
nodeService.setType(childAssocRef.getChildRef(), TYPE_UNFILED_RECORD_FOLDER);
|
||||
}
|
||||
|
||||
// check the created child is of an accepted type
|
||||
validateNewChildAssociationSubTypesIncluded(childAssocRef.getChildRef(), ACCEPTED_NON_UNIQUE_CHILD_TYPES);
|
||||
}
|
||||
|
@@ -55,6 +55,15 @@ public class UnfiledRecordFolderType extends BaseBehaviourBean
|
||||
@Behaviour(kind = BehaviourKind.ASSOCIATION)
|
||||
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode)
|
||||
{
|
||||
// We need to automatically cast the created folder to record folder if it is a plain folder
|
||||
// This occurs if the RM folder has been created via IMap, WebDav, etc. Don't check subtypes.
|
||||
// Some modules use hidden folder subtypes to store information (see RM-3283).
|
||||
QName childType = nodeService.getType(childAssocRef.getChildRef());
|
||||
if (childType.equals(ContentModel.TYPE_FOLDER))
|
||||
{
|
||||
nodeService.setType(childAssocRef.getChildRef(), TYPE_UNFILED_RECORD_FOLDER);
|
||||
}
|
||||
|
||||
// check the created child is of an accepted type
|
||||
validateNewChildAssociationSubTypesIncluded(childAssocRef.getChildRef(), ACCEPTED_NON_UNIQUE_CHILD_TYPES);
|
||||
}
|
||||
|
Reference in New Issue
Block a user