diff options
author | andre.schmid <andre.schmid@est.tech> | 2020-03-04 16:28:05 +0000 |
---|---|---|
committer | Julien Bertozzi <julien.bertozzi@intl.att.com> | 2020-07-29 11:39:50 +0000 |
commit | 5e8464585f07210ad4b20ddfee2c23b1cf2d8b2a (patch) | |
tree | d0e9b828f0b374f504115443814537deb35d49c1 /catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentInstanceServlet.java | |
parent | 18a43d537bc91d752377159fb0d5b3e9f5bdd6e5 (diff) |
Config. allowed instances in component composition
During the creation of Resource and Services components,
the allowed types to add in its composition are hard-coded.
This change allows those types to be configurable using the
configuration.yaml backend file.
Change-Id: If48849b57fe5124468db3d55f2f06391348935fb
Issue-ID: SDC-3177
Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentInstanceServlet.java')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentInstanceServlet.java | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentInstanceServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentInstanceServlet.java index 34b261b106..4f3120aba2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentInstanceServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentInstanceServlet.java @@ -166,24 +166,30 @@ public class ComponentInstanceServlet extends AbstractValidationsServlet { @Context final HttpServletRequest request) { validateNotEmptyBody(data); - ComponentInstance componentInstance = null; + final ComponentInstance componentInstance; try { componentInstance = RepresentationUtils.fromRepresentation(data, ComponentInstance.class); componentInstance.setInvariantName(null); componentInstance.setCreatedFrom(CreatedFrom.UI); - } catch (Exception e) { + } catch (final Exception e) { BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Create Component Instance"); log.debug("create component instance failed with exception", e); throw new ByActionStatusComponentException(ActionStatus.INVALID_CONTENT); } - loggerSupportability.log(LoggerSupportabilityActions.CREATE_INSTANCE, StatusCode.STARTED,"Starting to create component instance by {}",userId); - if (componentInstanceBusinessLogic == null) { - log.debug(UNSUPPORTED_COMPONENT_TYPE, containerComponentType); - return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.UNSUPPORTED_ERROR, containerComponentType)); - } - ComponentInstance actionResponse = componentInstanceBusinessLogic.createComponentInstance(containerComponentType, containerComponentId, userId, componentInstance); - loggerSupportability.log(LoggerSupportabilityActions.CREATE_INSTANCE,actionResponse.getComponentMetadataForSupportLog(),StatusCode.COMPLETE,"Ending to create component instance by user {}",userId); - return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.CREATED), actionResponse); + + loggerSupportability.log(LoggerSupportabilityActions.CREATE_INSTANCE, StatusCode.STARTED, + "Starting to create component instance by {}", userId); + if (componentInstanceBusinessLogic == null) { + log.debug(UNSUPPORTED_COMPONENT_TYPE, containerComponentType); + return buildErrorResponse( + getComponentsUtils().getResponseFormat(ActionStatus.UNSUPPORTED_ERROR, containerComponentType)); + } + final ComponentInstance actionResponse = componentInstanceBusinessLogic. + createComponentInstance(containerComponentType, containerComponentId, userId, componentInstance); + loggerSupportability + .log(LoggerSupportabilityActions.CREATE_INSTANCE, actionResponse.getComponentMetadataForSupportLog(), + StatusCode.COMPLETE, "Ending to create component instance by user {}", userId); + return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.CREATED), actionResponse); } |