提交 32191c84 编写于 作者: T Tijs Rademakers

REST API fixes and doc updates

上级 9c525db7
......@@ -92,7 +92,11 @@
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</dependency>
</dependencies>
<profiles>
......
......@@ -12,11 +12,14 @@
*/
package org.activiti.bpmn.model;
import org.codehaus.jackson.annotate.JsonIgnore;
/**
* @author Tijs Rademakers
*/
public class BoundaryEvent extends Event {
@JsonIgnore
protected Activity attachedToRef;
protected String attachedToRefId;
protected boolean cancelActivity = true;
......
......@@ -30,9 +30,14 @@ public class ActivitiServletContextListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent event) {
LOGGER.info("Booting Activiti Process Engine");
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
ProcessEngine processEngine = null;
try {
processEngine = ProcessEngines.getDefaultProcessEngine();
} catch (Exception e) {
LOGGER.error("Error starting the Activiti REST API", e);
}
if (processEngine == null) {
LOGGER.error("Could not start the Activiti Engine");
LOGGER.error("Could not start the Activiti REST API");
}
}
......
......@@ -35,7 +35,10 @@
<groupId>org.activiti</groupId>
<artifactId>activiti-common-rest</artifactId>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-json-converter</artifactId>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-simple-workflow</artifactId>
......
......@@ -110,22 +110,37 @@ public class RestResponseFactory {
initializeVariableConverters();
}
public TaskResponse createTaskReponse(SecuredResource resourceContext, Task task) {
public TaskResponse createTaskReponse(SecuredResource securedResource, Task task) {
TaskResponse response = new TaskResponse(task);
response.setUrl(resourceContext.createFullResourceUrl(RestUrls.URL_TASK, task.getId()));
response.setUrl(securedResource.createFullResourceUrl(RestUrls.URL_TASK, task.getId()));
// Add references to other resources, if needed
if (response.getParentTaskId() != null) {
response.setParentTaskUrl(resourceContext.createFullResourceUrl(RestUrls.URL_TASK, response.getParentTaskId()));
response.setParentTaskUrl(securedResource.createFullResourceUrl(RestUrls.URL_TASK, response.getParentTaskId()));
}
if (response.getProcessDefinitionId() != null) {
response.setProcessDefinitionUrl(resourceContext.createFullResourceUrl(RestUrls.URL_PROCESS_DEFINITION, response.getProcessDefinitionId()));
response.setProcessDefinitionUrl(securedResource.createFullResourceUrl(RestUrls.URL_PROCESS_DEFINITION, response.getProcessDefinitionId()));
}
if (response.getExecutionId() != null) {
response.setExecutionUrl(resourceContext.createFullResourceUrl(RestUrls.URL_EXECUTION, response.getExecutionId()));
response.setExecutionUrl(securedResource.createFullResourceUrl(RestUrls.URL_EXECUTION, response.getExecutionId()));
}
if (response.getProcessInstanceId() != null) {
response.setProcessInstanceUrl(resourceContext.createFullResourceUrl(RestUrls.URL_PROCESS_INSTANCE, response.getProcessInstanceId()));
response.setProcessInstanceUrl(securedResource.createFullResourceUrl(RestUrls.URL_PROCESS_INSTANCE, response.getProcessInstanceId()));
}
if (task.getProcessVariables() != null) {
Map<String, Object> variableMap = task.getProcessVariables();
for (String name : variableMap.keySet()) {
response.addVariable(createRestVariable(securedResource, name, variableMap.get(name),
RestVariableScope.GLOBAL, task.getId(), VARIABLE_TASK, false));
}
}
if (task.getTaskLocalVariables() != null) {
Map<String, Object> variableMap = task.getTaskLocalVariables();
for (String name : variableMap.keySet()) {
response.addVariable(createRestVariable(securedResource, name, variableMap.get(name),
RestVariableScope.LOCAL, task.getId(), VARIABLE_TASK, false));
}
}
return response;
......@@ -175,7 +190,8 @@ public class RestResponseFactory {
response.setGraphicalNotationDefined(((ProcessDefinitionEntity) deployedDefinition).isGraphicalNotationDefined());
// Links to other resources
response.setDeployment(resourceContext.createFullResourceUrl(RestUrls.URL_DEPLOYMENT, processDefinition.getDeploymentId()));
response.setDeploymentId(processDefinition.getDeploymentId());
response.setDeploymentUrl(resourceContext.createFullResourceUrl(RestUrls.URL_DEPLOYMENT, processDefinition.getDeploymentId()));
response.setResource(resourceContext.createFullResourceUrl(RestUrls.URL_DEPLOYMENT_RESOURCE, processDefinition.getDeploymentId(), processDefinition.getResourceName()));
if(processDefinition.getDiagramResourceName() != null) {
response.setDiagramResource(resourceContext.createFullResourceUrl(RestUrls.URL_DEPLOYMENT_RESOURCE,
......@@ -413,6 +429,13 @@ public class RestResponseFactory {
result.setProcessDefinitionUrl(securedResource.createFullResourceUrl(RestUrls.URL_PROCESS_DEFINITION, processInstance.getProcessDefinitionId()));
result.setSuspended(processInstance.isSuspended());
result.setUrl(securedResource.createFullResourceUrl(RestUrls.URL_PROCESS_INSTANCE, processInstance.getId()));
if (processInstance.getProcessVariables() != null) {
Map<String, Object> variableMap = processInstance.getProcessVariables();
for (String name : variableMap.keySet()) {
result.addVariable(createRestVariable(securedResource, name, variableMap.get(name),
RestVariableScope.LOCAL, processInstance.getId(), VARIABLE_PROCESS, false));
}
}
return result;
}
......@@ -424,10 +447,12 @@ public class RestResponseFactory {
result.setUrl(securedResource.createFullResourceUrl(RestUrls.URL_EXECUTION, execution.getId()));
result.setSuspended(execution.isSuspended());
result.setParentId(execution.getParentId());
if(execution.getParentId() != null) {
result.setParentUrl(securedResource.createFullResourceUrl(RestUrls.URL_EXECUTION, execution.getParentId()));
}
result.setProcessInstanceId(execution.getProcessInstanceId());
if(execution.getProcessInstanceId() != null) {
result.setProcessInstanceUrl(securedResource.createFullResourceUrl(RestUrls.URL_PROCESS_INSTANCE, execution.getProcessInstanceId()));
}
......@@ -504,7 +529,7 @@ public class RestResponseFactory {
Map<String, Object> variableMap = processInstance.getProcessVariables();
for (String name : variableMap.keySet()) {
result.addVariable(createRestVariable(securedResource, name, variableMap.get(name),
RestVariableScope.GLOBAL, processInstance.getId(), VARIABLE_HISTORY_PROCESS, false));
RestVariableScope.LOCAL, processInstance.getId(), VARIABLE_HISTORY_PROCESS, false));
}
}
return result;
......@@ -527,9 +552,13 @@ public class RestResponseFactory {
result.setParentTaskId(taskInstance.getParentTaskId());
result.setPriority(taskInstance.getPriority());
result.setProcessDefinitionId(taskInstance.getProcessDefinitionId());
result.setProcessDefinitionUrl(securedResource.createFullResourceUrl(RestUrls.URL_PROCESS_DEFINITION, taskInstance.getProcessDefinitionId()));
if (taskInstance.getProcessDefinitionId() != null) {
result.setProcessDefinitionUrl(securedResource.createFullResourceUrl(RestUrls.URL_PROCESS_DEFINITION, taskInstance.getProcessDefinitionId()));
}
result.setProcessInstanceId(taskInstance.getProcessInstanceId());
result.setProcessInstanceUrl(securedResource.createFullResourceUrl(RestUrls.URL_HISTORIC_PROCESS_INSTANCE, taskInstance.getProcessInstanceId()));
if (taskInstance.getProcessInstanceId() != null) {
result.setProcessInstanceUrl(securedResource.createFullResourceUrl(RestUrls.URL_HISTORIC_PROCESS_INSTANCE, taskInstance.getProcessInstanceId()));
}
result.setStartTime(taskInstance.getStartTime());
result.setTaskDefinitionKey(taskInstance.getTaskDefinitionKey());
result.setWorkTimeInMillis(taskInstance.getWorkTimeInMillis());
......
......@@ -24,7 +24,8 @@ public class ProcessDefinitionResponse {
private int version;
private String name;
private String description;
private String deployment;
private String deploymentId;
private String deploymentUrl;
private String resource;
private String diagramResource;
private String category;
......@@ -62,11 +63,17 @@ public class ProcessDefinitionResponse {
public void setName(String name) {
this.name = name;
}
public String getDeployment() {
return deployment;
public String getDeploymentId() {
return deploymentId;
}
public void setDeployment(String deployment) {
this.deployment = deployment;
public void setDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
}
public String getDeploymentUrl() {
return deploymentUrl;
}
public void setDeploymentUrl(String deploymentUrl) {
this.deploymentUrl = deploymentUrl;
}
public String getCategory() {
return category;
......
......@@ -21,7 +21,9 @@ public class ExecutionResponse {
protected String id;
protected String url;
protected String parentId;
protected String parentUrl;
protected String processInstanceId;
protected String processInstanceUrl;
protected boolean suspended;
protected String activityId;
......@@ -42,6 +44,14 @@ public class ExecutionResponse {
this.url = url;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getParentUrl() {
return parentUrl;
}
......@@ -50,6 +60,14 @@ public class ExecutionResponse {
this.parentUrl = parentUrl;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public String getProcessInstanceUrl() {
return processInstanceUrl;
}
......
......@@ -77,6 +77,11 @@ public class ProcessInstanceBaseResource extends SecuredResource {
if (queryRequest.getSuperProcessInstanceId() != null) {
query.superProcessInstanceId(queryRequest.getSuperProcessInstanceId());
}
if (queryRequest.getIncludeProcessVariables() != null) {
if (queryRequest.getIncludeProcessVariables()) {
query.includeProcessVariables();
}
}
if (queryRequest.getVariables() != null) {
addVariables(query, queryRequest.getVariables());
}
......
......@@ -33,6 +33,7 @@ public class ProcessInstanceQueryRequest {
private String subProcessInstanceId;
private String involvedUser;
private Boolean suspended;
private Boolean includeProcessVariables;
private List<QueryVariable> variables;
public String getProcessInstanceId() {
......@@ -99,6 +100,14 @@ public class ProcessInstanceQueryRequest {
this.suspended = suspended;
}
public Boolean getIncludeProcessVariables() {
return includeProcessVariables;
}
public void setIncludeProcessVariables(Boolean includeProcessVariables) {
this.includeProcessVariables = includeProcessVariables;
}
@JsonTypeInfo(use=Id.CLASS, defaultImpl=QueryVariable.class)
public List<QueryVariable> getVariables() {
return variables;
......
......@@ -13,6 +13,11 @@
package org.activiti.rest.api.runtime.process;
import java.util.ArrayList;
import java.util.List;
import org.activiti.rest.api.engine.variable.RestVariable;
/**
* @author Frederik Heremans
*/
......@@ -24,6 +29,7 @@ public class ProcessInstanceResponse {
protected String processDefinitionId;
protected String processDefinitionUrl;
protected String activityId;
protected List<RestVariable> variables = new ArrayList<RestVariable>();
public String getId() {
return id;
......@@ -80,4 +86,16 @@ public class ProcessInstanceResponse {
public void setActivityId(String activityId) {
this.activityId = activityId;
}
public List<RestVariable> getVariables() {
return variables;
}
public void setVariables(List<RestVariable> variables) {
this.variables = variables;
}
public void addVariable(RestVariable variable) {
variables.add(variable);
}
}
......@@ -195,6 +195,17 @@ public class TaskBaseResource extends SecuredResource {
}
}
if (request.getIncludeTaskLocalVariables() != null) {
if (request.getIncludeTaskLocalVariables()) {
taskQuery.includeTaskLocalVariables();
}
}
if (request.getIncludeProcessVariables() != null) {
if (request.getIncludeProcessVariables()) {
taskQuery.includeProcessVariables();
}
}
if(request.getTaskVariables() != null) {
addTaskvariables(taskQuery, request.getTaskVariables());
}
......
......@@ -168,6 +168,14 @@ public class TaskCollectionResource extends TaskBaseResource {
request.setActive(getQueryParameterAsBoolean("active", query));
}
if(names.contains("includeTaskLocalVariables")) {
request.setIncludeTaskLocalVariables(getQueryParameterAsBoolean("includeTaskLocalVariables", query));
}
if(names.contains("includeProcessVariables")) {
request.setIncludeProcessVariables(getQueryParameterAsBoolean("includeProcessVariables", query));
}
return getTasksFromQueryRequest(request);
}
}
......@@ -53,6 +53,8 @@ public class TaskQueryRequest {
private Date dueBefore;
private Date dueAfter;
private Boolean active;
private Boolean includeTaskLocalVariables;
private Boolean includeProcessVariables;
private List<QueryVariable> taskVariables;
private List<QueryVariable> processInstanceVariables;
......@@ -273,6 +275,22 @@ public class TaskQueryRequest {
this.active = active;
}
public Boolean getIncludeTaskLocalVariables() {
return includeTaskLocalVariables;
}
public void setIncludeTaskLocalVariables(Boolean includeTaskLocalVariables) {
this.includeTaskLocalVariables = includeTaskLocalVariables;
}
public Boolean getIncludeProcessVariables() {
return includeProcessVariables;
}
public void setIncludeProcessVariables(Boolean includeProcessVariables) {
this.includeProcessVariables = includeProcessVariables;
}
@JsonTypeInfo(use=Id.CLASS, defaultImpl=QueryVariable.class)
public List<QueryVariable> getTaskVariables() {
return taskVariables;
......
......@@ -13,10 +13,13 @@
package org.activiti.rest.api.runtime.task;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.activiti.engine.task.DelegationState;
import org.activiti.engine.task.Task;
import org.activiti.rest.api.engine.variable.RestVariable;
/**
* @author Frederik Heremans
......@@ -46,6 +49,8 @@ public class TaskResponse {
protected String processDefinitionId;
protected String processDefinitionUrl;
protected List<RestVariable> variables = new ArrayList<RestVariable>();
public TaskResponse(Task task) {
setId(task.getId());
setOwner(task.getOwner());
......@@ -208,4 +213,16 @@ public class TaskResponse {
public void setProcessDefinitionUrl(String processDefinitionUrl) {
this.processDefinitionUrl = processDefinitionUrl;
}
public List<RestVariable> getVariables() {
return variables;
}
public void setVariables(List<RestVariable> variables) {
this.variables = variables;
}
public void addVariable(RestVariable variable) {
variables.add(variable);
}
}
......@@ -13,10 +13,12 @@
package org.activiti.rest.demo;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import org.activiti.editor.constants.ModelDataJsonConstants;
import org.activiti.engine.IdentityService;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.RepositoryService;
......@@ -25,7 +27,12 @@ import org.activiti.engine.identity.Group;
import org.activiti.engine.identity.Picture;
import org.activiti.engine.identity.User;
import org.activiti.engine.impl.util.IoUtil;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.Model;
import org.activiti.engine.task.Task;
import org.apache.commons.io.IOUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.node.ObjectNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -33,7 +40,7 @@ import org.slf4j.LoggerFactory;
/**
* @author Joram Barrez
*/
public class DemoDataGenerator {
public class DemoDataGenerator implements ModelDataJsonConstants {
protected static final Logger LOGGER = LoggerFactory.getLogger(DemoDataGenerator.class);
......@@ -43,6 +50,8 @@ public class DemoDataGenerator {
protected transient TaskService taskService;
protected boolean createDemoUsersAndGroups;
protected boolean createDemoProcessDefinitions;
protected boolean createDemoModels;
public void init() {
this.identityService = processEngine.getIdentityService();
......@@ -56,6 +65,16 @@ public class DemoDataGenerator {
initDemoUsers();
}
if (createDemoProcessDefinitions) {
LOGGER.info("Initializing demo process definitions");
initDemoProcessDefinitions();
}
if (createDemoModels) {
LOGGER.info("Initializing demo models");
initDemoModelData();
}
initDemoStandaloneTasks();
}
......@@ -67,6 +86,14 @@ public class DemoDataGenerator {
public void setCreateDemoUsersAndGroups(boolean createDemoUsersAndGroups) {
this.createDemoUsersAndGroups = createDemoUsersAndGroups;
}
public void setCreateDemoProcessDefinitions(boolean createDemoProcessDefinitions) {
this.createDemoProcessDefinitions = createDemoProcessDefinitions;
}
public void setCreateDemoModels(boolean createDemoModels) {
this.createDemoModels = createDemoModels;
}
protected void initDemoGroups() {
String[] assignmentGroups = new String[] {"management", "sales", "marketing", "engineering"};
......@@ -145,6 +172,62 @@ public class DemoDataGenerator {
}
protected void initDemoProcessDefinitions() {
String deploymentName = "Demo processes";
List<Deployment> deploymentList = repositoryService.createDeploymentQuery().deploymentName(deploymentName).list();
if (deploymentList == null || deploymentList.size() == 0) {
repositoryService.createDeployment()
.name(deploymentName)
.addClasspathResource("org/activiti/rest/demo/process/createTimersProcess.bpmn20.xml")
.addClasspathResource("org/activiti/rest/demo/process/oneTaskProcess.bpmn20.xml")
.addClasspathResource("org/activiti/rest/demo/process/VacationRequest.bpmn20.xml")
.addClasspathResource("org/activiti/rest/demo/process/VacationRequest.png")
.addClasspathResource("org/activiti/rest/demo/process/FixSystemFailureProcess.bpmn20.xml")
.addClasspathResource("org/activiti/rest/demo/process/FixSystemFailureProcess.png")
.addClasspathResource("org/activiti/rest/demo/process/Helpdesk.bpmn20.xml")
.addClasspathResource("org/activiti/rest/demo/process/Helpdesk.png")
.addClasspathResource("org/activiti/rest/demo/process/reviewSalesLead.bpmn20.xml")
.deploy();
}
}
protected void initDemoModelData() {
createModelData("Demo model", "This is a demo model", "org/activiti/rest/demo/model/test.model.json");
}
protected void createModelData(String name, String description, String jsonFile) {
List<Model> modelList = repositoryService.createModelQuery().modelName("Demo model").list();
if (modelList == null || modelList.size() == 0) {
Model model = repositoryService.newModel();
model.setName(name);
ObjectNode modelObjectNode = new ObjectMapper().createObjectNode();
modelObjectNode.put(MODEL_NAME, name);
modelObjectNode.put(MODEL_DESCRIPTION, description);
model.setMetaInfo(modelObjectNode.toString());
repositoryService.saveModel(model);
try {
InputStream svgStream = this.getClass().getClassLoader().getResourceAsStream("org/activiti/rest/demo/model/test.svg");
repositoryService.addModelEditorSourceExtra(model.getId(), IOUtils.toByteArray(svgStream));
} catch(Exception e) {
LOGGER.warn("Failed to read SVG", e);
}
try {
InputStream editorJsonStream = this.getClass().getClassLoader().getResourceAsStream(jsonFile);
repositoryService.addModelEditorSource(model.getId(), IOUtils.toByteArray(editorJsonStream));
} catch(Exception e) {
LOGGER.warn("Failed to read editor JSON", e);
}
}
}
protected void initDemoStandaloneTasks() {
List<User> users = identityService.createUserQuery().list();
......
......@@ -50,7 +50,8 @@ public class ProcessDefinitionResourceTest extends BaseRestTestCase {
// Check URL's
assertEquals(client.getRequest().getResourceRef().toString(), URLDecoder.decode(responseNode.get("url").getTextValue(),"UTF-8"));
assertTrue(responseNode.get("deployment").getTextValue().endsWith(RestUrls.createRelativeResourceUrl(RestUrls.URL_DEPLOYMENT, processDefinition.getDeploymentId())));
assertEquals(processDefinition.getDeploymentId(), responseNode.get("deploymentId").getTextValue());
assertTrue(responseNode.get("deploymentUrl").getTextValue().endsWith(RestUrls.createRelativeResourceUrl(RestUrls.URL_DEPLOYMENT, processDefinition.getDeploymentId())));
assertTrue(URLDecoder.decode(responseNode.get("resource").getTextValue(), "UTF-8").endsWith(RestUrls.createRelativeResourceUrl(
RestUrls.URL_DEPLOYMENT_RESOURCE, processDefinition.getDeploymentId(), processDefinition.getResourceName())));
assertTrue(responseNode.get("diagramResource").isNull());
......@@ -82,7 +83,8 @@ public class ProcessDefinitionResourceTest extends BaseRestTestCase {
// Check URL's
assertEquals(client.getRequest().getResourceRef().toString(), URLDecoder.decode(responseNode.get("url").getTextValue(),"UTF-8"));
assertTrue(responseNode.get("deployment").getTextValue().endsWith(RestUrls.createRelativeResourceUrl(RestUrls.URL_DEPLOYMENT, processDefinition.getDeploymentId())));
assertEquals(processDefinition.getDeploymentId(), responseNode.get("deploymentId").getTextValue());
assertTrue(responseNode.get("deploymentUrl").getTextValue().endsWith(RestUrls.createRelativeResourceUrl(RestUrls.URL_DEPLOYMENT, processDefinition.getDeploymentId())));
assertTrue(URLDecoder.decode(responseNode.get("resource").getTextValue(), "UTF-8").endsWith(RestUrls.createRelativeResourceUrl(
RestUrls.URL_DEPLOYMENT_RESOURCE, processDefinition.getDeploymentId(), processDefinition.getResourceName())));
assertTrue(URLDecoder.decode(responseNode.get("diagramResource").getTextValue(), "UTF-8").endsWith(RestUrls.createRelativeResourceUrl(
......
......@@ -10,6 +10,8 @@ http://www.springframework.org/schema/tx http://www.springframework.org/schema/t
init-method="init">
<property name="processEngine" ref="processEngine" />
<property name="createDemoUsersAndGroups" value="true" />
<property name="createDemoProcessDefinitions" value="true" />
<property name="createDemoModels" value="true" />
</bean>
<bean id="dbProperties"
......
{ "bounds" : { "lowerRight" : { "x" : 1485,
"y" : 1050
},
"upperLeft" : { "x" : 0,
"y" : 0
}
},
"childShapes" : [ { "bounds" : { "lowerRight" : { "x" : 169.5,
"y" : 160
},
"upperLeft" : { "x" : 139.5,
"y" : 130
}
},
"childShapes" : [ ],
"dockers" : [ ],
"outgoing" : [ { "resourceId" : "sid-974EF4BD-0E76-4983-B84D-FA92053B98DC" } ],
"properties" : { "bgcolor" : "#ffffff",
"bordercolor" : "#000000",
"dataoutput" : "",
"dataoutputassociations" : "",
"documentation" : "",
"executionlisteners" : "",
"formproperties" : "",
"initiator" : "",
"name" : "",
"outputset" : "",
"processid" : "",
"trigger" : "None"
},
"resourceId" : "sid-2BB933AE-E0AE-48D2-9ACC-B5EC35AD3687",
"stencil" : { "id" : "StartNoneEvent" }
},
{ "bounds" : { "lowerRight" : { "x" : 325,
"y" : 185
},
"upperLeft" : { "x" : 225,
"y" : 105
}
},
"childShapes" : [ ],
"dockers" : [ ],
"outgoing" : [ { "resourceId" : "sid-AFFB5C18-4C31-469B-919B-A08BE34542EA" } ],
"properties" : { "asynchronousdefinition" : "No",
"bgcolor" : "#ffffcc",
"bordercolor" : "#000000",
"callacitivity" : "",
"completioncondition" : "",
"documentation" : "",
"duedatedefinition" : "",
"exclusivedefinition" : "Yes",
"executionlisteners" : "",
"formkeydefinition" : "",
"formproperties" : { "items" : [ { "formproperty_id" : "number",
"formproperty_name" : "Number",
"formproperty_type" : "long"
},
{ "formproperty_id" : "message",
"formproperty_name" : "Message",
"formproperty_type" : "string"
}
],
"totalCount" : 2
},
"inputdataitem" : "",
"isforcompensation" : "",
"loopcardinality" : "",
"loopcondition" : "",
"loopmaximum" : "",
"looptype" : "None",
"name" : "user task 1",
"prioritydefinition" : "",
"processid" : "",
"properties" : "",
"tasklisteners" : "",
"usertaskassignment" : { "items" : [ { "assignment_type" : "assignee",
"resourceassignmentexpr" : "kermit"
} ],
"totalCount" : 1
}
},
"resourceId" : "sid-AFE2BB40-CF6F-4947-9DF9-2F1F80E34C43",
"stencil" : { "id" : "UserTask" }
},
{ "bounds" : { "lowerRight" : { "x" : 224.10546875,
"y" : 145
},
"upperLeft" : { "x" : 169.62109375,
"y" : 145
}
},
"childShapes" : [ ],
"dockers" : [ { "x" : 15,
"y" : 15
},
{ "x" : 50,
"y" : 40
}
],
"outgoing" : [ { "resourceId" : "sid-AFE2BB40-CF6F-4947-9DF9-2F1F80E34C43" } ],
"properties" : { "bordercolor" : "#000000",
"conditionalflow" : "None",
"conditionexpression" : "",
"conditionsequenceflow" : "",
"conditiontype" : "None",
"defaultflow" : "None",
"documentation" : "",
"isimmediate" : "",
"name" : "",
"showdiamondmarker" : ""
},
"resourceId" : "sid-974EF4BD-0E76-4983-B84D-FA92053B98DC",
"stencil" : { "id" : "SequenceFlow" },
"target" : { "resourceId" : "sid-AFE2BB40-CF6F-4947-9DF9-2F1F80E34C43" }
},
{ "bounds" : { "lowerRight" : { "x" : 430,
"y" : 165
},
"upperLeft" : { "x" : 390,
"y" : 125
}
},
"childShapes" : [ ],
"dockers" : [ ],
"outgoing" : [ { "resourceId" : "sid-07A7E174-8857-4DE9-A7CD-A041706D79C3" },
{ "resourceId" : "sid-C2068B1E-9A82-41C9-B876-C58E2736C186" }
],
"properties" : { "documentation" : "",
"name" : ""
},
"resourceId" : "sid-B074A0DD-934A-4053-A537-20ADF0781023",
"stencil" : { "id" : "ExclusiveGateway" }
},
{ "bounds" : { "lowerRight" : { "x" : 389.3867255581166,
"y" : 145.42209123822184
},
"upperLeft" : { "x" : 325.7538994418834,
"y" : 145.18728376177816
}
},
"childShapes" : [ ],
"dockers" : [ { "x" : 50,
"y" : 40
},
{ "x" : 20.5,
"y" : 20.5
}
],
"outgoing" : [ { "resourceId" : "sid-B074A0DD-934A-4053-A537-20ADF0781023" } ],
"properties" : { "bordercolor" : "#000000",
"conditionalflow" : "None",
"conditionexpression" : "",
"conditionsequenceflow" : "",
"conditiontype" : "None",
"defaultflow" : "None",
"documentation" : "",
"isimmediate" : "",
"name" : "",
"showdiamondmarker" : false
},
"resourceId" : "sid-AFFB5C18-4C31-469B-919B-A08BE34542EA",
"stencil" : { "id" : "SequenceFlow" },
"target" : { "resourceId" : "sid-B074A0DD-934A-4053-A537-20ADF0781023" }
},
{ "bounds" : { "lowerRight" : { "x" : 575,
"y" : 110
},
"upperLeft" : { "x" : 475,
"y" : 30
}
},
"childShapes" : [ ],
"dockers" : [ ],
"outgoing" : [ { "resourceId" : "sid-5DC9E5BB-634D-43BE-BE09-2A4D1A77AB3B" } ],
"properties" : { "asynchronousdefinition" : "No",
"documentation" : "",
"duedatedefinition" : "",
"exclusivedefinition" : "Yes",
"executionlisteners" : "",
"formkeydefinition" : "",
"formproperties" : "",
"isforcompensation" : "false",
"looptype" : "None",
"name" : "User task 2",
"prioritydefinition" : "",
"tasklisteners" : "",
"usertaskassignment" : { "items" : [ { "assignment_type" : "assignee",
"resourceassignmentexpr" : "kermit"
} ],
"totalCount" : 1
}
},
"resourceId" : "sid-03BC7128-4496-4027-88A9-E67D3DA63734",
"stencil" : { "id" : "UserTask" }
},
{ "bounds" : { "lowerRight" : { "x" : 575,
"y" : 260
},
"upperLeft" : { "x" : 475,
"y" : 180
}
},
"childShapes" : [ ],
"dockers" : [ ],
"outgoing" : [ { "resourceId" : "sid-CBE1C51A-408E-4383-9D42-713450DD89BE" } ],
"properties" : { "asynchronousdefinition" : "No",
"documentation" : "",
"duedatedefinition" : "",
"exclusivedefinition" : "Yes",
"executionlisteners" : "",
"formkeydefinition" : "",
"formproperties" : "",
"isforcompensation" : "false",
"looptype" : "None",
"name" : "User task 3",
"prioritydefinition" : "",
"tasklisteners" : "",
"usertaskassignment" : { "items" : [ { "assignment_type" : "assignee",
"resourceassignmentexpr" : "kermit"
} ],
"totalCount" : 1
}
},
"resourceId" : "sid-7581049C-894E-4FF9-B861-7DF44B7229E3",
"stencil" : { "id" : "UserTask" }
},
{ "bounds" : { "lowerRight" : { "x" : 670,
"y" : 165
},
"upperLeft" : { "x" : 630,
"y" : 125
}
},
"childShapes" : [ ],
"dockers" : [ ],
"outgoing" : [ { "resourceId" : "sid-7A6FDAE1-C837-4148-AE9E-E36F9BD55C27" } ],
"properties" : { "documentation" : "",
"name" : ""
},
"resourceId" : "sid-6151821D-C3F9-4DFB-82EE-43885200535F",
"stencil" : { "id" : "ExclusiveGateway" }
},
{ "bounds" : { "lowerRight" : { "x" : 650.5,
"y" : 220
},
"upperLeft" : { "x" : 575.0234375,
"y" : 165.125
}
},
"childShapes" : [ ],
"dockers" : [ { "x" : 50,
"y" : 40
},
{ "x" : 650.5,
"y" : 220
},
{ "x" : 20.5,
"y" : 20.5
}
],
"outgoing" : [ { "resourceId" : "sid-6151821D-C3F9-4DFB-82EE-43885200535F" } ],
"properties" : { "conditionalflow" : "None",
"conditionsequenceflow" : "",
"defaultflow" : "None",
"documentation" : "",
"name" : ""
},
"resourceId" : "sid-CBE1C51A-408E-4383-9D42-713450DD89BE",
"stencil" : { "id" : "SequenceFlow" },
"target" : { "resourceId" : "sid-6151821D-C3F9-4DFB-82EE-43885200535F" }
},
{ "bounds" : { "lowerRight" : { "x" : 650,
"y" : 125.25
},
"upperLeft" : { "x" : 575.8046875,
"y" : 70
}
},
"childShapes" : [ ],
"dockers" : [ { "x" : 50,
"y" : 40
},
{ "x" : 650,
"y" : 70
},
{ "x" : 20,
"y" : 20
}
],
"outgoing" : [ { "resourceId" : "sid-6151821D-C3F9-4DFB-82EE-43885200535F" } ],
"properties" : { "conditionalflow" : "None",
"conditionsequenceflow" : "",
"defaultflow" : "None",
"documentation" : "",
"name" : ""
},
"resourceId" : "sid-5DC9E5BB-634D-43BE-BE09-2A4D1A77AB3B",
"stencil" : { "id" : "SequenceFlow" },
"target" : { "resourceId" : "sid-6151821D-C3F9-4DFB-82EE-43885200535F" }
},
{ "bounds" : { "lowerRight" : { "x" : 765,
"y" : 160
},
"upperLeft" : { "x" : 735,
"y" : 130
}
},
"childShapes" : [ ],
"dockers" : [ { "x" : 750,
"y" : 145
} ],
"outgoing" : [ { "resourceId" : "sid-104B63DD-B61E-4D47-B65F-95A1B77AB041" } ],
"properties" : { "documentation" : "",
"executionlisteners" : "",
"name" : "",
"timercycledefinition" : "",
"timerdatedefinition" : "",
"timerdurationdefinition" : "PT5M"
},
"resourceId" : "sid-C102D215-8257-40B4-AEE6-99B223204F7B",
"stencil" : { "id" : "CatchTimerEvent" }
},
{ "bounds" : { "lowerRight" : { "x" : 734.2304813757047,
"y" : 145.4012249378176
},
"upperLeft" : { "x" : 670.1562373742953,
"y" : 145.0792438121824
}
},
"childShapes" : [ ],
"dockers" : [ { "x" : 20.5,
"y" : 20.5
},
{ "x" : 15,
"y" : 15
}
],
"outgoing" : [ { "resourceId" : "sid-C102D215-8257-40B4-AEE6-99B223204F7B" } ],
"properties" : { "conditionalflow" : "None",
"conditionsequenceflow" : "",
"defaultflow" : "None",
"documentation" : "",
"name" : ""
},
"resourceId" : "sid-7A6FDAE1-C837-4148-AE9E-E36F9BD55C27",
"stencil" : { "id" : "SequenceFlow" },
"target" : { "resourceId" : "sid-C102D215-8257-40B4-AEE6-99B223204F7B" }
},
{ "bounds" : { "lowerRight" : { "x" : 838,
"y" : 159
},
"upperLeft" : { "x" : 810,
"y" : 131
}
},
"childShapes" : [ ],
"dockers" : [ ],
"outgoing" : [ ],
"properties" : { "documentation" : "",
"executionlisteners" : "",
"name" : ""
},
"resourceId" : "sid-65043A85-6BAD-4616-AD1E-FF3FA8D64D4B",
"stencil" : { "id" : "EndNoneEvent" }
},
{ "bounds" : { "lowerRight" : { "x" : 809.125,
"y" : 145
},
"upperLeft" : { "x" : 765.453125,
"y" : 145
}
},
"childShapes" : [ ],
"dockers" : [ { "x" : 15,
"y" : 15
},
{ "x" : 14,
"y" : 14
}
],
"outgoing" : [ { "resourceId" : "sid-65043A85-6BAD-4616-AD1E-FF3FA8D64D4B" } ],
"properties" : { "conditionalflow" : "None",
"conditionsequenceflow" : "",
"defaultflow" : "None",
"documentation" : "",
"name" : ""
},
"resourceId" : "sid-104B63DD-B61E-4D47-B65F-95A1B77AB041",
"stencil" : { "id" : "SequenceFlow" },
"target" : { "resourceId" : "sid-65043A85-6BAD-4616-AD1E-FF3FA8D64D4B" }
},
{ "bounds" : { "lowerRight" : { "x" : 474.80078125,
"y" : 124.4453125
},
"upperLeft" : { "x" : 410.5,
"y" : 70
}
},
"childShapes" : [ ],
"dockers" : [ { "x" : 20.5,
"y" : 20.5
},
{ "x" : 410.5,
"y" : 70
},
{ "x" : 50,
"y" : 40
}
],
"outgoing" : [ { "resourceId" : "sid-03BC7128-4496-4027-88A9-E67D3DA63734" } ],
"properties" : { "conditionalflow" : "None",
"conditionsequenceflow" : "${number > 1}",
"defaultflow" : "None",
"documentation" : "",
"name" : ""
},
"resourceId" : "sid-07A7E174-8857-4DE9-A7CD-A041706D79C3",
"stencil" : { "id" : "SequenceFlow" },
"target" : { "resourceId" : "sid-03BC7128-4496-4027-88A9-E67D3DA63734" }
},
{ "bounds" : { "lowerRight" : { "x" : 474.80078125,
"y" : 220
},
"upperLeft" : { "x" : 410.5,
"y" : 165.125
}
},
"childShapes" : [ ],
"dockers" : [ { "x" : 20.5,
"y" : 20.5
},
{ "x" : 410.5,
"y" : 220
},
{ "x" : 50,
"y" : 40
}
],
"outgoing" : [ { "resourceId" : "sid-7581049C-894E-4FF9-B861-7DF44B7229E3" } ],
"properties" : { "conditionalflow" : "None",
"conditionsequenceflow" : "${number <= 1}",
"defaultflow" : "None",
"documentation" : "",
"name" : ""
},
"resourceId" : "sid-C2068B1E-9A82-41C9-B876-C58E2736C186",
"stencil" : { "id" : "SequenceFlow" },
"target" : { "resourceId" : "sid-7581049C-894E-4FF9-B861-7DF44B7229E3" }
}
],
"properties" : { "author" : "",
"creationdate" : "",
"documentation" : "",
"executionlisteners" : "",
"expressionlanguage" : "http://www.w3.org/1999/XPath",
"modificationdate" : "",
"name" : "",
"orientation" : "horizontal",
"process_author" : "",
"process_id" : "process",
"process_namespace" : "http://www.activiti.org/processdef",
"process_version" : "",
"targetnamespace" : "http://www.activiti.org/processdef",
"typelanguage" : "http://www.w3.org/2001/XMLSchema",
"version" : ""
},
"resourceId" : "canvas",
"ssextensions" : [ ],
"stencil" : { "id" : "BPMNDiagram" },
"stencilset" : { "namespace" : "http://b3mn.org/stencilset/bpmn2.0#",
"url" : "../stencilsets/bpmn2.0/bpmn2.0.json"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti="http://activiti.org/bpmn"
targetNamespace="Examples">
<process id="fixSystemFailure" name="Fix system failure">
<startEvent id="theStart" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="subProcess" />
<subProcess id="subProcess">
<startEvent id="subProcessStart" />
<sequenceFlow id="flow2" sourceRef="subProcessStart" targetRef="subProcessFork" />
<parallelGateway id="subProcessFork" />
<sequenceFlow id="flow3" sourceRef="subProcessFork" targetRef="task1" />
<sequenceFlow id="flow4" sourceRef="subProcessFork" targetRef="task2" />
<userTask id="task1" name="Investigate hardware" activiti:candidateGroups="engineering" />
<sequenceFlow id="flow5" sourceRef="task1" targetRef="subProcessJoin" />
<userTask id="task2" name="Investigate software" activiti:candidateGroups="engineering" />
<sequenceFlow id="flow6" sourceRef="task2" targetRef="subProcessJoin" />
<parallelGateway id="subProcessJoin" />
<sequenceFlow id="flow7" sourceRef="subProcessJoin" targetRef="subProcessEnd" />
<endEvent id="subProcessEnd" />
</subProcess>
<!-- Timer on subprocess -->
<boundaryEvent id="timer" attachedToRef="subProcess">
<timerEventDefinition>
<timeDuration>PT4H</timeDuration>
</timerEventDefinition>
</boundaryEvent>
<sequenceFlow id="flow8" sourceRef="timer" targetRef="taskAfterTimer" />
<userTask id="taskAfterTimer" name="Hand over to Level 2 support" activiti:candidateGroups="management" />
<sequenceFlow id="flow9" sourceRef="taskAfterTimer" targetRef="theEnd1" />
<endEvent id="theEnd1" />
<sequenceFlow id="flow10" sourceRef="subProcess" targetRef="taskAfterSubProcess" />
<userTask id="taskAfterSubProcess" name="Write report" activiti:candidateGroups="engineering" />
<sequenceFlow id="flow11" sourceRef="taskAfterSubProcess" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
</definitions>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti="http://activiti.org/bpmn"
targetNamespace="Examples">
<process id="escalationExample" name="Helpdesk process">
<startEvent id="theStart" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="firstLineSupport" />
<userTask id="firstLineSupport" name="First line support" activiti:assignee="kermit">
<documentation>Fix issue raised by customer</documentation>
</userTask>
<sequenceFlow id="flow2" sourceRef="firstLineSupport" targetRef="normalEnd" />
<endEvent id="normalEnd" />
<boundaryEvent id="escalationTimer" cancelActivity="true" attachedToRef="firstLineSupport">
<timerEventDefinition>
<timeDuration>PT5M</timeDuration>
</timerEventDefinition>
</boundaryEvent>
<sequenceFlow id="flow3" sourceRef="escalationTimer" targetRef="handleEscalation" />
<userTask id="handleEscalation" name="Handle escalated issue" activiti:candidateGroups="management">
<documentation>Escalation: issue was not fixed in time by first level support</documentation>
</userTask>
<sequenceFlow id="flow4" sourceRef="handleEscalation" targetRef="escalatedEnd" />
<endEvent id="escalatedEnd" />
</process>
</definitions>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<definitions id="definitions"
targetNamespace="http://activiti.org/bpmn20"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti="http://activiti.org/bpmn">
<process id="vacationRequest" name="Vacation request">
<startEvent id="request" activiti:initiator="employeeName">
<extensionElements>
<activiti:formProperty id="numberOfDays" name="Number of days" type="long" value="1" required="true"/>
<activiti:formProperty id="startDate" name="First day of holiday (dd-MM-yyy)" datePattern="dd-MM-yyyy hh:mm" type="date" required="true" />
<activiti:formProperty id="vacationMotivation" name="Motivation" type="string" />
</extensionElements>
</startEvent>
<sequenceFlow id="flow1" sourceRef="request" targetRef="handleRequest" />
<userTask id="handleRequest" name="Handle vacation request" >
<documentation>
${employeeName} would like to take ${numberOfDays} day(s) of vacation (Motivation: ${vacationMotivation}).
</documentation>
<extensionElements>
<activiti:formProperty id="vacationApproved" name="Do you approve this vacation" type="enum" required="true">
<activiti:value id="true" name="Approve" />
<activiti:value id="false" name="Reject" />
</activiti:formProperty>
<activiti:formProperty id="managerMotivation" name="Motivation" type="string" />
</extensionElements>
<potentialOwner>
<resourceAssignmentExpression>
<formalExpression>management</formalExpression>
</resourceAssignmentExpression>
</potentialOwner>
</userTask>
<sequenceFlow id="flow2" sourceRef="handleRequest" targetRef="requestApprovedDecision" />
<exclusiveGateway id="requestApprovedDecision" name="Request approved?" />
<sequenceFlow id="flow3" sourceRef="requestApprovedDecision" targetRef="sendApprovalMail">
<conditionExpression xsi:type="tFormalExpression">${vacationApproved == 'true'}</conditionExpression>
</sequenceFlow>
<task id="sendApprovalMail" name="Send confirmation e-mail" />
<sequenceFlow id="flow4" sourceRef="sendApprovalMail" targetRef="theEnd1" />
<endEvent id="theEnd1" />
<sequenceFlow id="flow5" sourceRef="requestApprovedDecision" targetRef="adjustVacationRequestTask">
<conditionExpression xsi:type="tFormalExpression">${vacationApproved == 'false'}</conditionExpression>
</sequenceFlow>
<userTask id="adjustVacationRequestTask" name="Adjust vacation request">
<documentation>
Your manager has disapproved your vacation request for ${numberOfDays} days.
Reason: ${managerMotivation}
</documentation>
<extensionElements>
<activiti:formProperty id="numberOfDays" name="Number of days" value="${numberOfDays}" type="long" required="true"/>
<activiti:formProperty id="startDate" name="First day of holiday (dd-MM-yyy)" value="${startDate}" datePattern="dd-MM-yyyy hh:mm" type="date" required="true" />
<activiti:formProperty id="vacationMotivation" name="Motivation" value="${vacationMotivation}" type="string" />
<activiti:formProperty id="resendRequest" name="Resend vacation request to manager?" type="enum" required="true">
<activiti:value id="true" name="Yes" />
<activiti:value id="false" name="No" />
</activiti:formProperty>
</extensionElements>
<humanPerformer>
<resourceAssignmentExpression>
<formalExpression>${employeeName}</formalExpression>
</resourceAssignmentExpression>
</humanPerformer>
</userTask>
<sequenceFlow id="flow6" sourceRef="adjustVacationRequestTask" targetRef="resendRequestDecision" />
<exclusiveGateway id="resendRequestDecision" name="Resend request?" />
<sequenceFlow id="flow7" sourceRef="resendRequestDecision" targetRef="handleRequest">
<conditionExpression xsi:type="tFormalExpression">${resendRequest == 'true'}</conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow8" sourceRef="resendRequestDecision" targetRef="theEnd2">
<conditionExpression xsi:type="tFormalExpression">${resendRequest == 'false'}</conditionExpression>
</sequenceFlow>
<endEvent id="theEnd2" />
</process>
</definitions>
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
targetNamespace="Examples">
<process id="createTimersProcess" name="Create timers process">
<documentation>Test process to create a number of timers.</documentation>
<startEvent id="theStart">
<extensionElements>
<activiti:formProperty id="throwException" name="Throw exception when executing timer"
type="enum" required="true">
<activiti:value id="true" name="Yes, please" />
<activiti:value id="false" name="No thanks" />
</activiti:formProperty>
<activiti:formProperty id="duration" name="Timer duration" type="enum" required="true">
<activiti:value id="long" name="One hour" />
<activiti:value id="short" name="10 seconds" />
</activiti:formProperty>
</extensionElements>
</startEvent>
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="exclusiveGw" />
<exclusiveGateway id="exclusiveGw" name="Exclusive Timer duration gateway" />
<sequenceFlow id="flow2" sourceRef="exclusiveGw" targetRef="longTimerTask">
<conditionExpression xsi:type="tFormalExpression">${duration == 'long'}</conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow3" sourceRef="exclusiveGw" targetRef="shortTimerTask">
<conditionExpression xsi:type="tFormalExpression">${duration == 'short'}</conditionExpression>
</sequenceFlow>
<userTask id="longTimerTask" name="Task with timer on it">
<documentation>This task has a timer on it</documentation>
</userTask>
<boundaryEvent id="longTimer" cancelActivity="true" attachedToRef="longTimerTask">
<timerEventDefinition>
<timeDuration>PT1H</timeDuration>
</timerEventDefinition>
</boundaryEvent>
<sequenceFlow id="flow4" sourceRef="longTimerTask" targetRef="theEnd" />
<sequenceFlow id="flow5" sourceRef="longTimer" targetRef="longTimerExpire" />
<scriptTask id="longTimerExpire" name="Execute script" scriptFormat="groovy">
<script>
if(throwException == 'true') {
throw new java.lang.RuntimeException('Activiti Engine Rocks!');
}
</script>
</scriptTask>
<sequenceFlow id="flow6" sourceRef="longTimerExpire" targetRef="theEnd" />
<userTask id="shortTimerTask" name="my task">
</userTask>
<boundaryEvent id="shortTimer" cancelActivity="true" attachedToRef="shortTimerTask">
<timerEventDefinition>
<timeDuration>PT10S</timeDuration>
</timerEventDefinition>
</boundaryEvent>
<sequenceFlow id="flow7" sourceRef="shortTimerTask" targetRef="theEnd" />
<sequenceFlow id="flow8" sourceRef="shortTimer" targetRef="shortTimerExpire" />
<scriptTask id="shortTimerExpire" name="Execute script" scriptFormat="js">
<script>
if(throwException == 'true') {
throw new java.lang.RuntimeException('Activiti Engine Rocks!');
}
</script>
</scriptTask>
<sequenceFlow id="flow9" sourceRef="shortTimerExpire" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
</definitions>
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti="http://activiti.org/bpmn"
targetNamespace="Examples">
<process id="oneTaskProcess" name="Famous One Task Process">
<startEvent id="theStart" activiti:initiator="initiator" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="theTask" />
<userTask id="theTask" name="my task" activiti:assignee="${initiator}" />
<sequenceFlow id="flow2" sourceRef="theTask" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
</definitions>
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti="http://activiti.org/bpmn"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
targetNamespace="Examples"
xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL http://www.omg.org/spec/BPMN/2.0/20100501/BPMN20.xsd">
<error id="notEnoughInfoError" errorCode="not_enough_info" />
<process id="reviewSaledLead" name="Review sales lead">
<startEvent id="theStart" activiti:initiator="initiator" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="provideNewSalesLead"/>
<userTask id="provideNewSalesLead" name="Provide new sales lead" activiti:assignee="${initiator}">
<extensionElements>
<activiti:formProperty id="customerName" name="Customer name" type="string" required="true"/>
<activiti:formProperty id="potentialProfit" name="Potential profit" type="long" />
<activiti:formProperty id="details" name="Details" type="string"/>
</extensionElements>
</userTask>
<sequenceFlow id="flow2" sourceRef="provideNewSalesLead" targetRef="reviewSalesLeadSubProcess"/>
<subProcess id="reviewSalesLeadSubProcess" name="Review sales lead">
<startEvent id="subProcessStart" />
<sequenceFlow id="flow3" sourceRef="subProcessStart" targetRef="fork"/>
<sequenceFlow id="flow4" sourceRef="fork" targetRef="reviewProfitability"/>
<parallelGateway id="fork" />
<sequenceFlow id="flow5" sourceRef="fork" targetRef="reviewCustomerRating"/>
<userTask id="reviewCustomerRating" name="Review customer rating" activiti:candidateGroups="accountancy" />
<sequenceFlow id="flow6" sourceRef="reviewCustomerRating" targetRef="subProcessEnd1"/>
<endEvent id="subProcessEnd1" />
<userTask id="reviewProfitability" name="Review profitability" activiti:candidateGroups="management">
<documentation>
${initiator} has published a new sales lead: ${customerName}. Details: ${details}
</documentation>
<extensionElements>
<activiti:formProperty id="notEnoughInformation" name="Do you believe this customer is profitable?" type="enum" required="true">
<activiti:value id="false" name="Yes" />
<activiti:value id="true" name="No (= request more info)" />
</activiti:formProperty>
</extensionElements>
</userTask>
<sequenceFlow id="flow7" sourceRef="reviewProfitability" targetRef="enoughInformationCheck"/>
<exclusiveGateway id="enoughInformationCheck" name="Enough information?" />
<sequenceFlow id="flow8" sourceRef="enoughInformationCheck" targetRef="notEnoughInformationEnd">
<conditionExpression>${notEnoughInformation == 'true'}</conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow9" sourceRef="enoughInformationCheck" targetRef="subProcessEnd2">
<conditionExpression>${notEnoughInformation == 'false'}</conditionExpression>
</sequenceFlow>
<endEvent id="subProcessEnd2" />
<endEvent id="notEnoughInformationEnd">
<errorEventDefinition errorRef="notEnoughInfoError" />
</endEvent>
</subProcess>
<sequenceFlow id="flow10" sourceRef="reviewSalesLeadSubProcess" targetRef="storeLeadInCrmSystem"/>
<boundaryEvent attachedToRef="reviewSalesLeadSubProcess" cancelActivity="true" id="catchNotEnoughInformationError" >
<errorEventDefinition errorRef="notEnoughInfoError" />
</boundaryEvent>
<sequenceFlow id="flow11" sourceRef="catchNotEnoughInformationError" targetRef="provideAdditionalDetails"/>
<userTask id="provideAdditionalDetails" name="Provide additional details" activiti:assignee="${initiator}">
<documentation>Provide additional details for ${customerName}.</documentation>
<extensionElements>
<activiti:formProperty id="details" name="Additional details" type="string" required="true"/>
</extensionElements>
</userTask>
<sequenceFlow id="flow12" sourceRef="provideAdditionalDetails" targetRef="reviewSalesLeadSubProcess"/>
<task id="storeLeadInCrmSystem" name="Store lead in CRM system" />
<sequenceFlow id="flow13" sourceRef="storeLeadInCrmSystem" targetRef="processEnd"/>
<endEvent id="processEnd" />
</process>
<bpmndi:BPMNDiagram id="sid-628a8d2c-0009-4da0-9c2a-412cf76015a8">
<bpmndi:BPMNPlane bpmnElement="reviewSaledLead" id="sid-5cb2f8c3-3889-4a12-8a5b-b8f90551695e">
<bpmndi:BPMNShape bpmnElement="theStart" id="theStart_gui">
<omgdc:Bounds height="30.0" width="30.0" x="75.0" y="300.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="provideNewSalesLead" id="provideNewSalesLead_gui">
<omgdc:Bounds height="80.0" width="100.0" x="165.0" y="275.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="reviewSalesLeadSubProcess" id="reviewSalesLeadSubProcess_gui" isExpanded="true">
<omgdc:Bounds height="320.0" width="544.0" x="315.0" y="160.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="subProcessStart" id="subProcessStart_gui">
<omgdc:Bounds height="30.0" width="30.0" x="360.0" y="300.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="fork" id="fork_gui">
<omgdc:Bounds height="40.0" width="40.0" x="435.0" y="295.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="reviewCustomerRating" id="reviewCustomerRating_gui">
<omgdc:Bounds height="80.0" width="100.0" x="517.0" y="210.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="subProcessEnd1" id="subProcessEnd1_gui">
<omgdc:Bounds height="28.0" width="28.0" x="670.0" y="236.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="reviewProfitability" id="reviewProfitability_gui">
<omgdc:Bounds height="80.0" width="100.0" x="517.0" y="360.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="enoughInformationCheck" id="enoughInformationCheck_gui" isMarkerVisible="true">
<omgdc:Bounds height="40.0" width="40.0" x="664.0" y="380.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="subProcessEnd2" id="subProcessEnd2_gui">
<omgdc:Bounds height="28.0" width="28.0" x="765.0" y="386.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="notEnoughInformationEnd" id="notEnoughInformationEnd_gui">
<omgdc:Bounds height="28.0" width="28.0" x="765.0" y="345.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="provideAdditionalDetails" id="provideAdditionalDetails_gui">
<omgdc:Bounds height="80.0" width="100.0" x="660.0" y="525.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="catchNotEnoughInformationError" id="catchNotEnoughInformationError_gui">
<omgdc:Bounds height="30.0" width="30.0" x="783.8620689660311" y="465.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="storeLeadInCrmSystem" id="storeLeadInCrmSystem_gui">
<omgdc:Bounds height="80.0" width="100.0" x="910.0" y="275.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="processEnd" id="processEnd_gui">
<omgdc:Bounds height="28.0" width="28.0" x="1050.0" y="301.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow12" id="flow12_gui">
<omgdi:waypoint x="660.0" y="565.0"/>
<omgdi:waypoint x="587.0" y="565.0"/>
<omgdi:waypoint x="587.0" y="480.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow9" id="flow9_gui">
<omgdi:waypoint x="704.0" y="400.0"/>
<omgdi:waypoint x="765.0" y="400.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow7" id="flow7_gui">
<omgdi:waypoint x="617.0" y="400.0"/>
<omgdi:waypoint x="664.0" y="400.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow8" id="flow8_gui">
<omgdi:waypoint x="684.0" y="380.0"/>
<omgdi:waypoint x="684.5" y="359.0"/>
<omgdi:waypoint x="765.0" y="359.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow3" id="flow3_gui">
<omgdi:waypoint x="390.0" y="315.0"/>
<omgdi:waypoint x="435.0" y="315.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow4" id="flow4_gui">
<omgdi:waypoint x="455.0" y="335.0"/>
<omgdi:waypoint x="455.5" y="400.0"/>
<omgdi:waypoint x="517.0" y="400.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow6" id="flow6_gui">
<omgdi:waypoint x="617.0" y="250.0"/>
<omgdi:waypoint x="670.0" y="250.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow1" id="flow1_gui">
<omgdi:waypoint x="105.0" y="315.0"/>
<omgdi:waypoint x="165.0" y="315.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow10" id="flow10_gui">
<omgdi:waypoint x="859.0" y="317.0"/>
<omgdi:waypoint x="910.0" y="315.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow11" id="flow11_gui">
<omgdi:waypoint x="798.0" y="495.0"/>
<omgdi:waypoint x="798.8620689660311" y="565.0"/>
<omgdi:waypoint x="760.0" y="565.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="flow2_gui">
<omgdi:waypoint x="265.0" y="315.0"/>
<omgdi:waypoint x="290.0" y="315.0"/>
<omgdi:waypoint x="315.0" y="316.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow13" id="flow13_gui">
<omgdi:waypoint x="1010.0" y="315.0"/>
<omgdi:waypoint x="1050.0" y="315.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow5" id="flow5_gui">
<omgdi:waypoint x="455.0" y="295.0"/>
<omgdi:waypoint x="455.5" y="250.0"/>
<omgdi:waypoint x="517.0" y="250.0"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
......@@ -9,10 +9,10 @@
<section>
<title>Installation and Authentication</title>
<para>Activiti includes a REST API to the Activiti Engine that can be installed by deploying the activiti-rest.war file to a servlet container like Apache Tomcat. By default the Activiti Engine will connect to a standalone H2 database. You can change the database settings in the db.properties file in the WEB-INF/classes folder. The REST API uses JSON format (http://www.json.org) and is built upon the Restlet (http://www.restlet.org).</para>
<para>Activiti includes a REST API to the Activiti Engine that can be installed by deploying the activiti-rest.war file to a servlet container like Apache Tomcat. By default the Activiti Engine will connect to an in-memory H2 database. You can change the database settings in the db.properties file in the WEB-INF/classes folder. The REST API uses JSON format (http://www.json.org) and is built upon the Restlet (http://www.restlet.org).</para>
<para>All REST-resources (except for the Login-resource) require a valid Activiti-user to be authenticated. Basic HTTP access authentication is used, so you should always include a <literal>Authorization: Basic ...==</literal> HTTP-header when performing requests or include the username and password in the request-url (eg. <literal>http://username:password@localhost...</literal>).
</para>
<para><emphasis role="bold">It's recommended to use Basic in combination with HTTPS.</emphasis></para>
<para><emphasis role="bold">It's recommended to use Basic Authentication in combination with HTTPS.</emphasis></para>
</section>
<section>
......@@ -202,6 +202,46 @@
</table>
</para>
</section>
<section id="restPagingAndSort">
<title>Paging and sorting</title>
<para>
Paging and order parameters can be added as query-string in the URL (eg. the name parameter used in <literal>http://host/activiti-rest/service/deployments?sort=name&start=3&size=10&order=desc</literal>).
<table>
<title>Variable query JSON parameters</title>
<tgroup cols="2">
<thead>
<row>
<entry>Parameter</entry>
<entry>Default value</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>sort</entry>
<entry>different per query implementation</entry>
<entry>Name of the sort key, for which the default value and the allowed values are different per query implementation.</entry>
</row>
<row>
<entry>order</entry>
<entry>asc</entry>
<entry>Sorting order which can be 'asc' or 'desc'.</entry>
</row>
<row>
<entry>start</entry>
<entry>0</entry>
<entry>Parameter to allow for paging of the result. By default the result will start at 0.</entry>
</row>
<row>
<entry>size</entry>
<entry>10</entry>
<entry>Parameter to allow for paging of the result. By default the size will be 10.</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</section>
<section id="restQueryVariable">
<title>JSON query variable format</title>
......@@ -1068,7 +1108,8 @@
"suspended" : false,
"name" : "The One Task Process",
"description" : "This is a process for testing purposes",
"deployment" : "http://localhost:8081/repository/deployments/2",
"deploymentId" : "2",
"deploymentUrl" : "http://localhost:8081/repository/deployments/2",
"graphicalNotationDefined" : true,
"resource" : "http://localhost:8182/repository/deployments/2/resources/testProcess.xml",
"diagramResource" : "http://localhost:8182/repository/deployments/2/resources/testProcess.png",
......@@ -1157,7 +1198,8 @@
"suspended" : false,
"name" : "The One Task Process",
"description" : "This is a process for testing purposes",
"deployment" : "http://localhost:8081/repository/deployments/2",
"deploymentId" : "2",
"deploymentUrl" : "http://localhost:8081/repository/deployments/2",
"graphicalNotationDefined" : true,
"resource" : "http://localhost:8182/repository/deployments/2/resources/testProcess.xml",
"diagramResource" : "http://localhost:8182/repository/deployments/2/resources/testProcess.png",
......@@ -2681,7 +2723,7 @@
<section id="restProcessinstancesGet">
<title>List of process instances</title>
<para>
<programlisting>GET repository/process-instances</programlisting>
<programlisting>GET runtime/process-instances</programlisting>
</para>
<para>
<table>
......@@ -2742,7 +2784,13 @@
<entry>subProcessInstanceId</entry>
<entry>No</entry>
<entry>String</entry>
<entry>Only return process instances which have the given sub process-instance id (for processes started as a call-activity).</entry>
<entry>Only return process instances which have the given sub process-instance id (for processes started as a call-activity).</entry>
</row>
<row>
<entry>includeProcessVariables</entry>
<entry>No</entry>
<entry>Boolean</entry>
<entry>Indication to include process variables in the result.</entry>
</row>
<row>
<entry>sort</entry>
......@@ -3605,7 +3653,7 @@ Note that only <literal>local</literal> scoped variables are returned, as there
<section>
<title>Get an execution</title>
<para>
<programlisting>GET runtime/executions/{exeuctionId}</programlisting>
<programlisting>GET runtime/executions/{executionId}</programlisting>
</para>
<para>
<table>
......@@ -3621,7 +3669,7 @@ Note that only <literal>local</literal> scoped variables are returned, as there
</thead>
<tbody>
<row>
<entry>exeuctionId</entry>
<entry>executionId</entry>
<entry>Yes</entry>
<entry>String</entry>
<entry>The id of the execution to get.</entry>
......@@ -3659,7 +3707,9 @@ Note that only <literal>local</literal> scoped variables are returned, as there
{
"id":"5",
"url":"http://localhost:8182/runtime/executions/5",
"parentId":null,
"parentUrl":null,
"processInstanceId":"5",
"processInstanceUrl":"http://localhost:8182/runtime/process-instances/5",
"suspended":false,
"activityId":null
......@@ -3669,7 +3719,7 @@ Note that only <literal>local</literal> scoped variables are returned, as there
<section>
<title>Execute an action on an execution</title>
<para>
<programlisting>PUT runtime/executions/{exeuctionId}</programlisting>
<programlisting>PUT runtime/executions/{executionId}</programlisting>
</para>
<para>
<table>
......@@ -3685,7 +3735,7 @@ Note that only <literal>local</literal> scoped variables are returned, as there
</thead>
<tbody>
<row>
<entry>exeuctionId</entry>
<entry>executionId</entry>
<entry>Yes</entry>
<entry>String</entry>
<entry>The id of the execution to execute action on.</entry>
......@@ -3758,7 +3808,9 @@ Note that only <literal>local</literal> scoped variables are returned, as there
{
"id":"5",
"url":"http://localhost:8182/runtime/executions/5",
"parentId":null,
"parentUrl":null,
"processInstanceId":"5",
"processInstanceUrl":"http://localhost:8182/runtime/process-instances/5",
"suspended":false,
"activityId":null
......@@ -3769,7 +3821,7 @@ Note that only <literal>local</literal> scoped variables are returned, as there
<section>
<title>Get active activities in an execution</title>
<para>
<programlisting>GET runtime/executions/{exeuctionId}/activities</programlisting>
<programlisting>GET runtime/executions/{executionId}/activities</programlisting>
</para>
<para>
Returns all activities which are active in the execution and in all child-executions (and their children, recursively), if any.
......@@ -3788,7 +3840,7 @@ Note that only <literal>local</literal> scoped variables are returned, as there
</thead>
<tbody>
<row>
<entry>exeuctionId</entry>
<entry>executionId</entry>
<entry>Yes</entry>
<entry>String</entry>
<entry>The id of the execution to get activities for.</entry>
......@@ -3934,7 +3986,9 @@ Note that only <literal>local</literal> scoped variables are returned, as there
{
"id":"5",
"url":"http://localhost:8182/runtime/executions/5",
"parentId":null,
"parentUrl":null,
"processInstanceId":"5",
"processInstanceUrl":"http://localhost:8182/runtime/process-instances/5",
"suspended":false,
"activityId":null
......@@ -3942,7 +3996,9 @@ Note that only <literal>local</literal> scoped variables are returned, as there
{
"id":"7",
"url":"http://localhost:8182/runtime/executions/7",
"parentId":"5",
"parentUrl":"http://localhost:8182/runtime/executions/5",
"processInstanceId":"5",
"processInstanceUrl":"http://localhost:8182/runtime/process-instances/5",
"suspended":false,
"activityId":"processTask"
......@@ -4025,7 +4081,9 @@ to include in the query, with their format <link linkend="restQueryVariable"> de
{
"id":"5",
"url":"http://localhost:8182/runtime/executions/5",
"parentId":null,
"parentUrl":null,
"processInstanceId":"5",
"processInstanceUrl":"http://localhost:8182/runtime/process-instances/5",
"suspended":false,
"activityId":null
......@@ -4033,7 +4091,9 @@ to include in the query, with their format <link linkend="restQueryVariable"> de
{
"id":"7",
"url":"http://localhost:8182/runtime/executions/7",
"parentId":"5",
"parentUrl":"http://localhost:8182/runtime/executions/5",
"processInstanceId":"5",
"processInstanceUrl":"http://localhost:8182/runtime/process-instances/5",
"suspended":false,
"activityId":"processTask"
......@@ -4823,6 +4883,18 @@ In case the variable is a binary variable or serializable, the <literal>valueUrl
<entry>Boolean</entry>
<entry>If <literal>true</literal>, only return tasks that are not suspended (either part of a process that is not suspended or not part of a process at all). If false, only tasks that are part of suspended process instances are returned.</entry>
</row>
<row>
<entry>includeTaskLocalVariables</entry>
<entry>No</entry>
<entry>Boolean</entry>
<entry>Indication to include task local variables in the result.</entry>
</row>
<row>
<entry>includeProcessVariables</entry>
<entry>No</entry>
<entry>Boolean</entry>
<entry>Indication to include process variables in the result.</entry>
</row>
<row>
<entry namest="c1" nameend="c4"><para>The general <link linkend="restPagingAndSort">paging and sorting query-parameters</link> can be used for this URL.</para></entry>
</row>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册