public static ProtobufMessages.Activation writeActivation( MarshallerWriteContext context, AgendaItem agendaItem) { ProtobufMessages.Activation.Builder _activation = ProtobufMessages.Activation.newBuilder(); RuleImpl rule = agendaItem.getRule(); _activation.setPackageName(rule.getPackage()); _activation.setRuleName(rule.getName()); _activation.setTuple(writeTuple(agendaItem.getTuple())); _activation.setSalience(agendaItem.getSalience()); _activation.setIsActivated(agendaItem.isQueued()); _activation.setEvaluated(agendaItem.isRuleAgendaItem()); if (agendaItem.getActivationGroupNode() != null) { _activation.setActivationGroup( agendaItem.getActivationGroupNode().getActivationGroup().getName()); } if (agendaItem.getFactHandle() != null) { _activation.setHandleId(agendaItem.getFactHandle().getId()); } org.drools.core.util.LinkedList<LogicalDependency> list = agendaItem.getLogicalDependencies(); if (list != null && !list.isEmpty()) { for (LogicalDependency node = list.getFirst(); node != null; node = node.getNext()) { _activation.addLogicalDependency(((BeliefSet) node.getJustified()).getFactHandle().getId()); } } return _activation.build(); }
public void removeRule(RuleImpl rule) { this.rules.remove(rule.getName()); this.dialectRuntimeRegistry.removeRule(this, rule); }
/** * Add a <code>Rule</code> to this <code>Package</code>. * * @param rule The rule to add. * @throws org.drools.core.rule.DuplicateRuleNameException If the <code>Rule</code> attempting to * be added has the same name as another previously added <code>Rule</code>. * @throws org.drools.core.rule.InvalidRuleException If the <code>Rule</code> is not valid. */ public void addRule(RuleImpl rule) { this.rules.put(rule.getName(), rule); }