private FlowHashIdMapImpl(FlowHashIdMapBuilder base) { if (base.getKey() == null) { this._key = new FlowHashIdMapKey( base.getHash() ); this._hash = base.getHash(); } else { this._key = base.getKey(); this._hash = _key.getHash(); } this._flowId = base.getFlowId(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.nodes.node.table.FlowHashIdMap>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.nodes.node.table.FlowHashIdMap>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.nodes.node.table.FlowHashIdMap>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.nodes.node.table.FlowHashIdMap>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
public FlowHashIdMapBuilder(FlowHashIdMap base) { if (base.getKey() == null) { this._key = new FlowHashIdMapKey( base.getHash() ); this._hash = base.getHash(); } else { this._key = base.getKey(); this._hash = _key.getHash(); } this._flowId = base.getFlowId(); if (base instanceof FlowHashIdMapImpl) { FlowHashIdMapImpl impl = (FlowHashIdMapImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.nodes.node.table.FlowHashIdMap> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.nodes.node.table.FlowHashIdMap>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
void reportFlow(final FlowAndStatisticsMapList flowStat, final ReadWriteTransaction trans) { ensureTableFowHashIdMapping(trans); final FlowHashIdMapKey hashingKey = new FlowHashIdMapKey(buildFlowIdOperKey(flowStat)); FlowKey flowKey = getFlowKeyAndRemoveHash(hashingKey); if (flowKey == null) { flowKey = searchInConfiguration(flowStat, trans); if ( flowKey == null) { flowKey = makeAlienFlowKey(); } updateHashCache(trans,flowKey,hashingKey); } final FlowBuilder flowBuilder = new FlowBuilder(flowStat); flowBuilder.setKey(flowKey); addStatistics(flowBuilder, flowStat); final InstanceIdentifier<Flow> flowIdent = tableRef.child(Flow.class, flowKey); trans.put(LogicalDatastoreType.OPERATIONAL, flowIdent, flowBuilder.build()); /* check life for Alien flows */ if (flowKey.getId().getValue().startsWith(ALIEN_SYSTEM_FLOW_ID)) { removeData(flowIdent, REMOVE_AFTER_MISSING_COLLECTION); } }
void reportFlow(final FlowAndStatisticsMapList flowStat, final ReadWriteTransaction trans) { ensureTableFowHashIdMapping(trans); final FlowHashIdMapKey hashingKey = new FlowHashIdMapKey(buildFlowIdOperKey(flowStat)); FlowKey flowKey = getFlowKeyAndRemoveHash(hashingKey); if (flowKey == null) { flowKey = searchInConfiguration(flowStat, trans); if ( flowKey == null) { flowKey = makeAlienFlowKey(); } updateHashCache(trans,flowKey,hashingKey); } final FlowBuilder flowBuilder = new FlowBuilder(flowStat); flowBuilder.setKey(flowKey); addStatistics(flowBuilder, flowStat); final InstanceIdentifier<Flow> flowIdent = tableRef.child(Flow.class, flowKey); trans.put(LogicalDatastoreType.OPERATIONAL, flowIdent, flowBuilder.build()); /* check life for Alien flows */ if (flowKey.getId().getValue().startsWith(ALIEN_SYSTEM_FLOW_ID)) { removeData(flowIdent, REMOVE_AFTER_MISSING_COLLECTION); } }