Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
246 righe
8.2 KiB
246 righe
8.2 KiB
5 anni fa
|
<?xml version="1.0"?>
|
||
|
<workflow-definition xmlns="urn:liferay.com:liferay-workflow_6.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:liferay.com:liferay-workflow_6.2.0 http://www.liferay.com/dtd/liferay-workflow-definition_6_2_0_1.xsd">
|
||
|
<name>Single Approver</name>
|
||
|
<description>A single approver can approve a workflow content.</description>
|
||
|
<version>1</version>
|
||
|
<state>
|
||
|
<name>created</name>
|
||
|
<metadata><![CDATA[{"transitions":{"review":{"bendpoints":[]}},"xy":[36,51]}]]></metadata>
|
||
|
<initial>true</initial>
|
||
|
<transitions>
|
||
|
<transition>
|
||
|
<name>review</name>
|
||
|
<target>review</target>
|
||
|
</transition>
|
||
|
</transitions>
|
||
|
</state>
|
||
|
<task>
|
||
|
<name>update</name>
|
||
|
<metadata><![CDATA[{"xy":[250,335],"transitions":{"Signal":{"bendpoints":[]},"wait":{"bendpoints":[]},"resubmit":{"bendpoints":[[303,140]]}}}]]></metadata>
|
||
|
<actions>
|
||
|
<action>
|
||
|
<name>reject</name>
|
||
|
<script> <![CDATA[
|
||
|
Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("denied"), workflowContext);
|
||
|
Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("pending"), workflowContext);
|
||
|
]]> </script>
|
||
|
<script-language>javascript</script-language>
|
||
|
<execution-type>onAssignment</execution-type>
|
||
|
</action>
|
||
|
<notification>
|
||
|
<name>Creator Modification Notification</name>
|
||
|
<template>Your submission was rejected by ${userName}, please modify and resubmit.</template>
|
||
|
<template-language>freemarker</template-language>
|
||
|
<notification-type>email</notification-type>
|
||
|
<notification-type>user-notification</notification-type>
|
||
|
<execution-type>onAssignment</execution-type>
|
||
|
</notification>
|
||
|
</actions>
|
||
|
<assignments>
|
||
|
<user/>
|
||
|
</assignments>
|
||
|
<transitions>
|
||
|
<transition>
|
||
|
<target>wait</target>
|
||
|
<name>wait</name>
|
||
|
</transition>
|
||
|
</transitions>
|
||
|
</task>
|
||
|
<task>
|
||
|
<name>review</name>
|
||
|
<metadata><![CDATA[{"xy":[280,36],"transitions":{"approve":{"bendpoints":[]},"reject":{"bendpoints":[]}}}]]></metadata>
|
||
|
<actions>
|
||
|
<notification>
|
||
|
<name>Review Notification</name>
|
||
|
<template>${userName} sent you a ${entryType} for review in the workflow.</template>
|
||
|
<template-language>freemarker</template-language>
|
||
|
<notification-type>email</notification-type>
|
||
|
<notification-type>user-notification</notification-type>
|
||
|
<execution-type>onAssignment</execution-type>
|
||
|
</notification>
|
||
|
<notification>
|
||
|
<name>Review Completion Notification</name>
|
||
|
<template>Your submission has been reviewed and the reviewer has applied the following ${taskComments}.</template>
|
||
|
<template-language>freemarker</template-language>
|
||
|
<notification-type>email</notification-type>
|
||
|
<recipients>
|
||
|
<user/>
|
||
|
</recipients>
|
||
|
<execution-type>onExit</execution-type>
|
||
|
</notification>
|
||
|
<action>
|
||
|
<name>onValidation1</name>
|
||
|
<script><![CDATA[import java.io.Serializable;
|
||
|
import java.util.Map;
|
||
|
import com.liferay.portal.kernel.json.JSONArray;
|
||
|
import com.liferay.portal.kernel.json.JSONFactoryUtil;
|
||
|
import com.liferay.portal.kernel.json.JSONObject;
|
||
|
import com.liferay.portal.kernel.util.MapUtil;
|
||
|
import com.liferay.portal.kernel.util.Validator;
|
||
|
JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
|
||
|
JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
|
||
|
jsonObject.put("errors", jsonArray);
|
||
|
|
||
|
String text =
|
||
|
MapUtil.getString((Map<String, String>) workflowContext.get("CONTEXT_TASK_FORM_PARAMETERS"), "Testo4348");
|
||
|
|
||
|
if (Validator.isNull(text)) {
|
||
|
jsonArray.put("Errore campo Testo");
|
||
|
}
|
||
|
|
||
|
boolean checkbox =
|
||
|
MapUtil.getBoolean((Map<String, String>) workflowContext.get("CONTEXT_TASK_FORM_PARAMETERS"), "Booleano1434");
|
||
|
|
||
|
if (!checkbox) {
|
||
|
jsonArray.put("Errore campo Booleano");
|
||
|
}
|
||
|
|
||
|
workflowContext.put("CONTEXT_VALIDATION_OUTCOME_PARAMETER", jsonObject.toString());
|
||
|
]]></script>
|
||
|
<script-language>groovy</script-language>
|
||
|
<execution-type>onValidation</execution-type>
|
||
|
</action>
|
||
|
<action>
|
||
|
<name>onOpenForm1</name>
|
||
|
<script><![CDATA[import java.io.Serializable;
|
||
|
import java.util.Map;
|
||
|
|
||
|
import com.liferay.portal.kernel.json.JSONArray;
|
||
|
import com.liferay.portal.kernel.json.JSONFactoryUtil;
|
||
|
import com.liferay.portal.kernel.json.JSONObject;
|
||
|
|
||
|
JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
|
||
|
|
||
|
JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
|
||
|
|
||
|
JSONObject json1 = JSONFactoryUtil.createJSONObject();
|
||
|
json1.put("label", "user");
|
||
|
json1.put("value", 1);
|
||
|
|
||
|
JSONObject json2 = JSONFactoryUtil.createJSONObject();
|
||
|
json2.put("label", "group");
|
||
|
json2.put("value", 2);
|
||
|
json2.put("default", true);
|
||
|
|
||
|
JSONObject json3 = JSONFactoryUtil.createJSONObject();
|
||
|
json3.put("label", "company");
|
||
|
json3.put("value", 3);
|
||
|
|
||
|
JSONObject json4 = JSONFactoryUtil.createJSONObject();
|
||
|
json4.put("label", "site");
|
||
|
json4.put("value", 4);
|
||
|
|
||
|
jsonArray.put(json1);
|
||
|
jsonArray.put(json2);
|
||
|
jsonArray.put(json3);
|
||
|
jsonArray.put(json4);
|
||
|
|
||
|
jsonObject.put("SELECT1", jsonArray);
|
||
|
|
||
|
json1 = JSONFactoryUtil.createJSONObject();
|
||
|
json1.put("label", "user");
|
||
|
json1.put("value", 1);
|
||
|
|
||
|
json2 = JSONFactoryUtil.createJSONObject();
|
||
|
json2.put("label", "group");
|
||
|
json2.put("value", 2);
|
||
|
json2.put("default", true);
|
||
|
|
||
|
json3 = JSONFactoryUtil.createJSONObject();
|
||
|
json3.put("label", "company");
|
||
|
json3.put("value", 3);
|
||
|
json3.put("default", true);
|
||
|
|
||
|
json4 = JSONFactoryUtil.createJSONObject();
|
||
|
json4.put("label", "site");
|
||
|
json4.put("value", 4);
|
||
|
|
||
|
jsonArray = JSONFactoryUtil.createJSONArray();
|
||
|
|
||
|
jsonArray.put(json1);
|
||
|
jsonArray.put(json2);
|
||
|
jsonArray.put(json3);
|
||
|
jsonArray.put(json4);
|
||
|
|
||
|
jsonObject.put("SELECT2", jsonArray);
|
||
|
|
||
|
workflowContext.put("CONTEXT_OPEN_FORM_OPTIONS_PARAMETER", jsonObject.toString()); ]]></script>
|
||
|
<script-language>groovy</script-language>
|
||
|
<execution-type>onOperForm</execution-type>
|
||
|
</action>
|
||
|
</actions>
|
||
|
<assignments>
|
||
|
<roles>
|
||
|
<role>
|
||
|
<role-type>organization</role-type>
|
||
|
<name>Organization Administrator</name>
|
||
|
</role>
|
||
|
<role>
|
||
|
<role-type>organization</role-type>
|
||
|
<name>Organization Content Reviewer</name>
|
||
|
</role>
|
||
|
<role>
|
||
|
<role-type>organization</role-type>
|
||
|
<name>Organization Owner</name>
|
||
|
</role>
|
||
|
<role>
|
||
|
<role-type>regular</role-type>
|
||
|
<name>Administrator</name>
|
||
|
</role>
|
||
|
<role>
|
||
|
<role-type>regular</role-type>
|
||
|
<name>Portal Content Reviewer</name>
|
||
|
</role>
|
||
|
<role>
|
||
|
<role-type>site</role-type>
|
||
|
<name>Site Administrator</name>
|
||
|
</role>
|
||
|
<role>
|
||
|
<role-type>site</role-type>
|
||
|
<name>Site Content Reviewer</name>
|
||
|
</role>
|
||
|
<role>
|
||
|
<role-type>site</role-type>
|
||
|
<name>Site Owner</name>
|
||
|
</role>
|
||
|
</roles>
|
||
|
</assignments>
|
||
|
<transitions>
|
||
|
<transition>
|
||
|
<name>approve</name>
|
||
|
<target>approved</target>
|
||
|
</transition>
|
||
|
<transition>
|
||
|
<target>update</target>
|
||
|
<name>reject</name>
|
||
|
</transition>
|
||
|
</transitions>
|
||
|
</task>
|
||
|
<state>
|
||
|
<name>approved</name>
|
||
|
<metadata><![CDATA[{"xy":[640,51]}]]></metadata>
|
||
|
<actions>
|
||
|
<action>
|
||
|
<name>approve</name>
|
||
|
<script> <![CDATA[
|
||
|
import com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil;
|
||
|
import com.liferay.portal.kernel.workflow.WorkflowConstants;
|
||
|
|
||
|
WorkflowStatusManagerUtil.updateStatus(WorkflowConstants.toStatus("approved"), workflowContext);
|
||
|
]]> </script>
|
||
|
<script-language>groovy</script-language>
|
||
|
<execution-type>onEntry</execution-type>
|
||
|
</action>
|
||
|
</actions>
|
||
|
</state>
|
||
|
<state>
|
||
|
<metadata><![CDATA[{"xy":[620,350],"transitions":{"signal1":{"bendpoints":[]}}}]]></metadata>
|
||
|
<name>wait</name>
|
||
|
<transitions>
|
||
|
<transition>
|
||
|
<target>review</target>
|
||
|
<name>signal1</name>
|
||
|
</transition>
|
||
|
</transitions>
|
||
|
</state>
|
||
|
</workflow-definition>
|