Replaced all tabs with spaces in java and pom.xml
[so.git] / adapters / mso-adapter-utils / src / main / java / org / onap / so / cloud / CloudConfig.java
index b32ca18..fbf7741 100644 (file)
@@ -21,9 +21,7 @@
 package org.onap.so.cloud;
 
 import java.util.Optional;
-
 import com.fasterxml.jackson.annotation.JsonRootName;
-
 import org.onap.so.db.catalog.beans.CloudSite;
 import org.onap.so.db.catalog.beans.CloudifyManager;
 import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -31,24 +29,21 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 /**
- * JavaBean JSON class for a CloudConfig. This bean maps a JSON-format cloud
- * configuration file to Java. The CloudConfig contains information about
- * Openstack cloud configurations. It includes: 
- * - CloudIdentity objects,representing DCP nodes (Openstack Identity Service) 
- * - CloudSite objects, representing LCP nodes (Openstack Compute & other services)
+ * JavaBean JSON class for a CloudConfig. This bean maps a JSON-format cloud configuration file to Java. The CloudConfig
+ * contains information about Openstack cloud configurations. It includes: - CloudIdentity objects,representing DCP
+ * nodes (Openstack Identity Service) - CloudSite objects, representing LCP nodes (Openstack Compute & other services)
  *
- * Note that this is only used to access Cloud Configurations loaded from a JSON
- * config file, so there are no explicit property setters.
+ * Note that this is only used to access Cloud Configurations loaded from a JSON config file, so there are no explicit
+ * property setters.
  *
- * This class also contains methods to query cloud sites and/or identity
- * services by ID.
+ * This class also contains methods to query cloud sites and/or identity services by ID.
  *
  */
 
 @JsonRootName("cloud_config")
 @Component
 public class CloudConfig {
-       
+
     private static final String CLOUD_SITE_VERSION = "2.5";
     private static final String DEFAULT_CLOUD_SITE_ID = "DEFAULT";
 
@@ -56,41 +51,40 @@ public class CloudConfig {
     private CatalogDbClient catalogDbClient;
 
     /**
-     * Get a specific CloudSites, based on an ID. The ID is first checked
-     * against the regions, and if no match is found there, then against
-     * individual entries to try and find one with a CLLI that matches the ID
-     * and an AIC version of 2.5.
+     * Get a specific CloudSites, based on an ID. The ID is first checked against the regions, and if no match is found
+     * there, then against individual entries to try and find one with a CLLI that matches the ID and an AIC version of
+     * 2.5.
      * 
      * @param id the ID to match
      * @return an Optional of CloudSite object.
      */
-     public synchronized Optional<CloudSite> getCloudSite(String id) {
-         if (id == null) {
-             return Optional.empty();
-         }
-         CloudSite cloudSite = catalogDbClient.getCloudSite(id);
+    public synchronized Optional<CloudSite> getCloudSite(String id) {
+        if (id == null) {
+            return Optional.empty();
+        }
+        CloudSite cloudSite = catalogDbClient.getCloudSite(id);
+
+        if (cloudSite != null) {
+            return Optional.of(cloudSite);
+        } else {
+            return getCloudSiteWithClli(id);
+        }
+    }
 
-         if (cloudSite != null) {
-             return Optional.of(cloudSite);
-         } else {
-             return getCloudSiteWithClli(id);
-         }
-     }
-    
     /**
-     * Get a specific CloudSites, based on a CLLI and (optional) version, which
-     * will be matched against the aic_version field of the CloudSite.
+     * Get a specific CloudSites, based on a CLLI and (optional) version, which will be matched against the aic_version
+     * field of the CloudSite.
      * 
-     * @param clli
-     *            the CLLI to match
+     * @param clli the CLLI to match
      * @return a CloudSite, or null of no match found
      */
     private Optional<CloudSite> getCloudSiteWithClli(String clli) {
-        Optional <CloudSite> cloudSiteOptional = Optional.ofNullable(catalogDbClient.getCloudSiteByClliAndAicVersion(clli,CLOUD_SITE_VERSION));
+        Optional<CloudSite> cloudSiteOptional =
+                Optional.ofNullable(catalogDbClient.getCloudSiteByClliAndAicVersion(clli, CLOUD_SITE_VERSION));
         if (cloudSiteOptional.isPresent()) {
-               return cloudSiteOptional;
+            return cloudSiteOptional;
         } else {
-               return getDefaultCloudSite(clli);
+            return getDefaultCloudSite(clli);
         }
     }
 
@@ -107,12 +101,13 @@ public class CloudConfig {
         }
     }
 
-       /**
-        * Get a specific CloudifyManager, based on an ID.
-        * @param id the ID to match
-        * @return a CloudifyManager, or null of no match found
-        */
-       public CloudifyManager getCloudifyManager (String id) {
+    /**
+     * Get a specific CloudifyManager, based on an ID.
+     * 
+     * @param id the ID to match
+     * @return a CloudifyManager, or null of no match found
+     */
+    public CloudifyManager getCloudifyManager(String id) {
         return catalogDbClient.getCloudifyManager(id);
-       }
+    }
 }