Merged V1.3 to V1.4 (Workflow changes required)

svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4152 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4153 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4163 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4164 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4178 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4179 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4328 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4329 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4331 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4332 .



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4529 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-12-06 16:03:37 +00:00
parent f5f4a867f7
commit 5b086fc759
5 changed files with 144 additions and 45 deletions

View File

@@ -1209,9 +1209,12 @@ in_progress=In Progress
by=by by=by
# Workflow Definitions # Workflow Definitions
wf_review_options=Review Options
wf_review_status=Review Status
wf_review_due_date=Review Due Date wf_review_due_date=Review Due Date
wf_review_priority=Review Priority wf_review_priority=Review Priority
wf_reviewer=Reviewer wf_reviewer=Reviewer
wf_reviewers=Reviewers
wf_adhoc_due_date=Due Date wf_adhoc_due_date=Due Date
wf_adhoc_priority=Priority wf_adhoc_priority=Priority
wf_adhoc_assignee=Assign To wf_adhoc_assignee=Assign To

View File

@@ -232,17 +232,6 @@
<!-- Generic workflow task --> <!-- Generic workflow task -->
<config evaluator="node-type" condition="bpm:workflowTask" replace="true">
<property-sheet>
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
<show-property name="bpm:taskId" />
<show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
<show-property name="bpm:dueDate" read-only="true" />
<show-property name="bpm:priority" read-only="true" />
<show-property name="bpm:status" />
</property-sheet>
</config>
<config evaluator="node-type" condition="bpm:startTask" replace="true"> <config evaluator="node-type" condition="bpm:startTask" replace="true">
<property-sheet> <property-sheet>
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" /> <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
@@ -277,6 +266,51 @@
<show-association name="bpm:assignee" display-label-id="wf_reviewer" /> <show-association name="bpm:assignee" display-label-id="wf_reviewer" />
</property-sheet> </property-sheet>
</config> </config>
<config evaluator="node-type" condition="wf:submitParallelReviewTask" replace="true">
<property-sheet>
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
<show-property name="bpm:workflowDescription" component-generator="TextAreaGenerator" />
<show-property name="bpm:workflowPriority" display-label-id="wf_review_priority" />
<show-property name="bpm:workflowDueDate" display-label-id="wf_review_due_date" />
<separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
<show-association name="bpm:assignees" display-label-id="wf_reviewers" />
<separator name="sep3" display-label-id="wf_review_options" component-generator="HeaderSeparatorGenerator" />
<show-property name="wf:requiredApprovePercent" />
</property-sheet>
</config>
<config evaluator="node-type" condition="wf:rejectedParallelTask" replace="true">
<property-sheet>
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
<show-property name="bpm:taskId" />
<show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
<show-property name="bpm:dueDate" read-only="true" />
<show-property name="bpm:priority" read-only="true" />
<show-property name="bpm:status" />
<separator name="sep2" display-label-id="wf_review_status" component-generator="HeaderSeparatorGenerator" />
<show-property name="wf:reviewerCount" read-only="true"/>
<show-property name="wf:requiredPercent" read-only="true"/>
<show-property name="wf:approveCount" read-only="true"/>
<show-property name="wf:actualPercent" read-only="true"/>
</property-sheet>
</config>
<config evaluator="node-type" condition="wf:approvedParallelTask" replace="true">
<property-sheet>
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
<show-property name="bpm:taskId" />
<show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
<show-property name="bpm:dueDate" read-only="true" />
<show-property name="bpm:priority" read-only="true" />
<show-property name="bpm:status" />
<separator name="sep2" display-label-id="wf_review_status" component-generator="HeaderSeparatorGenerator" />
<show-property name="wf:reviewerCount" read-only="true"/>
<show-property name="wf:requiredPercent" read-only="true"/>
<show-property name="wf:approveCount" read-only="true"/>
<show-property name="wf:actualPercent" read-only="true"/>
</property-sheet>
</config>
<!-- Ad hoc workflow tasks --> <!-- Ad hoc workflow tasks -->

View File

@@ -2,6 +2,7 @@ package org.alfresco.web.bean.repository;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -9,6 +10,7 @@ import java.util.Map;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.service.cmr.dictionary.AspectDefinition; import org.alfresco.service.cmr.dictionary.AspectDefinition;
import org.alfresco.service.cmr.dictionary.AssociationDefinition; import org.alfresco.service.cmr.dictionary.AssociationDefinition;
import org.alfresco.service.cmr.dictionary.ClassDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.dictionary.PropertyDefinition; import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.cmr.dictionary.TypeDefinition; import org.alfresco.service.cmr.dictionary.TypeDefinition;
@@ -60,6 +62,69 @@ public class TransientNode extends Node
initNode(data); initNode(data);
} }
/**
* Construct a transient node for an item yet to be created in the Repository.
*
* This will apply any one-time initialisation required upon creation of the node
* e.g. assignment of default values.
*
* @param dictionaryService dictionary service
* @param typeDef The type definition this node will represent
* @param name The name of the node
* @param data The properties and associations this node will have
* @return transient node
*/
public static TransientNode createNew(DictionaryService dictionaryService, TypeDefinition typeDef, String name, Map<QName, Serializable> data)
{
// build a complete anonymous type for the start task
List<AspectDefinition> aspects = typeDef.getDefaultAspects();
List<QName> aspectNames = new ArrayList<QName>(aspects.size());
getMandatoryAspects(typeDef, aspectNames);
ClassDefinition startTaskDef = dictionaryService.getAnonymousType(typeDef.getName(), aspectNames);
// initialise start task values
Map<QName, Serializable> startValues = new HashMap<QName, Serializable>();
if (data != null)
{
startValues.putAll(data);
}
// apply default values
Map<QName, PropertyDefinition> propertyDefs = startTaskDef.getProperties();
for (Map.Entry<QName, PropertyDefinition> entry : propertyDefs.entrySet())
{
String defaultValue = entry.getValue().getDefaultValue();
if (defaultValue != null)
{
if (startValues.get(entry.getKey()) == null)
{
startValues.put(entry.getKey(), defaultValue);
}
}
}
return new TransientNode(typeDef.getName(), name, startValues);
}
/**
* Gets a flattened list of all mandatory aspects for a given class
*
* @param classDef the class
* @param aspects a list to hold the mandatory aspects
*/
private static void getMandatoryAspects(ClassDefinition classDef, List<QName> aspects)
{
for (AspectDefinition aspect : classDef.getDefaultAspects())
{
QName aspectName = aspect.getName();
if (!aspects.contains(aspectName))
{
aspects.add(aspect.getName());
getMandatoryAspects(aspect, aspects);
}
}
}
/** /**
* Initialises the node. * Initialises the node.
* *

View File

@@ -253,40 +253,37 @@ public class ManageTaskDialog extends BaseDialogBean
} }
} }
if (selectedTransition != null) UserTransaction tx = null;
try
{ {
UserTransaction tx = null; tx = Repository.getUserTransaction(context);
tx.begin();
try
{ // prepare the edited parameters for saving
tx = Repository.getUserTransaction(context); Map<QName, Serializable> params = WorkflowUtil.prepareTaskParams(this.taskNode);
tx.begin();
if (logger.isDebugEnabled())
// prepare the edited parameters for saving logger.debug("Transitioning task with parameters: " + params);
Map<QName, Serializable> params = WorkflowUtil.prepareTaskParams(this.taskNode);
// update the task with the updated parameters
if (logger.isDebugEnabled()) this.workflowService.updateTask(this.task.id, params, null, null);
logger.debug("Transitioning task with parameters: " + params);
// signal the selected transition to the workflow task
// update the task with the updated parameters this.workflowService.endTask(this.task.id, selectedTransition);
this.workflowService.updateTask(this.task.id, params, null, null);
// commit the changes
// signal the selected transition to the workflow task tx.commit();
this.workflowService.endTask(this.task.id, selectedTransition);
if (logger.isDebugEnabled())
// commit the changes logger.debug("Ended task with transition: " + selectedTransition);
tx.commit(); }
catch (Throwable e)
if (logger.isDebugEnabled()) {
logger.debug("Ended task with transition: " + selectedTransition); // rollback the transaction
} try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
catch (Throwable e) Utils.addErrorMessage(formatErrorMessage(e), e);
{ outcome = this.getErrorOutcome(e);
// rollback the transaction
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
Utils.addErrorMessage(formatErrorMessage(e), e);
outcome = this.getErrorOutcome(e);
}
} }
return outcome; return outcome;

View File

@@ -202,7 +202,7 @@ public class StartWorkflowWizard extends BaseWizardBean
logger.debug("Start task definition: " + taskDef); logger.debug("Start task definition: " + taskDef);
// create an instance of a task from the data dictionary // create an instance of a task from the data dictionary
this.startTaskNode = new TransientNode(taskDef.metadata.getName(), this.startTaskNode = TransientNode.createNew(dictionaryService, taskDef.metadata,
"task_" + System.currentTimeMillis(), null); "task_" + System.currentTimeMillis(), null);
} }