apply checkstyle check during build for neutron-mapper
[groupbasedpolicy.git] / neutron-mapper / src / main / java / org / opendaylight / groupbasedpolicy / neutron / mapper / infrastructure / NetworkClient.java
index 0ac5cf05e860c9ba5bf5ec8fb4616db7660ef80c..d693ec9b3a4f94f8e3d0dd7b0b1c2b0d18a08025 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.groupbasedpolicy.neutron.mapper.infrastructure;
 
+import com.google.common.base.Preconditions;
+
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.groupbasedpolicy.util.IidFactory;
@@ -16,22 +18,18 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.Name;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.TenantId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.EndpointGroup;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.EndpointGroup.IntraGroupPolicy;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.EndpointGroupBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.endpoint.group.ConsumerNamedSelector;
 
-import com.google.common.base.Preconditions;
-
-public class NetworkClient {
+public class NetworkClient extends ServiceUtil {
 
     private static final Name NETWORK_CLIENT_EPG_NAME = new Name("NETWORK_CLIENT");
     private static final Description NETWORK_CLIENT_EPG_DESC = new Description("Represents DHCP and DNS clients.");
     /**
-     * ID of {@link #EPG}
+     * ID of {@link #EPG}.
      */
     public static final EndpointGroupId EPG_ID = new EndpointGroupId("ccc5e444-573c-11e5-885d-feff819cdc9f");
     /**
-     * Network-client endpoint-group consuming no contract
+     * Network-client endpoint-group consuming no contract.
      */
     public static final EndpointGroup EPG;
 
@@ -40,34 +38,30 @@ public class NetworkClient {
     }
 
     private static EndpointGroup createNetworkClientEpg() {
-        return new EndpointGroupBuilder().setId(EPG_ID)
-            .setName(NETWORK_CLIENT_EPG_NAME)
-            .setIntraGroupPolicy(IntraGroupPolicy.RequireContract)
-            .setDescription(NETWORK_CLIENT_EPG_DESC)
-            .build();
+        return createEpgBuilder(EPG_ID, NETWORK_CLIENT_EPG_NAME, NETWORK_CLIENT_EPG_DESC).build();
     }
 
     /**
-     * Puts {@link #EPG} to {@link LogicalDatastoreType#CONFIGURATION}
+     * Puts {@link #EPG} to {@link LogicalDatastoreType#CONFIGURATION}.
      *
      * @param tenantId location of {@link #EPG}
-     * @param wTx transaction where {@link #EPG} is written
+     * @param writeTx transaction where {@link #EPG} is written
      */
-    public static void writeNetworkClientEntitiesToTenant(TenantId tenantId, WriteTransaction wTx) {
-        wTx.put(LogicalDatastoreType.CONFIGURATION, IidFactory.endpointGroupIid(tenantId, EPG_ID), EPG, true);
+    public static void writeNetworkClientEntitiesToTenant(TenantId tenantId, WriteTransaction writeTx) {
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, IidFactory.endpointGroupIid(tenantId, EPG_ID), EPG, true);
     }
 
     /**
-     * Puts consumer-named-selector to {@link #EPG} in {@link LogicalDatastoreType#CONFIGURATION}
+     * Puts consumer-named-selector to {@link #EPG} in {@link LogicalDatastoreType#CONFIGURATION}.
      *
      * @param tenantId tenantId location of {@link #EPG}
      * @param consumerNamedSelector is added to {@link #EPG}
-     * @param wTx transaction where the given consumer-named-selector is written
+     * @param writeTx transaction where the given consumer-named-selector is written
      */
     public static void writeConsumerNamedSelector(TenantId tenantId, ConsumerNamedSelector consumerNamedSelector,
-            WriteTransaction wTx) {
+            WriteTransaction writeTx) {
         Preconditions.checkNotNull(consumerNamedSelector);
-        wTx.put(LogicalDatastoreType.CONFIGURATION,
+        writeTx.put(LogicalDatastoreType.CONFIGURATION,
                 IidFactory.consumerNamedSelectorIid(tenantId, EPG_ID, consumerNamedSelector.getName()),
                 consumerNamedSelector, true);
     }