/** * Looks up container id for given alias that is associated with case instance * @param alias container alias * @param caseId unique case instance id * @return * @throws IllegalArgumentException in case there are no containers for given alias */ public String forCaseInstance(String alias, String caseId) { return registry.getContainerId(alias, new ByCaseIdContainerLocator(caseId)); }
/** * Looks up container id for given alias that is associated with process instance * @param alias container alias * @param processInstanceId unique process instance id * @return * @throws IllegalArgumentException in case there are no containers for given alias */ public String forProcessInstance(String alias, long processInstanceId) { return registry.getContainerId(alias, new ByProcessInstanceIdContainerLocator(processInstanceId)); }
public void setProcessVariables(String containerId, Number processInstanceId, String variablePayload, String marshallingType) { containerId = context.getContainerId(containerId, new ByProcessInstanceIdContainerLocator(processInstanceId.longValue())); logger.debug("About to unmarshal variables from payload: '{}'", variablePayload); Map<String, Object> variables = marshallerHelper.unmarshal(containerId, variablePayload, marshallingType, Map.class); logger.debug("Setting variables '{}' on process instance with id {} with value {}", variables.keySet(), processInstanceId, variables.values()); processService.setProcessVariables(containerId, processInstanceId.longValue(), variables); }
public void completeWorkItem(String containerId, Number processInstanceId, Number workItemId, String resultPayload, String marshallingType) { containerId = context.getContainerId(containerId, new ByProcessInstanceIdContainerLocator(processInstanceId.longValue())); logger.debug("About to unmarshal work item result from payload: '{}'", resultPayload); Map<String, Object> results = marshallerHelper.unmarshal(containerId, resultPayload, marshallingType, Map.class); logger.debug("Completing work item '{}' on process instance id {} with value {}", workItemId, processInstanceId, results); processService.completeWorkItem(containerId, processInstanceId.longValue(), workItemId.longValue(), results); }
public void addTaskInputs(String containerId, Number taskId, String payload, String marshallingType) { logger.debug("About to unmarshall payload '{}' to map of task inputs", payload); containerId = context.getContainerId(containerId, new ByTaskIdContainerLocator(taskId.longValue())); Map<String, Object> data = marshallerHelper.unmarshal(containerId, payload, marshallingType, Map.class); logger.debug("Task input data to be added to a task {} is {}", taskId, data); userTaskAdminService.addTaskInputs(containerId, taskId.longValue(), data); logger.debug("Task inputs {} added successfully to task {}", data, taskId); }
public void setDescription(String containerId, Number taskId, String descriptionPayload, String marshallingType) { containerId = context.getContainerId(containerId, new ByTaskIdContainerLocator(taskId.longValue())); logger.debug("About to unmarshal task description from payload: '{}'", descriptionPayload); String description = marshallerHelper.unmarshal(containerId, descriptionPayload, marshallingType, String.class); logger.debug("About to set name for a task with id '{}' with value '{}'", taskId, description); userTaskService.setDescription(containerId, taskId.longValue(), description); }
public String getProcessInstanceVariable(String containerId, Number processInstanceId, String varName, String marshallingType) { containerId = context.getContainerId(containerId, new ByProcessInstanceIdContainerLocator(processInstanceId.longValue())); Object variable = processService.getProcessInstanceVariable(containerId, processInstanceId.longValue(), varName); if (variable == null) { throw new IllegalStateException("Unable to find variable '"+ varName + "' within process instance with id " + processInstanceId); } logger.debug("About to marshal process variable with name '{}' {}", varName, variable); String response = marshallerHelper.marshal(containerId, marshallingType, variable); return response; }
public String getTaskInputContentByTaskId(String containerId, Number taskId, String marshallingType) { containerId = context.getContainerId(containerId, new ByTaskIdContainerLocator(taskId.longValue())); Map<String, Object> variables = userTaskService.getTaskInputContentByTaskId(containerId, taskId.longValue()); logger.debug("About to marshal task '{}' input variables {}", taskId, variables); String response = marshallerHelper.marshal(containerId, marshallingType, variables); return response; }
public Object abortProcessInstance(String containerId, Number processInstanceId) { try { containerId = context.getContainerId(containerId, new ByProcessInstanceIdContainerLocator(processInstanceId.longValue())); processService.abortProcessInstance(containerId, processInstanceId.longValue()); return null; } catch (IllegalArgumentException e) { throw new DeploymentNotFoundException(e.getMessage()); } }
public String getAvailableSignals(String containerId, Number processInstanceId, String marshallingType) { containerId = context.getContainerId(containerId, new ByProcessInstanceIdContainerLocator(processInstanceId.longValue())); Collection<String> signals = processService.getAvailableSignals(containerId, processInstanceId.longValue()); logger.debug("About to marshal available signals {}", signals); String response = marshallerHelper.marshal(containerId, marshallingType, signals); return response; }
public void signalProcessInstances(String containerId, List<Long> processInstanceIds, String signalName, String eventPayload, String marshallingType) { List<Long> ids = convert(processInstanceIds); if (ids.isEmpty()) { return; } containerId = context.getContainerId(containerId, new ByProcessInstanceIdContainerLocator(ids.get(0))); logger.debug("About to unmarshal event from payload: '{}'", eventPayload); Object event = marshallerHelper.unmarshal(containerId, eventPayload, marshallingType, Object.class); logger.debug("Calling signal '{}' process instances with id {} on container {} and event {}", signalName, processInstanceIds, containerId, event); processService.signalProcessInstances(containerId, ids, signalName, event); }
/** * Looks up latest container id for given alias. * @param alias container alias * @return resolved latest container id * @throws IllegalArgumentException in case there are no containers for given alias */ public String latest(String alias) { return registry.getContainerId(alias, ContainerLocatorProvider.get().getLocator()); }
public String reassignWhenNotCompleted(String containerId, Number taskId, String timeExpression, String payload, String marshallingType) { logger.debug("About to unmarshall payload '{}' to list of org entities (users/groups)", payload); containerId = context.getContainerId(containerId, new ByTaskIdContainerLocator(taskId.longValue())); OrganizationalEntity[] entities = convert(containerId, taskId, payload, marshallingType); Long id = userTaskAdminService.reassignWhenNotCompleted(containerId, taskId.longValue(), timeExpression, entities); logger.debug("Reassignment (when not completed) to {} successfully created for task {} to fire at {}", entities, taskId, timeExpression); String response = marshallerHelper.marshal(containerId, marshallingType, id, new ByTaskIdContainerLocator(taskId.longValue())); return response; }
protected ProcessDefinition findProcessDefinition(String containerId, String processId) { containerId = context.getContainerId(containerId, ContainerLocatorProvider.get().getLocator()); ProcessDefinition procDef = definitionService.getProcessDefinition(containerId, processId); if (procDef == null) { throw new IllegalStateException("Process definition " + containerId + " : " + processId + " not found"); } return procDef; }
public String addComment(String containerId, Number taskId, String payload, String marshallingType) { containerId = context.getContainerId(containerId, new ByTaskIdContainerLocator(taskId.longValue())); logger.debug("About to unmarshal task comment from payload: '{}'", payload); TaskComment comment = marshallerHelper.unmarshal(containerId, payload, marshallingType, TaskComment.class); logger.debug("About to set comment on a task with id '{}' with data {}", taskId, comment); Long commentId = userTaskService.addComment(containerId, taskId.longValue(), comment.getText(), comment.getAddedBy(), comment.getAddedAt()); String response = marshallerHelper.marshal(containerId, marshallingType, commentId); return response; }
public UserTaskDefinitionList getTasksDefinitions(String containerId, String processId) { containerId = context.getContainerId(containerId, ContainerLocatorProvider.get().getLocator()); findProcessDefinition(containerId, processId); Collection<UserTaskDefinition> userTaskDefinitions = definitionService.getTasksDefinitions(containerId, processId); return convert(userTaskDefinitions); }
public SubProcessesDefinition getReusableSubProcesses(String containerId, String processId) { containerId = context.getContainerId(containerId, ContainerLocatorProvider.get().getLocator()); findProcessDefinition(containerId, processId); Collection<String> reusableSubProcesses = definitionService.getReusableSubProcesses(containerId, processId); return new SubProcessesDefinition(reusableSubProcesses); }
public VariablesDefinition getProcessVariables(String containerId, String processId) { containerId = context.getContainerId(containerId, ContainerLocatorProvider.get().getLocator()); findProcessDefinition(containerId, processId); Map<String, String> processVariables = definitionService.getProcessVariables(containerId, processId); return new VariablesDefinition(processVariables); }
public ServiceTasksDefinition getServiceTasks(String containerId, String processId) { containerId = context.getContainerId(containerId, ContainerLocatorProvider.get().getLocator()); findProcessDefinition(containerId, processId); Map<String, String> serviceTasks = definitionService.getServiceTasks(containerId, processId); return new ServiceTasksDefinition(serviceTasks); }
public AssociatedEntitiesDefinition getAssociatedEntities(String containerId, String processId) { containerId = context.getContainerId(containerId, ContainerLocatorProvider.get().getLocator()); findProcessDefinition(containerId, processId); Map<String, Collection<String>> entities = definitionService.getAssociatedEntities(containerId, processId); return AssociatedEntitiesDefinition.from(entities); }