private RapturePipelineTask createTask() { RapturePipelineTask task = new RapturePipelineTask(); Worker worker = new Worker(); worker.setPriority(2); task.setPriority(worker.getPriority()); task.setCategoryList(ImmutableList.of("cat")); task.addMimeObject(worker); task.setContentType(MimeDecisionProcessAdvance.getMimeType()); task.initTask(); Kernel.getPipeline().publishMessageToCategory(ContextFactory.getKernelUser(), task); return task; }
public static Worker createForkChild( WorkOrder workOrder, Worker parent, Workflow flow, int nextId, Step target) { Worker result = new Worker(); result.setWorkOrderURI(workOrder.getWorkOrderURI()); result.setId("" + nextId); result.setSiblingPosition(0); result.setSiblingCount(0); result.setParent(""); result.setWaitCount(0); List<Map<String, String>> globalView = Lists.newArrayList(); globalView.add(flow.getView()); result.setLocalView(globalView); result.setEffectiveUser(parent.getEffectiveUser()); result.setStatus(WorkerExecutionState.READY); result.setPriority(parent.getPriority()); result.setCallingContext(parent.getCallingContext()); if (target != null) { Map<String, String> viewWF = flow.getView(); Map<String, String> viewS = target.getView(); Map<String, String> composite = Maps.newHashMap(); composite.putAll(viewWF); composite.putAll(viewS); result.getStack().add(flow.getWorkflowURI() + "#" + target.getName()); } result.setActivityId(parent.getActivityId()); result.setAppStatusNameStack(parent.getAppStatusNameStack()); return result; }