public String getAttachmentContentById(String containerId, Number taskId, Number attachmentId, String marshallingType) { containerId = context.getContainerId(containerId, new ByTaskIdContainerLocator(taskId.longValue())); Object attachment = userTaskService.getAttachmentContentById(containerId, taskId.longValue(), attachmentId.longValue()); if (attachment == null) { throw new IllegalStateException("No attachment found for id " + attachmentId + " for task " + taskId); } logger.debug("About to marshal task attachment with id '{}' {}", attachmentId, attachment); String response = marshallerHelper.marshal(containerId, marshallingType, attachment); return response; }
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 getTaskOutputContentByTaskId(String containerId, Number taskId, String marshallingType) { containerId = context.getContainerId(containerId, new ByTaskIdContainerLocator(taskId.longValue())); Map<String, Object> variables = userTaskService.getTaskOutputContentByTaskId(containerId, taskId.longValue()); logger.debug("About to marshal task '{}' output variables {}", taskId, variables); String response = marshallerHelper.marshal(containerId, marshallingType, variables); 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 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 String getProcessInstanceVariables(String containerId, Number processInstanceId, String marshallingType) { containerId = context.getContainerId(containerId, new ByProcessInstanceIdContainerLocator(processInstanceId.longValue())); Map<String, Object> variables = processService.getProcessInstanceVariables(containerId, processInstanceId.longValue()); logger.debug("About to marshal process variables {}", variables); String response = marshallerHelper.marshal(containerId, marshallingType, variables); return response; }
public String saveContent(String containerId, Number taskId, String payload, String marshallingType) { containerId = context.getContainerId(containerId, new ByTaskIdContainerLocator(taskId.longValue())); logger.debug("About to unmarshal task content parameters from payload: '{}'", payload); Map<String, Object> parameters = marshallerHelper.unmarshal(containerId, payload, marshallingType, Map.class); logger.debug("About to set content of a task with id '{}' with data {}", taskId, parameters); Long contentId = userTaskService.saveContent(containerId, taskId.longValue(), parameters); String response = marshallerHelper.marshal(containerId, marshallingType, contentId); return response; }
public String getRequestById(long requestId, boolean withErrors, boolean withData, String marshallingType) { String result = null; RequestInfo request = executorService.getRequestById(requestId); if (request == null) { throw new IllegalArgumentException("Request with id: " + requestId + " doesn't exist"); } else { RequestInfoInstance requestInstance = convertToRequestInfo(request, withErrors, withData); String deploymentId = ((org.jbpm.executor.entities.RequestInfo) request).getDeploymentId(); if (deploymentId != null && context.getContainer(deploymentId) != null) { result = marshallerHelper.marshal(deploymentId, marshallingType, requestInstance); } else { result = marshallerHelper.marshal(marshallingType, requestInstance); } } return result; }
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; }
public String reassignWhenNotStarted(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.reassignWhenNotStarted(containerId, taskId.longValue(), timeExpression, entities); logger.debug("Reassignment (when not started) to {} successfully created for task {} to fire at {}", entities, taskId, timeExpression); String response = marshallerHelper.marshal(containerId, marshallingType, id, new ByTaskIdContainerLocator(taskId.longValue())); return response; }
public String marshal(String containerId, String marshallingFormat, Object entity) { return marshal(containerId, marshallingFormat, entity, ContainerLocatorProvider.get().getLocator()); }
public String addAttachment(String containerId, Number taskId, String userId, String name, String attachmentPayload, String marshallingType) { containerId = context.getContainerId(containerId, new ByTaskIdContainerLocator(taskId.longValue())); logger.debug("About to unmarshal task attachment from payload: '{}'", attachmentPayload); Object attachment = marshallerHelper.unmarshal(containerId, attachmentPayload, marshallingType, Object.class); logger.debug("About to add attachment on a task with id '{}' with data {}", taskId, attachment); Long attachmentId = userTaskService.addAttachment(containerId, taskId.longValue(), getUser(userId), name, attachment); String response = marshallerHelper.marshal(containerId, marshallingType, attachmentId); return response; }
public String notifyWhenNotCompleted(String containerId, Number taskId, String timeExpression, String payload, String marshallingType) { logger.debug("About to unmarshall payload '{}' to EmailNotification (when not completed) of task inputs", payload); containerId = context.getContainerId(containerId, new ByTaskIdContainerLocator(taskId.longValue())); EmailNotification emailNotification = marshallerHelper.unmarshal(containerId, payload, marshallingType, EmailNotification.class, new ByTaskIdContainerLocator(taskId.longValue())); logger.debug("Email notification to be added to a task {} is {}", taskId, emailNotification); org.kie.internal.task.api.model.EmailNotification email = buildEmail(emailNotification); Long id = userTaskAdminService.notifyWhenNotCompleted(containerId, taskId.longValue(), timeExpression, email); logger.debug("Email notification (when not completed) {} added successfully to task {} to be fired after {}", emailNotification, taskId, timeExpression); String response = marshallerHelper.marshal(containerId, marshallingType, id, new ByTaskIdContainerLocator(taskId.longValue())); return response; }
public String notifyWhenNotStarted(String containerId, Number taskId, String timeExpression, String payload, String marshallingType) { logger.debug("About to unmarshall payload '{}' to EmailNotification (when not started) of task inputs", payload); containerId = context.getContainerId(containerId, new ByTaskIdContainerLocator(taskId.longValue())); EmailNotification emailNotification = marshallerHelper.unmarshal(containerId, payload, marshallingType, EmailNotification.class, new ByTaskIdContainerLocator(taskId.longValue())); logger.debug("Email notification to be added to a task {} is {}", taskId, emailNotification); org.kie.internal.task.api.model.EmailNotification email = buildEmail(emailNotification); Long id = userTaskAdminService.notifyWhenNotStarted(containerId, taskId.longValue(), timeExpression, email); logger.debug("Email notification (when not started) {} added successfully to task {} to be fired after {}", emailNotification, taskId, timeExpression); String response = marshallerHelper.marshal(containerId, marshallingType, id, new ByTaskIdContainerLocator(taskId.longValue())); return response; }
public String addCommentToCase(String containerId, String caseId, String author, List<String> restrictions, String comment, String marshallingType) { verifyContainerId(containerId, caseId); author = getUser(author); String actualComment = marshallerHelper.unmarshal(containerId, comment, marshallingType, String.class, new ByCaseIdContainerLocator(caseId)); logger.debug("Adding comment to case {} by {} with text '{}' with restrictions {}", caseId, author, actualComment, restrictions); String commentId = caseService.addCaseComment(caseId, author, actualComment, restrictions.toArray(new String[restrictions.size()])); return marshallerHelper.marshal(containerId, marshallingType, commentId); }
public String getCaseFileDataByName(String containerId, String caseId, String name, String marshallingType) { verifyContainerId(containerId, caseId); CaseFileInstance caseFileInstance = caseService.getCaseFileInstance(caseId); Object caseFileData = caseFileInstance.getData(name); logger.debug("About to marshal case file data (name = {}) for case with id '{}' {}", name, caseId, caseFileData); return marshallerHelper.marshal(containerId, marshallingType, caseFileData, new ByCaseIdContainerLocator(caseId)); }
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 String startProcessWithCorrelation(String containerId, String processId, String correlationKey, String payload, String marshallingType) { containerId = context.getContainerId(containerId, ContainerLocatorProvider.get().getLocator()); // check validity of deployment and process id definitionService.getProcessDefinition(containerId, processId); logger.debug("About to unmarshal parameters from payload: '{}'", payload); Map<String, Object> parameters = marshallerHelper.unmarshal(containerId, payload, marshallingType, Map.class); String[] correlationProperties = correlationKey.split(":"); CorrelationKey actualCorrelationKey = correlationKeyFactory.newCorrelationKey(Arrays.asList(correlationProperties)); logger.debug("Calling start process with id {} on container {} and parameters {}", processId, containerId, parameters); Long processInstanceId = processService.startProcess(containerId, processId, actualCorrelationKey, parameters); // return response String response = marshallerHelper.marshal(containerId, marshallingType, processInstanceId); return response; }
public String startProcess(String containerId, String processId, String payload, String marshallingType) { containerId = context.getContainerId(containerId, ContainerLocatorProvider.get().getLocator()); // check validity of deployment and process id definitionService.getProcessDefinition(containerId, processId); logger.debug("About to unmarshal parameters from payload: '{}'", payload); Map<String, Object> parameters = marshallerHelper.unmarshal(containerId, payload, marshallingType, Map.class); logger.debug("Calling start process with id {} on container {} and parameters {}", processId, containerId, parameters); Long processInstanceId = processService.startProcess(containerId, processId, parameters); // return response String response = marshallerHelper.marshal(containerId, marshallingType, processInstanceId); return response; }
public String startProcess(String containerId, String processId, String marshallingType) { containerId = context.getContainerId(containerId, ContainerLocatorProvider.get().getLocator()); // check validity of deployment and process id definitionService.getProcessDefinition(containerId, processId); logger.debug("Calling start process with id {} on container {} and parameters {}", processId, containerId, null); Long processInstanceId = processService.startProcess(containerId, processId); // return response String response = marshallerHelper.marshal(containerId, marshallingType, processInstanceId); return response; }