<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wfl:lifecycleapproval">
<swimlane name="initiator" />
<start-state name="start">
<task name="wf:submitReviewTask" swimlane="initiator" />
<event type="node-leave">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
if (logger.isLoggingEnabled()) logger.log("—=== START ===—");
/* Creation de l aspect versions dans la tache si il n existe pas deja */
if (!bpm_package.hasAspect("wfl:versions")){
bpm_package.addAspect("wfl:versions");
if (logger.isLoggingEnabled())logger.log("Aspect version ajoute !");
}
/* Declaration du tableau dans lequel on stockera les versions */
var verTable = new Array();
if (logger.isLoggingEnabled())logger.log("Array version cree !");
/* Parcours des noeuds documents */
for (var i = 0; i < bpm_package.children.length; i++){
var child = bpm_package.children[i];
var versions = child.getVersionHistory();
/* On recupere la version du document */
verTable[i] = child.properties["cm:versionLabel"];
/* Recuperation de la derniere version du document */
var version = child.getVersion(verTable[i]);
var verNode = version.getNode();
if (logger.isLoggingEnabled())logger.log("Version " + version.getLabel());
/* Creation de l aspect status de la version si il n existe pas deja */
try {
if (!verNode.hasAspect("wfl:status")){
verNode.addAspect("wfl:status");
}
} catch (error) { if (logger.isLoggingEnabled())logger.log("Erreur addAspect wfl:status");}
/* Acces aux properties */
try{
logger.log("Version status : " + verNode.properties["wfl:status"]);
} catch (error) { if (logger.isLoggingEnabled())logger.log("Erreur acces properties");}
/* Mise a jour de l aspect versions qui prend le tableau de versions */
bpm_package.properties["wfl:versions"] = verTable;
bpm_package.save();
if (logger.isLoggingEnabled())logger.log("Version mise a jour !");
}
</script>
</action>
</event>
<transition name="" to="review" />
</start-state>
<swimlane name="reviewer">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<actor>#{bpm_assignee}</actor>
</assignment>
</swimlane>
<task-node name="review">
<event type="node-enter">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
if (logger.isLoggingEnabled()) logger.log("—=== REVIEW : node-enter ===—");
/* Recuperation du tableau de version dans la tache */
var verTable = bpm_package.properties["wfl:versions"];
if (logger.isLoggingEnabled())logger.log("Tableau des versions recupere !");
/* Parcours des noeuds documents */
for (var i = 0; i < bpm_package.children.length; i++){
var child = bpm_package.children[i];
var versions = child.getVersionHistory();
/* Recuperation de la bonne version du document */
var version = child.getVersion(verTable[i]);
var verNode = version.getNode();
if (logger.isLoggingEnabled())logger.log("Version url : " + verNode.getUrl());
verNode.properties["wfl:status"] = "In Review";
verNode.save();
try{
logger.log("Version status : " + verNode.properties["wfl:status"]);
} catch (error) { logger.log("Erreur acces properties");}
}
</script>
</action>
</event>
<task name="wf:reviewTask" swimlane="reviewer">
<event type="task-create">
<script>
if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
</script>
</event>
</task>
<transition name="reject" to="rejected" />
<transition name="approve" to="approved" />
</task-node>
<?xml version="1.0" encoding="UTF-8"?>
<model name="wfl:workflowlifecyclemodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<description>Workflow Lifecycle Model</description>
<author></author>
<version>1.0</version>
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
<import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm"/>
</imports>
<namespaces>
<namespace uri="wfl.model" prefix="wfl" />
</namespaces>
<constraints>
<constraint name="wfl:status" type="LIST">
<parameter name="allowedValues">
<list>
<value>Draft</value>
<value>In Review</value>
<value>Approved</value>
</list>
</parameter>
</constraint>
</constraints>
<aspects>
<aspect name="wfl:status">
<title>Status</title>
<properties>
<property name="wfl:status">
<title>Status</title>
<type>d:text</type>
<default>Draft</default>
<constraints>
<constraint ref="wfl:status" />
</constraints>
</property>
</properties>
</aspect>
<aspect name="wfl:versions">
<title>Version Tache</title>
<properties>
<property name="wfl:versions">
<title>Version Tache</title>
<type>d:any</type>
</property>
</properties>
</aspect>
</aspects>
</model>
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.