public String toExternalForm() { return "[ "+this.getRule().getName()+" active="+this.activated+ " ]"; }
public Object getProperty(String name, Object obj, VariableResolverFactory variableFactory) { AgendaItem item = ( AgendaItem ) obj; if ( "rule".equals( name ) ) { return item.getRule(); } else if ( "active".equals( name ) ) { return item.isActive(); } else if ( "objects".equals( name ) ) { return item.getObjects(); } else if ( "factHandles".equals( name ) ) { return item.getFactHandles(); } else if ( "declarationIDs".equals( name ) ) { return item.getDeclarationIDs(); } else if ( "this".equals( name ) ) { return item; } // FIXME hack as MVEL seems to be ignoring indexed variables VariableResolver vr = variableFactory.getNextFactory().getVariableResolver( name ); if ( vr != null ) { return vr.getValue(); } Declaration declr = item.getRuleTerminalNode().getSubRule().getOuterDeclarations().get( name ); if ( declr != null ) { return declr.getValue( null, item.getTuple().get( declr ).getObject() ); } else { return item.getRule().getMetaData().get( name ); } }
/** * If the item belongs to an activation group, add it * * @param item */ private void addItemToActivationGroup(final AgendaItem item) { String group = item.getRule().getActivationGroup(); if ( group != null && group.length() > 0 ) { this.getActivationGroup( group ).addActivation(item); } }
public boolean equals(final Object object) { if ( object == this ) { return true; } if ( !(object instanceof AgendaItem) ) { return false; } final AgendaItem otherItem = (AgendaItem) object; return (this.rtn.getRule().equals( otherItem.getRule() ) && this.tuple.equals( otherItem.getTuple() )); }
Rule rule = agendaItem.getRule(); stream.writeUTF( rule.getPackage() ); stream.writeUTF( rule.getName() );
addActivation( activation, true ); } else { Timer timer = activation.getRule().getTimer(); if ( timer != null && timer instanceof ExpressionIntervalTimer ) { ScheduledAgendaItem schItem = ( ScheduledAgendaItem ) activation;
public static ProtobufMessages.Activation writeActivation(MarshallerWriteContext context, AgendaItem agendaItem) { ProtobufMessages.Activation.Builder _activation = ProtobufMessages.Activation.newBuilder(); Rule rule = agendaItem.getRule(); _activation.setPackageName(rule.getPackage()); _activation.setRuleName(rule.getName()); ProtobufMessages.Tuple.Builder _tb = ProtobufMessages.Tuple.newBuilder(); for (LeftTuple entry = agendaItem.getTuple(); entry != null; entry = entry.getParent()) { InternalFactHandle handle = entry.getLastHandle(); _tb.addHandleId(handle.getId()); } _activation.setTuple(_tb.build()); _activation.setSalience(agendaItem.getSalience()); _activation.setIsActivated(agendaItem.isActivated()); 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(((InternalFactHandle) node.getJustified()).getId()); } } return _activation.build(); }