Replaced all tabs with spaces in java and pom.xml
[so.git] / bpmn / so-bpmn-tasks / src / main / java / org / onap / so / bpmn / buildingblock / OofHomingV2.java
index f65dde1..2524fc7 100644 (file)
@@ -65,19 +65,16 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Component;
 import org.springframework.web.util.UriUtils;
-
 import java.time.Duration;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
-
 import static org.apache.commons.lang3.StringUtils.isBlank;
 import static org.apache.commons.lang3.StringUtils.isNotBlank;
 
 
 /**
- * The oof homing building block obtains licensing and homing solutions for a given
- * resource or set of resources.
+ * The oof homing building block obtains licensing and homing solutions for a given resource or set of resources.
  *
  */
 @Component("OofHoming")
@@ -109,14 +106,13 @@ public class OofHomingV2 {
     private static final int INTERNAL = 500;
 
     /**
-     * Generates the request payload then sends to Oof to perform homing and
-     * licensing for the provided demands
+     * Generates the request payload then sends to Oof to perform homing and licensing for the provided demands
      *
      * @param execution
      */
-    public void callOof(BuildingBlockExecution execution){
+    public void callOof(BuildingBlockExecution execution) {
         logger.trace("Started Sniro Homing Call Sniro");
-        try{
+        try {
             GeneralBuildingBlock bb = execution.getGeneralBuildingBlock();
 
             RequestContext requestContext = bb.getRequestContext();
@@ -127,13 +123,13 @@ public class OofHomingV2 {
             Customer customer = bb.getCustomer();
 
             String timeout = execution.getVariable("timeout");
-            if(isBlank(timeout)){
+            if (isBlank(timeout)) {
                 timeout = env.getProperty("oof.timeout", "PT30M");
             }
 
             OofRequest request = new OofRequest();
 
-            RequestInfo requestInfo = (RequestInfo)buildRequestInfo(requestId, timeout);
+            RequestInfo requestInfo = (RequestInfo) buildRequestInfo(requestId, timeout);
             request.setRequestInformation(requestInfo);
 
             ServiceInfo serviceInfo = buildServiceInfo(serviceInstance);
@@ -151,71 +147,74 @@ public class OofHomingV2 {
             licenseInfo.put("licenseDemands", licenseDemands);
             request.setLicenseInformation(licenseInfo.toString());
 
-            if(placementDemands.size() > 0 || licenseDemands.length() > 0){
+            if (placementDemands.size() > 0 || licenseDemands.length() > 0) {
                 client.postDemands(request);
-            }else{
+            } else {
                 logger.debug(SERVICE_MISSING_DATA + " resources eligible for homing or licensing");
-                throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + " resources eligible for homing or licensing");
+                throw new BpmnError(UNPROCESSABLE,
+                        SERVICE_MISSING_DATA + " resources eligible for homing or licensing");
             }
 
-            //Variables for ReceiveWorkflowMessage subflow
+            // Variables for ReceiveWorkflowMessage subflow
             execution.setVariable("asyncCorrelator", requestId);
             execution.setVariable("asyncMessageType", "OofResponse");
             execution.setVariable("asyncTimeout", timeout);
 
             logger.trace("Completed Oof Homing Call Oof");
-        }catch(BpmnError e){
+        } catch (BpmnError e) {
             exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
-        }catch(BadResponseException e){
+        } catch (BadResponseException e) {
             exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
-        }catch(Exception e){
-            exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while preparing oof request: " + e.getMessage());
+        } catch (Exception e) {
+            exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
+                    "Internal Error - occurred while preparing oof request: " + e.getMessage());
         }
     }
 
     /**
-     * Validates, processes, and sets the homing and licensing solutions that are returned by
-     * Oof
+     * Validates, processes, and sets the homing and licensing solutions that are returned by Oof
      *
      * @param execution
      * @param asyncResponse
      */
-    public void processSolution(BuildingBlockExecution execution, String asyncResponse){
+    public void processSolution(BuildingBlockExecution execution, String asyncResponse) {
         logger.trace("Started Oof Homing Process Solution");
-        try{
+        try {
             oofValidator.validateSolution(asyncResponse);
-            ServiceInstance serviceInstance = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0);
+            ServiceInstance serviceInstance = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription()
+                    .getServiceInstances().get(0);
 
             logger.debug("Processing Oof asyncronous response");
             JSONObject response = new JSONObject(asyncResponse);
-            if(response.has(SOLUTIONS)){
+            if (response.has(SOLUTIONS)) {
                 JSONObject allSolutions = response.getJSONObject(SOLUTIONS);
-                if(allSolutions.has("placementSolutions")){
+                if (allSolutions.has("placementSolutions")) {
                     JSONArray placementSolutions = allSolutions.getJSONArray("placementSolutions");
-                    for(int i = 0; i < placementSolutions.length(); i++){
+                    for (int i = 0; i < placementSolutions.length(); i++) {
                         JSONArray placements = placementSolutions.getJSONArray(i);
                         processPlacementSolution(serviceInstance, placements, i);
                     }
                 }
-                if(allSolutions.has("licenseSolutions")){
+                if (allSolutions.has("licenseSolutions")) {
                     JSONArray licenseSolutions = allSolutions.getJSONArray("licenseSolutions");
-                    if(licenseSolutions.length() > 0){
+                    if (licenseSolutions.length() > 0) {
                         processLicenseSolution(serviceInstance, licenseSolutions);
                     }
                 }
-            }else{
+            } else {
                 throw new BpmnError(UNPROCESSABLE, "Oof response does not contain: " + SOLUTIONS);
             }
 
             execution.setVariable("generalBuildingBlock", execution.getGeneralBuildingBlock());
 
             logger.trace("Completed Oof Homing Process Solution");
-        }catch(BpmnError e){
+        } catch (BpmnError e) {
             exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
-        }catch(BadResponseException e){
+        } catch (BadResponseException e) {
             exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
-        }catch(Exception e){
-            exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while processing Oof asynchronous response: " + e.getMessage());
+        } catch (Exception e) {
+            exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
+                    "Internal Error - occurred while processing Oof asynchronous response: " + e.getMessage());
         }
     }
 
@@ -224,12 +223,13 @@ public class OofHomingV2 {
      *
      * @throws Exception
      */
-    private RequestInfo buildRequestInfo(String requestId, String timeout) throws Exception{
+    private RequestInfo buildRequestInfo(String requestId, String timeout) throws Exception {
         logger.trace("Building request information");
         RequestInfo requestInfo = new RequestInfo();
-        if(requestId != null){
+        if (requestId != null) {
             String host = env.getProperty("mso.workflow.message.endpoint");
-            String callbackUrl = host + "/" + UriUtils.encodePathSegment("OofResponse", "UTF-8") + "/" + UriUtils.encodePathSegment(requestId, "UTF-8");
+            String callbackUrl = host + "/" + UriUtils.encodePathSegment("OofResponse", "UTF-8") + "/"
+                    + UriUtils.encodePathSegment(requestId, "UTF-8");
 
             Duration d = Duration.parse(timeout);
             long timeoutSeconds = d.getSeconds();
@@ -240,7 +240,7 @@ public class OofHomingV2 {
             requestInfo.setSourceId("mso");
             requestInfo.setRequestType("create");
             requestInfo.setTimeout(timeoutSeconds);
-        } else{
+        } else {
             throw new BpmnError(UNPROCESSABLE, "Request Context does not contain: requestId");
         }
         return requestInfo;
@@ -250,17 +250,17 @@ public class OofHomingV2 {
      * Builds the request information section for the homing/licensing request
      *
      */
-    private ServiceInfo buildServiceInfo(ServiceInstance serviceInstance){
+    private ServiceInfo buildServiceInfo(ServiceInstance serviceInstance) {
         logger.trace("Building service information");
         ServiceInfo info = new ServiceInfo();
         ModelInfoServiceInstance modelInfo = serviceInstance.getModelInfoServiceInstance();
-        if(isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())){
+        if (isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())) {
             info.setServiceInstanceId(serviceInstance.getServiceInstanceId());
-            if(modelInfo.getServiceType() != null && modelInfo.getServiceType().length() > 0){ //temp solution
+            if (modelInfo.getServiceType() != null && modelInfo.getServiceType().length() > 0) { // temp solution
                 info.setServiceName(modelInfo.getServiceType());
             }
             info.setModelInfo(buildModelInfo(serviceInstance.getModelInfoServiceInstance()));
-        }else{
+        } else {
             throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + MODEL_VERSION_ID + ", " + MODEL_INVARIANT_ID);
         }
         return info;
@@ -270,32 +270,32 @@ public class OofHomingV2 {
      * Builds initial section of placement info for the homing/licensing request
      *
      */
-    private PlacementInfo buildPlacementInfo(Customer customer, RequestParameters requestParams){
+    private PlacementInfo buildPlacementInfo(Customer customer, RequestParameters requestParams) {
         PlacementInfo placementInfo = new PlacementInfo();
-        if(customer != null){
+        if (customer != null) {
             logger.debug("Adding subscriber to placement information");
             SubscriberInfo subscriberInfo = new SubscriberInfo();
             subscriberInfo.setGlobalSubscriberId(customer.getGlobalCustomerId());
             subscriberInfo.setSubscriberName(customer.getSubscriberName());
             subscriberInfo.setSubscriberCommonSiteId(customer.getSubscriberCommonSiteId());
             placementInfo.setSubscriberInfo(subscriberInfo);
-            if(requestParams != null){
+            if (requestParams != null) {
                 logger.debug("Adding request parameters to placement information");
                 OofRequestParameters oofRequestParams = new OofRequestParameters();
-                for (Map requestParam : requestParams.getUserParams()){
-                    if (requestParam.containsKey("customerLatitude")){
+                for (Map requestParam : requestParams.getUserParams()) {
+                    if (requestParam.containsKey("customerLatitude")) {
                         oofRequestParams.setCustomerLatitude(requestParam.get("customerLatitude").toString());
                     }
-                    if (requestParam.containsKey("customerLongitude")){
+                    if (requestParam.containsKey("customerLongitude")) {
                         oofRequestParams.setCustomerLongitude(requestParam.get("customerLongitude").toString());
                     }
-                    if (requestParam.containsKey("customerName")){
+                    if (requestParam.containsKey("customerName")) {
                         oofRequestParams.setCustomerName(requestParam.get("customerName").toString());
                     }
                 }
                 placementInfo.setRequestParameters(oofRequestParams);
             }
-        }else{
+        } else {
             throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + "customer");
         }
         return placementInfo;
@@ -306,33 +306,33 @@ public class OofHomingV2 {
      * Builds the placement demand list for the homing/licensing request
      *
      */
-    private ArrayList<PlacementDemand> buildPlacementDemands(ServiceInstance serviceInstance){
+    private ArrayList<PlacementDemand> buildPlacementDemands(ServiceInstance serviceInstance) {
         logger.trace("Building placement information demands");
         ArrayList<PlacementDemand> placementDemands = new ArrayList();
 
         List<AllottedResource> allottedResourceList = serviceInstance.getAllottedResources();
-        if(!allottedResourceList.isEmpty()){
+        if (!allottedResourceList.isEmpty()) {
             logger.debug("Adding allotted resources to placement demands list");
-            for(AllottedResource ar : allottedResourceList){
-                if(isBlank(ar.getId())){
+            for (AllottedResource ar : allottedResourceList) {
+                if (isBlank(ar.getId())) {
                     ar.setId(UUID.randomUUID().toString());
                 }
                 PlacementDemand demand = buildDemand(ar.getId(), ar.getModelInfoAllottedResource());
-                //addCandidates(ar, demand);
+                // addCandidates(ar, demand);
                 placementDemands.add(demand);
             }
         }
         List<VpnBondingLink> vpnBondingLinkList = serviceInstance.getVpnBondingLinks();
-        if(!vpnBondingLinkList.isEmpty()){
+        if (!vpnBondingLinkList.isEmpty()) {
             logger.debug("Adding vpn bonding links to placement demands list");
-            for(VpnBondingLink vbl:vpnBondingLinkList){
+            for (VpnBondingLink vbl : vpnBondingLinkList) {
                 List<ServiceProxy> serviceProxyList = vbl.getServiceProxies();
-                for(ServiceProxy sp : serviceProxyList){
-                    if(isBlank(sp.getId())){
+                for (ServiceProxy sp : serviceProxyList) {
+                    if (isBlank(sp.getId())) {
                         sp.setId(UUID.randomUUID().toString());
                     }
                     PlacementDemand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy());
-                    //addCandidates(sp, demand);
+                    // addCandidates(sp, demand);
                     placementDemands.add(demand);
                 }
             }
@@ -344,13 +344,13 @@ public class OofHomingV2 {
      * Builds the license demand list for the homing/licensing request
      *
      */
-    private JSONArray buildLicenseDemands(ServiceInstance serviceInstance){
+    private JSONArray buildLicenseDemands(ServiceInstance serviceInstance) {
         logger.trace("Building license information");
         JSONArray licenseDemands = new JSONArray();
         List<GenericVnf> vnfList = serviceInstance.getVnfs();
-        if(!vnfList.isEmpty()){
+        if (!vnfList.isEmpty()) {
             logger.debug("Adding vnfs to license demands list");
-            for(GenericVnf vnf : vnfList){
+            for (GenericVnf vnf : vnfList) {
                 JSONObject demand = buildLicenseDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf());
                 licenseDemands.put(demand);
             }
@@ -362,14 +362,14 @@ public class OofHomingV2 {
      * Builds a single license demand object
      *
      */
-    private JSONObject buildLicenseDemand(String id, ModelInfoMetadata metadata){
+    private JSONObject buildLicenseDemand(String id, ModelInfoMetadata metadata) {
         logger.debug("Building demand for service or resource: " + id);
         JSONObject demand = new JSONObject();
-        if(isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())){
+        if (isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())) {
             demand.put(SERVICE_RESOURCE_ID, id);
             demand.put(RESOURCE_MODULE_NAME, metadata.getModelInstanceName());
             demand.put(RESOURCE_MODEL_INFO, buildModelInfo(metadata));
-        }else{
+        } else {
             throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName");
         }
         return demand;
@@ -379,14 +379,14 @@ public class OofHomingV2 {
      * Builds a single demand object
      *
      */
-    private PlacementDemand buildDemand(String id, ModelInfoMetadata metadata){
+    private PlacementDemand buildDemand(String id, ModelInfoMetadata metadata) {
         logger.debug("Building demand for service or resource: " + id);
         PlacementDemand placementDemand = new PlacementDemand();
-        if(isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())){
+        if (isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())) {
             placementDemand.setServiceResourceId(id);
             placementDemand.setResourceModuleName(metadata.getModelInstanceName());
             placementDemand.setResourceModelInfo((ResourceModelInfo) buildModelInfo(metadata));
-        }else{
+        } else {
             throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName");
         }
         return placementDemand;
@@ -396,18 +396,18 @@ public class OofHomingV2 {
      * Builds the resource model info section
      *
      */
-    private ModelInfo buildModelInfo(ModelInfoMetadata metadata){
+    private ModelInfo buildModelInfo(ModelInfoMetadata metadata) {
         ModelInfo modelInfo = new ModelInfo();
         String invariantUuid = metadata.getModelInvariantUuid();
         String modelUuid = metadata.getModelUuid();
-        if(isNotBlank(invariantUuid) && isNotBlank(modelUuid)){
+        if (isNotBlank(invariantUuid) && isNotBlank(modelUuid)) {
             modelInfo.setModelInvariantId(invariantUuid);
             modelInfo.setModelVersionId(modelUuid);
             modelInfo.setModelName(metadata.getModelName());
             modelInfo.setModelVersion(metadata.getModelVersion());
-        }else if(isNotBlank(invariantUuid)){
+        } else if (isNotBlank(invariantUuid)) {
             throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + MODEL_VERSION_ID);
-        }else{
+        } else {
             throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + MODEL_INVARIANT_ID);
         }
         return modelInfo;
@@ -417,30 +417,30 @@ public class OofHomingV2 {
      * Adds required, excluded, and existing candidates to a demand
      *
      */
-    private void addCandidates(SolutionCandidates candidates, JSONObject demand){
+    private void addCandidates(SolutionCandidates candidates, JSONObject demand) {
         List<Candidate> required = candidates.getRequiredCandidates();
         List<Candidate> excluded = candidates.getExcludedCandidates();
-        if(!required.isEmpty()){
+        if (!required.isEmpty()) {
             demand.put("requiredCandidates", required);
         }
-        if(!excluded.isEmpty()){
+        if (!excluded.isEmpty()) {
             demand.put("excludedCandidates", excluded);
         }
-        //TODO support existing candidates
+        // TODO support existing candidates
     }
 
     /**
      * Processes the license solutions and sets to the corresponding generic vnf
      *
      */
-    private void processLicenseSolution(ServiceInstance serviceInstance, JSONArray licenseSolutions){
+    private void processLicenseSolution(ServiceInstance serviceInstance, JSONArray licenseSolutions) {
         List<GenericVnf> vnfs = serviceInstance.getVnfs();
 
         logger.debug("Processing the license solution");
-        for(int i = 0; i < licenseSolutions.length(); i++){
+        for (int i = 0; i < licenseSolutions.length(); i++) {
             JSONObject licenseSolution = licenseSolutions.getJSONObject(i);
-            for(GenericVnf vnf:vnfs){
-                if(licenseSolution.getString(SERVICE_RESOURCE_ID).equals(vnf.getVnfId())){
+            for (GenericVnf vnf : vnfs) {
+                if (licenseSolution.getString(SERVICE_RESOURCE_ID).equals(vnf.getVnfId())) {
                     License license = new License();
                     JSONArray entitlementPools = licenseSolution.getJSONArray("entitlementPoolUUID");
                     List<String> entitlementPoolsList = jsonUtils.StringArrayToList(entitlementPools);
@@ -456,47 +456,48 @@ public class OofHomingV2 {
     }
 
     /**
-     * Processes a placement solution list then correlates and sets each placement solution
-     * to its corresponding resource
+     * Processes a placement solution list then correlates and sets each placement solution to its corresponding
+     * resource
      *
      */
-    private void processPlacementSolution(ServiceInstance serviceInstance, JSONArray placements, int i){
+    private void processPlacementSolution(ServiceInstance serviceInstance, JSONArray placements, int i) {
         List<VpnBondingLink> links = serviceInstance.getVpnBondingLinks();
         List<AllottedResource> allottes = serviceInstance.getAllottedResources();
         List<GenericVnf> vnfs = serviceInstance.getVnfs();
 
-        logger.debug("Processing placement solution " + i+1);
-        for(int p = 0; p < placements.length(); p++){
+        logger.debug("Processing placement solution " + i + 1);
+        for (int p = 0; p < placements.length(); p++) {
             JSONObject placement = placements.getJSONObject(p);
             SolutionInfo solutionInfo = new SolutionInfo();
             solutionInfo.setSolutionId(i + 1);
             search: {
-                for(VpnBondingLink vbl:links){
+                for (VpnBondingLink vbl : links) {
                     List<ServiceProxy> proxies = vbl.getServiceProxies();
-                    for(ServiceProxy sp:proxies){
-                        if(placement.getString(SERVICE_RESOURCE_ID).equals(sp.getId())){
-                            if(i > 0){
-                                if(p % 2 == 0){
+                    for (ServiceProxy sp : proxies) {
+                        if (placement.getString(SERVICE_RESOURCE_ID).equals(sp.getId())) {
+                            if (i > 0) {
+                                if (p % 2 == 0) {
                                     VpnBondingLink vblNew = (VpnBondingLink) SerializationUtils.clone(vbl);
                                     vblNew.setVpnBondingLinkId(UUID.randomUUID().toString());
                                     links.add(vblNew);
                                 }
-                                links.get(links.size() - 1).getServiceProxy(sp.getId()).setServiceInstance(setSolution(solutionInfo, placement));
-                            }else{
+                                links.get(links.size() - 1).getServiceProxy(sp.getId())
+                                        .setServiceInstance(setSolution(solutionInfo, placement));
+                            } else {
                                 sp.setServiceInstance(setSolution(solutionInfo, placement));
                             }
                             break search;
                         }
                     }
                 }
-                for(AllottedResource ar:allottes){
-                    if(placement.getString(SERVICE_RESOURCE_ID).equals(ar.getId())){
+                for (AllottedResource ar : allottes) {
+                    if (placement.getString(SERVICE_RESOURCE_ID).equals(ar.getId())) {
                         ar.setParentServiceInstance(setSolution(solutionInfo, placement));
                         break search;
                     }
                 }
-                for(GenericVnf vnf:vnfs){
-                    if(placement.getString(SERVICE_RESOURCE_ID).equals(vnf.getVnfId())){
+                for (GenericVnf vnf : vnfs) {
+                    if (placement.getString(SERVICE_RESOURCE_ID).equals(vnf.getVnfId())) {
                         ServiceInstance si = setSolution(solutionInfo, placement);
                         serviceInstance.setSolutionInfo(si.getSolutionInfo());
                         serviceInstance.getVnfs().add(si.getVnfs().get(0));
@@ -512,7 +513,7 @@ public class OofHomingV2 {
      * Creates and sets necessary pojos with placement solution data for a given demand
      *
      */
-    private ServiceInstance setSolution(SolutionInfo solutionInfo, JSONObject placement){
+    private ServiceInstance setSolution(SolutionInfo solutionInfo, JSONObject placement) {
         logger.debug("Mapping placement solution");
         String invalidMessage = "Oof Response contains invalid: ";
 
@@ -528,45 +529,45 @@ public class OofHomingV2 {
 
         ServiceInstance si = new ServiceInstance();
         CloudRegion cloud = setCloud(assignmentsMap);
-        if(type.equals("service")){
-            if(identifierType.equals(CandidateType.SERVICE_INSTANCE_ID.toString())){
+        if (type.equals("service")) {
+            if (identifierType.equals(CandidateType.SERVICE_INSTANCE_ID.toString())) {
                 solutionInfo.setHomed(true);
                 si.setServiceInstanceId(identifierValue);
                 si.setOrchestrationStatus(OrchestrationStatus.CREATED);
                 cloud.setLcpCloudRegionId(assignmentsMap.get("cloudRegionId"));
-                if(assignmentsMap.containsKey("vnfHostName")){
+                if (assignmentsMap.containsKey("vnfHostName")) {
                     logger.debug("Resources has been homed to a vnf");
                     GenericVnf vnf = setVnf(assignmentsMap);
                     vnf.setCloudRegion(cloud);
                     si.getVnfs().add(vnf);
 
-                }else if(assignmentsMap.containsKey("primaryPnfName")){
+                } else if (assignmentsMap.containsKey("primaryPnfName")) {
                     logger.debug("Resources has been homed to a pnf");
                     Pnf priPnf = setPnf(assignmentsMap, "primary");
                     priPnf.setCloudRegion(cloud);
                     si.getPnfs().add(priPnf);
-                    if(assignmentsMap.containsKey("secondaryPnfName")){
+                    if (assignmentsMap.containsKey("secondaryPnfName")) {
                         Pnf secPnf = setPnf(assignmentsMap, "secondary");
                         secPnf.setCloudRegion(cloud);
                         si.getPnfs().add(secPnf);
                     }
                 }
-            }else{
+            } else {
                 logger.debug(invalidMessage + IDENTIFIER_TYPE);
                 throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE);
             }
-        }else if(type.equals("cloud")){
-            if(identifierType.equals(CandidateType.CLOUD_REGION_ID.toString())){
+        } else if (type.equals("cloud")) {
+            if (identifierType.equals(CandidateType.CLOUD_REGION_ID.toString())) {
                 logger.debug("Resources has been homed to a cloud region");
                 cloud.setLcpCloudRegionId(identifierValue);
                 solutionInfo.setHomed(false);
                 solutionInfo.setTargetedCloudRegion(cloud);
                 si.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
-            }else{
+            } else {
                 logger.debug(invalidMessage + IDENTIFIER_TYPE);
                 throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE);
             }
-        }else{
+        } else {
             logger.debug(invalidMessage + INVENTORY_TYPE);
             throw new BpmnError(UNPROCESSABLE, invalidMessage + INVENTORY_TYPE);
         }
@@ -578,7 +579,7 @@ public class OofHomingV2 {
      * Sets the cloud data to a cloud region object
      *
      */
-    private CloudRegion setCloud(Map<String, String> assignmentsMap){
+    private CloudRegion setCloud(Map<String, String> assignmentsMap) {
         CloudRegion cloud = new CloudRegion();
         cloud.setCloudOwner(assignmentsMap.get("cloudOwner"));
         cloud.setCloudRegionVersion(assignmentsMap.get("aicVersion"));
@@ -590,7 +591,7 @@ public class OofHomingV2 {
      * Sets the vnf data to a generic vnf object
      *
      */
-    private GenericVnf setVnf(Map<String, String> assignmentsMap){
+    private GenericVnf setVnf(Map<String, String> assignmentsMap) {
         GenericVnf vnf = new GenericVnf();
         vnf.setOrchestrationStatus(OrchestrationStatus.CREATED);
         vnf.setVnfName(assignmentsMap.get("vnfHostName"));
@@ -602,7 +603,7 @@ public class OofHomingV2 {
      * Sets the pnf data to a pnf object
      *
      */
-    private Pnf setPnf(Map<String, String> assignmentsMap, String role){
+    private Pnf setPnf(Map<String, String> assignmentsMap, String role) {
         Pnf pnf = new Pnf();
         pnf.setRole(role);
         pnf.setOrchestrationStatus(OrchestrationStatus.CREATED);