private String createMilestoneRule(Process process, MilestoneNode milestone) { return "rule \"RuleFlow-Milestone-" + process.getId() + "-" + milestone.getUniqueId() + "\" @Propagation(EAGER) \n" + " ruleflow-group \"DROOLS_SYSTEM\" \n" + " when \n" + " " + milestone.getConstraint() + "\n" + " then \n" + "end \n\n"; }
private String getActivationEventType() { return "RuleFlow-Milestone-" + getProcessInstance().getProcessId() + "-" + getMilestoneNode().getUniqueId(); }
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 String createMilestoneRule(Process process, MilestoneNode milestone) { return "rule \"RuleFlow-Milestone-" + process.getId() + "-" + milestone.getUniqueId() + "\" @Propagation(EAGER) \n" + " ruleflow-group \"DROOLS_SYSTEM\" \n" + " when \n" + " " + milestone.getConstraint() + "\n" + " then \n" + "end \n\n"; }
private String getActivationEventType() { return "RuleFlow-Milestone-" + getProcessInstance().getProcessId() + "-" + getMilestoneNode().getUniqueId(); }
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(); } } } }