private boolean checkProcessInstance(Activation activation, long processInstanceId) { final Map<String, Declaration> declarations = activation.getSubRule().getOuterDeclarations(); for (Declaration declaration : declarations.values()) { if ("processInstance".equals(declaration.getIdentifier())) { Object value = declaration.getValue(workingMemory, activation.getTuple().get(declaration).getObject()); if (value instanceof ProcessInstance) { return ((ProcessInstance) value).getId() == processInstanceId; } } } return true; }
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 Object getDeclarationValue(String variableName) { Declaration decl = ((RuleImpl) this.rule).getDeclaration(variableName); return decl.getValue( null, ((InternalFactHandle) factHandles.get(decl.getPattern().getOffset())).getObject()); }