protected boolean checkProcessInstance(Activation activation) { final Map<?, ?> declarations = activation.getSubRule().getOuterDeclarations(); for ( Iterator<?> it = declarations.values().iterator(); it.hasNext(); ) { Declaration declaration = (Declaration) it.next(); if ("processInstance".equals(declaration.getIdentifier()) || "org.kie.api.runtime.process.WorkflowProcessInstance".equals(declaration.getTypeName())) { Object value = declaration.getValue( ((StatefulKnowledgeSessionImpl) getProcessInstance().getKnowledgeRuntime()).getInternalWorkingMemory(), ((InternalFactHandle) activation.getTuple().get(declaration)).getObject()); if (value instanceof ProcessInstance) { return ((ProcessInstance) value).getId() == getProcessInstance().getId(); } } } return true; }
processInstance.getId()); ((ProcessInstanceImpl) subProcessInstance).setParentProcessInstanceId(processInstance.getId()); subProcessInstance = (ProcessInstance) ksession.startProcessInstance(subProcessInstance.getId()); subProcessNodeInstance.internalSetProcessInstanceId(subProcessInstance.getId()); return subProcessInstance.getId();
return getProcessInstance().getId(); } else if ("parentProcessInstanceId".equals(name) && getProcessInstance() != null) { return getProcessInstance().getParentProcessInstanceId();
this.exceptionHandlingProcessInstanceId = processInstance.getId(); ((ProcessInstanceImpl) processInstance).setMetaData("ParentProcessInstanceId", getProcessInstance().getId()); ((ProcessInstanceImpl) processInstance).setMetaData("ParentNodeInstanceId", getUniqueId()); ((ProcessInstanceImpl) processInstance).setSignalCompletion(true); kruntime.startProcessInstance(processInstance.getId()); if (processInstance.getState() == ProcessInstance.STATE_COMPLETED || processInstance.getState() == ProcessInstance.STATE_ABORTED) {
public void registerTimer(final TimerInstance timer, ProcessInstance processInstance) { try { kruntime.startOperation(); timer.setId(++timerId); timer.setProcessInstanceId(processInstance.getId()); timer.setSessionId(((KieSession) kruntime).getIdentifier()); timer.setActivated(new Date()); Trigger trigger = null; if (timer.getCronExpression() != null) { Date startTime = new Date(timerService.getCurrentTime() + 1000); trigger = new CronTrigger(timerService.getCurrentTime(), startTime, null, -1, timer.getCronExpression(), null, null); // cron timers are by nature repeatable timer.setPeriod(1); } else { trigger = new IntervalTrigger(timerService.getCurrentTime(), null, null, timer.getRepeatLimit(), timer.getDelay(), timer.getPeriod(), null, null); } ProcessJobContext ctx = new ProcessJobContext(timer, trigger, processInstance.getId(), this.kruntime); JobHandle jobHandle = this.timerService.scheduleJob(processJob, ctx, trigger); timer.setJobHandle(jobHandle); timers.put(timer.getId(), timer); } finally { kruntime.endOperation(); } }
processInstance = ( ProcessInstance ) kruntime.createProcessInstance(processId, parameters); this.processInstanceId = processInstance.getId(); ((ProcessInstanceImpl) processInstance).setMetaData("ParentProcessInstanceId", getProcessInstance().getId()); ((ProcessInstanceImpl) processInstance).setMetaData("ParentNodeInstanceId", getUniqueId()); ((ProcessInstanceImpl) processInstance).setSignalCompletion(getSubProcessNode().isWaitForCompletion()); kruntime.startProcessInstance(processInstance.getId()); if (!getSubProcessNode().isWaitForCompletion()) { triggerCompleted();
session, processInstance.getId(), "org.test.ruleflow2", mapping); assertEquals("org.test.ruleflow2", processInstance.getProcessId());
session, processInstance.getId(), "org.test.ruleflow2", new HashMap<String, Long>()); assertEquals("org.test.ruleflow2", processInstance.getProcessId());
session, processInstance.getId(), "org.test.ruleflow2", mapping); assertEquals("org.test.ruleflow2", processInstance.getProcessId());
protected boolean checkProcessInstance(Activation activation) { final Map<?, ?> declarations = activation.getSubRule().getOuterDeclarations(); for ( Iterator<?> it = declarations.values().iterator(); it.hasNext(); ) { Declaration declaration = (Declaration) it.next(); if ("processInstance".equals(declaration.getIdentifier()) || "org.kie.api.runtime.process.WorkflowProcessInstance".equals(declaration.getTypeName())) { Object value = declaration.getValue( ((StatefulKnowledgeSessionImpl) getProcessInstance().getKnowledgeRuntime()).getInternalWorkingMemory(), ((InternalFactHandle) activation.getTuple().get(declaration)).getObject()); if (value instanceof ProcessInstance) { return ((ProcessInstance) value).getId() == getProcessInstance().getId(); } } } return true; }
processInstance.getId()); ((ProcessInstanceImpl) subProcessInstance).setParentProcessInstanceId(processInstance.getId()); subProcessInstance = (ProcessInstance) ksession.startProcessInstance(subProcessInstance.getId()); subProcessNodeInstance.internalSetProcessInstanceId(subProcessInstance.getId()); return subProcessInstance.getId();
return getProcessInstance().getId(); } else if ("parentProcessInstanceId".equals(name) && getProcessInstance() != null) { return getProcessInstance().getParentProcessInstanceId();
this.exceptionHandlingProcessInstanceId = processInstance.getId(); ((ProcessInstanceImpl) processInstance).setMetaData("ParentProcessInstanceId", getProcessInstance().getId()); ((ProcessInstanceImpl) processInstance).setMetaData("ParentNodeInstanceId", getUniqueId()); ((ProcessInstanceImpl) processInstance).setSignalCompletion(true); kruntime.startProcessInstance(processInstance.getId()); if (processInstance.getState() == ProcessInstance.STATE_COMPLETED || processInstance.getState() == ProcessInstance.STATE_ABORTED) {
public void registerTimer(final TimerInstance timer, ProcessInstance processInstance) { try { kruntime.startOperation(); timer.setId(++timerId); timer.setProcessInstanceId(processInstance.getId()); timer.setSessionId(((KieSession) kruntime).getIdentifier()); timer.setActivated(new Date()); Trigger trigger = null; if (timer.getCronExpression() != null) { Date startTime = new Date(timerService.getCurrentTime() + 1000); trigger = new CronTrigger(timerService.getCurrentTime(), startTime, null, -1, timer.getCronExpression(), null, null); // cron timers are by nature repeatable timer.setPeriod(1); } else { trigger = new IntervalTrigger(timerService.getCurrentTime(), null, null, timer.getRepeatLimit(), timer.getDelay(), timer.getPeriod(), null, null); } ProcessJobContext ctx = new ProcessJobContext(timer, trigger, processInstance.getId(), this.kruntime); JobHandle jobHandle = this.timerService.scheduleJob(processJob, ctx, trigger); timer.setJobHandle(jobHandle); timers.put(timer.getId(), timer); } finally { kruntime.endOperation(); } }
processInstance = ( ProcessInstance ) kruntime.createProcessInstance(processId, parameters); this.processInstanceId = processInstance.getId(); ((ProcessInstanceImpl) processInstance).setMetaData("ParentProcessInstanceId", getProcessInstance().getId()); ((ProcessInstanceImpl) processInstance).setMetaData("ParentNodeInstanceId", getUniqueId()); ((ProcessInstanceImpl) processInstance).setSignalCompletion(getSubProcessNode().isWaitForCompletion()); kruntime.startProcessInstance(processInstance.getId()); if (!getSubProcessNode().isWaitForCompletion()) { triggerCompleted();