summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java10
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java77
-rwxr-xr-xadapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java4
-rw-r--r--asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java57
-rw-r--r--asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java111
-rw-r--r--asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java20
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java18
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java5
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java10
-rw-r--r--common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java56
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java37
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java56
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java90
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java41
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java90
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java76
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java39
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java76
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java13
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java6
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java26
-rw-r--r--mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java2
24 files changed, 414 insertions, 520 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
index 699bd7c684..6862492d7e 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
@@ -143,7 +143,7 @@ public class MsoHeatUtils extends MsoCommonUtils {
String tenantId,
String stackName,
String heatTemplate,
- Map <String, ? extends Object> stackInputs,
+ Map <String, ?> stackInputs,
boolean pollForCompletion,
int timeoutMinutes) throws MsoException {
// Just call the new method with the environment & files variable set to null
@@ -165,7 +165,7 @@ public class MsoHeatUtils extends MsoCommonUtils {
String tenantId,
String stackName,
String heatTemplate,
- Map <String, ? extends Object> stackInputs,
+ Map <String, ?> stackInputs,
boolean pollForCompletion,
int timeoutMinutes,
String environment) throws MsoException {
@@ -188,7 +188,7 @@ public class MsoHeatUtils extends MsoCommonUtils {
String tenantId,
String stackName,
String heatTemplate,
- Map <String, ? extends Object> stackInputs,
+ Map <String, ?> stackInputs,
boolean pollForCompletion,
int timeoutMinutes,
String environment,
@@ -211,7 +211,7 @@ public class MsoHeatUtils extends MsoCommonUtils {
String tenantId,
String stackName,
String heatTemplate,
- Map <String, ? extends Object> stackInputs,
+ Map <String, ?> stackInputs,
boolean pollForCompletion,
int timeoutMinutes,
String environment,
@@ -275,7 +275,7 @@ public class MsoHeatUtils extends MsoCommonUtils {
String tenantId,
String stackName,
String heatTemplate,
- Map <String, ? extends Object> stackInputs,
+ Map <String, ?> stackInputs,
boolean pollForCompletion,
int timeoutMinutes,
String environment,
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java
index d0d3999cf4..c1c5aee8f1 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java
@@ -531,44 +531,43 @@ public class CatalogDbAdapterRest {
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response resourceRecipe(@QueryParam("resourceModelUuid") String rmUuid, @QueryParam("action") String action) {
int respStatus = HttpStatus.SC_OK;
- CatalogDatabase db = CatalogDatabase.getInstance();
- String entity = "";
- try{
- if(rmUuid != null && !"".equals(rmUuid)){
- LOGGER.debug ("Query recipe by resource model uuid: " + rmUuid);
- //check vnf and network and ar, the resource could be any resource.
- Recipe recipe = db.getVnfRecipeByModuleUuid(rmUuid, action);
- if(null == recipe){
- recipe = db.getNetworkRecipeByModuleUuid(rmUuid, action);
- }
- if(null == recipe){
- recipe = db.getArRecipeByModuleUuid(rmUuid, action);
- }
- if(recipe != null){
- QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe);
- entity = resourceRecipe.JSON2(false, false);
- }
- else{
- respStatus = HttpStatus.SC_NOT_FOUND;
- }
- }else{
- throw(new Exception("Incoming parameter is null or blank"));
- }
- LOGGER.debug ("Query recipe exit");
- return Response
- .status(respStatus)
- .entity(entity)
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .build();
- }catch(Exception e){
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, rmUuid, "", "resourceRecipe", MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query recipe by resource model uuid: ", e);
- CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
- return Response
- .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<CatalogQueryException>(excResp) {})
- .build();
- }finally {
- db.close();
- }
+ String entity = "";
+ try (CatalogDatabase db = CatalogDatabase.getInstance()) {
+ if (rmUuid != null && !"".equals(rmUuid)) {
+ LOGGER.debug("Query recipe by resource model uuid: " + rmUuid);
+ //check vnf and network and ar, the resource could be any resource.
+ Recipe recipe = db.getVnfRecipeByModuleUuid(rmUuid, action);
+ if (null == recipe) {
+ recipe = db.getNetworkRecipeByModuleUuid(rmUuid, action);
+ }
+ if (null == recipe) {
+ recipe = db.getArRecipeByModuleUuid(rmUuid, action);
+ }
+ if (recipe != null) {
+ QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe);
+ entity = resourceRecipe.JSON2(false, false);
+ } else {
+ respStatus = HttpStatus.SC_NOT_FOUND;
+ }
+ } else {
+ throw (new Exception("Incoming parameter is null or blank"));
+ }
+ LOGGER.debug("Query recipe exit");
+ return Response
+ .status(respStatus)
+ .entity(entity)
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .build();
+ } catch (Exception e) {
+ LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, rmUuid, "", "resourceRecipe",
+ MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query recipe by resource model uuid: ", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
+ CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response
+ .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {
+ })
+ .build();
+ }
}
}
diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java
index 856b713c94..2118eec0a5 100755
--- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java
+++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java
@@ -88,7 +88,7 @@ public interface VduPlugin {
String tenantId,
String vduInstanceName,
VduBlueprint vduBlueprint,
- Map <String, ? extends Object> inputs,
+ Map <String, ?> inputs,
String environmentFile,
int timeoutMinutes,
boolean suppressBackout)
@@ -198,7 +198,7 @@ public interface VduPlugin {
String tenantId,
String vduInstanceId,
VduBlueprint vduBlueprint,
- Map <String, ? extends Object> inputs,
+ Map <String, ?> inputs,
String environmentFile,
int timeoutMinutes)
throws MsoException;
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java
index e0f338e27c..8c08d3eb26 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java
@@ -419,39 +419,34 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller {
toscaResourceStruct.getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID);
logger.debug("vfGroups:" + vfGroups.toString());
- Collections.sort(vfGroups, new Comparator<org.openecomp.sdc.toscaparser.api.Group>() {
-
- @Override
- public int compare(org.openecomp.sdc.toscaparser.api.Group group1,
- org.openecomp.sdc.toscaparser.api.Group group2) {
-
- // Field name1Field = group1.class.getDeclaredField("name");
- // name1Field.setAccessible(true);
- String thisName = group1.getName(); // (String)
- // name1Field.get(group1);
- String thatName = group2.getName(); // (String)
- // name1Field.get(group2);
-
- Matcher m = lastDigit.matcher(thisName);
- Matcher m2 = lastDigit.matcher(thatName);
-
- String thisDigit = "0";
- String thatDigit = "0";
- if(m.find()) {
- thisDigit = m.group();
- } else {
- return -1;
- }
- if(m2.find()) {
- thatDigit = m2.group();
- } else {
- return 1;
- }
+ vfGroups.sort((group1, group2) -> {
+
+ // Field name1Field = group1.class.getDeclaredField("name");
+ // name1Field.setAccessible(true);
+ String thisName = group1.getName(); // (String)
+ // name1Field.get(group1);
+ String thatName = group2.getName(); // (String)
+ // name1Field.get(group2);
+
+ Matcher m = lastDigit.matcher(thisName);
+ Matcher m2 = lastDigit.matcher(thatName);
+
+ String thisDigit = "0";
+ String thatDigit = "0";
+ if (m.find()) {
+ thisDigit = m.group();
+ } else {
+ return -1;
+ }
+ if (m2.find()) {
+ thatDigit = m2.group();
+ } else {
+ return 1;
+ }
- return new Integer(thisDigit).compareTo(new Integer(thatDigit));
+ return new Integer(thisDigit).compareTo(new Integer(thatDigit));
- }
- });
+ });
logger.debug("vfGroupsAfter:" + vfGroups.toString());
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java
index 2080be137c..396784add4 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java
@@ -42,51 +42,15 @@ public class ASDCNotificationLogging {
if (asdcNotification == null) {
return "NULL";
}
- StringBuilder buffer = new StringBuilder("ASDC Notification:");
- buffer.append(System.lineSeparator());
-
- buffer.append("DistributionID:");
- buffer.append(testNull(asdcNotification.getDistributionID()));
- buffer.append(System.lineSeparator());
-
-
- buffer.append("ServiceName:");
- buffer.append(testNull(asdcNotification.getServiceName()));
- buffer.append(System.lineSeparator());
-
-
- buffer.append("ServiceVersion:");
- buffer.append(testNull(asdcNotification.getServiceVersion()));
- buffer.append(System.lineSeparator());
-
-
- buffer.append("ServiceUUID:");
- buffer.append(testNull(asdcNotification.getServiceUUID()));
- buffer.append(System.lineSeparator());
-
-
- buffer.append("ServiceInvariantUUID:");
- buffer.append(testNull(asdcNotification.getServiceInvariantUUID()));
- buffer.append(System.lineSeparator());
-
-
- buffer.append("ServiceDescription:");
- buffer.append(testNull(asdcNotification.getServiceDescription()));
- buffer.append(System.lineSeparator());
-
-
- buffer.append("Service Artifacts List:");
- buffer.append(System.lineSeparator());
- buffer.append(testNull(dumpArtifactInfoList(asdcNotification.getServiceArtifacts())));
- buffer.append(System.lineSeparator());
-
- buffer.append("Resource Instances List:");
- buffer.append(System.lineSeparator());
- buffer.append(testNull(dumpASDCResourcesList(asdcNotification)));
- buffer.append(System.lineSeparator());
-
-
- return buffer.toString();
+ return "ASDC Notification:" + System.lineSeparator() +
+ "DistributionID:" + testNull(asdcNotification.getDistributionID()) + System.lineSeparator() +
+ "ServiceName:" + testNull(asdcNotification.getServiceName()) + System.lineSeparator() +
+ "ServiceVersion:" + testNull(asdcNotification.getServiceVersion()) + System.lineSeparator() +
+ "ServiceUUID:" + testNull(asdcNotification.getServiceUUID()) + System.lineSeparator() +
+ "ServiceInvariantUUID:" + testNull(asdcNotification.getServiceInvariantUUID()) + System.lineSeparator() +
+ "ServiceDescription:" + testNull(asdcNotification.getServiceDescription()) + System.lineSeparator() +
+ "Service Artifacts List:" + System.lineSeparator() + testNull(dumpArtifactInfoList(asdcNotification.getServiceArtifacts())) + System.lineSeparator() +
+ "Resource Instances List:" + System.lineSeparator() + testNull(dumpASDCResourcesList(asdcNotification)) + System.lineSeparator();
}
public static String dumpCSARNotification(INotificationData asdcNotification, ToscaResourceStructure toscaResourceStructure) {
@@ -418,52 +382,17 @@ public class ASDCNotificationLogging {
return null;
}
- StringBuilder buffer = new StringBuilder("Resource Instance Info:");
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceInstanceName:");
- buffer.append(testNull(resourceInstance.getResourceInstanceName()));
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceCustomizationUUID:");
- buffer.append(testNull(resourceInstance.getResourceCustomizationUUID()));
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceInvariantUUID:");
- buffer.append(testNull(resourceInstance.getResourceInvariantUUID()));
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceName:");
- buffer.append(testNull(resourceInstance.getResourceName()));
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceType:");
- buffer.append(testNull(resourceInstance.getResourceType()));
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceUUID:");
- buffer.append(testNull(resourceInstance.getResourceUUID()));
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceVersion:");
- buffer.append(testNull(resourceInstance.getResourceVersion()));
- buffer.append(System.lineSeparator());
-
- buffer.append("Category:");
- buffer.append(testNull(resourceInstance.getCategory()));
- buffer.append(System.lineSeparator());
-
- buffer.append("SubCategory:");
- buffer.append(testNull(resourceInstance.getSubcategory()));
- buffer.append(System.lineSeparator());
-
- buffer.append("Resource Artifacts List:");
- buffer.append(System.lineSeparator());
- buffer.append(testNull(dumpArtifactInfoList(resourceInstance.getArtifacts())));
- buffer.append(System.lineSeparator());
-
- return buffer.toString();
-
+ return "Resource Instance Info:" + System.lineSeparator() +
+ "ResourceInstanceName:" + testNull(resourceInstance.getResourceInstanceName()) + System.lineSeparator() +
+ "ResourceCustomizationUUID:" + testNull(resourceInstance.getResourceCustomizationUUID()) + System.lineSeparator() +
+ "ResourceInvariantUUID:" + testNull(resourceInstance.getResourceInvariantUUID()) + System.lineSeparator() +
+ "ResourceName:" + testNull(resourceInstance.getResourceName()) + System.lineSeparator() +
+ "ResourceType:" + testNull(resourceInstance.getResourceType()) + System.lineSeparator() +
+ "ResourceUUID:" + testNull(resourceInstance.getResourceUUID()) + System.lineSeparator() +
+ "ResourceVersion:" + testNull(resourceInstance.getResourceVersion()) + System.lineSeparator() +
+ "Category:" + testNull(resourceInstance.getCategory()) + System.lineSeparator() +
+ "SubCategory:" + testNull(resourceInstance.getSubcategory()) + System.lineSeparator() +
+ "Resource Artifacts List:" + System.lineSeparator() + testNull(dumpArtifactInfoList(resourceInstance.getArtifacts())) + System.lineSeparator();
}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java
index c0a1f53283..f9871b745a 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java
@@ -43,19 +43,15 @@ public class NotificationLogging implements InvocationHandler {
private static Map<Object, List<Method>> objectMethodsToLog = new HashMap<>();
protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC);
-
- private static InvocationHandler handler = new InvocationHandler() {
- @Override
- public Object invoke(Object arg0, Method arg1, Object[] arg2)
- throws Throwable {
- List<Method> methods = objectMethodsToLog.get(arg0);
- if ((methods == null) || (methods.isEmpty())) {
- // Do nothing for now...
- return null;
- }
- methods.add(arg1);
- return arg1.invoke(arg0, arg2);
+
+ private static InvocationHandler handler = (arg0, arg1, arg2) -> {
+ List<Method> methods = objectMethodsToLog.get(arg0);
+ if ((methods == null) || (methods.isEmpty())) {
+ // Do nothing for now...
+ return null;
}
+ methods.add(arg1);
+ return arg1.invoke(arg0, arg2);
};
public static InvocationHandler getHandler() {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java
index 2ad1e30316..846b87aba8 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java
@@ -94,23 +94,5 @@ public class CryptoUtils {
return b;
}
- /**
- * Not Used...
- *
- * Call Rttp utility jar to encrypt pwd
- * @param clearPassword
- * @return
- * @throws GeneralSecurityException
- * @throws Exception
- *
- public static String encryptRttpPwd(String clearPassword) throws GeneralSecurityException {
- try {
- return RttpBasicAuth.encrypt(clearPassword);
- } catch (Exception e) {
- // wrap generic exception
- throw new GeneralSecurityException(e);
- }
- }
- */
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java
index 9fcde31e4f..0bb5186a17 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java
@@ -68,7 +68,7 @@ public class BPMNUtil {
}
@SuppressWarnings("unchecked")
- public static <T extends Object> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) {
+ public static <T> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) {
String pID = getProcessInstanceId(processEngineServices,
processDefinitionID);
assertProcessInstanceFinished(processEngineServices, pID);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java
index 2ebb44a644..38d0584d0d 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java
@@ -35,11 +35,6 @@ public class FileUtil {
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
- private FileUtil() {
- /**
- * Constructor.
- */
- }
/**
* Read the specified resource file and return the contents as a String.
*
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
index c346308e2b..730c1451d5 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
@@ -321,14 +321,8 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
}
private void loadFromDB(DelegateExecution execution, ProcessEngineConfigurationImpl processEngineConfiguration) {
- Command<List<URNMapping>> command = new Command<List<URNMapping>>() {
- @SuppressWarnings("unchecked")
- @Override
- public List<URNMapping> execute(CommandContext commandContext) {
- return (List<URNMapping>) commandContext.getDbSqlSession().selectList(
- "mso.urnMapping.selectAll", null);
- }
- };
+ Command<List<URNMapping>> command = commandContext -> (List<URNMapping>) commandContext.getDbSqlSession()
+ .selectList("mso.urnMapping.selectAll", null);
CustomMyBatisSessionFactory sessionFactory = new CustomMyBatisSessionFactory();
sessionFactory.initFromProcessEngineConfiguration(processEngineConfiguration,
diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java b/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java
index 8da155fe08..ec0b54a14f 100644
--- a/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java
+++ b/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java
@@ -159,15 +159,9 @@ public class MsoJsonProperties extends AbstractMsoProperties {
@Override
public String toString() {
- StringBuilder response = new StringBuilder();
- response.append("Config file ").append(propertiesFileName).append("(Timer:").append(automaticRefreshInMinutes)
- .append("mins):").append(System.getProperty("line.separator"));
- response.append(this.jsonRootNode.toString());
- response.append(System.getProperty("line.separator"));
- response.append(System.getProperty("line.separator"));
- return response.toString();
-
+ return "Config file " + propertiesFileName + "(Timer:" + automaticRefreshInMinutes + "mins):" + System
+ .getProperty("line.separator") + this.jsonRootNode.toString() + System.getProperty("line.separator")
+ + System.getProperty("line.separator");
}
-
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java
index 4e1468c4e9..2c7bd1cc36 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java
@@ -130,33 +130,35 @@ public class NetworkInfoHandler {
if (ar.getVnfType () != null) {
vi.setNetworkType (ar.getVnfType ());
}
- if (version.equals(Constants.SCHEMA_VERSION_V1)) {
- if (ar.getServiceType () != null) {
- vi.setServiceType (ar.getServiceType ());
- }
- if (ar.getAicNodeClli () != null) {
- vi.setAicNodeClli (ar.getAicNodeClli ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getServiceInstanceId () != null) {
- vi.setServiceInstanceId (ar.getServiceInstanceId ());
- }
-
+ switch (version) {
+ case Constants.SCHEMA_VERSION_V1:
+ if (ar.getServiceType() != null) {
+ vi.setServiceType(ar.getServiceType());
+ }
+ if (ar.getAicNodeClli() != null) {
+ vi.setAicNodeClli(ar.getAicNodeClli());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V2:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V3:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getServiceInstanceId() != null) {
+ vi.setServiceInstanceId(ar.getServiceInstanceId());
+ }
+
+ break;
}
if (ar.getTenantId () != null) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java
index c87b4f387d..3d419926f1 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java
@@ -147,24 +147,27 @@ public class NetworkMsoInfraRequest {
}
// Verify that the elements correspond to the version
-
- if (version.equals(Constants.SCHEMA_VERSION_V1)) {
- if (this.networkInputs.getBackoutOnFailure() != null || this.networkInputs.getAicCloudRegion() != null ||
- this.networkInputs.getServiceInstanceId() != null) {
- throw new ValidationException ("format for v1 version of network request");
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
- if (this.networkInputs.getServiceType() != null || this.networkInputs.getAicNodeClli() != null ||
- this.networkInputs.getServiceInstanceId() != null) {
- throw new ValidationException ("format for v2 version of network request");
- }
+
+ switch (version) {
+ case Constants.SCHEMA_VERSION_V1:
+ if (this.networkInputs.getBackoutOnFailure() != null || this.networkInputs.getAicCloudRegion() != null
+ ||
+ this.networkInputs.getServiceInstanceId() != null) {
+ throw new ValidationException("format for v1 version of network request");
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V2:
+ if (this.networkInputs.getServiceType() != null || this.networkInputs.getAicNodeClli() != null ||
+ this.networkInputs.getServiceInstanceId() != null) {
+ throw new ValidationException("format for v2 version of network request");
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V3:
+ if (this.networkInputs.getServiceType() != null || this.networkInputs.getAicNodeClli() != null) {
+ throw new ValidationException("format for v3 version of network request");
+ }
+ break;
}
- else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
- if (this.networkInputs.getServiceType() != null || this.networkInputs.getAicNodeClli() != null) {
- throw new ValidationException ("format for v3 version of network request");
- }
- }
switch (action) {
case UPDATE:
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java
index 79247deca8..6a770202fa 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java
@@ -158,33 +158,35 @@ public class NetworkRequestHandler {
if (ar.getVnfType () != null) {
vi.setNetworkType (ar.getVnfType ());
}
- if (version.equals(Constants.SCHEMA_VERSION_V1)) {
- if (ar.getServiceType () != null) {
- vi.setServiceType (ar.getServiceType ());
- }
- if (ar.getAicNodeClli () != null) {
- vi.setAicNodeClli (ar.getAicNodeClli ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getServiceInstanceId () != null) {
- vi.setServiceInstanceId (ar.getServiceInstanceId ());
- }
-
+ switch (version) {
+ case Constants.SCHEMA_VERSION_V1:
+ if (ar.getServiceType() != null) {
+ vi.setServiceType(ar.getServiceType());
+ }
+ if (ar.getAicNodeClli() != null) {
+ vi.setAicNodeClli(ar.getAicNodeClli());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V2:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V3:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getServiceInstanceId() != null) {
+ vi.setServiceInstanceId(ar.getServiceInstanceId());
+ }
+
+ break;
}
if (ar.getTenantId () != null) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java
index a5e1f6f4e2..d13212a483 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java
@@ -148,50 +148,52 @@ public class VnfInfoHandler {
if (ar.getVolumeGroupId () != null) {
vi.setVolumeGroupId (ar.getVolumeGroupId ());
}
- if (version.equals(Constants.SCHEMA_VERSION_V1)) {
- if (ar.getServiceType () != null) {
- vi.setServiceType (ar.getServiceType ());
- }
- if (ar.getAicNodeClli () != null) {
- vi.setAicNodeClli (ar.getAicNodeClli ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getVfModuleName () != null) {
- vi.setVfModuleName (ar.getVfModuleName ());
- }
- if (ar.getVfModuleId () != null) {
- vi.setVfModuleId (ar.getVfModuleId ());
- }
- if (ar.getVfModuleModelName () != null) {
- vi.setVfModuleModelName (ar.getVfModuleModelName ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getVfModuleName () != null) {
- vi.setVfModuleName (ar.getVfModuleName ());
- }
- if (ar.getVfModuleId () != null) {
- vi.setVfModuleId (ar.getVfModuleId ());
- }
- if (ar.getVfModuleModelName () != null) {
- vi.setVfModuleModelName (ar.getVfModuleModelName ());
- }
- if (ar.getServiceInstanceId () != null) {
- vi.setServiceInstanceId (ar.getServiceInstanceId ());
- }
+ switch (version) {
+ case Constants.SCHEMA_VERSION_V1:
+ if (ar.getServiceType() != null) {
+ vi.setServiceType(ar.getServiceType());
+ }
+ if (ar.getAicNodeClli() != null) {
+ vi.setAicNodeClli(ar.getAicNodeClli());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V2:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getVfModuleName() != null) {
+ vi.setVfModuleName(ar.getVfModuleName());
+ }
+ if (ar.getVfModuleId() != null) {
+ vi.setVfModuleId(ar.getVfModuleId());
+ }
+ if (ar.getVfModuleModelName() != null) {
+ vi.setVfModuleModelName(ar.getVfModuleModelName());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V3:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getVfModuleName() != null) {
+ vi.setVfModuleName(ar.getVfModuleName());
+ }
+ if (ar.getVfModuleId() != null) {
+ vi.setVfModuleId(ar.getVfModuleId());
+ }
+ if (ar.getVfModuleModelName() != null) {
+ vi.setVfModuleModelName(ar.getVfModuleModelName());
+ }
+ if (ar.getServiceInstanceId() != null) {
+ vi.setServiceInstanceId(ar.getServiceInstanceId());
+ }
+ break;
}
qr.setVnfInputs (vi);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java
index 80d0c48a5e..1f3008aa1a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java
@@ -157,26 +157,29 @@ public class VnfMsoInfraRequest {
throw new ValidationException ("format for vnf request");
}
// Verify that the elements correspond to the version
-
-
- if (version.equals(Constants.SCHEMA_VERSION_V1)) {
- if (this.vnfInputs.getVfModuleName () != null || this.vnfInputs.getVfModuleId () != null ||
- this.vnfInputs.getVfModuleModelName () != null || this.vnfInputs.getAsdcServiceModelVersion () != null ||
- this.vnfInputs.getBackoutOnFailure() != null || this.vnfInputs.getAicCloudRegion() != null ||
- this.vnfInputs.getServiceInstanceId () != null) {
- throw new ValidationException ("format for v1 version of vnf request");
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
- if (this.vnfInputs.getServiceType() != null || this.vnfInputs.getAicNodeClli() != null || this.vnfInputs.getServiceInstanceId () != null) {
- throw new ValidationException ("format for v2 version of vnf request");
- }
+
+ switch (version) {
+ case Constants.SCHEMA_VERSION_V1:
+ if (this.vnfInputs.getVfModuleName() != null || this.vnfInputs.getVfModuleId() != null ||
+ this.vnfInputs.getVfModuleModelName() != null || this.vnfInputs.getAsdcServiceModelVersion() != null
+ ||
+ this.vnfInputs.getBackoutOnFailure() != null || this.vnfInputs.getAicCloudRegion() != null ||
+ this.vnfInputs.getServiceInstanceId() != null) {
+ throw new ValidationException("format for v1 version of vnf request");
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V2:
+ if (this.vnfInputs.getServiceType() != null || this.vnfInputs.getAicNodeClli() != null
+ || this.vnfInputs.getServiceInstanceId() != null) {
+ throw new ValidationException("format for v2 version of vnf request");
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V3:
+ if (this.vnfInputs.getServiceType() != null || this.vnfInputs.getAicNodeClli() != null) {
+ throw new ValidationException("format for v3 version of vnf request");
+ }
+ break;
}
- else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
- if (this.vnfInputs.getServiceType() != null || this.vnfInputs.getAicNodeClli() != null) {
- throw new ValidationException ("format for v3 version of vnf request");
- }
- }
if (!InfraUtils.isActionAllowed (props, "vnf", version, action.value ())) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java
index 2b7e71ad9c..098ed31b58 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java
@@ -179,50 +179,52 @@ public class VnfRequestHandler {
if (ar.getVolumeGroupId () != null) {
vi.setVolumeGroupId (ar.getVolumeGroupId ());
}
- if (version.equals(Constants.SCHEMA_VERSION_V1)) {
- if (ar.getServiceType () != null) {
- vi.setServiceType (ar.getServiceType ());
- }
- if (ar.getAicNodeClli () != null) {
- vi.setAicNodeClli (ar.getAicNodeClli ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getVfModuleName () != null) {
- vi.setVfModuleName (ar.getVfModuleName ());
- }
- if (ar.getVfModuleId () != null) {
- vi.setVfModuleId (ar.getVfModuleId ());
- }
- if (ar.getVfModuleModelName () != null) {
- vi.setVfModuleModelName (ar.getVfModuleModelName ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getVfModuleName () != null) {
- vi.setVfModuleName (ar.getVfModuleName ());
- }
- if (ar.getVfModuleId () != null) {
- vi.setVfModuleId (ar.getVfModuleId ());
- }
- if (ar.getVfModuleModelName () != null) {
- vi.setVfModuleModelName (ar.getVfModuleModelName ());
- }
- if (ar.getServiceInstanceId () != null) {
- vi.setServiceInstanceId (ar.getServiceInstanceId ());
- }
+ switch (version) {
+ case Constants.SCHEMA_VERSION_V1:
+ if (ar.getServiceType() != null) {
+ vi.setServiceType(ar.getServiceType());
+ }
+ if (ar.getAicNodeClli() != null) {
+ vi.setAicNodeClli(ar.getAicNodeClli());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V2:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getVfModuleName() != null) {
+ vi.setVfModuleName(ar.getVfModuleName());
+ }
+ if (ar.getVfModuleId() != null) {
+ vi.setVfModuleId(ar.getVfModuleId());
+ }
+ if (ar.getVfModuleModelName() != null) {
+ vi.setVfModuleModelName(ar.getVfModuleModelName());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V3:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getVfModuleName() != null) {
+ vi.setVfModuleName(ar.getVfModuleName());
+ }
+ if (ar.getVfModuleId() != null) {
+ vi.setVfModuleId(ar.getVfModuleId());
+ }
+ if (ar.getVfModuleModelName() != null) {
+ vi.setVfModuleModelName(ar.getVfModuleModelName());
+ }
+ if (ar.getServiceInstanceId() != null) {
+ vi.setServiceInstanceId(ar.getServiceInstanceId());
+ }
+ break;
}
qr.setVnfInputs (vi);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java
index 3de945a275..c74bb0734d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java
@@ -134,43 +134,45 @@ public class VolumeInfoHandler {
if (ar.getVnfType () != null) {
vi.setVnfType (ar.getVnfType ());
}
-
- if (version.equals(Constants.SCHEMA_VERSION_V1)) {
- if (ar.getServiceType () != null) {
- vi.setServiceType (ar.getServiceType ());
- }
- if (ar.getAicNodeClli () != null) {
- vi.setAicNodeClli (ar.getAicNodeClli ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getVfModuleModelName () != null) {
- vi.setVfModuleModelName (ar.getVfModuleModelName ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getVfModuleModelName () != null) {
- vi.setVfModuleModelName (ar.getVfModuleModelName ());
- }
- if (ar.getServiceInstanceId () != null) {
- vi.setServiceInstanceId (ar.getServiceInstanceId ());
- }
- if (ar.getVnfId () != null) {
- vi.setVnfId (ar.getVnfId ());
- }
- }
+
+ switch (version) {
+ case Constants.SCHEMA_VERSION_V1:
+ if (ar.getServiceType() != null) {
+ vi.setServiceType(ar.getServiceType());
+ }
+ if (ar.getAicNodeClli() != null) {
+ vi.setAicNodeClli(ar.getAicNodeClli());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V2:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getVfModuleModelName() != null) {
+ vi.setVfModuleModelName(ar.getVfModuleModelName());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V3:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getVfModuleModelName() != null) {
+ vi.setVfModuleModelName(ar.getVfModuleModelName());
+ }
+ if (ar.getServiceInstanceId() != null) {
+ vi.setServiceInstanceId(ar.getServiceInstanceId());
+ }
+ if (ar.getVnfId() != null) {
+ vi.setVnfId(ar.getVnfId());
+ }
+ break;
+ }
if (ar.getTenantId () != null) {
vi.setTenantId (ar.getTenantId ());
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java
index 0524a85bf3..f908a3f0d6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java
@@ -144,24 +144,27 @@ public class VolumeMsoInfraRequest {
// Verify that the elements correspond to the version
- if (version.equals(Constants.SCHEMA_VERSION_V1)) {
- if (this.volumeInputs.getBackoutOnFailure() != null || this.volumeInputs.getAicCloudRegion() != null ||
- this.volumeInputs.getVfModuleModelName () != null || this.volumeInputs.getAsdcServiceModelVersion () != null ||
- this.volumeInputs.getServiceInstanceId () != null || this.volumeInputs.getVnfId () != null) {
- throw new ValidationException ("format for v1 version of volume request");
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
- if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null ||
- this.volumeInputs.getServiceInstanceId () != null || this.volumeInputs.getVnfId () != null) {
- throw new ValidationException ("format for v2 version of volume request");
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
- if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null) {
- throw new ValidationException ("format for v3 version of volume request");
- }
- }
+ switch (version) {
+ case Constants.SCHEMA_VERSION_V1:
+ if (this.volumeInputs.getBackoutOnFailure() != null || this.volumeInputs.getAicCloudRegion() != null ||
+ this.volumeInputs.getVfModuleModelName() != null
+ || this.volumeInputs.getAsdcServiceModelVersion() != null ||
+ this.volumeInputs.getServiceInstanceId() != null || this.volumeInputs.getVnfId() != null) {
+ throw new ValidationException("format for v1 version of volume request");
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V2:
+ if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null ||
+ this.volumeInputs.getServiceInstanceId() != null || this.volumeInputs.getVnfId() != null) {
+ throw new ValidationException("format for v2 version of volume request");
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V3:
+ if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null) {
+ throw new ValidationException("format for v3 version of volume request");
+ }
+ break;
+ }
if (!InfraUtils.isActionAllowed (props, "volume", version, action.value ())) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java
index d1c1c18e87..e3af83df92 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java
@@ -166,43 +166,45 @@ public class VolumeRequestHandler {
if (ar.getVnfType () != null) {
vi.setVnfType (ar.getVnfType ());
}
-
- if (version.equals(Constants.SCHEMA_VERSION_V1)) {
- if (ar.getServiceType () != null) {
- vi.setServiceType (ar.getServiceType ());
- }
- if (ar.getAicNodeClli () != null) {
- vi.setAicNodeClli (ar.getAicNodeClli ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V2)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getVfModuleModelName () != null) {
- vi.setVfModuleModelName (ar.getVfModuleModelName ());
- }
- }
- else if (version.equals(Constants.SCHEMA_VERSION_V3)) {
- if (ar.getAaiServiceId () != null) {
- vi.setServiceId (ar.getAaiServiceId ());
- }
- if (ar.getAicCloudRegion () != null) {
- vi.setAicCloudRegion (ar.getAicCloudRegion ());
- }
- if (ar.getVfModuleModelName () != null) {
- vi.setVfModuleModelName (ar.getVfModuleModelName ());
- }
- if (ar.getServiceInstanceId () != null) {
- vi.setServiceInstanceId (ar.getServiceInstanceId ());
- }
- if (ar.getVnfId () != null) {
- vi.setVnfId (ar.getVnfId ());
- }
- }
+
+ switch (version) {
+ case Constants.SCHEMA_VERSION_V1:
+ if (ar.getServiceType() != null) {
+ vi.setServiceType(ar.getServiceType());
+ }
+ if (ar.getAicNodeClli() != null) {
+ vi.setAicNodeClli(ar.getAicNodeClli());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V2:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getVfModuleModelName() != null) {
+ vi.setVfModuleModelName(ar.getVfModuleModelName());
+ }
+ break;
+ case Constants.SCHEMA_VERSION_V3:
+ if (ar.getAaiServiceId() != null) {
+ vi.setServiceId(ar.getAaiServiceId());
+ }
+ if (ar.getAicCloudRegion() != null) {
+ vi.setAicCloudRegion(ar.getAicCloudRegion());
+ }
+ if (ar.getVfModuleModelName() != null) {
+ vi.setVfModuleModelName(ar.getVfModuleModelName());
+ }
+ if (ar.getServiceInstanceId() != null) {
+ vi.setServiceInstanceId(ar.getServiceInstanceId());
+ }
+ if (ar.getVnfId() != null) {
+ vi.setVnfId(ar.getVnfId());
+ }
+ break;
+ }
if (ar.getTenantId () != null) {
vi.setTenantId (ar.getTenantId ());
}
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
index c556ddadb5..6b27c50609 100644
--- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
@@ -1175,14 +1175,11 @@ public class CatalogDatabase implements Closeable {
* @return VnfRecipe object or null if none found
*/
public VnfRecipe getVnfRecipeByNameVersion(String modelName, String modelVersion, String action) {
- StringBuilder hql = new StringBuilder("FROM VnfRecipe WHERE vnfType = :vnfType AND version= :version AND action = :action ");
long startTime = System.currentTimeMillis();
- LOGGER.debug("Catalog database - get VNF recipe with name " + modelName
- + " and action "
- + action);
+ LOGGER.debug("Catalog database - get VNF recipe with name " + modelName + " and action " + action);
- Query query = getSession().createQuery(hql.toString());
+ Query query = getSession().createQuery("FROM VnfRecipe WHERE vnfType = :vnfType AND version= :version AND action = :action ");
query.setParameter(VNF_TYPE, modelName);
query.setParameter(MODEL_VERSION, modelVersion);
query.setParameter(ACTION, action);
@@ -1195,7 +1192,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort(resultList, new MavenLikeVersioningComparator());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse(resultList);
LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfRecipe", null);
@@ -4576,7 +4573,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
return resultList.get (0);
@@ -5161,7 +5158,7 @@ public class CatalogDatabase implements Closeable {
return null;
}
- Collections.sort (resultList, new MavenLikeVersioningComparator ());
+ resultList.sort(new MavenLikeVersioningComparator());
Collections.reverse (resultList);
return resultList.get (0);
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java
index b4c1f0594f..e22d1eb036 100644
--- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java
@@ -37,10 +37,6 @@ public class ArRecipe extends Recipe implements Serializable {
@Override
public String toString () {
- StringBuilder sb = new StringBuilder();
- sb.append(super.toString());
- sb.append(",modelName=").append(modelName);
- sb.append(",arParamXSD=").append(getParamXSD());
- return sb.toString();
+ return super.toString() + ",modelName=" + modelName + ",arParamXSD=" + getParamXSD();
}
}
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java
index b211dbd4c3..cb5bf64b8c 100644
--- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java
@@ -179,21 +179,17 @@ public class VnfResourceCustomization extends MavenLikeVersioning implements Ser
@Override
public String toString() {
- StringBuilder sb = new StringBuilder("VnfResourceCustomization: ");
- sb.append("ModelCustUuid=").append(this.modelCustomizationUuid);
- sb.append(", ModelInstanceName=").append(this.modelInstanceName);
- sb.append(", vnfResourceModelUuid=").append(this.vnfResourceModelUUID);
- sb.append(", creationTimestamp=").append(this.created);
- sb.append(", minInstances=").append(this.minInstances);
- sb.append(", maxInstances=").append(this.maxInstances);
- sb.append(", availabilityZoneMaxCount=").append(this.availabilityZoneMaxCount);
-// sb.append(", vnfResource:\n" + this.vnfResource == null ? "null" : this.vnfResource.toString());
- sb.append(", nfFunction=").append(this.nfFunction);
- sb.append(", nfType=").append(this.nfType);
- sb.append(", nfRole=").append(this.nfRole);
- sb.append(", nfNamingCode=").append(this.nfNamingCode);
-
- return sb.toString();
+ return "VnfResourceCustomization: " + "ModelCustUuid=" + this.modelCustomizationUuid +
+ ", ModelInstanceName=" + this.modelInstanceName +
+ ", vnfResourceModelUuid=" + this.vnfResourceModelUUID +
+ ", creationTimestamp=" + this.created +
+ ", minInstances=" + this.minInstances +
+ ", maxInstances=" + this.maxInstances +
+ ", availabilityZoneMaxCount=" + this.availabilityZoneMaxCount +
+ ", nfFunction=" + this.nfFunction +
+ ", nfType=" + this.nfType +
+ ", nfRole=" + this.nfRole +
+ ", nfNamingCode=" + this.nfNamingCode;
}
}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java
index 3dddb17d7c..c99a714b11 100644
--- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java
+++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java
@@ -167,7 +167,7 @@ public class MavenVersioningTest {
list.add(test11);
list.add(test12);
- Collections.sort(list,new MavenLikeVersioningComparator());
+ list.sort(new MavenLikeVersioningComparator());
//Collections.reverse(list);
assertTrue(list.get(0).getVersion().equals("0.02"));
assertTrue(list.get(1).getVersion().equals("1.1"));