protected boolean actAsWaitState() { Object asWaitState = getProcessInstance().getKnowledgeRuntime().getEnvironment().get(ACT_AS_WAIT_STATE_PROPERTY); if (asWaitState != null) { return Boolean.parseBoolean(asWaitState.toString()); } return false; }
protected boolean useAsync(final Node node) { if (!(node instanceof EventSubProcessNode) && (node instanceof ActionNode || node instanceof StateBasedNode || node instanceof EndNode)) { boolean asyncMode = Boolean.parseBoolean((String)node.getMetaData().get("customAsync")); if (asyncMode) { return asyncMode; } return Boolean.parseBoolean((String)getProcessInstance().getKnowledgeRuntime().getEnvironment().get("AsyncMode")); } return false; }
public void retractFacts() { Map<String, Object> objects = new HashMap<String, Object>(); KieRuntime kruntime = getProcessInstance().getKnowledgeRuntime(); for (Entry<String, FactHandle> entry : factHandles.entrySet()) { Object object = ((StatefulKnowledgeSession)kruntime).getObject(entry.getValue()); String key = entry.getKey(); key = key.replaceAll(getRuleFlowGroup()+"_", ""); key = key.replaceAll(getProcessInstance().getId()+"_", ""); objects.put(key , object); kruntime.delete(entry.getValue()); } processOutputs(objects); factHandles.clear(); }
private void cancelSlaTimer() { if (this.slaTimerId > -1) { TimerManager timerManager = ((InternalProcessRuntime) getProcessInstance().getKnowledgeRuntime().getProcessRuntime()).getTimerManager(); timerManager.cancelTimer(this.slaTimerId); logger.debug("SLA Timer {} has been canceled", this.slaTimerId); } }
private void cancelSlaTimer() { if (this.slaTimerId > -1) { TimerManager timerManager = ((InternalProcessRuntime) getProcessInstance().getKnowledgeRuntime().getProcessRuntime()).getTimerManager(); timerManager.cancelTimer(this.slaTimerId); logger.debug("SLA Timer {} has been canceled", this.slaTimerId); } }
protected void handleSLAViolation() { if (slaCompliance == ProcessInstance.SLA_PENDING) { InternalProcessRuntime processRuntime = ((InternalProcessRuntime) getProcessInstance().getKnowledgeRuntime().getProcessRuntime()); processRuntime.getProcessEventSupport().fireBeforeSLAViolated(getProcessInstance(), this, getProcessInstance().getKnowledgeRuntime()); logger.debug("SLA violated on node instance {}", getId()); this.slaCompliance = ProcessInstance.SLA_VIOLATED; this.slaTimerId = -1; processRuntime.getProcessEventSupport().fireAfterSLAViolated(getProcessInstance(), this, getProcessInstance().getKnowledgeRuntime()); } }
protected void handleSLAViolation() { if (slaCompliance == ProcessInstance.SLA_PENDING) { InternalProcessRuntime processRuntime = ((InternalProcessRuntime) getProcessInstance().getKnowledgeRuntime().getProcessRuntime()); processRuntime.getProcessEventSupport().fireBeforeSLAViolated(getProcessInstance(), this, getProcessInstance().getKnowledgeRuntime()); logger.debug("SLA violated on node instance {}", getId()); this.slaCompliance = ProcessInstance.SLA_VIOLATED; this.slaTimerId = -1; processRuntime.getProcessEventSupport().fireAfterSLAViolated(getProcessInstance(), this, getProcessInstance().getKnowledgeRuntime()); } }
private String getRuleSetEventType() { InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime(); if (kruntime instanceof StatefulKnowledgeSession) { return "RuleFlowGroup_" + getRuleFlowGroup() + "_" + ((StatefulKnowledgeSession) kruntime).getIdentifier(); } else { return "RuleFlowGroup_" + getRuleFlowGroup(); } }
private void cancelTimers() { // deactivate still active timers if (timerInstances != null) { TimerManager timerManager = ((InternalProcessRuntime) getProcessInstance().getKnowledgeRuntime().getProcessRuntime()).getTimerManager(); for (Long id: timerInstances) { timerManager.cancelTimer(id); } } }
private void handleAssignment(Assignment assignment) { AssignmentAction action = (AssignmentAction) assignment.getMetaData("Action"); try { ProcessContext context = new ProcessContext(getProcessInstance().getKnowledgeRuntime()); context.setNodeInstance(this); action.execute(getWorkItem(), context); } catch (Exception e) { throw new RuntimeException("unable to execute Assignment", e); } }
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; }
public void triggerCompleted(String outType) { ((InternalAgenda) getProcessInstance().getKnowledgeRuntime().getAgenda()) .deactivateRuleFlowGroup(getRuleFlowGroupName()); super.triggerCompleted(outType); }
public void cancel() { ((InternalProcessRuntime) getProcessInstance().getKnowledgeRuntime() .getProcessRuntime()).getTimerManager().cancelTimer(timerId); super.cancel(); }
protected ExecutionErrorHandler getExecutionErrorHandler() { ExecutionErrorManager errorManager = (ExecutionErrorManager) getProcessInstance().getKnowledgeRuntime().getEnvironment().get(EnvironmentName.EXEC_ERROR_MANAGER); if (errorManager == null) { return new NoOpExecutionErrorHandler(); } return errorManager.getHandler(); }
public void internalTrigger(NodeInstance from, String type) { if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) { throw new IllegalArgumentException( "A TimerNode only accepts default incoming connections!"); } InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime(); timerInstance = createTimerInstance(kruntime); if (getTimerInstances() == null) { addTimerListener(); } ((InternalProcessRuntime)kruntime.getProcessRuntime()) .getTimerManager().registerTimer(timerInstance, (ProcessInstance) getProcessInstance()); timerId = timerInstance.getId(); }
private void addActivationListener() { getProcessInstance().getKnowledgeRuntime().addEventListener(this); getProcessInstance().addEventListener(getActivationEventType(), this, true); }
private void addActivationListener() { getProcessInstance().getKnowledgeRuntime().addEventListener(this); getProcessInstance().addEventListener(getActivationEventType(), this, true); }
public void removeEventListeners() { super.removeEventListeners(); getProcessInstance().getKnowledgeRuntime().removeEventListener(this); getProcessInstance().removeEventListener(getActivationEventType(), this, true); }
public void removeEventListeners() { super.removeEventListeners(); getProcessInstance().getKnowledgeRuntime().removeEventListener(this); getProcessInstance().removeEventListener(getActivationEventType(), this, true); }
public void cancel() { super.cancel(); if (actAsWaitState()) { ((InternalAgenda) getProcessInstance().getKnowledgeRuntime().getAgenda()).deactivateRuleFlowGroup(getRuleFlowGroup()); } }