mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Addition of "submitted" aspect to items submitted for web site review.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4620 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -36,6 +36,7 @@ import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.repo.avm.wf.AVMSubmittedAspect;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.workflow.WorkflowModel;
|
||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||
@@ -97,6 +98,9 @@ public class CreateWebContentWizard extends BaseContentWizard
|
||||
/** AVM Browse Bean reference */
|
||||
protected AVMBrowseBean avmBrowseBean;
|
||||
|
||||
/** AVM Submitted Aspect reference */
|
||||
protected AVMSubmittedAspect avmSubmittedAspect;
|
||||
|
||||
/** Workflow service bean reference */
|
||||
protected WorkflowService workflowService;
|
||||
|
||||
@@ -116,6 +120,14 @@ public class CreateWebContentWizard extends BaseContentWizard
|
||||
this.avmSyncService = avmSyncService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param avmSubmittedAspect The AVM Submitted Aspect to set.
|
||||
*/
|
||||
public void setAvmSubmittedAspect(AVMSubmittedAspect avmSubmittedAspect)
|
||||
{
|
||||
this.avmSubmittedAspect = avmSubmittedAspect;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param workflowService The WorkflowService to set.
|
||||
*/
|
||||
@@ -345,6 +357,21 @@ public class CreateWebContentWizard extends BaseContentWizard
|
||||
}
|
||||
}
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("starting workflow " + wd + " with parameters " + parameters);
|
||||
|
||||
// start the workflow to get access to the start task
|
||||
WorkflowPath path = this.workflowService.startWorkflow(wd.id, null);
|
||||
if (path != null)
|
||||
{
|
||||
// extract the start task
|
||||
List<WorkflowTask> tasks = this.workflowService.getTasksForWorkflowPath(path.id);
|
||||
if (tasks.size() == 1)
|
||||
{
|
||||
WorkflowTask startTask = tasks.get(0);
|
||||
|
||||
if (startTask.state == WorkflowTaskState.IN_PROGRESS)
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("creating workflow package");
|
||||
|
||||
@@ -368,6 +395,7 @@ public class CreateWebContentWizard extends BaseContentWizard
|
||||
String destPath = packagesPath + renditionPath;
|
||||
AVMDifference diff = new AVMDifference(-1, srcPath, -1, destPath, AVMDifference.NEWER);
|
||||
diffs.add(diff);
|
||||
avmSubmittedAspect.markSubmitted(-1, srcPath, path.instance.id);
|
||||
}
|
||||
String instancePath = AVMNodeConverter.ToAVMVersionPath(this.formInstanceData.getNodeRef()).getSecond();
|
||||
int webappIndex = instancePath.indexOf('/' + webapp);
|
||||
@@ -376,6 +404,7 @@ public class CreateWebContentWizard extends BaseContentWizard
|
||||
String destPath = packagesPath + instancePath;
|
||||
AVMDifference diff = new AVMDifference(-1, srcPath, -1, destPath, AVMDifference.NEWER);
|
||||
diffs.add(diff);
|
||||
avmSubmittedAspect.markSubmitted(-1, srcPath, path.instance.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -386,6 +415,7 @@ public class CreateWebContentWizard extends BaseContentWizard
|
||||
String destPath = packagesPath + itemPath;
|
||||
AVMDifference diff = new AVMDifference(-1, srcPath, -1, destPath, AVMDifference.NEWER);
|
||||
diffs.add(diff);
|
||||
avmSubmittedAspect.markSubmitted(-1, srcPath, path.instance.id);
|
||||
}
|
||||
|
||||
// write changes to layer so files are marked as modified
|
||||
@@ -402,21 +432,9 @@ public class CreateWebContentWizard extends BaseContentWizard
|
||||
parameters.put(AVMWorkflowUtil.PROP_FROM_PATH, AVMConstants.buildAVMStoreRootPath(
|
||||
this.avmBrowseBean.getSandbox()));
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("starting workflow " + wd + " with parameters " + parameters);
|
||||
// update start task with submit parameters
|
||||
this.workflowService.updateTask(startTask.id, parameters, null, null);
|
||||
|
||||
// start the workflow to get access to the start task
|
||||
WorkflowPath path = this.workflowService.startWorkflow(wd.id, parameters);
|
||||
if (path != null)
|
||||
{
|
||||
// extract the start task
|
||||
List<WorkflowTask> tasks = this.workflowService.getTasksForWorkflowPath(path.id);
|
||||
if (tasks.size() == 1)
|
||||
{
|
||||
WorkflowTask startTask = tasks.get(0);
|
||||
|
||||
if (startTask.state == WorkflowTaskState.IN_PROGRESS)
|
||||
{
|
||||
// end the start task to trigger the first 'proper' task in the workflow
|
||||
this.workflowService.endTask(startTask.id, null);
|
||||
}
|
||||
|
@@ -34,6 +34,7 @@ import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.repo.avm.AVMDAOs;
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.repo.avm.wf.AVMSubmittedAspect;
|
||||
import org.alfresco.repo.workflow.WorkflowModel;
|
||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
@@ -80,6 +81,7 @@ public class SubmitDialog extends BaseDialogBean
|
||||
private List<UIListItem> workflowItems;
|
||||
|
||||
protected AVMService avmService;
|
||||
protected AVMSubmittedAspect avmSubmittedAspect;
|
||||
protected AVMBrowseBean avmBrowseBean;
|
||||
protected WorkflowService workflowService;
|
||||
protected AVMSyncService avmSyncService;
|
||||
@@ -93,6 +95,14 @@ public class SubmitDialog extends BaseDialogBean
|
||||
this.avmService = avmService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param avmSubmittedAspect The AVM Submitted Aspect to set.
|
||||
*/
|
||||
public void setAvmSubmittedAspect(AVMSubmittedAspect avmSubmittedAspect)
|
||||
{
|
||||
this.avmSubmittedAspect = avmSubmittedAspect;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param avmSyncService The AVMSyncService to set.
|
||||
*/
|
||||
@@ -189,18 +199,9 @@ public class SubmitDialog extends BaseDialogBean
|
||||
|
||||
if (params != null)
|
||||
{
|
||||
// create container for our avm workflow package
|
||||
NodeRef workflowPackage = createWorkflowPackage();
|
||||
params.put(WorkflowModel.ASSOC_PACKAGE, workflowPackage);
|
||||
|
||||
// add submission parameters
|
||||
params.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, getComment());
|
||||
params.put(AVMWorkflowUtil.PROP_LABEL, getLabel());
|
||||
params.put(AVMWorkflowUtil.PROP_FROM_PATH, AVMConstants.buildAVMStoreRootPath(this.avmBrowseBean.getSandbox()));
|
||||
|
||||
// start the workflow to get access to the start task
|
||||
WorkflowDefinition wfDef = workflowService.getDefinitionByName(workflowName);
|
||||
WorkflowPath path = this.workflowService.startWorkflow(wfDef.id, params);
|
||||
WorkflowPath path = this.workflowService.startWorkflow(wfDef.id, null);
|
||||
if (path != null)
|
||||
{
|
||||
// extract the start task
|
||||
@@ -211,6 +212,18 @@ public class SubmitDialog extends BaseDialogBean
|
||||
|
||||
if (startTask.state == WorkflowTaskState.IN_PROGRESS)
|
||||
{
|
||||
// create container for our avm workflow package
|
||||
NodeRef workflowPackage = createWorkflowPackage(path.instance.id);
|
||||
params.put(WorkflowModel.ASSOC_PACKAGE, workflowPackage);
|
||||
|
||||
// add submission parameters
|
||||
params.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, getComment());
|
||||
params.put(AVMWorkflowUtil.PROP_LABEL, getLabel());
|
||||
params.put(AVMWorkflowUtil.PROP_FROM_PATH, AVMConstants.buildAVMStoreRootPath(this.avmBrowseBean.getSandbox()));
|
||||
|
||||
// update start task with submit parameters
|
||||
this.workflowService.updateTask(startTask.id, params, null, null);
|
||||
|
||||
// end the start task to trigger the first 'proper' task in the workflow
|
||||
this.workflowService.endTask(startTask.id, null);
|
||||
}
|
||||
@@ -552,9 +565,10 @@ public class SubmitDialog extends BaseDialogBean
|
||||
* Construct a workflow package as a layered directory over the staging sandbox. The items for
|
||||
* submission are pushed into the layer and the package constructed around it.
|
||||
*
|
||||
* @param workflowInstanceId workflow instance id
|
||||
* @return Reference to the package
|
||||
*/
|
||||
private NodeRef createWorkflowPackage()
|
||||
private NodeRef createWorkflowPackage(String workflowInstanceId)
|
||||
{
|
||||
List<ItemWrapper> items = getSubmitItems();
|
||||
|
||||
@@ -563,6 +577,7 @@ public class SubmitDialog extends BaseDialogBean
|
||||
String packagesPath = AVMWorkflowUtil.createAVMLayeredPackage(this.avmService, stagingPath);
|
||||
|
||||
// construct diffs for selected items for submission
|
||||
// mark selected items for submission
|
||||
String sandboxPath = AVMConstants.buildAVMStoreRootPath(this.avmBrowseBean.getSandbox());
|
||||
List<AVMDifference> diffs = new ArrayList<AVMDifference>(this.submitItems.size());
|
||||
for (ItemWrapper wrapper : this.submitItems)
|
||||
@@ -571,6 +586,7 @@ public class SubmitDialog extends BaseDialogBean
|
||||
String destPath = packagesPath + wrapper.getPath();
|
||||
AVMDifference diff = new AVMDifference(-1, srcPath, -1, destPath, AVMDifference.NEWER);
|
||||
diffs.add(diff);
|
||||
avmSubmittedAspect.markSubmitted(-1, srcPath, workflowInstanceId);
|
||||
}
|
||||
|
||||
// write changes to layer so files are marked as modified
|
||||
|
@@ -2132,6 +2132,10 @@
|
||||
<property-name>avmSyncService</property-name>
|
||||
<value>#{AVMSyncService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>avmSubmittedAspect</property-name>
|
||||
<value>#{AVMSubmittedAspect}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>avmBrowseBean</property-name>
|
||||
<value>#{AVMBrowseBean}</value>
|
||||
@@ -2791,6 +2795,10 @@
|
||||
<property-name>avmBrowseBean</property-name>
|
||||
<value>#{AVMBrowseBean}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>avmSubmittedAspect</property-name>
|
||||
<value>#{AVMSubmittedAspect}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>workflowService</property-name>
|
||||
<value>#{WorkflowService}</value>
|
||||
|
Reference in New Issue
Block a user