RM-1280: It's possible to create a folder in the root of File Plan via FTP/CIFS/WebDav/NFS

RM-1281: Not possible to create folders in Categories via FTP/CIFS/WebDav/NFS



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.1@63128 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2014-02-24 04:58:53 +00:00
parent 59a4b2893a
commit b8f699ec23
3 changed files with 30 additions and 6 deletions

View File

@@ -56,6 +56,7 @@
parent="org_alfresco_module_rm_BaseBehaviour"> parent="org_alfresco_module_rm_BaseBehaviour">
<property name="dictionaryService" ref="DictionaryService"/> <property name="dictionaryService" ref="DictionaryService"/>
<property name="recordsManagementIdentifierService" ref="recordsManagementIdentifierService"/> <property name="recordsManagementIdentifierService" ref="recordsManagementIdentifierService"/>
<property name="recordFolderService" ref="recordFolderService" />
</bean> </bean>
<bean id="org_alfresco_module_rm_RmSiteType" <bean id="org_alfresco_module_rm_RmSiteType"

View File

@@ -21,10 +21,11 @@ package org.alfresco.module.org_alfresco_module_rm.model.behaviour;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderServiceImpl;
import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
import org.alfresco.repo.policy.JavaBehaviour; import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent; import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.dictionary.DictionaryService;
@@ -55,6 +56,9 @@ public class RecordContainerType implements RecordsManagementModel,
/** Identity service */ /** Identity service */
private IdentifierService recordsManagementIdentifierService; private IdentifierService recordsManagementIdentifierService;
/** record folder service */
private RecordFolderServiceImpl recordFolderService;
/** /**
* Set the policy component * Set the policy component
* @param policyComponent policy component * @param policyComponent policy component
@@ -94,6 +98,14 @@ public class RecordContainerType implements RecordsManagementModel,
this.recordsManagementIdentifierService = recordsManagementIdentifierService; this.recordsManagementIdentifierService = recordsManagementIdentifierService;
} }
/**
* @param recordFolderService record folder service
*/
public void setRecordFolderService(RecordFolderServiceImpl recordFolderService)
{
this.recordFolderService = recordFolderService;
}
/** /**
* Bean initialisation method * Bean initialisation method
*/ */
@@ -140,11 +152,22 @@ public class RecordContainerType implements RecordsManagementModel,
// We need to automatically cast the created folder to RM type if it is a plain folder // We need to automatically cast the created folder to RM type if it is a plain folder
// This occurs if the RM folder has been created via IMap, WebDav, etc // This occurs if the RM folder has been created via IMap, WebDav, etc
if (nodeService.hasAspect(child, ASPECT_FILE_PLAN_COMPONENT) == false) if (nodeService.hasAspect(child, ASPECT_FILE_PLAN_COMPONENT) == false)
{ {
// TODO it may not always be a record folder ... perhaps if the current user is a admin it would be a record category?? // check the type of the parent to determine what 'kind' of artifact to create
NodeRef parent = childAssocRef.getParentRef();
QName parentType = nodeService.getType(parent);
// Assume any created folder is a rma:recordFolder if (dictionaryService.isSubClass(parentType, TYPE_FILE_PLAN))
nodeService.setType(child, TYPE_RECORD_FOLDER); {
// create a rma:recordCategoty since we are in the root of the file plan
nodeService.setType(child, TYPE_RECORD_CATEGORY);
}
else
{
// create a rma:recordFolder and initialise record folder
nodeService.setType(child, TYPE_RECORD_FOLDER);
recordFolderService.initialiseRecordFolder(child);
}
} }
// Catch all to generate the rm id (assuming it doesn't already have one!) // Catch all to generate the rm id (assuming it doesn't already have one!)

View File

@@ -99,7 +99,7 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew)
{ {
NodeRef nodeRef = childAssocRef.getChildRef(); NodeRef nodeRef = childAssocRef.getChildRef();
if (nodeService.exists(nodeRef) == true) if (nodeService.exists(nodeRef) == true && instanceOf(nodeRef, TYPE_RECORD_FOLDER))
{ {
initialiseRecordFolder(nodeRef); initialiseRecordFolder(nodeRef);
} }