Code improvements for FDS scenarios
[groupbasedpolicy.git] / groupbasedpolicy / src / main / java / org / opendaylight / groupbasedpolicy / base_endpoint / BaseEndpointServiceImpl.java
index d8e05be52aa87a191eac0de9ca03cbae57101f43..96359bccec2ca62da6c25d853b28a3fa25f01fd8 100644 (file)
@@ -157,7 +157,8 @@ public class BaseEndpointServiceImpl implements BaseEndpointService, AutoCloseab
                 t.put(LogicalDatastoreType.OPERATIONAL, childInParentIid, epAsChild, true);
             }
         }
-        for (ParentContainmentEndpoint parent : EndpointUtils.getParentContainmentEndpoints(endpoint.getParentEndpointChoice())) {
+        for (ParentContainmentEndpoint parent : EndpointUtils
+            .getParentContainmentEndpoints(endpoint.getParentEndpointChoice())) {
             InstanceIdentifier<ContainmentEndpoint> parentIid = IidFactory
                 .containmentEndpointIid(new ContainmentEndpointKey(parent.getContextId(), parent.getContextType()));
             Optional<ContainmentEndpoint> parentContEpOptional =
@@ -268,12 +269,13 @@ public class BaseEndpointServiceImpl implements BaseEndpointService, AutoCloseab
         ParentEndpointChoice parentEndpointChoice = endpoint.getParentEndpointChoice();
         for (ParentEndpoint parentEndpoint : EndpointUtils.getParentEndpoints(parentEndpointChoice)) {
             KeyedInstanceIdentifier<ChildEndpoint, ChildEndpointKey> childEp =
-                    IidFactory.addressEndpointIid(EndpointUtils.createAddressEndpointKey(parentEndpoint)).child(ChildEndpoint.class,
-                            new ChildEndpointKey(endpoint.getAddress(), endpoint.getAddressType(),
-                                    endpoint.getContextId(), endpoint.getContextType()));
+                    IidFactory.addressEndpointIid(EndpointUtils.createAddressEndpointKey(parentEndpoint))
+                        .child(ChildEndpoint.class, new ChildEndpointKey(endpoint.getAddress(),
+                                endpoint.getAddressType(), endpoint.getContextId(), endpoint.getContextType()));
             DataStoreHelper.removeIfExists(LogicalDatastoreType.OPERATIONAL, childEp, t);
         }
-        for (ParentContainmentEndpoint parentContEndpoint : EndpointUtils.getParentContainmentEndpoints(parentEndpointChoice)) {
+        for (ParentContainmentEndpoint parentContEndpoint : EndpointUtils
+            .getParentContainmentEndpoints(parentEndpointChoice)) {
             KeyedInstanceIdentifier<ChildEndpoint, ChildEndpointKey> childEp = IidFactory
                 .containmentEndpointIid(new ContainmentEndpointKey(parentContEndpoint.getContextId(),
                         parentContEndpoint.getContextType()))
@@ -286,9 +288,9 @@ public class BaseEndpointServiceImpl implements BaseEndpointService, AutoCloseab
     private void deleteAddressEndpointFromChilds(ReadWriteTransaction t, AddressEndpoint endpoint) {
         for (ChildEndpoint childEndpoint : nullToEmpty(endpoint.getChildEndpoint())) {
             KeyedInstanceIdentifier<ParentEndpoint, ParentEndpointKey> parentEp =
-                    IidFactory.addressEndpointIid(EndpointUtils.createAddressEndpointKey(childEndpoint)).child(ParentEndpoint.class,
-                            new ParentEndpointKey(endpoint.getAddress(), endpoint.getAddressType(),
-                                    endpoint.getContextId(), endpoint.getContextType()));
+                    IidFactory.addressEndpointIid(EndpointUtils.createAddressEndpointKey(childEndpoint))
+                        .child(ParentEndpoint.class, new ParentEndpointKey(endpoint.getAddress(),
+                                endpoint.getAddressType(), endpoint.getContextId(), endpoint.getContextType()));
             DataStoreHelper.removeIfExists(LogicalDatastoreType.OPERATIONAL, parentEp, t);
         }
     }
@@ -305,8 +307,7 @@ public class BaseEndpointServiceImpl implements BaseEndpointService, AutoCloseab
     }
 
     @Override
-    public void close() {
-    }
+    public void close() {}
 
     private <T> List<T> nullToEmpty(@Nullable List<T> list) {
         return list == null ? Collections.emptyList() : list;