예제 #1
0
 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;
 }
예제 #2
0
 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;
 }
예제 #3
0
 public Object getDeclarationValue(String variableName) {
   Declaration decl = ((RuleImpl) this.rule).getDeclaration(variableName);
   return decl.getValue(
       null, ((InternalFactHandle) factHandles.get(decl.getPattern().getOffset())).getObject());
 }