use of org.drools.tms.LogicalDependency in project drools by kiegroup.
the class ProtobufOutputMarshaller method writeActivation.
public static <M extends ModedAssertion<M>> ProtobufMessages.Activation writeActivation(MarshallerWriteContext context, AgendaItem agendaItem, boolean isDormient) {
ProtobufMessages.Activation.Builder _activation = ProtobufMessages.Activation.newBuilder();
RuleImpl rule = agendaItem.getRule();
_activation.setPackageName(rule.getPackage());
_activation.setRuleName(rule.getName());
_activation.setTuple(writeTuple(context, agendaItem, isDormient));
_activation.setSalience(agendaItem.getSalience());
_activation.setIsActivated(agendaItem.isQueued());
_activation.setEvaluated(agendaItem.isRuleAgendaItem());
if (agendaItem.getActivationGroupNode() != null) {
_activation.setActivationGroup(agendaItem.getActivationGroupNode().getActivationGroup().getName());
}
if (agendaItem.getActivationFactHandle() != null) {
_activation.setHandleId(agendaItem.getActivationFactHandle().getId());
}
if (agendaItem instanceof TruthMaintenanceSystemAgendaItem) {
org.drools.core.util.LinkedList<LogicalDependency<M>> list = ((TruthMaintenanceSystemAgendaItem) 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();
}
Aggregations