diff options
Diffstat (limited to 'vid-app-common/src/main')
4 files changed, 38 insertions, 23 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/parser/VidNotionsBuilder.java b/vid-app-common/src/main/java/org/onap/vid/asdc/parser/VidNotionsBuilder.java index 3f18a5ace..760eb4251 100644 --- a/vid-app-common/src/main/java/org/onap/vid/asdc/parser/VidNotionsBuilder.java +++ b/vid-app-common/src/main/java/org/onap/vid/asdc/parser/VidNotionsBuilder.java @@ -24,6 +24,7 @@ import static java.util.stream.Collectors.toSet; import static org.apache.commons.lang3.StringUtils.equalsAnyIgnoreCase; import static org.apache.commons.lang3.StringUtils.equalsIgnoreCase; import static org.apache.commons.lang3.StringUtils.isEmpty; +import static org.hibernate.annotations.common.util.StringHelper.isNotEmpty; import static org.onap.vid.utils.KotlinUtilsKt.JACKSON_OBJECT_MAPPER; import com.google.common.collect.ImmutableMap; @@ -42,6 +43,7 @@ import org.onap.sdc.toscaparser.api.elements.Metadata; import org.onap.vid.exceptions.GenericUncheckedException; import org.onap.vid.model.ServiceModel; import org.onap.vid.model.VidNotions; +import org.onap.vid.model.VidNotions.InstantiationType; import org.onap.vid.model.VidNotions.InstantiationUI; import org.onap.vid.model.VidNotions.ModelCategory; import org.onap.vid.properties.Features; @@ -78,11 +80,13 @@ public class VidNotionsBuilder { VidNotions buildVidNotions(ISdcCsarHelper csarHelper, ServiceModel serviceModel) { VidNotions.ModelCategory modelCategory = suggestModelCategory(csarHelper, serviceModel); + final InstantiationType instantiationType = suggestInstantiationType(serviceModel, modelCategory); return new VidNotions( - suggestInstantiationUI(csarHelper, serviceModel, modelCategory), + suggestInstantiationUI(csarHelper, serviceModel, modelCategory, instantiationType), modelCategory, - suggestViewEditUI(csarHelper, serviceModel, modelCategory), - suggestInstantiationType(serviceModel, modelCategory)); + suggestViewEditUI(csarHelper, serviceModel, modelCategory, instantiationType), + instantiationType + ); } private boolean isMacroTypeByModelCategory(VidNotions.ModelCategory modelCategory) { @@ -91,34 +95,47 @@ public class VidNotionsBuilder { return (featureOfMacroType!=null && featureManager.isActive(featureOfMacroType)); } - VidNotions.InstantiationType suggestInstantiationType(ServiceModel serviceModel, VidNotions.ModelCategory modelCategory) { + InstantiationType suggestInstantiationType(ServiceModel serviceModel, VidNotions.ModelCategory modelCategory) { if (isMacroTypeByModelCategory(modelCategory)) { - return VidNotions.InstantiationType.Macro; + return InstantiationType.Macro; } - if (serviceModel==null || serviceModel.getService()==null || isEmpty(serviceModel.getService().getInstantiationType())) { - return VidNotions.InstantiationType.ClientConfig; + if (serviceModel==null || serviceModel.getService()==null) { + return defaultInstantiationType(); } - String instantiationType = serviceModel.getService().getInstantiationType(); - if (instantiationType.equals(ToscaParserImpl2.Constants.MACRO)) { - return VidNotions.InstantiationType.Macro; + + if (StringUtils.equals(serviceModel.getService().getInstantiationType(), ToscaParserImpl2.Constants.MACRO)) { + return InstantiationType.Macro; } - if (instantiationType.equals(ToscaParserImpl2.Constants.A_LA_CARTE)) { - return VidNotions.InstantiationType.ALaCarte; + + if (StringUtils.equals(serviceModel.getService().getInstantiationType(), ToscaParserImpl2.Constants.A_LA_CARTE)) { + return InstantiationType.ALaCarte; } - return VidNotions.InstantiationType.ClientConfig; + if (!featureManager.isActive(Features.FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND)) + return InstantiationType.ClientConfig; + + return isMacroByInvariantUuid(serviceModel.getService().getInvariantUuid()) ? + InstantiationType.Macro : + InstantiationType.ALaCarte; + } + + @NotNull + private InstantiationType defaultInstantiationType() { + return featureManager.isActive(Features.FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND) ? + InstantiationType.ALaCarte : + InstantiationType.ClientConfig; } //UI route a-la-carte services to old UI only if InstantiationUI is LEGACY //So any other value for InstantiationUI other than LEGACY make UI to route //a-la-carte services to new UI - VidNotions.InstantiationUI suggestInstantiationUI(ISdcCsarHelper csarHelper, ServiceModel serviceModel, ModelCategory modelCategory) { + VidNotions.InstantiationUI suggestInstantiationUI(ISdcCsarHelper csarHelper, ServiceModel serviceModel, ModelCategory modelCategory, InstantiationType instantiationType) { if(featureManager.isActive(Features.FLAG_EXP_ANY_ALACARTE_NEW_INSTANTIATION_UI) && isALaCarte(csarHelper)) { return VidNotions.InstantiationUI.ANY_ALACARTE_NEW_UI; } if (featureManager.isActive(Features.FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI) && - !isMacro(serviceModel) && + !isMacro(instantiationType) && !isAlacarteExcludedByCategory(modelCategory)) { return InstantiationUI.ANY_ALACARTE_WHICH_NOT_EXCLUDED; } @@ -206,13 +223,13 @@ public class VidNotionsBuilder { return VidNotions.ModelCategory.OTHER; } - VidNotions.InstantiationUI suggestViewEditUI(ISdcCsarHelper csarHelper, ServiceModel serviceModel, ModelCategory modelCategory) { + VidNotions.InstantiationUI suggestViewEditUI(ISdcCsarHelper csarHelper, ServiceModel serviceModel, ModelCategory modelCategory, InstantiationType instantiationType) { if (featureManager.isActive(Features.FLAG_1902_VNF_GROUPING) && isGrouping(csarHelper)) { return VidNotions.InstantiationUI.SERVICE_WITH_VNF_GROUPING; } if (featureManager.isActive(Features.FLAG_1908_MACRO_NOT_TRANSPORT_NEW_VIEW_EDIT) && - isMacro(serviceModel) && + isMacro(instantiationType) && !isTransportService(csarHelper) && //till new view/edit would support fabric service activation !hasFabricConfiguration(csarHelper)) { @@ -220,7 +237,7 @@ public class VidNotionsBuilder { } if (featureManager.isActive(Features.FLAG_1902_NEW_VIEW_EDIT)) { - VidNotions.InstantiationUI instantiationUISuggestion = suggestInstantiationUI(csarHelper, serviceModel, modelCategory); + VidNotions.InstantiationUI instantiationUISuggestion = suggestInstantiationUI(csarHelper, serviceModel, modelCategory, instantiationType); if (instantiationUISuggestion!=VidNotions.InstantiationUI.LEGACY) { return instantiationUISuggestion; } @@ -229,8 +246,8 @@ public class VidNotionsBuilder { return VidNotions.InstantiationUI.LEGACY; } - private boolean isMacro(ServiceModel serviceModel) { - return ToscaParserImpl2.Constants.MACRO.equals(serviceModel.getService().getInstantiationType()); + private boolean isMacro(InstantiationType instantiationType) { + return instantiationType==InstantiationType.Macro; } private boolean isUuidExactlyHardCoded1ffce89fef3f(ISdcCsarHelper csarHelper) { diff --git a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java index 232484ba9..d6d7a6aa2 100644 --- a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java +++ b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java @@ -29,7 +29,6 @@ public enum Features implements Feature { * Use /docs/feature-flags.md for details */ - EMPTY_DRAWING_BOARD_TEST, FLAG_ADD_MSO_TESTAPI_FIELD, FLAG_SERVICE_MODEL_CACHE, FLAG_NETWORK_TO_ASYNC_INSTANTIATION, @@ -81,6 +80,7 @@ public enum Features implements Feature { FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE, FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI, FLAG_2002_VFM_UPGRADE_ADDITIONAL_OPTIONS, + FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND, ; diff --git a/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties b/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties index d5d2ead44..7baa08690 100644 --- a/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties +++ b/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties @@ -1,6 +1,5 @@ FLAG_ENABLE_WEBPACK_MODERN_UI = true FLAG_ASYNC_JOBS = true -EMPTY_DRAWING_BOARD_TEST = false FLAG_ADD_MSO_TESTAPI_FIELD = true FLAG_UNASSIGN_SERVICE = true FLAG_COLLECTION_RESOURCE_SUPPORT = true diff --git a/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties b/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties index 29672bcd6..1f7244c3d 100644 --- a/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties +++ b/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties @@ -21,7 +21,6 @@ FLAG_SHOW_ORCHESTRATION_TYPE = false FLAG_COLLECTION_RESOURCE_SUPPORT = false FLAG_ENABLE_WEBPACK_MODERN_UI = false FLAG_ASYNC_JOBS = false -EMPTY_DRAWING_BOARD_TEST = false FLAG_NETWORK_TO_ASYNC_INSTANTIATION = false FLAG_DUPLICATE_VNF = false FLAG_DEFAULT_VNF = false |