Merge "Reduce Cyclomatic Complexity"
authorLukasz Muszkieta <lukasz.muszkieta@nokia.com>
Thu, 7 May 2020 11:25:41 +0000 (11:25 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 7 May 2020 11:25:41 +0000 (11:25 +0000)
1  2 
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java

@@@ -38,8 -38,8 +38,8 @@@ import org.onap.so.bpmn.core.WorkflowEx
  import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
  import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
  import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
 -import org.onap.so.client.aai.AAIObjectType;
 -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
 +import org.onap.aaiclient.client.aai.AAIObjectType;
 +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
  import org.onap.logging.filter.base.ErrorCode;
  import org.onap.so.logger.LoggingAnchor;
  import org.onap.so.logger.MessageEnum;
@@@ -80,7 -80,7 +80,7 @@@ public class ExceptionBuilder 
              }
  
              logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
-                     ErrorCode.UnknownError.getValue(), msg.toString());
+                     ErrorCode.UnknownError.getValue(), msg);
              execution.setVariable(errorVariable, exception.getMessage());
          } catch (Exception ex) {
              // log trace, allow process to complete gracefully
              }
  
              logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
-                     ErrorCode.UnknownError.getValue(), msg.toString());
+                     ErrorCode.UnknownError.getValue(), msg);
              execution.setVariable(errorVariable, exception.getMessage());
          } catch (Exception ex) {
              // log trace, allow process to complete gracefully
                  }
              }
              logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
-                     ErrorCode.UnknownError.getValue(), msg.toString());
+                     ErrorCode.UnknownError.getValue(), msg);
              execution.setVariable(errorVariable, exception.getMessage());
          } catch (Exception ex) {
              // log trace, allow process to complete gracefully
                  }
              }
              logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
-                     ErrorCode.UnknownError.getValue(), msg.toString());
+                     ErrorCode.UnknownError.getValue(), msg);
              execution.setVariable(errorVariable, exception.getMessage());
          } catch (Exception ex) {
              // log trace, allow process to complete gracefully
  
      public void processAuditException(DelegateExecutionImpl execution, boolean flowShouldContinue) {
          logger.debug("Processing Audit Results");
-         String auditListString = (String) execution.getVariable("auditInventoryResult");
+         String auditListString = execution.getVariable("auditInventoryResult");
          String processKey = getProcessKey(execution.getDelegateExecution());
          if (auditListString != null) {
              StringBuilder errorMessage = new StringBuilder();
  
              } catch (IOException | BBObjectNotFoundException e) {
                  errorMessage = errorMessage.append("process objects in AAI. ");
+                 logger.error("Exception occurred in processAuditException", e);
              }
  
              if (flowShouldContinue) {
          }
      }
  
 -    public void processVnfAdapterException(DelegateExecution execution) {
 +    public void processOpenstackAdapterException(DelegateExecution execution) {
          StringBuilder workflowExceptionMessage = new StringBuilder();
          logger.debug("Processing Vnf Adapter Exception");
          try {
@@@ -23,8 -23,8 +23,8 @@@ package org.onap.so.client.restproperti
  import java.net.MalformedURLException;
  import java.net.URL;
  import org.onap.so.bpmn.core.UrnPropertiesReader;
 -import org.onap.so.client.aai.AAIProperties;
 -import org.onap.so.client.aai.AAIVersion;
 +import org.onap.aaiclient.client.aai.AAIProperties;
 +import org.onap.aaiclient.client.aai.AAIVersion;
  import org.springframework.stereotype.Component;
  
  @Component
@@@ -33,11 -33,10 +33,10 @@@ public class AAIPropertiesImpl implemen
      public static final String MSO_MSO_KEY = "mso.msoKey";
      public static final String AAI_AUTH = "aai.auth";
      public static final String AAI_ENDPOINT = "aai.endpoint";
-     private UrnPropertiesReader reader;
  
      @Override
      public URL getEndpoint() throws MalformedURLException {
-         return new URL(reader.getVariable(AAI_ENDPOINT));
+         return new URL(UrnPropertiesReader.getVariable(AAI_ENDPOINT));
      }
  
      @Override
  
      @Override
      public String getAuth() {
-         return reader.getVariable(AAI_AUTH);
+         return UrnPropertiesReader.getVariable(AAI_AUTH);
      }
  
      @Override
      public String getKey() {
-         return reader.getVariable(MSO_MSO_KEY);
+         return UrnPropertiesReader.getVariable(MSO_MSO_KEY);
      }
  }