RM-449: It's possible to move folder to another folder

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.0@39297 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2012-07-16 05:10:09 +00:00
parent d423133ee8
commit e8fe0ffd36

View File

@@ -30,6 +30,7 @@ import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.model.RenditionModel;
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
@@ -194,6 +195,13 @@ public class RecordsManagementServiceImpl implements RecordsManagementService,
TYPE_RECORD_CATEGORY,
ContentModel.ASSOC_CONTAINS,
new JavaBehaviour(this, "onAddContentToContainer", NotificationFrequency.EVERY_EVENT));
policyComponent.bindAssociationBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateChildAssociation"),
ASPECT_RECORD,
RenditionModel.ASSOC_RENDITION,
new JavaBehaviour(this, "onAddRecordThumbnail", NotificationFrequency.TRANSACTION_COMMIT)
);
// Register script execution behaviour on RM property update.
this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
@@ -228,8 +236,23 @@ public class RecordsManagementServiceImpl implements RecordsManagementService,
*/
public void onFileContent(ChildAssociationRef childAssocRef, boolean bNew)
{
// File the document
rmActionService.executeRecordsManagementAction(childAssocRef.getChildRef(), "file");
NodeRef nodeRef = childAssocRef.getChildRef();
if (nodeService.exists(nodeRef) == true)
{
// Ensure that the filed item is cm:content
QName type = nodeService.getType(nodeRef);
if (ContentModel.TYPE_CONTENT.equals(type) == true ||
dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT) == true)
{
// File the document
rmActionService.executeRecordsManagementAction(childAssocRef.getChildRef(), "file");
}
else
{
// Raise an exception since we should only be filling content into a record folder
throw new AlfrescoRuntimeException("Unable to complete operation, because only content can be filed within a record folder.");
}
}
}
/**
@@ -254,6 +277,22 @@ public class RecordsManagementServiceImpl implements RecordsManagementService,
}
}
/**
* Make sure the thumbnails of records are marked as file plan components as are therefore subject to the same
* permission restrictions.
*
* @param childAssocRef
* @param bNew
*/
public void onAddRecordThumbnail(ChildAssociationRef childAssocRef, boolean bNew)
{
NodeRef thumbnail = childAssocRef.getChildRef();
if (nodeService.exists(thumbnail) == true)
{
nodeService.addAspect(thumbnail, ASPECT_FILE_PLAN_COMPONENT, null);
}
}
/**
* Called after a DispositionActionDefinition property has been updated.
*/