RM-643: Create record rule within a collaboration site allows folders to be created as records

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@48063 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2013-03-14 01:41:08 +00:00
parent e653fe265e
commit 2bcaf4222d
2 changed files with 29 additions and 1 deletions

View File

@@ -18,6 +18,7 @@
<property name="recordService" ref="RecordService" /> <property name="recordService" ref="RecordService" />
<property name="nodeService" ref="NodeService" /> <property name="nodeService" ref="NodeService" />
<property name="filePlanService" ref="FilePlanService" /> <property name="filePlanService" ref="FilePlanService" />
<property name="dictionaryService" ref="DictionaryService" />
<property name="applicableTypes"> <property name="applicableTypes">
<list> <list>
<value>{http://www.alfresco.org/model/content/1.0}content</value> <value>{http://www.alfresco.org/model/content/1.0}content</value>

View File

@@ -31,6 +31,7 @@ import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition; import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@@ -68,6 +69,9 @@ public class CreateRecordAction extends ActionExecuterAbstractBase
/** File plan service */ /** File plan service */
private FilePlanService filePlanService; private FilePlanService filePlanService;
/** Dictionary service */
private DictionaryService dictionaryService;
/** /**
* @param recordsManagementService records management service * @param recordsManagementService records management service
*/ */
@@ -100,13 +104,36 @@ public class CreateRecordAction extends ActionExecuterAbstractBase
this.filePlanService = filePlanService; this.filePlanService = filePlanService;
} }
@Override
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
/** /**
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
*/ */
@Override @Override
protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef) protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef)
{ {
if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD) == true)
if (nodeService.exists(actionedUponNodeRef) == false)
{
// do not create record if the actioned upon node does not exist!
if (logger.isDebugEnabled() == true)
{
logger.debug("Can not create record, because " + actionedUponNodeRef.toString() + " does not exist.");
}
}
else if (dictionaryService.isSubClass(ContentModel.TYPE_CONTENT, nodeService.getType(actionedUponNodeRef)) == false)
{
// TODO eventually we should support other types .. either as record folders or as composite records
if (logger.isDebugEnabled() == true)
{
logger.debug("Can not create record, because " + actionedUponNodeRef.toString() + " is not a supported type.");
}
}
else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD) == true)
{ {
// Do not create record if the actioned upon node is already a record! // Do not create record if the actioned upon node is already a record!
if (logger.isDebugEnabled() == true) if (logger.isDebugEnabled() == true)