mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-553 - Create record repository action & RM-554 - Create record UI action
* filled out create record action implemenation * added 'Create Record" action to normal document library * configured UI action to call back to repo action * TODO aciton icon git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@44279 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,22 +24,4 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- File record action -->
|
|
||||||
<bean id="file-record" parent="action-executer" class="org.alfresco.module.org_alfresco_module_rm.action.dm.FileRecordAction">
|
|
||||||
<property name="fileFolderService" ref="FileFolderService"/>
|
|
||||||
<!-- <property name="applicableTypes">
|
|
||||||
<list>
|
|
||||||
<value>{http://www.alfresco.org/model/content/1.0}content</value>
|
|
||||||
</list>
|
|
||||||
</property> -->
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!-- Declare record action -->
|
|
||||||
<bean id="declare-record" parent="action-executer" class="org.alfresco.module.org_alfresco_module_rm.action.dm.DeclareRecordAction">
|
|
||||||
<property name="recordsManagementService" ref="RecordsManagementService" />
|
|
||||||
<property name="recordService" ref="RecordService" />
|
|
||||||
<property name="nodeService" ref="NodeService" />
|
|
||||||
<property name="ownableService" ref="OwnableService" />
|
|
||||||
<property name="dictionaryService" ref="DictionaryService" />
|
|
||||||
</bean>
|
|
||||||
</beans>
|
</beans>
|
@@ -38,16 +38,6 @@ rm.action.event-not-undone=The event {0} can not be undone, because it is not de
|
|||||||
#
|
#
|
||||||
# i18n for Rule Actions
|
# i18n for Rule Actions
|
||||||
#
|
#
|
||||||
# File record
|
|
||||||
file-record.title=File record
|
|
||||||
# FIXME!!!
|
|
||||||
#file-record.description=The rule is applied to all items that...
|
|
||||||
#file-record.destination-record-folder.display-label=File record
|
|
||||||
# Create record
|
# Create record
|
||||||
create-record.title=Create record
|
create-record.title=Create record
|
||||||
# FIXME!!!
|
create-record.description=Creates a Record from an existing document.
|
||||||
#create-record.description=The rule is applied to all items that...
|
|
||||||
# Declare record
|
|
||||||
declare-record.title=Declare record
|
|
||||||
# FIXME!!!
|
|
||||||
#declare-record.description=The rule is applied to all items that...
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||||
*
|
*
|
||||||
* This file is part of Alfresco
|
* This file is part of Alfresco
|
||||||
*
|
*
|
||||||
@@ -21,16 +21,21 @@ package org.alfresco.module.org_alfresco_module_rm.action.dm;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
||||||
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.record.RecordService;
|
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||||
|
import org.alfresco.repo.action.ParameterDefinitionImpl;
|
||||||
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
|
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
|
||||||
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.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.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.LogFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new record from an existing content object.
|
* Creates a new record from an existing content object.
|
||||||
@@ -42,9 +47,15 @@ import org.alfresco.service.cmr.repository.NodeService;
|
|||||||
public class CreateRecordAction extends ActionExecuterAbstractBase
|
public class CreateRecordAction extends ActionExecuterAbstractBase
|
||||||
implements RecordsManagementModel
|
implements RecordsManagementModel
|
||||||
{
|
{
|
||||||
|
/** Logger */
|
||||||
|
private static Log logger = LogFactory.getLog(CreateRecordAction.class);
|
||||||
|
|
||||||
/** Action name */
|
/** Action name */
|
||||||
public static final String NAME = "create-record";
|
public static final String NAME = "create-record";
|
||||||
|
|
||||||
|
/** Parameter names */
|
||||||
|
public static final String PARAM_FILE_PLAN = "file-plan";
|
||||||
|
|
||||||
/** Records management service */
|
/** Records management service */
|
||||||
private RecordsManagementService recordsManagementService;
|
private RecordsManagementService recordsManagementService;
|
||||||
|
|
||||||
@@ -82,25 +93,63 @@ public class CreateRecordAction extends ActionExecuterAbstractBase
|
|||||||
* @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(Action action, final NodeRef actionedUponNodeRef)
|
protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef)
|
||||||
{
|
{
|
||||||
// skip everything if the actioned upon node reference is already a record
|
if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD) == true)
|
||||||
if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD) == false)
|
|
||||||
{
|
{
|
||||||
// TODO we should use the file plan passed as a parameter
|
// Do not create record if the actioned upon node is already a record!
|
||||||
// grab the file plan
|
if (logger.isDebugEnabled() == true)
|
||||||
List<NodeRef> filePlans = recordsManagementService.getFilePlans();
|
|
||||||
if (filePlans.size() == 1)
|
|
||||||
{
|
{
|
||||||
// TODO parameterise the action with the file plan
|
logger.debug("Can not create record, because " + actionedUponNodeRef.toString() + " is already a record.");
|
||||||
final NodeRef filePlan = filePlans.get(0);
|
}
|
||||||
|
}
|
||||||
|
else if (nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY) == true)
|
||||||
|
{
|
||||||
|
// We can not create records from working copies
|
||||||
|
if (logger.isDebugEnabled() == true)
|
||||||
|
{
|
||||||
|
logger.debug("Can node create record, because " + actionedUponNodeRef.toString() + " is a working copy.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// run record creation as system
|
// run record creation as system
|
||||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Void doWork() throws Exception
|
public Void doWork() throws Exception
|
||||||
{
|
{
|
||||||
|
NodeRef filePlan = (NodeRef)action.getParameterValue(PARAM_FILE_PLAN);
|
||||||
|
if (filePlan == null)
|
||||||
|
{
|
||||||
|
List<NodeRef> filePlans = recordsManagementService.getFilePlans();
|
||||||
|
if (filePlans.size() == 1)
|
||||||
|
{
|
||||||
|
filePlan = filePlans.get(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled() == true)
|
||||||
|
{
|
||||||
|
logger.debug("Can not create record, because the default file plan can not be determined.");
|
||||||
|
}
|
||||||
|
throw new AlfrescoRuntimeException("Can not create record, because the default file plan can not be determined.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// verify that the provided file plan is actually a file plan
|
||||||
|
if (recordsManagementService.isFilePlan(filePlan) == false)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled() == true)
|
||||||
|
{
|
||||||
|
logger.debug("Can not create record, because the provided file plan node reference is not a file plan.");
|
||||||
|
}
|
||||||
|
throw new AlfrescoRuntimeException("Can not create record, because the provided file plan node reference is not a file plan.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// create record from existing document
|
// create record from existing document
|
||||||
recordService.createRecordFromDocument(filePlan, actionedUponNodeRef);
|
recordService.createRecordFromDocument(filePlan, actionedUponNodeRef);
|
||||||
|
|
||||||
@@ -108,11 +157,6 @@ public class CreateRecordAction extends ActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new AlfrescoRuntimeException("Unable to find file plan.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,8 +165,8 @@ public class CreateRecordAction extends ActionExecuterAbstractBase
|
|||||||
@Override
|
@Override
|
||||||
protected void addParameterDefinitions(List<ParameterDefinition> params)
|
protected void addParameterDefinitions(List<ParameterDefinition> params)
|
||||||
{
|
{
|
||||||
// TODO eventually we will need to pass in the file plan as a parameter
|
// Optional parameter used to specify the file plan
|
||||||
// TODO .. or the RM site
|
params.add(new ParameterDefinitionImpl(PARAM_FILE_PLAN, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PARAM_FILE_PLAN)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,219 +0,0 @@
|
|||||||
package org.alfresco.module.org_alfresco_module_rm.action.dm;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
|
||||||
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
|
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
|
||||||
import org.alfresco.service.cmr.action.Action;
|
|
||||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
|
||||||
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
|
||||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
|
||||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
|
||||||
import org.alfresco.service.cmr.security.OwnableService;
|
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.springframework.extensions.surf.util.I18NUtil;
|
|
||||||
|
|
||||||
public class DeclareRecordAction extends ActionExecuterAbstractBase implements RecordsManagementModel
|
|
||||||
{
|
|
||||||
/** I18N */
|
|
||||||
private static final String MSG_UNDECLARED_ONLY_RECORDS = "rm.action.undeclared-only-records";
|
|
||||||
private static final String MSG_NO_DECLARE_MAND_PROP = "rm.action.no-declare-mand-prop";
|
|
||||||
|
|
||||||
/** Logger */
|
|
||||||
private static Log logger = LogFactory.getLog(DeclareRecordAction.class);
|
|
||||||
|
|
||||||
/** Record service */
|
|
||||||
private RecordService recordService;
|
|
||||||
|
|
||||||
/** Record management service */
|
|
||||||
private RecordsManagementService recordsManagementService;
|
|
||||||
|
|
||||||
/** Node service */
|
|
||||||
private NodeService nodeService;
|
|
||||||
|
|
||||||
/** Ownable service **/
|
|
||||||
private OwnableService ownableService;
|
|
||||||
|
|
||||||
/** Dictionary service */
|
|
||||||
private DictionaryService dictionaryService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param recordService record service
|
|
||||||
*/
|
|
||||||
public void setRecordService(RecordService recordService)
|
|
||||||
{
|
|
||||||
this.recordService = recordService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param recordsManagementService records management service
|
|
||||||
*/
|
|
||||||
public void setRecordsManagementService(
|
|
||||||
RecordsManagementService recordsManagementService)
|
|
||||||
{
|
|
||||||
this.recordsManagementService = recordsManagementService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param nodeService node service
|
|
||||||
*/
|
|
||||||
public void setNodeService(NodeService nodeService)
|
|
||||||
{
|
|
||||||
this.nodeService = nodeService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ownableSerice ownable serice
|
|
||||||
*/
|
|
||||||
public void setOwnableService(OwnableService ownableService)
|
|
||||||
{
|
|
||||||
this.ownableService = ownableService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param dictionaryService dictionary service
|
|
||||||
*/
|
|
||||||
public void setDictionaryService(DictionaryService dictionaryService)
|
|
||||||
{
|
|
||||||
this.dictionaryService = dictionaryService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void executeImpl(Action action, final NodeRef actionedUponNodeRef)
|
|
||||||
{
|
|
||||||
if (recordService.isRecord(actionedUponNodeRef) == true)
|
|
||||||
{
|
|
||||||
if (recordService.isDeclared(actionedUponNodeRef) == false)
|
|
||||||
{
|
|
||||||
List<String> missingProperties = new ArrayList<String>(5);
|
|
||||||
// Aspect not already defined - check mandatory properties then add
|
|
||||||
if (mandatoryPropertiesSet(actionedUponNodeRef, missingProperties) == true)
|
|
||||||
{
|
|
||||||
// Add the declared aspect
|
|
||||||
Map<QName, Serializable> declaredProps = new HashMap<QName, Serializable>(2);
|
|
||||||
declaredProps.put(PROP_DECLARED_AT, new Date());
|
|
||||||
declaredProps.put(PROP_DECLARED_BY, AuthenticationUtil.getRunAsUser());
|
|
||||||
nodeService.addAspect(actionedUponNodeRef, ASPECT_DECLARED_RECORD, declaredProps);
|
|
||||||
|
|
||||||
// remove all owner related rights
|
|
||||||
ownableService.setOwner(actionedUponNodeRef, OwnableService.NO_OWNER);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new AlfrescoRuntimeException(buildMissingPropertiesErrorString(missingProperties));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNDECLARED_ONLY_RECORDS, actionedUponNodeRef.toString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String buildMissingPropertiesErrorString(List<String> missingProperties)
|
|
||||||
{
|
|
||||||
StringBuilder builder = new StringBuilder(255);
|
|
||||||
builder.append(I18NUtil.getMessage(MSG_NO_DECLARE_MAND_PROP));
|
|
||||||
builder.append(" ");
|
|
||||||
for (String missingProperty : missingProperties)
|
|
||||||
{
|
|
||||||
builder.append(missingProperty)
|
|
||||||
.append(", ");
|
|
||||||
}
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper method to check whether all the mandatory properties of the node have been set
|
|
||||||
*
|
|
||||||
* @param nodeRef
|
|
||||||
* node reference
|
|
||||||
* @return boolean true if all mandatory properties are set, false otherwise
|
|
||||||
*/
|
|
||||||
private boolean mandatoryPropertiesSet(NodeRef nodeRef, List<String> missingProperties)
|
|
||||||
{
|
|
||||||
boolean result = true;
|
|
||||||
|
|
||||||
Map<QName, Serializable> nodeRefProps = nodeService.getProperties(nodeRef);
|
|
||||||
|
|
||||||
QName nodeRefType = nodeService.getType(nodeRef);
|
|
||||||
|
|
||||||
TypeDefinition typeDef = dictionaryService.getType(nodeRefType);
|
|
||||||
for (PropertyDefinition propDef : typeDef.getProperties().values())
|
|
||||||
{
|
|
||||||
if (propDef.isMandatory() == true)
|
|
||||||
{
|
|
||||||
if (nodeRefProps.get(propDef.getName()) == null)
|
|
||||||
{
|
|
||||||
logMissingProperty(propDef, missingProperties);
|
|
||||||
|
|
||||||
result = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result != false)
|
|
||||||
{
|
|
||||||
Set<QName> aspects = this.nodeService.getAspects(nodeRef);
|
|
||||||
for (QName aspect : aspects)
|
|
||||||
{
|
|
||||||
AspectDefinition aspectDef = dictionaryService.getAspect(aspect);
|
|
||||||
for (PropertyDefinition propDef : aspectDef.getProperties().values())
|
|
||||||
{
|
|
||||||
if (propDef.isMandatory() == true)
|
|
||||||
{
|
|
||||||
if (nodeRefProps.get(propDef.getName()) == null)
|
|
||||||
{
|
|
||||||
logMissingProperty(propDef, missingProperties);
|
|
||||||
|
|
||||||
result = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Log information about missing properties.
|
|
||||||
*
|
|
||||||
* @param propDef property definition
|
|
||||||
* @param missingProperties missing properties
|
|
||||||
*/
|
|
||||||
private void logMissingProperty(PropertyDefinition propDef, List<String> missingProperties)
|
|
||||||
{
|
|
||||||
if (logger.isWarnEnabled())
|
|
||||||
{
|
|
||||||
StringBuilder msg = new StringBuilder();
|
|
||||||
msg.append("Mandatory property missing: ").append(propDef.getName());
|
|
||||||
logger.warn(msg.toString());
|
|
||||||
}
|
|
||||||
missingProperties.add(propDef.getName().toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addParameterDefinitions(List<ParameterDefinition> paramList)
|
|
||||||
{
|
|
||||||
// No parameters
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,70 +0,0 @@
|
|||||||
package org.alfresco.module.org_alfresco_module_rm.action.dm;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
|
||||||
import org.alfresco.repo.action.ParameterDefinitionImpl;
|
|
||||||
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
|
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
|
||||||
import org.alfresco.service.cmr.action.Action;
|
|
||||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
|
||||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
|
||||||
import org.alfresco.service.cmr.model.FileFolderService;
|
|
||||||
import org.alfresco.service.cmr.model.FileNotFoundException;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
|
||||||
|
|
||||||
public class FileRecordAction extends ActionExecuterAbstractBase
|
|
||||||
{
|
|
||||||
public static final String NAME = "file-record";
|
|
||||||
public static final String PARAM_DESTINATION_RECORD_FOLDER = "destination-record-folder";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FileFolder service
|
|
||||||
*/
|
|
||||||
private FileFolderService fileFolderService;
|
|
||||||
|
|
||||||
public void setFileFolderService(FileFolderService fileFolderService)
|
|
||||||
{
|
|
||||||
this.fileFolderService = fileFolderService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addParameterDefinitions(List<ParameterDefinition> paramList)
|
|
||||||
{
|
|
||||||
paramList.add(new ParameterDefinitionImpl(
|
|
||||||
PARAM_DESTINATION_RECORD_FOLDER,
|
|
||||||
DataTypeDefinition.NODE_REF,
|
|
||||||
true,
|
|
||||||
getParamDisplayLabel(PARAM_DESTINATION_RECORD_FOLDER)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.alfresco.repo.action.executer.ActionExecuter#execute(org.alfresco.repo.ref.NodeRef, org.alfresco.repo.ref.NodeRef)
|
|
||||||
*/
|
|
||||||
public void executeImpl(final Action ruleAction, final NodeRef actionedUponNodeRef)
|
|
||||||
{
|
|
||||||
final NodeRef destinationParent = (NodeRef)ruleAction.getParameterValue(PARAM_DESTINATION_RECORD_FOLDER);
|
|
||||||
|
|
||||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public Void doWork() throws Exception
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
fileFolderService.move(actionedUponNodeRef, destinationParent, null);
|
|
||||||
}
|
|
||||||
catch (FileNotFoundException e)
|
|
||||||
{
|
|
||||||
throw new AlfrescoRuntimeException("Could not file record.", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user