@Test public void testConvertToTask() { Date testDate = new Date(); UserTaskInstanceDesc userTaskWithSla = new UserTaskInstanceDesc(Long.valueOf(1), "Ready", testDate, "Task1_name", "Task1_desc", 1, "Task1_Owner", "Task1_Creator", "deployment", "Process", 1L, testDate, testDate, 1L, "formName-1", "subject-1", "1", 1, testDate, ProcessInstance.SLA_PENDING); UserTaskInstanceDesc userTask = new UserTaskInstanceDesc(Long.valueOf(1), "Ready", testDate, "Task1_name", "Task1_desc", 1, "Task1_Owner", "Task1_Creator", "deployment", "Process", 1L, testDate, testDate); verifyTaskInstanceEqualsUserTaskInstance(userTask, ConvertUtils.convertToTask(userTask)); verifyTaskInstanceEqualsUserTaskInstance(userTaskWithSla, ConvertUtils.convertToTask(userTaskWithSla)); }
public static TaskInstance convertToTask(UserTaskInstanceDesc userTask) { return TaskInstance.builder() .id(userTask.getTaskId()) .name(userTask.getName()) .processInstanceId(userTask.getProcessInstanceId()) .processId(userTask.getProcessId()) .activationTime(userTask.getActivationTime()) .actualOwner(userTask.getActualOwner()) .containerId(userTask.getDeploymentId()) .createdBy(userTask.getCreatedBy()) .createdOn(userTask.getCreatedOn()) .description(userTask.getDescription()) .expirationTime(userTask.getDueDate()) .status(userTask.getStatus()) .priority(userTask.getPriority()) .workItemId(userTask.getWorkItemId()) .slaCompliance(userTask.getSlaCompliance()) .slaDueDate(userTask.getSlaDueDate()) .formName(userTask.getFormName()) .subject(userTask.getSubject()) .processType(userTask.getProcessType()) .correlationKey(userTask.getCorrelationKey()) .build(); }
ConvertUtils { public static TaskInstance convertToTask(UserTaskInstanceDesc userTask) { return TaskInstance.builder() .id(userTask.getTaskId()) .name(userTask.getName()) .processInstanceId(userTask.getProcessInstanceId()) .processId(userTask.getProcessId()) .activationTime(userTask.getActivationTime()) .actualOwner(userTask.getActualOwner()) .containerId(userTask.getDeploymentId()) .createdBy(userTask.getCreatedBy()) .createdOn(userTask.getCreatedOn()) .description(userTask.getDescription()) .expirationTime(userTask.getDueDate()) .status(userTask.getStatus()) .priority(userTask.getPriority()) .workItemId(userTask.getWorkItemId()) .slaCompliance(userTask.getSlaCompliance()) .slaDueDate(userTask.getSlaDueDate()) .formName(userTask.getFormName()) .subject(userTask.getSubject()) .processType(userTask.getProcessType()) .correlationKey(userTask.getCorrelationKey()) .build(); } }
ConvertUtils { public static TaskInstance convertToTask(UserTaskInstanceDesc userTask) { return TaskInstance.builder() .id(userTask.getTaskId()) .name(userTask.getName()) .processInstanceId(userTask.getProcessInstanceId()) .processId(userTask.getProcessId()) .activationTime(userTask.getActivationTime()) .actualOwner(userTask.getActualOwner()) .containerId(userTask.getDeploymentId()) .createdBy(userTask.getCreatedBy()) .createdOn(userTask.getCreatedOn()) .description(userTask.getDescription()) .expirationTime(userTask.getDueDate()) .status(userTask.getStatus()) .priority(userTask.getPriority()) .workItemId(userTask.getWorkItemId()) .slaCompliance(userTask.getSlaCompliance()) .slaDueDate(userTask.getSlaDueDate()) .formName(userTask.getFormName()) .subject(userTask.getSubject()) .processType(userTask.getProcessType()) .correlationKey(userTask.getCorrelationKey()) .build(); } private  ConvertUtils(); }
ConvertUtils { public static TaskInstance convertToTask(UserTaskInstanceDesc userTask) { return TaskInstance.builder() .id(userTask.getTaskId()) .name(userTask.getName()) .processInstanceId(userTask.getProcessInstanceId()) .processId(userTask.getProcessId()) .activationTime(userTask.getActivationTime()) .actualOwner(userTask.getActualOwner()) .containerId(userTask.getDeploymentId()) .createdBy(userTask.getCreatedBy()) .createdOn(userTask.getCreatedOn()) .description(userTask.getDescription()) .expirationTime(userTask.getDueDate()) .status(userTask.getStatus()) .priority(userTask.getPriority()) .workItemId(userTask.getWorkItemId()) .slaCompliance(userTask.getSlaCompliance()) .slaDueDate(userTask.getSlaDueDate()) .formName(userTask.getFormName()) .subject(userTask.getSubject()) .processType(userTask.getProcessType()) .correlationKey(userTask.getCorrelationKey()) .build(); } private  ConvertUtils(); static ProcessInstanceList convertToProcessInstanceList(Collection<ProcessInstanceDesc> instances); static ProcessInstanceList convertToProcessInstanceList(Collection<ProcessInstanceDesc> instances, String containerId); static ProcessInstanceList convertToProcessInstanceWithVarsList(Collection<ProcessInstanceWithVarsDesc> instances); static org.kie.server.api.model.instance.ProcessInstance convertToProcessInstance(ProcessInstanceDesc pi); static org.kie.server.api.model.instance.ProcessInstance convertToProcessInstance(ProcessInstanceDesc pi, String containerId); static ProcessInstanceCustomVarsList convertToProcessInstanceCustomVarsList(Collection<ProcessInstanceCustomDesc> instances); static ProcessInstanceCustomVars convertToProcessInstanceCustomVars(ProcessInstanceCustomDesc pi); static ProcessDefinitionList convertToProcessList(Collection<ProcessDefinition> definitions); static org.kie.server.api.model.definition.ProcessDefinition convertToProcess(ProcessDefinition processDesc); static ExecutionErrorInstanceList convertToErrorInstanceList(List<ExecutionError> executionErrors); static ExecutionErrorInstance convertToErrorInstance(ExecutionError executionError); static QueryContext buildQueryContext(Integer page, Integer pageSize); static QueryContext buildQueryContext(Integer page, Integer pageSize, String orderBy, boolean asc); static QueryFilter buildQueryFilter(Integer page, Integer pageSize); static QueryFilter buildQueryFilter(Integer page, Integer pageSize, String orderBy, boolean asc); static QueryFilter buildTaskByNameQueryFilter(Integer page, Integer pageSize, String orderBy, boolean asc, String filter); static List<Status> buildTaskStatuses(List<String> status); static NodeInstance convertToNodeInstance(NodeInstanceDesc nodeInstanceDesc); static NodeInstance convertToNodeInstance(NodeInstanceDesc nodeInstanceDesc, String containerId); static NodeInstanceList convertToNodeInstanceList(Collection<NodeInstanceDesc> definitions, String containerId); static VariableInstance convertToVariable(VariableDesc variableDesc); static VariableInstance convertToVariable(VariableDesc variableDesc, String containerId); static VariableInstanceList convertToVariablesList(Collection<VariableDesc> variables, String containerId); static TaskInstanceList convertToTaskInstanceWithVarsList(Collection<UserTaskInstanceWithVarsDesc> instances); static TaskInstanceList convertToTaskInstanceList(Collection<UserTaskInstanceDesc> instances); static TaskInstance convertToTask(UserTaskInstanceDesc userTask); static TaskWithProcessDescriptionList convertToTaskInstanceListPO(Collection<UserTaskInstanceWithPotOwnerDesc> instances); static TaskWithProcessDescription convertToTaskPO(UserTaskInstanceWithPotOwnerDesc userTask); static TaskSummaryList convertToTaskSummaryList(Collection<TaskSummary> tasks); static org.kie.server.api.model.instance.TaskSummary convertToTaskSummary(TaskSummary taskSummary); static QueryDefinition convertQueryDefinition(org.jbpm.services.api.query.model.QueryDefinition queryDefinition); static QueryDefinitionList convertToQueryDefinitionList(Collection<org.jbpm.services.api.query.model.QueryDefinition> definitions); static ProcessInstanceCustomVarsList convertToProcessInstanceCustomVarsList(List<ProcessInstanceWithVarsDesc> data); static ProcessInstanceUserTaskWithVariablesList convertToUserTaskWithVariablesList(List<UserTaskInstanceWithPotOwnerDesc> queryUserTasksByVariables); static List<org.jbpm.services.api.query.model.QueryParam> convertToServiceApiQueryParam(List<QueryParam> param); static String nullEmpty(String value); static String checkSort(String sort); static List<Integer> checkStatus(List<Integer> status); static void throwException(long processInstanceId, String containerId); }
ConvertUtils { public static TaskInstance convertToTask(UserTaskInstanceDesc userTask) { return TaskInstance.builder() .id(userTask.getTaskId()) .name(userTask.getName()) .processInstanceId(userTask.getProcessInstanceId()) .processId(userTask.getProcessId()) .activationTime(userTask.getActivationTime()) .actualOwner(userTask.getActualOwner()) .containerId(userTask.getDeploymentId()) .createdBy(userTask.getCreatedBy()) .createdOn(userTask.getCreatedOn()) .description(userTask.getDescription()) .expirationTime(userTask.getDueDate()) .status(userTask.getStatus()) .priority(userTask.getPriority()) .workItemId(userTask.getWorkItemId()) .slaCompliance(userTask.getSlaCompliance()) .slaDueDate(userTask.getSlaDueDate()) .formName(userTask.getFormName()) .subject(userTask.getSubject()) .processType(userTask.getProcessType()) .correlationKey(userTask.getCorrelationKey()) .build(); } private  ConvertUtils(); static ProcessInstanceList convertToProcessInstanceList(Collection<ProcessInstanceDesc> instances); static ProcessInstanceList convertToProcessInstanceList(Collection<ProcessInstanceDesc> instances, String containerId); static ProcessInstanceList convertToProcessInstanceWithVarsList(Collection<ProcessInstanceWithVarsDesc> instances); static org.kie.server.api.model.instance.ProcessInstance convertToProcessInstance(ProcessInstanceDesc pi); static org.kie.server.api.model.instance.ProcessInstance convertToProcessInstance(ProcessInstanceDesc pi, String containerId); static ProcessInstanceCustomVarsList convertToProcessInstanceCustomVarsList(Collection<ProcessInstanceCustomDesc> instances); static ProcessInstanceCustomVars convertToProcessInstanceCustomVars(ProcessInstanceCustomDesc pi); static ProcessDefinitionList convertToProcessList(Collection<ProcessDefinition> definitions); static org.kie.server.api.model.definition.ProcessDefinition convertToProcess(ProcessDefinition processDesc); static ExecutionErrorInstanceList convertToErrorInstanceList(List<ExecutionError> executionErrors); static ExecutionErrorInstance convertToErrorInstance(ExecutionError executionError); static QueryContext buildQueryContext(Integer page, Integer pageSize); static QueryContext buildQueryContext(Integer page, Integer pageSize, String orderBy, boolean asc); static QueryFilter buildQueryFilter(Integer page, Integer pageSize); static QueryFilter buildQueryFilter(Integer page, Integer pageSize, String orderBy, boolean asc); static QueryFilter buildTaskByNameQueryFilter(Integer page, Integer pageSize, String orderBy, boolean asc, String filter); static List<Status> buildTaskStatuses(List<String> status); static NodeInstance convertToNodeInstance(NodeInstanceDesc nodeInstanceDesc); static NodeInstance convertToNodeInstance(NodeInstanceDesc nodeInstanceDesc, String containerId); static NodeInstanceList convertToNodeInstanceList(Collection<NodeInstanceDesc> definitions, String containerId); static VariableInstance convertToVariable(VariableDesc variableDesc); static VariableInstance convertToVariable(VariableDesc variableDesc, String containerId); static VariableInstanceList convertToVariablesList(Collection<VariableDesc> variables, String containerId); static TaskInstanceList convertToTaskInstanceWithVarsList(Collection<UserTaskInstanceWithVarsDesc> instances); static TaskInstanceList convertToTaskInstanceList(Collection<UserTaskInstanceDesc> instances); static TaskInstance convertToTask(UserTaskInstanceDesc userTask); static TaskWithProcessDescriptionList convertToTaskInstanceListPO(Collection<UserTaskInstanceWithPotOwnerDesc> instances); static TaskWithProcessDescription convertToTaskPO(UserTaskInstanceWithPotOwnerDesc userTask); static TaskSummaryList convertToTaskSummaryList(Collection<TaskSummary> tasks); static org.kie.server.api.model.instance.TaskSummary convertToTaskSummary(TaskSummary taskSummary); static QueryDefinition convertQueryDefinition(org.jbpm.services.api.query.model.QueryDefinition queryDefinition); static QueryDefinitionList convertToQueryDefinitionList(Collection<org.jbpm.services.api.query.model.QueryDefinition> definitions); static ProcessInstanceCustomVarsList convertToProcessInstanceCustomVarsList(List<ProcessInstanceWithVarsDesc> data); static ProcessInstanceUserTaskWithVariablesList convertToUserTaskWithVariablesList(List<UserTaskInstanceWithPotOwnerDesc> queryUserTasksByVariables); static List<org.jbpm.services.api.query.model.QueryParam> convertToServiceApiQueryParam(List<QueryParam> param); static String nullEmpty(String value); static String checkSort(String sort); static List<Integer> checkStatus(List<Integer> status); static void throwException(long processInstanceId, String containerId);  }