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:
Roy Wetherall
2012-10-24 00:24:55 +00:00
parent 389c775945
commit 691865e574
6 changed files with 132 additions and 9 deletions

View File

@@ -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;
}
});

View File

@@ -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;
}
});
}
}