use of org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.batch.group.input.update.grouping.UpdatedBatchedGroupBuilder in project openflowplugin by opendaylight.
the class SyncPlanPushStrategyFlatBatchImpl method assembleAddOrUpdateGroups.
@VisibleForTesting
static int assembleAddOrUpdateGroups(final List<Batch> batchBag, int batchOrder, final List<ItemSyncBox<Group>> groupsToAddOrUpdate) {
// process group add+update
int order = batchOrder;
if (groupsToAddOrUpdate != null) {
for (ItemSyncBox<Group> groupItemSyncBox : groupsToAddOrUpdate) {
if (!groupItemSyncBox.getItemsToPush().isEmpty()) {
final List<FlatBatchAddGroup> flatBatchAddGroupBag = new ArrayList<>(groupItemSyncBox.getItemsToUpdate().size());
int itemOrder = 0;
for (Group group : groupItemSyncBox.getItemsToPush()) {
flatBatchAddGroupBag.add(new FlatBatchAddGroupBuilder(group).setBatchOrder(itemOrder++).build());
}
final Batch batch = new BatchBuilder().setBatchChoice(new FlatBatchAddGroupCaseBuilder().setFlatBatchAddGroup(flatBatchAddGroupBag).build()).setBatchOrder(order).build();
order += itemOrder;
batchBag.add(batch);
}
if (!groupItemSyncBox.getItemsToUpdate().isEmpty()) {
final List<FlatBatchUpdateGroup> flatBatchUpdateGroupBag = new ArrayList<>(groupItemSyncBox.getItemsToUpdate().size());
int itemOrder = 0;
for (ItemSyncBox.ItemUpdateTuple<Group> groupUpdate : groupItemSyncBox.getItemsToUpdate()) {
flatBatchUpdateGroupBag.add(new FlatBatchUpdateGroupBuilder().setBatchOrder(itemOrder++).setOriginalBatchedGroup(new OriginalBatchedGroupBuilder(groupUpdate.getOriginal()).build()).setUpdatedBatchedGroup(new UpdatedBatchedGroupBuilder(groupUpdate.getUpdated()).build()).build());
}
final Batch batch = new BatchBuilder().setBatchChoice(new FlatBatchUpdateGroupCaseBuilder().setFlatBatchUpdateGroup(flatBatchUpdateGroupBag).build()).setBatchOrder(order).build();
order += itemOrder;
batchBag.add(batch);
}
}
}
return order;
}
Aggregations