mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
RM: In-place prototype
* demo model * file and create actions updated * bug fixes for demo scenario git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/DEV/INPLACE@43030 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.action.dm;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
@@ -51,6 +52,7 @@ public class CreateRecordAction extends ActionExecuterAbstractBase
|
||||
/** Record service */
|
||||
private RecordService recordService;
|
||||
|
||||
/** Node service */
|
||||
private NodeService nodeService;
|
||||
|
||||
/**
|
||||
@@ -69,6 +71,9 @@ public class CreateRecordAction extends ActionExecuterAbstractBase
|
||||
this.recordService = recordService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nodeService node service
|
||||
*/
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
@@ -100,6 +105,20 @@ public class CreateRecordAction extends ActionExecuterAbstractBase
|
||||
// create record from existing document
|
||||
recordService.createRecordFromDocument(filePlan, actionedUponNodeRef);
|
||||
|
||||
// DEMO CODE
|
||||
if (nodeService.getProperty(actionedUponNodeRef, PROP_ORIGINATOR) == null)
|
||||
{
|
||||
nodeService.setProperty(actionedUponNodeRef, PROP_ORIGINATOR, "Michelle Smith");
|
||||
}
|
||||
if (nodeService.getProperty(actionedUponNodeRef, PROP_ORIGINATING_ORGANIZATION) == null)
|
||||
{
|
||||
nodeService.setProperty(actionedUponNodeRef, PROP_ORIGINATING_ORGANIZATION, "Customer Service");
|
||||
}
|
||||
if (nodeService.getProperty(actionedUponNodeRef, PROP_PUBLICATION_DATE) == null)
|
||||
{
|
||||
nodeService.setProperty(actionedUponNodeRef, PROP_PUBLICATION_DATE, new Date());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
@@ -2,8 +2,11 @@ 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;
|
||||
@@ -39,16 +42,29 @@ public class FileRecordAction extends ActionExecuterAbstractBase
|
||||
/**
|
||||
* @see org.alfresco.repo.action.executer.ActionExecuter#execute(org.alfresco.repo.ref.NodeRef, org.alfresco.repo.ref.NodeRef)
|
||||
*/
|
||||
public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef)
|
||||
public void executeImpl(final Action ruleAction, final NodeRef actionedUponNodeRef)
|
||||
{
|
||||
NodeRef destinationParent = (NodeRef)ruleAction.getParameterValue(PARAM_DESTINATION_RECORD_FOLDER);
|
||||
try
|
||||
final NodeRef destinationParent = (NodeRef)ruleAction.getParameterValue(PARAM_DESTINATION_RECORD_FOLDER);
|
||||
|
||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
||||
{
|
||||
fileFolderService.move(actionedUponNodeRef, destinationParent, null);
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
@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