@Override public BaseQueryFilterSpec getQueryFilterSpec() { return marshallerHelper.unmarshal(payload, marshallingType, ProcessInstanceQueryFilterSpec.class); } };
public void updateRequestData(long requestId, String containerId, String payload, String marshallingType) { Map<String, Object> data = null; if (containerId != null && !containerId.isEmpty()) { logger.debug("About to unmarshal job data from payload: '{}' using container {} marshaller", payload, containerId); data = marshallerHelper.unmarshal(containerId, payload, marshallingType, Map.class); } else { logger.debug("About to unmarshal job data from payload: '{}' using server marshaller", payload); data = marshallerHelper.unmarshal(payload, marshallingType, Map.class); } logger.debug("About to update job's ( with id {}) data {}", requestId, data); executorService.updateRequestData(requestId, data); }
public void signal(String containerId, String signalName, String eventPayload, String marshallingType) { logger.debug("About to unmarshal event from payload: '{}'", eventPayload); Object event = marshallerHelper.unmarshal(containerId, eventPayload, marshallingType, Object.class); logger.debug("Calling signal '{}' on container {} and event {}", signalName, containerId, event); processService.signalEvent(containerId, signalName, event); }
public void closeCaseInstance(String containerId, String caseId, String payload, String marshallingType) { verifyContainerId(containerId, caseId); logger.debug("About to unmarshal task name from payload: '{}'", payload); String comment = marshallerHelper.unmarshal(containerId, payload, marshallingType, String.class); logger.debug("Closing case with id {} inside container {} with comment {}", caseId, containerId, comment); caseService.closeCase(caseId, comment); }
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); }
protected OrganizationalEntity[] convert(String containerId, Number taskId, String payload, String marshallingType) { OrgEntities orgEntities = marshallerHelper.unmarshal(containerId, payload, marshallingType, OrgEntities.class, new ByTaskIdContainerLocator(taskId.longValue())); List<OrganizationalEntity> entities = new ArrayList<>(); if (orgEntities.getUsers() != null) { entities.addAll(orgEntities.getUsers().stream().map(mapToUser).collect(toList())); } if (orgEntities.getGroups() != null) { entities.addAll(orgEntities.getGroups().stream().map(mapToGroup).collect(toList())); } return entities.toArray(new OrganizationalEntity[entities.size()]); }
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 signalProcessInstance(String containerId, Number processInstanceId, String signalName, String eventPayload, String marshallingType) { containerId = context.getContainerId(containerId, new ByProcessInstanceIdContainerLocator(processInstanceId.longValue())); logger.debug("About to unmarshal event from payload: '{}'", eventPayload); Object event = marshallerHelper.unmarshal(containerId, eventPayload, marshallingType, Object.class); logger.debug("Calling signal '{}' process instance with id {} on container {} and event {}", signalName, processInstanceId, containerId, event); processService.signalProcessInstance(containerId, processInstanceId.longValue(), signalName, event); }
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 void setProcessVariable(String containerId, Number processInstanceId, String varName, String variablePayload, String marshallingType) { containerId = context.getContainerId(containerId, new ByProcessInstanceIdContainerLocator(processInstanceId.longValue())); logger.debug("About to unmarshal variable from payload: '{}'", variablePayload); Object variable = marshallerHelper.unmarshal(containerId, variablePayload, marshallingType, Object.class); logger.debug("Setting variable '{}' on process instance with id {} with value {}", varName, processInstanceId, variable); processService.setProcessVariable(containerId, processInstanceId.longValue(), varName, variable); }
public void completeAutoProgress(String containerId, Number taskId, String userId, String payload, String marshallerType) { containerId = context.getContainerId(containerId, new ByTaskIdContainerLocator(taskId.longValue())); userId = getUser(userId); logger.debug("About to unmarshal task outcome parameters from payload: '{}'", payload); Map<String, Object> parameters = marshallerHelper.unmarshal(containerId, payload, marshallerType, Map.class); logger.debug("About to complete task with id '{}' as user '{}' with data {}", taskId, userId, parameters); userTaskService.completeAutoProgress(containerId, taskId.longValue(), userId, parameters); }
public void complete(String containerId, Number taskId, String userId, String payload, String marshallerType) { containerId = context.getContainerId(containerId, new ByTaskIdContainerLocator(taskId.longValue())); userId = getUser(userId); logger.debug("About to unmarshal task outcome parameters from payload: '{}'", payload); Map<String, Object> parameters = marshallerHelper.unmarshal(containerId, payload, marshallerType, Map.class); logger.debug("About to complete task with id '{}' as user '{}' with data {}", taskId, userId, parameters); userTaskService.complete(containerId, taskId.longValue(), userId, parameters); }
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); }
public void updateDocument(String documentId, String documentPayload, String marshallingType) { logger.debug("About to unmarshal document payload '{}' with marshaling type {}", documentPayload, marshallingType); DocumentInstance documentInstance = marshallerHelper.unmarshal(documentPayload, marshallingType, DocumentInstance.class); logger.debug("Document created from payload {}", documentInstance); Document document = documentStorageService.getDocument(documentId); logger.debug("Document found {}", documentInstance != null); if (document == null) { throw new KieServerRuntimeException("No document found with id " + documentId); } documentStorageService.saveDocument(document, documentInstance.getContent()); logger.debug("Document {} updated successfully", document); }
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 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 QueryDefinition registerQuery(String queryName, String payload, String marshallingType) throws QueryAlreadyRegisteredException { logger.debug("About to unmarshal queryDefinition from payload: '{}'", payload); QueryDefinition queryDefinition = marshallerHelper.unmarshal(payload, marshallingType, QueryDefinition.class); queryDefinition.setName(queryName); SqlQueryDefinition actualDefinition = build(context, queryDefinition); logger.debug("Built sql query definition for {} with content {}", queryName, actualDefinition); queryService.registerQuery(actualDefinition); return convertQueryDefinition(actualDefinition); }
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 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; }