Update MRI projects for Aluminium
[ovsdb.git] / hwvtepsouthbound / hwvtepsouthbound-impl / src / main / java / org / opendaylight / ovsdb / hwvtepsouthbound / transact / PlainLogicalSwitchRemoveCmd.java
index d1ad3cc737e7e94e1de87b59a0eb402408f74640..f48095d1c098864cb420f4fc4e096a0dc8f4466a 100644 (file)
@@ -5,17 +5,15 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.ovsdb.hwvtepsouthbound.transact;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
 
 import java.util.Collection;
-import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
-
 import org.opendaylight.mdsal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundConstants;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
@@ -24,21 +22,24 @@ import org.opendaylight.ovsdb.schema.hardwarevtep.LogicalSwitch;
 import org.opendaylight.ovsdb.utils.mdsal.utils.Scheduler;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitchesKey;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class PlainLogicalSwitchRemoveCmd extends AbstractTransactCommand<LogicalSwitches, HwvtepGlobalAugmentation> {
+public class PlainLogicalSwitchRemoveCmd
+        extends AbstractTransactCommand<LogicalSwitches, LogicalSwitchesKey, HwvtepGlobalAugmentation> {
     private static final Logger LOG = LoggerFactory.getLogger(PlainLogicalSwitchRemoveCmd.class);
+
     private AtomicInteger retryCount = new AtomicInteger(5);
-    private LogicalSwitches logicalSwitches;
-    private InstanceIdentifier<Node> nodeIid;
+    private final LogicalSwitches logicalSwitches;
+    private final InstanceIdentifier<Node> nodeIid;
 
-    public PlainLogicalSwitchRemoveCmd(HwvtepOperationalState state,
-                                       Collection<DataTreeModification<Node>> changes,
-                                       LogicalSwitches logicalSwitches,
-                                       int retryCount) {
+    public PlainLogicalSwitchRemoveCmd(final HwvtepOperationalState state,
+                                       final Collection<DataTreeModification<Node>> changes,
+                                       final LogicalSwitches logicalSwitches,
+                                       final int retryCount) {
         super(state, changes);
         this.logicalSwitches = logicalSwitches;
         this.retryCount = new AtomicInteger(retryCount);
@@ -46,7 +47,7 @@ public class PlainLogicalSwitchRemoveCmd extends AbstractTransactCommand<Logical
     }
 
     @Override
-    public void execute(TransactionBuilder transaction) {
+    public void execute(final TransactionBuilder transaction) {
         LogicalSwitch logicalSwitch = TyperUtils.getTypedRowWrapper(
                 transaction.getDatabaseSchema(), LogicalSwitch.class, null);
         transaction.add(op.delete(logicalSwitch.getSchema())
@@ -55,16 +56,17 @@ public class PlainLogicalSwitchRemoveCmd extends AbstractTransactCommand<Logical
     }
 
     @Override
-    protected List<LogicalSwitches> getData(HwvtepGlobalAugmentation augmentation) {
+    protected Map<LogicalSwitchesKey, LogicalSwitches> getData(final HwvtepGlobalAugmentation augmentation) {
         return augmentation.getLogicalSwitches();
     }
 
     @Override
-    protected boolean areEqual(LogicalSwitches logicalSwitches1 , LogicalSwitches logicalSwitches2) {
+    protected boolean areEqual(final LogicalSwitches logicalSwitches1 , final LogicalSwitches logicalSwitches2) {
         return logicalSwitches1.key().equals(logicalSwitches2.key())
                 && Objects.equals(logicalSwitches1.getTunnelKey(), logicalSwitches2.getTunnelKey());
     }
 
+    @Override
     public boolean retry() {
         boolean ret = retryCount.decrementAndGet() > 0;
         if (ret) {
@@ -77,6 +79,7 @@ public class PlainLogicalSwitchRemoveCmd extends AbstractTransactCommand<Logical
         return ret;
     }
 
+    @Override
     protected boolean isDeleteCmd() {
         return true;
     }