diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties
index 200aa08023..08cc445d1f 100644
--- a/config/alfresco/messages/webclient.properties
+++ b/config/alfresco/messages/webclient.properties
@@ -1209,9 +1209,12 @@ in_progress=In Progress
by=by
# Workflow Definitions
+wf_review_options=Review Options
+wf_review_status=Review Status
wf_review_due_date=Review Due Date
wf_review_priority=Review Priority
wf_reviewer=Reviewer
+wf_reviewers=Reviewers
wf_adhoc_due_date=Due Date
wf_adhoc_priority=Priority
wf_adhoc_assignee=Assign To
diff --git a/config/alfresco/web-client-config-properties.xml b/config/alfresco/web-client-config-properties.xml
index 1a7d39a8c1..939b400afa 100644
--- a/config/alfresco/web-client-config-properties.xml
+++ b/config/alfresco/web-client-config-properties.xml
@@ -232,17 +232,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -277,6 +266,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source/java/org/alfresco/web/bean/repository/TransientNode.java b/source/java/org/alfresco/web/bean/repository/TransientNode.java
index fa7ca06c0a..44747cb574 100644
--- a/source/java/org/alfresco/web/bean/repository/TransientNode.java
+++ b/source/java/org/alfresco/web/bean/repository/TransientNode.java
@@ -2,6 +2,7 @@ package org.alfresco.web.bean.repository;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -9,6 +10,7 @@ import java.util.Map;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.service.cmr.dictionary.AspectDefinition;
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.PropertyDefinition;
import org.alfresco.service.cmr.dictionary.TypeDefinition;
@@ -60,6 +62,69 @@ public class TransientNode extends Node
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 data)
+ {
+ // build a complete anonymous type for the start task
+ List aspects = typeDef.getDefaultAspects();
+ List aspectNames = new ArrayList(aspects.size());
+ getMandatoryAspects(typeDef, aspectNames);
+ ClassDefinition startTaskDef = dictionaryService.getAnonymousType(typeDef.getName(), aspectNames);
+
+ // initialise start task values
+ Map startValues = new HashMap();
+ if (data != null)
+ {
+ startValues.putAll(data);
+ }
+
+ // apply default values
+ Map propertyDefs = startTaskDef.getProperties();
+ for (Map.Entry 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 aspects)
+ {
+ for (AspectDefinition aspect : classDef.getDefaultAspects())
+ {
+ QName aspectName = aspect.getName();
+ if (!aspects.contains(aspectName))
+ {
+ aspects.add(aspect.getName());
+ getMandatoryAspects(aspect, aspects);
+ }
+ }
+ }
+
/**
* Initialises the node.
*
diff --git a/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java b/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java
index ab00b650cc..8026546b5f 100644
--- a/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java
+++ b/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java
@@ -253,40 +253,37 @@ public class ManageTaskDialog extends BaseDialogBean
}
}
- if (selectedTransition != null)
+ UserTransaction tx = null;
+
+ try
{
- UserTransaction tx = null;
-
- try
- {
- tx = Repository.getUserTransaction(context);
- tx.begin();
-
- // prepare the edited parameters for saving
- Map params = WorkflowUtil.prepareTaskParams(this.taskNode);
-
- if (logger.isDebugEnabled())
- logger.debug("Transitioning task with parameters: " + params);
-
- // update the task with the updated parameters
- this.workflowService.updateTask(this.task.id, params, null, null);
-
- // signal the selected transition to the workflow task
- this.workflowService.endTask(this.task.id, selectedTransition);
-
- // commit the changes
- tx.commit();
-
- if (logger.isDebugEnabled())
- logger.debug("Ended task with transition: " + selectedTransition);
- }
- catch (Throwable e)
- {
- // rollback the transaction
- try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
- Utils.addErrorMessage(formatErrorMessage(e), e);
- outcome = this.getErrorOutcome(e);
- }
+ tx = Repository.getUserTransaction(context);
+ tx.begin();
+
+ // prepare the edited parameters for saving
+ Map params = WorkflowUtil.prepareTaskParams(this.taskNode);
+
+ if (logger.isDebugEnabled())
+ logger.debug("Transitioning task with parameters: " + params);
+
+ // update the task with the updated parameters
+ this.workflowService.updateTask(this.task.id, params, null, null);
+
+ // signal the selected transition to the workflow task
+ this.workflowService.endTask(this.task.id, selectedTransition);
+
+ // commit the changes
+ tx.commit();
+
+ if (logger.isDebugEnabled())
+ logger.debug("Ended task with transition: " + selectedTransition);
+ }
+ catch (Throwable e)
+ {
+ // rollback the transaction
+ try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
+ Utils.addErrorMessage(formatErrorMessage(e), e);
+ outcome = this.getErrorOutcome(e);
}
return outcome;
diff --git a/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java b/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java
index 5cfa7a719b..6b0b1006e7 100644
--- a/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java
+++ b/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java
@@ -202,7 +202,7 @@ public class StartWorkflowWizard extends BaseWizardBean
logger.debug("Start task definition: " + taskDef);
// 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);
}