AgendaGroup[] agendaGroups = (AgendaGroup[]) agenda.getAgendaGroupsMap().values().toArray( new AgendaGroup[agenda.getAgendaGroupsMap().size()] );
Arrays.sort( agendaGroups,
AgendaGroupSorter.instance );
for ( AgendaGroup ag : agendaGroups ) {
AgendaGroupQueueImpl group = (AgendaGroupQueueImpl) ag;
org.drools.core.marshalling.impl.ProtobufMessages.Agenda.AgendaGroup.Builder _agb = ProtobufMessages.Agenda.AgendaGroup.newBuilder();
_agb.setName( group.getName() )
.setIsActive( group.isActive() )
.setIsAutoDeactivate( group.isAutoDeactivate() )
.setClearedForRecency( group.getClearedForRecency() )
.setHasRuleFlowLister( group.isRuleFlowListener() )
.setActivatedForRecency( group.getActivatedForRecency() );
Map<Long, String> nodeInstances = group.getNodeInstances();
for ( Map.Entry<Long, String> entry : nodeInstances.entrySet() ) {
org.drools.core.marshalling.impl.ProtobufMessages.Agenda.AgendaGroup.NodeInstance.Builder _nib = ProtobufMessages.Agenda.AgendaGroup.NodeInstance.newBuilder();
_nib.setProcessInstanceId( entry.getKey() );
_nib.setNodeInstanceId( entry.getValue() );
_agb.addNodeInstance( _nib.build() );
}
_ab.addAgendaGroup( _agb.build() );
}
org.drools.core.marshalling.impl.ProtobufMessages.Agenda.FocusStack.Builder _fsb = ProtobufMessages.Agenda.FocusStack.newBuilder();
LinkedList<AgendaGroup> focusStack = agenda.getStackList();
for ( Iterator<AgendaGroup> it = focusStack.iterator(); it.hasNext(); ) {
AgendaGroup group = it.next();
_fsb.addGroupName( group.getName() );
}
_ab.setFocusStack( _fsb.build() );
// serialize all dormant activations
org.drools.core.util.Iterator it = ActivationIterator.iterator( wm );