}
org.drools.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() );
RuleFlowGroupImpl[] ruleFlowGroups = (RuleFlowGroupImpl[]) agenda.getRuleFlowGroupsMap().values().toArray( new RuleFlowGroupImpl[agenda.getRuleFlowGroupsMap().size()] );
Arrays.sort( ruleFlowGroups,
RuleFlowGroupSorter.instance );
for ( RuleFlowGroupImpl group : ruleFlowGroups ) {
org.drools.marshalling.impl.ProtobufMessages.Agenda.RuleFlowGroup.Builder _rfgb = ProtobufMessages.Agenda.RuleFlowGroup.newBuilder();
_rfgb.setName( group.getName() );
_rfgb.setIsActive( group.isActive() );
_rfgb.setIsAutoDeactivate( group.isAutoDeactivate() );
Map<Long, String> nodeInstances = group.getNodeInstances();
for ( Map.Entry<Long, String> entry : nodeInstances.entrySet() ) {
org.drools.marshalling.impl.ProtobufMessages.Agenda.RuleFlowGroup.NodeInstance.Builder _nib = ProtobufMessages.Agenda.RuleFlowGroup.NodeInstance.newBuilder();
_nib.setProcessInstanceId( entry.getKey() );
_nib.setNodeInstanceId( entry.getValue() );
_rfgb.addNodeInstance( _nib.build() );