Codota Logo
ProcessContext.setNodeInstance
Code IndexAdd Codota to your IDE (free)

How to use
setNodeInstance
method
in
org.drools.core.spi.ProcessContext

Best Java code snippets using org.drools.core.spi.ProcessContext.setNodeInstance (Showing top 11 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
LocalDateTime l =
  • Codota Iconnew LocalDateTime()
  • Codota IconLocalDateTime.now()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseLocalDateTime(text)
  • Smart code suggestions by Codota
}
origin: kiegroup/jbpm

public boolean evaluate(NodeInstance instance,
            Connection connection,
            Constraint constraint) {
  Object value;
  try {
    ProcessContext context = new ProcessContext(((ProcessInstance)instance.getProcessInstance()).getKnowledgeRuntime());
    context.setNodeInstance( instance );
    value = this.evaluator.evaluate( context );
  } catch ( Exception e ) {
    throw new RuntimeException( "unable to execute ReturnValueEvaluator: ",
                  e );
  }
  if ( !(value instanceof Boolean) ) {
    throw new RuntimeException( "Constraints must return boolean values: " + value + " for expression " + constraint);
  }
  return ((Boolean) value).booleanValue();
}
origin: kiegroup/jbpm

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);
  }
}
origin: kiegroup/jbpm

/**
 * This method is used in both instances of the {@link ExtendedNodeInstanceImpl}
 * and {@link ActionNodeInstance} instances in order to handle 
 * exceptions thrown when executing actions.
 * 
 * @param action An {@link Action} instance.
 */
protected void executeAction(Action action) {
  ProcessContext context = new ProcessContext(getProcessInstance().getKnowledgeRuntime());
  context.setNodeInstance(this);
  try {
    action.execute(context);
  } catch (Exception e) {
    String exceptionName = e.getClass().getName();
    ExceptionScopeInstance exceptionScopeInstance = (ExceptionScopeInstance)
      resolveContextInstance(ExceptionScope.EXCEPTION_SCOPE, exceptionName);
    if (exceptionScopeInstance == null) {
      throw new WorkflowRuntimeException(this, getProcessInstance(), "Unable to execute Action: " + e.getMessage(), e);
    }
    
    exceptionScopeInstance.handleException(exceptionName, e);
    cancel();
  }
}

origin: kiegroup/jbpm

public void internalTrigger(final NodeInstance from, String type) {
  if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) {
    throw new IllegalArgumentException(
      "An ActionNode only accepts default incoming connections!");
  }
  Action action = (Action) getActionNode().getAction().getMetaData("Action");
  try {
    ProcessContext context = new ProcessContext(getProcessInstance().getKnowledgeRuntime());
    context.setNodeInstance(this);
    executeAction(action);
  } catch( WorkflowRuntimeException wre) { 
    throw wre;
  } catch (Exception e) {
    // for the case that one of the following throws an exception
    // - the ProcessContext() constructor 
    // - or context.setNodeInstance(this) 
    throw new WorkflowRuntimeException(this, getProcessInstance(), "Unable to execute Action: " + e.getMessage(), e);
  } 
  triggerCompleted();
}
origin: kiegroup/jbpm

public void handleException(ExceptionHandler handler, String exception, Object params) {
  
  if (handler instanceof ActionExceptionHandler) {
    ActionExceptionHandler exceptionHandler = (ActionExceptionHandler) handler;
    Action action = (Action) exceptionHandler.getAction().getMetaData("Action");
    try {
      ProcessInstance processInstance = getProcessInstance();
      ProcessContext processContext = new ProcessContext(processInstance.getKnowledgeRuntime());
      ContextInstanceContainer contextInstanceContainer = getContextInstanceContainer();
      if (contextInstanceContainer instanceof NodeInstance) {
        processContext.setNodeInstance((NodeInstance) contextInstanceContainer);
      } else {
        processContext.setProcessInstance(processInstance);
      }
      String faultVariable = exceptionHandler.getFaultVariable();
      if (faultVariable != null) {
        processContext.setVariable(faultVariable, params);
      }
      action.execute(processContext);
    } catch (Exception e) {
      throw new RuntimeException("unable to execute Action", e);
    }
  } else {
    throw new IllegalArgumentException("Unknown exception handler " + handler);
  }
}
origin: org.jbpm/jbpm-flow

public boolean evaluate(NodeInstance instance,
            Connection connection,
            Constraint constraint) {
  Object value;
  try {
    ProcessContext context = new ProcessContext(((ProcessInstance)instance.getProcessInstance()).getKnowledgeRuntime());
    context.setNodeInstance( instance );
    value = this.evaluator.evaluate( context );
  } catch ( Exception e ) {
    throw new RuntimeException( "unable to execute ReturnValueEvaluator: ",
                  e );
  }
  if ( !(value instanceof Boolean) ) {
    throw new RuntimeException( "Constraints must return boolean values: " + value + " for expression " + constraint);
  }
  return ((Boolean) value).booleanValue();
}
origin: org.jbpm/jbpm-flow

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);
  }
}
origin: org.jbpm/jbpm-flow

/**
 * This method is used in both instances of the {@link ExtendedNodeInstanceImpl}
 * and {@link ActionNodeInstance} instances in order to handle 
 * exceptions thrown when executing actions.
 * 
 * @param action An {@link Action} instance.
 */
protected void executeAction(Action action) {
  ProcessContext context = new ProcessContext(getProcessInstance().getKnowledgeRuntime());
  context.setNodeInstance(this);
  try {
    action.execute(context);
  } catch (Exception e) {
    String exceptionName = e.getClass().getName();
    ExceptionScopeInstance exceptionScopeInstance = (ExceptionScopeInstance)
      resolveContextInstance(ExceptionScope.EXCEPTION_SCOPE, exceptionName);
    if (exceptionScopeInstance == null) {
      throw new WorkflowRuntimeException(this, getProcessInstance(), "Unable to execute Action: " + e.getMessage(), e);
    }
    
    exceptionScopeInstance.handleException(exceptionName, e);
    cancel();
  }
}

origin: org.jbpm/jbpm-flow

public void internalTrigger(final NodeInstance from, String type) {
  if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) {
    throw new IllegalArgumentException(
      "An ActionNode only accepts default incoming connections!");
  }
  Action action = (Action) getActionNode().getAction().getMetaData("Action");
  try {
    ProcessContext context = new ProcessContext(getProcessInstance().getKnowledgeRuntime());
    context.setNodeInstance(this);
    executeAction(action);
  } catch( WorkflowRuntimeException wre) { 
    throw wre;
  } catch (Exception e) {
    // for the case that one of the following throws an exception
    // - the ProcessContext() constructor 
    // - or context.setNodeInstance(this) 
    throw new WorkflowRuntimeException(this, getProcessInstance(), "Unable to execute Action: " + e.getMessage(), e);
  } 
  triggerCompleted();
}
origin: org.jbpm/jbpm-flow

public void handleException(ExceptionHandler handler, String exception, Object params) {
  
  if (handler instanceof ActionExceptionHandler) {
    ActionExceptionHandler exceptionHandler = (ActionExceptionHandler) handler;
    Action action = (Action) exceptionHandler.getAction().getMetaData("Action");
    try {
      ProcessInstance processInstance = getProcessInstance();
      ProcessContext processContext = new ProcessContext(processInstance.getKnowledgeRuntime());
      ContextInstanceContainer contextInstanceContainer = getContextInstanceContainer();
      if (contextInstanceContainer instanceof NodeInstance) {
        processContext.setNodeInstance((NodeInstance) contextInstanceContainer);
      } else {
        processContext.setProcessInstance(processInstance);
      }
      String faultVariable = exceptionHandler.getFaultVariable();
      if (faultVariable != null) {
        processContext.setVariable(faultVariable, params);
      }
      action.execute(processContext);
    } catch (Exception e) {
      throw new RuntimeException("unable to execute Action", e);
    }
  } else {
    throw new IllegalArgumentException("Unknown exception handler " + handler);
  }
}
origin: org.jbpm.contrib/java-workitem

WorkItemNodeInstance nodeInstance = findNodeInstance(workItem.getId(),
                           processInstance);
kcontext.setNodeInstance(nodeInstance);
Map<String, Object> results = handler.execute(kcontext);
org.drools.core.spiProcessContextsetNodeInstance

Popular methods of ProcessContext

  • <init>
  • setProcessInstance
  • getCaseAssignment
  • getCaseData
  • setVariable

Popular in Java

  • Running tasks concurrently on multiple threads
  • notifyDataSetChanged (ArrayAdapter)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • BufferedInputStream (java.io)
    Wraps an existing InputStream and buffers the input. Expensive interaction with the underlying input
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • PriorityQueue (java.util)
    An unbounded priority Queue based on a priority heap. The elements of the priority queue are ordered
  • Pattern (java.util.regex)
    A compiled representation of a regular expression. A regular expression, specified as a string, must
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Runner (org.openjdk.jmh.runner)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now