public void internalTrigger(final NodeInstance from, String type) { super.internalTrigger(from, type); // if node instance was cancelled, abort if (getNodeInstanceContainer().getNodeInstance(getId()) == null) { return; } if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) { throw new IllegalArgumentException( "A MilestoneNode only accepts default incoming connections!"); } String rule = "RuleFlow-Milestone-" + getProcessInstance().getProcessId() + "-" + getMilestoneNode().getUniqueId(); boolean isActive = ((InternalAgenda) getProcessInstance().getKnowledgeRuntime().getAgenda()) .isRuleActiveInRuleFlowGroup("DROOLS_SYSTEM", rule, getProcessInstance().getId()); if (isActive) { triggerCompleted(); } else { addActivationListener(); } }
public void matchCreated(MatchCreatedEvent event) { // check whether this activation is from the DROOLS_SYSTEM agenda group String ruleFlowGroup = ((RuleImpl) event.getMatch().getRule()).getRuleFlowGroup(); if ("DROOLS_SYSTEM".equals(ruleFlowGroup)) { // new activations of the rule associate with a milestone node // trigger node instances of that milestone node String ruleName = event.getMatch().getRule().getName(); String milestoneName = "RuleFlow-Milestone-" + getProcessInstance().getProcessId() + "-" + getMilestoneNode().getUniqueId(); if (milestoneName.equals(ruleName) && checkProcessInstance((Activation) event.getMatch()) && checkDeclarationMatch(event.getMatch(), getMilestoneNode().getMatchVariable())) { synchronized(getProcessInstance()) { removeEventListeners(); triggerCompleted(); } } } }
private void addActivationListener() { getProcessInstance().getKnowledgeRuntime().addEventListener(this); getProcessInstance().addEventListener(getActivationEventType(), this, true); }
@Override public void signalEvent(String type, Object event) { if (getActivationEventType().equals(type)) { if (event instanceof MatchCreatedEvent) { matchCreated((MatchCreatedEvent) event); } } else { super.signalEvent(type, event); } }
private String getActivationEventType() { return "RuleFlow-Milestone-" + getProcessInstance().getProcessId() + "-" + getMilestoneNode().getUniqueId(); }
nodeInstance = new MilestoneNodeInstance(); nbTimerInstances = stream.readInt(); if (nbTimerInstances > 0) { timerInstances.add(stream.readLong()); ((MilestoneNodeInstance) nodeInstance).internalSetTimerInstances(timerInstances);
public void addEventListeners() { super.addEventListeners(); addActivationListener(); }
protected MilestoneNode getMilestoneNode() { return (MilestoneNode) getNode(); }
nodeInstance = new MilestoneNodeInstance(); if ( _content.getMilestone().getTimerInstanceIdCount() > 0 ) { List<Long> timerInstances = new ArrayList<Long>(); timerInstances.add( _timerId ); ((MilestoneNodeInstance) nodeInstance).internalSetTimerInstances( timerInstances );
@Override public void signalEvent(String type, Object event) { if (getActivationEventType().equals(type)) { if (event instanceof MatchCreatedEvent) { matchCreated((MatchCreatedEvent) event); } } else { super.signalEvent(type, event); } }
private String getActivationEventType() { return "RuleFlow-Milestone-" + getProcessInstance().getProcessId() + "-" + getMilestoneNode().getUniqueId(); }
public void addEventListeners() { super.addEventListeners(); addActivationListener(); }
protected MilestoneNode getMilestoneNode() { return (MilestoneNode) getNode(); }
public void internalTrigger(final NodeInstance from, String type) { super.internalTrigger(from, type); // if node instance was cancelled, abort if (getNodeInstanceContainer().getNodeInstance(getId()) == null) { return; } if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) { throw new IllegalArgumentException( "A MilestoneNode only accepts default incoming connections!"); } String rule = "RuleFlow-Milestone-" + getProcessInstance().getProcessId() + "-" + getMilestoneNode().getUniqueId(); boolean isActive = ((InternalAgenda) getProcessInstance().getKnowledgeRuntime().getAgenda()) .isRuleActiveInRuleFlowGroup("DROOLS_SYSTEM", rule, getProcessInstance().getId()); if (isActive) { triggerCompleted(); } else { addActivationListener(); } }
public void matchCreated(MatchCreatedEvent event) { // check whether this activation is from the DROOLS_SYSTEM agenda group String ruleFlowGroup = ((RuleImpl) event.getMatch().getRule()).getRuleFlowGroup(); if ("DROOLS_SYSTEM".equals(ruleFlowGroup)) { // new activations of the rule associate with a milestone node // trigger node instances of that milestone node String ruleName = event.getMatch().getRule().getName(); String milestoneName = "RuleFlow-Milestone-" + getProcessInstance().getProcessId() + "-" + getMilestoneNode().getUniqueId(); if (milestoneName.equals(ruleName) && checkProcessInstance((Activation) event.getMatch()) && checkDeclarationMatch(event.getMatch(), getMilestoneNode().getMatchVariable())) { synchronized(getProcessInstance()) { removeEventListeners(); triggerCompleted(); } } } }
public void removeEventListeners() { super.removeEventListeners(); getProcessInstance().getKnowledgeRuntime().removeEventListener(this); getProcessInstance().removeEventListener(getActivationEventType(), this, true); }
nodeInstance = new MilestoneNodeInstance(); nbTimerInstances = stream.readInt(); if (nbTimerInstances > 0) { timerInstances.add(stream.readLong()); ((MilestoneNodeInstance) nodeInstance).internalSetTimerInstances(timerInstances);
private void addActivationListener() { getProcessInstance().getKnowledgeRuntime().addEventListener(this); getProcessInstance().addEventListener(getActivationEventType(), this, true); }
nodeInstance = new MilestoneNodeInstance(); if ( _content.getMilestone().getTimerInstanceIdCount() > 0 ) { List<Long> timerInstances = new ArrayList<Long>(); timerInstances.add( _timerId ); ((MilestoneNodeInstance) nodeInstance).internalSetTimerInstances( timerInstances );
public void removeEventListeners() { super.removeEventListeners(); getProcessInstance().getKnowledgeRuntime().removeEventListener(this); getProcessInstance().removeEventListener(getActivationEventType(), this, true); }