void preprocessParameterCommand(Object cmdObj, List<Object> extraClassInstanceList) { if (cmdObj instanceof CompleteWorkItemCommand) { addPossiblyNullObject(((CompleteWorkItemCommand) cmdObj).getResult(), extraClassInstanceList); } else if (cmdObj instanceof SignalEventCommand) { addPossiblyNullObject(((SignalEventCommand) cmdObj).getEvent(), extraClassInstanceList); } else if (cmdObj instanceof StartCorrelatedProcessCommand) { StartCorrelatedProcessCommand cmd = (StartCorrelatedProcessCommand) cmdObj; if (cmd.getData() != null) { addPossiblyNullObject(cmd.getData().getDatas(), extraClassInstanceList); } addPossiblyNullObject(cmd.getParameter(), extraClassInstanceList); } else if (cmdObj instanceof StartProcessCommand) { StartProcessCommand startProcCmd = (StartProcessCommand) cmdObj; if (startProcCmd.getData() != null) { addPossiblyNullObject(startProcCmd.getData().getDatas(), extraClassInstanceList); } addPossiblyNullObject(((StartProcessCommand) cmdObj).getParameter(), extraClassInstanceList); } else if (cmdObj instanceof SetGlobalCommand) { addPossiblyNullObject(((SetGlobalCommand) cmdObj).getObject(), extraClassInstanceList); } else if (cmdObj instanceof InsertObjectCommand) { addPossiblyNullObject(((InsertObjectCommand) cmdObj).getObject(), extraClassInstanceList); } else if (cmdObj instanceof UpdateCommand) { addPossiblyNullObject(((UpdateCommand) cmdObj).getObject(), extraClassInstanceList); } else if (cmdObj instanceof AddTaskCommand) { addPossiblyNullObject(((AddTaskCommand) cmdObj).getParameter(), extraClassInstanceList); } else if (cmdObj instanceof CompleteTaskCommand) { addPossiblyNullObject(((CompleteTaskCommand) cmdObj).getData(), extraClassInstanceList); } else if (cmdObj instanceof FailTaskCommand) { addPossiblyNullObject(((FailTaskCommand) cmdObj).getData(), extraClassInstanceList); } }
void preprocessParameterCommand(Object cmdObj, List<Object> extraClassInstanceList) { if (cmdObj instanceof CompleteWorkItemCommand) { addPossiblyNullObject(((CompleteWorkItemCommand) cmdObj).getResult(), extraClassInstanceList); } else if (cmdObj instanceof SignalEventCommand) { addPossiblyNullObject(((SignalEventCommand) cmdObj).getEvent(), extraClassInstanceList); } else if (cmdObj instanceof StartCorrelatedProcessCommand) { StartCorrelatedProcessCommand cmd = (StartCorrelatedProcessCommand) cmdObj; if (cmd.getData() != null) { addPossiblyNullObject(cmd.getData().getDatas(), extraClassInstanceList); } addPossiblyNullObject(cmd.getParameter(), extraClassInstanceList); } else if (cmdObj instanceof StartProcessCommand) { StartProcessCommand startProcCmd = (StartProcessCommand) cmdObj; if (startProcCmd.getData() != null) { addPossiblyNullObject(startProcCmd.getData().getDatas(), extraClassInstanceList); } addPossiblyNullObject(((StartProcessCommand) cmdObj).getParameter(), extraClassInstanceList); } else if (cmdObj instanceof SetGlobalCommand) { addPossiblyNullObject(((SetGlobalCommand) cmdObj).getObject(), extraClassInstanceList); } else if (cmdObj instanceof InsertObjectCommand) { addPossiblyNullObject(((InsertObjectCommand) cmdObj).getObject(), extraClassInstanceList); } else if (cmdObj instanceof UpdateCommand) { addPossiblyNullObject(((UpdateCommand) cmdObj).getObject(), extraClassInstanceList); } else if (cmdObj instanceof AddTaskCommand) { addPossiblyNullObject(((AddTaskCommand) cmdObj).getParameter(), extraClassInstanceList); } else if (cmdObj instanceof CompleteTaskCommand) { addPossiblyNullObject(((CompleteTaskCommand) cmdObj).getData(), extraClassInstanceList); } else if (cmdObj instanceof FailTaskCommand) { addPossiblyNullObject(((FailTaskCommand) cmdObj).getData(), extraClassInstanceList); } else if (cmdObj instanceof AddContentFromUserCommand) { addPossiblyNullObject( ((AddContentFromUserCommand) cmdObj).getOutputContentMap(), extraClassInstanceList); } else if (cmdObj instanceof AddContentCommand) { AddContentCommand cmd = (AddContentCommand) cmdObj; addPossiblyNullObject(cmd.getParameter(), extraClassInstanceList); Content jaxbContent = cmd.getJaxbContent(); if (jaxbContent != null) { addPossiblyNullObject(jaxbContent.getContentMap(), extraClassInstanceList); } } else if (cmdObj instanceof SetTaskPropertyCommand) { addPossiblyNullObject(((SetTaskPropertyCommand) cmdObj).getOutput(), extraClassInstanceList); } else if (cmdObj instanceof ExecuteTaskRulesCommand) { addPossiblyNullObject(((ExecuteTaskRulesCommand) cmdObj).getData(), extraClassInstanceList); } else if (cmdObj instanceof ProcessSubTaskCommand) { addPossiblyNullObject(((ProcessSubTaskCommand) cmdObj).getData(), extraClassInstanceList); } else if (cmdObj instanceof SetProcessInstanceVariablesCommand) { addPossiblyNullObject( ((SetProcessInstanceVariablesCommand) cmdObj).getVariables(), extraClassInstanceList); } }
/** * Start a simple process, and retrieve the task information and content via the webservice * * @param applicationUrl Something like "http://localhost:8080/kie-wb/" or * "http://localhost:8080/business-central/" * @param user The user doing the webservice requests * @param password The user's password * @param deploymentId The deployment id that the request will interact with * @param processId The id of the process we want to start * @throws Exception if something goes wrong */ public static void startSimpleProcess( URL applicationUrl, String user, String password, String deploymentId, String processId) throws Exception { CommandWebService commandWebService = createWebserviceClient(applicationUrl, user, password, deploymentId); // Create start process command StartProcessCommand spc = new StartProcessCommand(); spc.setProcessId(processId); JaxbStringObjectPairArray map = new JaxbStringObjectPairArray(); JaxbStringObjectPair keyValue = new JaxbStringObjectPair(); keyValue.setKey("myobject"); keyValue.setValue(new MyType("variable", 29)); map.getItems().add(keyValue); spc.setParameter(map); // Do webService request JaxbProcessInstanceResponse jpir = doWebserviceSingleCommandRequest( commandWebService, spc, JaxbProcessInstanceResponse.class, deploymentId); long procInstId = ((JaxbProcessInstanceResponse) jpir).getId(); // Create command GetTasksByProcessInstanceIdCommand gtbic = new GetTasksByProcessInstanceIdCommand(); gtbic.setProcessInstanceId(procInstId); // Do webservice request JaxbLongListResponse jllr = doWebserviceSingleCommandRequest( commandWebService, gtbic, JaxbLongListResponse.class, deploymentId); List<Long> taskIds = jllr.getResult(); long taskId = taskIds.get(0); // Commands for task and task content GetTaskCommand gtc = new GetTaskCommand(); gtc.setTaskId(taskId); GetTaskContentCommand gtcc = new GetTaskContentCommand(); gtcc.setTaskId(taskId); // Do webservice request (with both commands) JaxbCommandsRequest req = new JaxbCommandsRequest(deploymentId, gtc); req.getCommands().add(gtcc); // <3> JaxbCommandsResponse response = commandWebService.execute(req); // Get task and content response Task task = (Task) response.getResponses().get(0).getResult(); Map<String, Object> contentMap = (Map<String, Object>) response.getResponses().get(1).getResult(); }