Tabnine Logo
NodeInstance
Code IndexAdd Tabnine to your IDE (free)

How to use
NodeInstance
in
org.jbpm.workflow.instance

Best Java code snippets using org.jbpm.workflow.instance.NodeInstance (Showing top 20 results out of 315)

Refine searchRefine arrow

  • Node
  • NodeInstanceContainer
  • NodeInstanceImpl
  • WorkflowProcessInstanceImpl
  • NodeInstance
origin: kiegroup/jbpm

public NodeInstance getNodeInstance(long nodeInstanceId, boolean recursive) {
  for (NodeInstance nodeInstance: getNodeInstances(recursive)) {
    if (nodeInstance.getId() == nodeInstanceId) {
      return nodeInstance;
    }
  }
  return null;
}
origin: kiegroup/jbpm

public JBPMMessages.ProcessInstance.NodeInstance writeNodeInstance(MarshallerWriteContext context,
                                  NodeInstance nodeInstance) throws IOException {
  JBPMMessages.ProcessInstance.NodeInstance.Builder _node = JBPMMessages.ProcessInstance.NodeInstance.newBuilder()
      .setId( nodeInstance.getId() )
      .setNodeId( nodeInstance.getNodeId())
      .setLevel(((org.jbpm.workflow.instance.NodeInstance)nodeInstance).getLevel())
      .setSlaCompliance(((org.jbpm.workflow.instance.NodeInstance)nodeInstance).getSlaCompliance());
          
  if (((org.jbpm.workflow.instance.NodeInstance)nodeInstance).getSlaDueDate() != null) {
    _node.setSlaDueDate(((org.jbpm.workflow.instance.NodeInstance)nodeInstance).getSlaDueDate().getTime());
  }
  if (((org.jbpm.workflow.instance.NodeInstance)nodeInstance).getSlaTimerId() != null) {
    _node.setSlaTimerId(((org.jbpm.workflow.instance.NodeInstance)nodeInstance).getSlaTimerId());
  }
  
  _node.setContent( writeNodeInstanceContent( _node, 
                        nodeInstance, 
                        context ) );
  return _node.build();
}
origin: kiegroup/jbpm

@SuppressWarnings("unchecked")
private void updateNodeInstances(NodeInstanceContainer nodeInstanceContainer, Map<String, String> nodeMapping, NodeContainer nodeContainer, EntityManager em) {
  for (NodeInstance nodeInstance : nodeInstanceContainer.getNodeInstances()) {
    if (nodeInstance.getNode() == null) {
      continue;
    String oldNodeId = (String) ((NodeImpl) ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).getNode()).getMetaData().get("UniqueId");
    String newNodeId = nodeMapping.get(oldNodeId);
    if (newNodeId == null) {
      Boolean isHidden = (Boolean) ((NodeImpl) ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).getNode()).getMetaData().get("hidden");
      if (isHidden != null && isHidden.booleanValue()) {
      upgradedNodeId = upgradedNode.getId();
    ((NodeInstanceImpl) nodeInstance).setNodeId(upgradedNodeId);
      nodeInstanceIdQuery
                .setParameter("oldNodeId", oldNodeId)
                .setParameter("processInstanceId", nodeInstance.getProcessInstance().getId());
                          "where nodeInstanceId in (:ids) and processInstanceId = :processInstanceId");
        nodeLogQuery
              .setParameter("nodeId", (String) upgradedNode.getMetaData().get("UniqueId"))
              .setParameter("nodeName", VariableUtil.resolveVariable(upgradedNode.getName(), nodeInstance))
              .setParameter("nodeType", upgradedNode.getClass().getSimpleName())
              .setParameter("ids", nodeInstanceIds)
              .setParameter("processInstanceId", nodeInstance.getProcessInstance().getId());
origin: kiegroup/jbpm

public NodeInstance getFirstNodeInstance(final long nodeId) {
  for (final Iterator<NodeInstance> iterator = this.nodeInstances
      .iterator(); iterator.hasNext();) {
    final NodeInstance nodeInstance = iterator.next();
    if (nodeInstance.getNodeId() == nodeId && nodeInstance.getLevel() == getCurrentLevel()) {
      return nodeInstance;
    }
  }
  return null;
}
origin: kiegroup/jbpm

public NodeInstance getFirstNodeInstance(final long nodeId) {
  for ( final Iterator<NodeInstance> iterator = this.nodeInstances.iterator(); iterator.hasNext(); ) {
    final NodeInstance nodeInstance = iterator.next();
    if ( nodeInstance.getNodeId() == nodeId && nodeInstance.getLevel() == getCurrentLevel()) {
      return nodeInstance;
    }
  }
  return null;
}
origin: kiegroup/jbpm

@SuppressWarnings("unchecked")
protected void triggerSelectedNode(Node node, Object event) {
  NodeInstance nodeInstance = getNodeInstance(node);
  if (event != null) {                             
    Map<String, Object> dynamicParams = new HashMap<>();
    if (event instanceof Map) {
      dynamicParams.putAll((Map<String, Object>) event);                                  
    } else {
      dynamicParams.put("Data", event);
    }
    ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).setDynamicParameters(dynamicParams);
  }
  ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).trigger(null, NodeImpl.CONNECTION_DEFAULT_TYPE);
}

origin: kiegroup/jbpm

@SuppressWarnings("unchecked")
public void signalEvent(String type, Object event) {
  logger.debug("Signal {} received with data {} in process instance {}", type, event, getId());
  synchronized (this) {
    if (getState() != ProcessInstance.STATE_ACTIVE) {
      return;
      TimerInstance timer = (TimerInstance) event;
      if (timer.getId() == slaTimerId) {
        handleSLAViolation();
                dynamicNodeInstance.signalEvent(type, event);
              } else {
                List<NodeInstance> nodeInstances = getNodeInstances(node.getId(), currentView);
                if (nodeInstances != null && !nodeInstances.isEmpty()) {
                  for (NodeInstance nodeInstance : nodeInstances) {
      if (((org.jbpm.workflow.core.WorkflowProcess) getWorkflowProcess()).isDynamic()) {
        for (Node node : getWorkflowProcess().getNodes()) {
          if (type.equals(node.getName()) && node.getIncomingConnections().isEmpty()) {
            NodeInstance nodeInstance = getNodeInstance(node);
            if (event != null) {
                dynamicParams.put("Data", event);
              ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).setDynamicParameters(dynamicParams);
            ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).trigger(null, NodeImpl.CONNECTION_DEFAULT_TYPE);
origin: kiegroup/jbpm

public final void trigger(NodeInstance from, String type) {
  boolean hidden = false;
  if (getNode().getMetaData().get("hidden") != null) {
    hidden = true;
    int level = ((org.jbpm.workflow.instance.NodeInstance)from).getLevel();
    ((org.jbpm.workflow.instance.NodeInstanceContainer)getNodeInstanceContainer()).setCurrentLevel(level);
    Collection<Connection> incoming = getNode().getIncomingConnections(type);
    for (Connection conn : incoming) {
      if (conn.getFrom().getId() == from.getNodeId()) {
        this.metaData.put("IncomingConnection", conn.getMetaData().get("UniqueId"));
        break;
origin: kiegroup/jbpm

protected void triggerNodeInstance(org.jbpm.workflow.instance.NodeInstance nodeInstance, String type, boolean fireEvents) {
  boolean hidden = false;
  if (getNode().getMetaData().get("hidden") != null) {
    hidden = true;
  }
  InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime();
  if (!hidden && fireEvents) {
    ((InternalProcessRuntime) kruntime.getProcessRuntime())
      .getProcessEventSupport().fireBeforeNodeLeft(this, kruntime);
  }
  // trigger next node
  nodeInstance.trigger(this, type);
  Collection<Connection> outgoing = getNode().getOutgoingConnections(type);
  for (Connection conn : outgoing) {
    if (conn.getTo().getId() == nodeInstance.getNodeId()) {
      this.metaData.put("OutgoingConnection", conn.getMetaData().get("UniqueId"));
      break;
    }
  }
  if (!hidden && fireEvents) {
    ((InternalProcessRuntime) kruntime.getProcessRuntime())
      .getProcessEventSupport().fireAfterNodeLeft(this, kruntime);
  }
}

origin: kiegroup/jbpm

private static void updateNodeInstances(NodeInstanceContainer nodeInstanceContainer, Map<String, Long> nodeMapping) {
  for (NodeInstance nodeInstance : nodeInstanceContainer.getNodeInstances()) {
    String oldNodeId = ((NodeImpl)
        ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).getNode()).getUniqueId();
    Long newNodeId = nodeMapping.get(oldNodeId);
    if (newNodeId == null) {
      newNodeId = nodeInstance.getNodeId();
    }
    // clean up iteration levels for removed (old) nodes
    Map<String, Integer> iterLevels = ((WorkflowProcessInstanceImpl) nodeInstance.getProcessInstance()).getIterationLevels();
    String uniqueId = (String) ((NodeImpl) nodeInstance.getNode()).getMetaData("UniqueId");
    iterLevels.remove(uniqueId);
    // and now set to new node id
    ((NodeInstanceImpl) nodeInstance).setNodeId(newNodeId);
    if (nodeInstance instanceof NodeInstanceContainer) {
      updateNodeInstances((NodeInstanceContainer) nodeInstance, nodeMapping);
    }
  }
}
origin: kiegroup/jbpm

List<Connection> connections = nodeAndType.getNode().getIncomingConnections(nodeAndType.getType());
for (Iterator<Connection> iterator = connections.iterator(); iterator.hasNext(); ) {
  Connection connection = iterator.next();
  if ((connection.getFrom() instanceof CompositeNode.CompositeNodeStart) &&
      (from == null ||
      ((CompositeNode.CompositeNodeStart) connection.getFrom()).getInNode().getId() == from.getNodeId())) {
    NodeInstance nodeInstance = getNodeInstance(connection.getFrom());
    ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).trigger(null, nodeAndType.getType());
    return;
      NodeInstance nodeInstance = getNodeInstance(startNode);
      ((org.jbpm.workflow.instance.NodeInstance) nodeInstance)
        .trigger(null, null);
      found = true;
origin: kiegroup/jbpm

if (getNode().getMetaData().get("hidden") != null) {
  hidden = true;
    .getProcessEventSupport().fireBeforeNodeLeft(this, kruntime);
((NodeInstanceContainer) getNodeInstanceContainer()).removeNodeInstance(this);
if (getEndNode().isTerminate()) {
  if (getNodeInstanceContainer() instanceof CompositeNodeInstance) {
    } else {
      while (!getNodeInstanceContainer().getNodeInstances().isEmpty()) {
        ((org.jbpm.workflow.instance.NodeInstance) getNodeInstanceContainer().getNodeInstances().iterator().next()).cancel();
      ((NodeInstanceContainer) getNodeInstanceContainer()).nodeInstanceCompleted(this, null);
    ((NodeInstanceContainer) getNodeInstanceContainer()).setState( ProcessInstance.STATE_COMPLETED );
origin: kiegroup/jbpm

((NodeInstanceContainer) getNodeInstanceContainer()).removeNodeInstance(this);
if ( selected == null ) {
  for ( final Iterator<Connection> iterator = outgoing.iterator(); iterator.hasNext(); ) {
  ((NodeInstanceContainer)getNodeInstanceContainer()).setCurrentLevel(1);
((NodeInstanceContainer) getNodeInstanceContainer()).removeNodeInstance(this);
outgoing = split.getDefaultOutgoingConnections();
boolean found = false;
List<Connection> connections = null;
if (node != null) {
  connections = node.getOutgoingConnections(type);
    if (getNode().getMetaData().get("hidden") != null) {
      hidden = true;
        .getProcessEventSupport().fireBeforeNodeLeft(this, kruntime);
    ((org.jbpm.workflow.instance.NodeInstance) entry.getKey()).trigger(this, entry.getValue());
    if (!hidden) {
      ((InternalProcessRuntime) kruntime.getProcessRuntime())
origin: kiegroup/jbpm

public void nodeInstanceCompleted(NodeInstance nodeInstance, String outType) {
  Node nodeInstanceNode = nodeInstance.getNode();
  if( nodeInstanceNode != null ) {
    Object compensationBoolObj =  nodeInstanceNode.getMetaData().get("isForCompensation");
    boolean isForCompensation = compensationBoolObj == null ? false : ((Boolean) compensationBoolObj);
    if( isForCompensation ) {
      return;
    }
  }
  if (nodeInstance instanceof FaultNodeInstance || nodeInstance instanceof EndNodeInstance ||
      ((org.jbpm.workflow.core.WorkflowProcess) getWorkflowProcess()).isDynamic()
      || nodeInstance instanceof CompositeNodeInstance) {
    if (((org.jbpm.workflow.core.WorkflowProcess) getProcess()).isAutoComplete()) {
      if (canComplete()) {
        setState(ProcessInstance.STATE_COMPLETED);
      }
    }
  } else {
    throw new IllegalArgumentException(
        "Completing a node instance that has no outgoing connection is not supported.");
  }
}
origin: kiegroup/jbpm

public void nodeInstanceCompleted(NodeInstance nodeInstance, String outType) {
  Node nodeInstanceNode = nodeInstance.getNode();
  if( nodeInstanceNode != null ) {
    Object compensationBoolObj =  nodeInstanceNode.getMetaData().get("isForCompensation");
    boolean isForCompensation = compensationBoolObj == null ? false : ((Boolean) compensationBoolObj);
    if( isForCompensation ) {
      return;
    }
  }
  if (nodeInstance instanceof FaultNodeInstance || nodeInstance instanceof EndNodeInstance || nodeInstance instanceof EventSubProcessNodeInstance ) {
    if (getCompositeNode().isAutoComplete()) {
      if (nodeInstances.isEmpty()) {
        triggerCompleted(
          org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE);
      }
    }
  } else {
    throw new IllegalArgumentException(
      "Completing a node instance that has no outgoing connection not supported.");
  }
}
origin: kiegroup/jbpm

private void updateNodeInstances(NodeInstanceContainer nodeInstanceContainer, Map<String, Long> nodeMapping) {
  for (NodeInstance nodeInstance: nodeInstanceContainer.getNodeInstances()) {
    String oldNodeId = ((NodeImpl)
      ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).getNode()).getUniqueId();
    Long newNodeId = nodeMapping.get(oldNodeId);
    if (newNodeId == null) {
      newNodeId = nodeInstance.getNodeId();
    }
    ((NodeInstanceImpl) nodeInstance).setNodeId(newNodeId);
    if (nodeInstance instanceof NodeInstanceContainer) {
      updateNodeInstances((NodeInstanceContainer) nodeInstance, nodeMapping);
    }
  }
}

origin: kiegroup/jbpm

if (((org.jbpm.workflow.instance.NodeInstance)nodeInstance).getLevel() != getLevel()) {
  continue;
Node node = nodeInstance.getNode();            
Set<Long> vistedNodes = new HashSet<Long>();
checkNodes(vistedNodes,node,  node, lookFor);
if (vistedNodes.contains(lookFor.getId()) && !vistedNodes.contains(node.getId())) {
  return true;
origin: kiegroup/jbpm

public void internalStart(String trigger) {
  StartNode startNode = getRuleFlowProcess().getStart(trigger);
  if (startNode != null) {
    ((NodeInstance) getNodeInstance(startNode)).trigger(null, null);
  } else if (!getRuleFlowProcess().isDynamic()) {
    throw new IllegalArgumentException("There is no start node that matches the trigger " + (trigger == null ? "none" : trigger));
  }
  
  // activate ad hoc fragments if they are marked as such
  List<Node> autoStartNodes = getRuleFlowProcess().getAutoStartNodes();
  autoStartNodes
    .forEach(austoStartNode -> signalEvent(austoStartNode.getName(), null));
}
origin: kiegroup/jbpm

if (event.getNodeInstance() != null) {
  long nodeInstanceId = event.getNodeInstance().getId();
  long processInstanceId = event.getProcessInstance().getId();
  NodeInstanceLog log = (NodeInstanceLog) ((NodeInstanceImpl) event.getNodeInstance()).getMetaData().get("NodeInstanceLog");
  if (log == null) {
    List<NodeInstanceLog> result = em.createQuery(
    log.setSlaCompliance(((NodeInstance)event.getNodeInstance()).getSlaCompliance());
    em.merge(log);
origin: kiegroup/jbpm

public void internalTrigger(org.kie.api.runtime.process.NodeInstance fromm, String type) {
  String collectionExpression = getForEachNode().getCollectionExpression();
  Collection<?> collection = evaluateCollectionExpression(collectionExpression);
  ((NodeInstanceContainer) getNodeInstanceContainer()).removeNodeInstance(this);
  if (collection.isEmpty()) {
    ForEachNodeInstance.this.triggerCompleted(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE, true);
  } else {
    List<NodeInstance> nodeInstances = new ArrayList<NodeInstance>();
    for (Object o: collection) {
      String variableName = getForEachNode().getVariableName();
      NodeInstance nodeInstance = (NodeInstance)
      ((NodeInstanceContainer) getNodeInstanceContainer()).getNodeInstance(getForEachSplitNode().getTo().getTo());
      VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
        nodeInstance.resolveContextInstance(VariableScope.VARIABLE_SCOPE, variableName);
      variableScopeInstance.setVariable(variableName, o);
      nodeInstances.add(nodeInstance);
    }
    for (NodeInstance nodeInstance: nodeInstances) {
      logger.debug( "Triggering [{}] in multi-instance loop.", ((NodeInstanceImpl) nodeInstance).getNodeId() );
      ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).trigger(this, getForEachSplitNode().getTo().getToType());
    }
    if (!getForEachNode().isWaitForCompletion()) {
      ForEachNodeInstance.this.triggerCompleted(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE, false);
    }
  }
}
org.jbpm.workflow.instanceNodeInstance

Javadoc

Represents a node instance in a RuleFlow. This is the runtime counterpart of a node, containing all runtime state. Node instance classes also contain the logic on what to do when it is being triggered (start executing) or completed (end of execution).

Most used methods

  • getId
  • getSlaCompliance
  • getNode
  • resolveContextInstance
  • trigger
  • cancel
  • getLevel
  • getNodeId
  • getNodeInstanceContainer
  • getNodeName
  • getProcessInstance
  • getSlaDueDate
  • getProcessInstance,
  • getSlaDueDate,
  • getSlaTimerId,
  • setDynamicParameters

Popular in Java

  • Reading from database using SQL prepared statement
  • compareTo (BigDecimal)
  • getContentResolver (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • JComboBox (javax.swing)
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now