7fd667d1471e8a7c6cf30ed9eb1252160ac76fd8
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / servlets / ComponentServlet.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20 package org.openecomp.sdc.be.servlets;
21
22 import static org.openecomp.sdc.common.util.GeneralUtility.getCategorizedComponents;
23
24 import com.jcabi.aspects.Loggable;
25 import fj.data.Either;
26 import io.swagger.v3.oas.annotations.Operation;
27 import io.swagger.v3.oas.annotations.Parameter;
28 import io.swagger.v3.oas.annotations.media.ArraySchema;
29 import io.swagger.v3.oas.annotations.media.Content;
30 import io.swagger.v3.oas.annotations.media.Schema;
31 import io.swagger.v3.oas.annotations.responses.ApiResponse;
32 import io.swagger.v3.oas.annotations.servers.Server;
33 import io.swagger.v3.oas.annotations.servers.Servers;
34 import io.swagger.v3.oas.annotations.tags.Tag;
35 import io.swagger.v3.oas.annotations.tags.Tags;
36 import java.io.IOException;
37 import java.util.ArrayList;
38 import java.util.EnumMap;
39 import java.util.List;
40 import java.util.Map;
41 import javax.inject.Inject;
42 import javax.servlet.http.HttpServletRequest;
43 import javax.ws.rs.Consumes;
44 import javax.ws.rs.GET;
45 import javax.ws.rs.HeaderParam;
46 import javax.ws.rs.POST;
47 import javax.ws.rs.Path;
48 import javax.ws.rs.PathParam;
49 import javax.ws.rs.Produces;
50 import javax.ws.rs.QueryParam;
51 import javax.ws.rs.core.Context;
52 import javax.ws.rs.core.MediaType;
53 import javax.ws.rs.core.Response;
54 import org.apache.commons.collections.CollectionUtils;
55 import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic;
56 import org.openecomp.sdc.be.components.impl.ComponentBusinessLogicProvider;
57 import org.openecomp.sdc.be.components.impl.aaf.AafPermission;
58 import org.openecomp.sdc.be.components.impl.aaf.PermissionAllowed;
59 import org.openecomp.sdc.be.config.BeEcompErrorManager;
60 import org.openecomp.sdc.be.dao.api.ActionStatus;
61 import org.openecomp.sdc.be.datamodel.api.HighestFilterEnum;
62 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
63 import org.openecomp.sdc.be.datatypes.enums.FilterKeyEnum;
64 import org.openecomp.sdc.be.impl.ComponentsUtils;
65 import org.openecomp.sdc.be.mixin.GroupCompositionMixin;
66 import org.openecomp.sdc.be.mixin.PolicyCompositionMixin;
67 import org.openecomp.sdc.be.model.Component;
68 import org.openecomp.sdc.be.model.ComponentInstance;
69 import org.openecomp.sdc.be.model.IComponentInstanceConnectedElement;
70 import org.openecomp.sdc.be.model.Resource;
71 import org.openecomp.sdc.be.model.User;
72 import org.openecomp.sdc.be.ui.model.UiComponentDataTransfer;
73 import org.openecomp.sdc.be.ui.model.UiLeftPaletteComponent;
74 import org.openecomp.sdc.be.user.UserBusinessLogic;
75 import org.openecomp.sdc.be.view.ResponseView;
76 import org.openecomp.sdc.common.api.Constants;
77 import org.openecomp.sdc.common.log.wrappers.Logger;
78 import org.openecomp.sdc.common.util.ValidationUtils;
79 import org.openecomp.sdc.exception.ResponseFormat;
80 import org.springframework.stereotype.Controller;
81
82 @Loggable(prepend = true, value = Loggable.DEBUG, trim = false)
83 @Path("/v1/catalog")
84 @Tags({@Tag(name = "SDCE-2 APIs")})
85 @Servers({@Server(url = "/sdc2/rest")})
86 @Controller
87 public class ComponentServlet extends BeGenericServlet {
88
89     private static final String GET_CERTIFIED_NOT_ABSTRACT_COMPONENTS_FAILED_WITH_EXCEPTION = "getCertifiedNotAbstractComponents failed with exception";
90     private static final String GET_CERTIFIED_NON_ABSTRACT = "Get Certified Non Abstract";
91     private static final String FAILED_TO_GET_ALL_NON_ABSTRACT = "failed to get all non abstract {}";
92     private static final String START_HANDLE_REQUEST_OF = "Start handle request of {}";
93     private static final Logger log = Logger.getLogger(ComponentServlet.class);
94     private final ComponentBusinessLogicProvider componentBusinessLogicProvider;
95
96     @Inject
97     public ComponentServlet(UserBusinessLogic userBusinessLogic, ComponentsUtils componentsUtils,
98                             ComponentBusinessLogicProvider componentBusinessLogicProvider) {
99         super(userBusinessLogic, componentsUtils);
100         this.componentBusinessLogicProvider = componentBusinessLogicProvider;
101     }
102
103     @GET
104     @Path("/{componentType}/{componentUuid}/conformanceLevelValidation")
105     @Consumes(MediaType.APPLICATION_JSON)
106     @Produces(MediaType.APPLICATION_JSON)
107     @Operation(description = "Validate Component Conformance Level", method = "GET", summary = "Returns the result according to conformance level in BE config", responses = {
108         @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))),
109         @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"),
110         @ApiResponse(responseCode = "404", description = "Component not found")})
111     @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
112     public Response conformanceLevelValidation(@PathParam("componentType") final String componentType,
113                                                @PathParam("componentUuid") final String componentUuid, @Context final HttpServletRequest request,
114                                                @HeaderParam(value = Constants.USER_ID_HEADER) String userId) {
115         Response response;
116         String url = request.getMethod() + " " + request.getRequestURI();
117         log.debug(START_HANDLE_REQUEST_OF, url);
118         ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(componentType);
119         if (componentTypeEnum != null) {
120             ComponentBusinessLogic compBL = componentBusinessLogicProvider.getInstance(componentTypeEnum);
121             Either<Boolean, ResponseFormat> eitherConformanceLevel = compBL.validateConformanceLevel(componentUuid, componentTypeEnum, userId);
122             if (eitherConformanceLevel.isRight()) {
123                 response = buildErrorResponse(eitherConformanceLevel.right().value());
124             } else {
125                 response = buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK),
126                     gson.toJson(eitherConformanceLevel.left().value()));
127             }
128         } else {
129             response = buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.INVALID_CONTENT));
130         }
131         return response;
132     }
133
134     @GET
135     @Path("/{componentType}/{componentId}/requirmentsCapabilities")
136     @Consumes(MediaType.APPLICATION_JSON)
137     @Produces(MediaType.APPLICATION_JSON)
138     @Operation(description = "Get Component Requirments And Capabilities", method = "GET", summary = "Returns Requirements And Capabilities according to componentId", responses = {
139         @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))),
140         @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"),
141         @ApiResponse(responseCode = "404", description = "Component not found")})
142     @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
143     public Response getRequirementAndCapabilities(@PathParam("componentType") final String componentType,
144                                                   @PathParam("componentId") final String componentId, @Context final HttpServletRequest request,
145                                                   @HeaderParam(value = Constants.USER_ID_HEADER) String userId) throws IOException {
146         Response response;
147         String url = request.getMethod() + " " + request.getRequestURI();
148         log.debug(START_HANDLE_REQUEST_OF, url);
149         ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(componentType);
150         if (componentTypeEnum != null) {
151             try {
152                 ComponentBusinessLogic compBL = componentBusinessLogicProvider.getInstance(componentTypeEnum);
153                 response = buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK),
154                     RepresentationUtils.toRepresentation(compBL.getRequirementsAndCapabilities(componentId, componentTypeEnum, userId)));
155             } catch (IOException e) {
156                 BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Get Capabilities and requirements for " + componentId);
157                 log.debug("getRequirementAndCapabilities failed with exception", e);
158                 throw e;
159             }
160         } else {
161             response = buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.INVALID_CONTENT));
162         }
163         return response;
164     }
165
166     @GET
167     @Path("/{componentType}/latestversion/notabstract")
168     @Consumes(MediaType.APPLICATION_JSON)
169     @Produces(MediaType.APPLICATION_JSON)
170     @Operation(description = "Get Component Requirments And Capabilities", method = "GET", summary = "Returns Requirments And Capabilities according to componentId", responses = {
171         @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))),
172         @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"),
173         @ApiResponse(responseCode = "404", description = "Component not found")})
174     @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
175     public Response getLatestVersionNotAbstractCheckoutComponents(@PathParam("componentType") final String componentType,
176                                                                   @Context final HttpServletRequest request,
177                                                                   @QueryParam("internalComponentType") String internalComponentType,
178                                                                   @QueryParam("componentUids") List<String> componentUids,
179                                                                   @HeaderParam(value = Constants.USER_ID_HEADER) String userId) throws IOException {
180         String url = request.getMethod() + " " + request.getRequestURI();
181         log.debug("(get) Start handle request of {}", url);
182         try {
183             ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(componentType);
184             ComponentBusinessLogic businessLogic = componentBusinessLogicProvider.getInstance(componentTypeEnum);
185             log.debug("Received componentUids size is {}", componentUids == null ? 0 : componentUids.size());
186             Either<List<Component>, ResponseFormat> actionResponse = businessLogic
187                 .getLatestVersionNotAbstractComponents(false, componentTypeEnum, internalComponentType, componentUids, userId);
188             if (actionResponse.isRight()) {
189                 log.debug(FAILED_TO_GET_ALL_NON_ABSTRACT, componentType);
190                 return buildErrorResponse(actionResponse.right().value());
191             }
192             Object components = RepresentationUtils.toRepresentation(actionResponse.left().value());
193             return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), components);
194         } catch (Exception e) {
195             BeEcompErrorManager.getInstance().logBeRestApiGeneralError(GET_CERTIFIED_NON_ABSTRACT + componentType);
196             log.debug(GET_CERTIFIED_NOT_ABSTRACT_COMPONENTS_FAILED_WITH_EXCEPTION, e);
197             throw e;
198         }
199     }
200
201     @POST
202     @Path("/{componentType}/latestversion/notabstract")
203     @Consumes(MediaType.APPLICATION_JSON)
204     @Produces(MediaType.APPLICATION_JSON)
205     @Operation(description = "Get Component Requirments And Capabilities", method = "GET", summary = "Returns Requirments And Capabilities according to componentId", responses = {
206         @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))),
207         @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"),
208         @ApiResponse(responseCode = "404", description = "Component not found")})
209     @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
210     public Response getLatestVersionNotAbstractCheckoutComponentsByBody(@PathParam("componentType") final String componentType,
211                                                                         @Context final HttpServletRequest request,
212                                                                         @QueryParam("internalComponentType") String internalComponentType,
213                                                                         @HeaderParam(value = Constants.USER_ID_HEADER) String userId,
214                                                                         @Parameter(description = "Consumer Object to be created", required = true) List<String> data)
215         throws IOException {
216         String url = request.getMethod() + " " + request.getRequestURI();
217         log.debug("(GET) Start handle request of {}", url);
218         Response response;
219         try {
220             ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(componentType);
221             ComponentBusinessLogic businessLogic = componentBusinessLogicProvider.getInstance(componentTypeEnum);
222             if (log.isDebugEnabled()) {
223                 log.debug("Received componentUids size is {}", data == null ? 0 : data.size());
224             }
225             Either<List<Component>, ResponseFormat> actionResponse = businessLogic
226                 .getLatestVersionNotAbstractComponents(false, componentTypeEnum, internalComponentType, data, userId);
227             if (actionResponse.isRight()) {
228                 log.debug(FAILED_TO_GET_ALL_NON_ABSTRACT, componentType);
229                 return buildErrorResponse(actionResponse.right().value());
230             }
231             Object components = RepresentationUtils.toRepresentation(actionResponse.left().value());
232             return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), components);
233         } catch (Exception e) {
234             BeEcompErrorManager.getInstance().logBeRestApiGeneralError(GET_CERTIFIED_NON_ABSTRACT + componentType);
235             log.debug(GET_CERTIFIED_NOT_ABSTRACT_COMPONENTS_FAILED_WITH_EXCEPTION, e);
236             throw e;
237         }
238     }
239
240     @GET
241     @Path("/{componentType}/latestversion/notabstract/metadata")
242     @Consumes(MediaType.APPLICATION_JSON)
243     @Produces(MediaType.APPLICATION_JSON)
244     @Operation(description = "Get Component uid only", method = "GET", summary = "Returns componentId", responses = {
245         @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))),
246         @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"),
247         @ApiResponse(responseCode = "404", description = "Component not found")})
248     @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
249     public Response getLatestVersionNotAbstractCheckoutComponentsIdesOnly(@PathParam("componentType") final String componentType,
250                                                                           @Context final HttpServletRequest request,
251                                                                           @QueryParam("internalComponentType") String internalComponentType,
252                                                                           @QueryParam("componentModel") String internalComponentModel,
253                                                                           @HeaderParam(value = Constants.USER_ID_HEADER) String userId,
254                                                                           @Parameter(description = "uid list", required = true) String data)
255         throws IOException {
256         String url = request.getMethod() + " " + request.getRequestURI();
257         log.debug("(get) Start handle request of {}", url);
258         try {
259             ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(componentType);
260             ComponentBusinessLogic businessLogic = componentBusinessLogicProvider.getInstance(componentTypeEnum);
261             if (internalComponentModel != null) {
262                 internalComponentModel = ValidationUtils.sanitizeInputString(internalComponentModel.trim());
263             }
264             Either<List<Component>, ResponseFormat> actionResponse = businessLogic
265                 .getLatestVersionNotAbstractComponentsMetadata(false, HighestFilterEnum.HIGHEST_ONLY, componentTypeEnum,
266                     internalComponentType, userId, internalComponentModel);
267             if (actionResponse.isRight()) {
268                 log.debug(FAILED_TO_GET_ALL_NON_ABSTRACT, componentType);
269                 return buildErrorResponse(actionResponse.right().value());
270             }
271             List<UiLeftPaletteComponent> uiLeftPaletteComponents = getComponentsUtils()
272                 .convertComponentToUiLeftPaletteComponentObject(actionResponse.left().value());
273             Map<String, Map<String, List<UiLeftPaletteComponent>>> categorizedComponents = getCategorizedComponents(uiLeftPaletteComponents);
274             Object components = RepresentationUtils.toRepresentation(categorizedComponents);
275             return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), components);
276         } catch (Exception e) {
277             BeEcompErrorManager.getInstance().logBeRestApiGeneralError(GET_CERTIFIED_NON_ABSTRACT + componentType);
278             log.debug(GET_CERTIFIED_NOT_ABSTRACT_COMPONENTS_FAILED_WITH_EXCEPTION, e);
279             throw e;
280         }
281     }
282
283     @GET
284     @Path("/{componentType}/{componentId}/componentInstances")
285     @Consumes(MediaType.APPLICATION_JSON)
286     @Produces(MediaType.APPLICATION_JSON)
287     @Operation(description = "Get Component instances", method = "GET", summary = "Returns component instances", responses = {
288         @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))),
289         @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"),
290         @ApiResponse(responseCode = "404", description = "Component not found")})
291     @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
292     public Response getComponentInstancesFilteredByPropertiesAndInputs(@PathParam("componentType") final String componentType,
293                                                                        @PathParam("componentId") final String componentId,
294                                                                        @Context final HttpServletRequest request,
295                                                                        @QueryParam("searchText") String searchText,
296                                                                        @HeaderParam(value = Constants.USER_ID_HEADER) String userId,
297                                                                        @Parameter(description = "uid" + " " + "list", required = true) String data)
298         throws IOException {
299         String url = request.getMethod() + " " + request.getRequestURI();
300         log.debug("(GET) Start handle request of {}", url);
301         try {
302             ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(componentType);
303             ComponentBusinessLogic businessLogic = componentBusinessLogicProvider.getInstance(componentTypeEnum);
304             Either<List<ComponentInstance>, ResponseFormat> actionResponse = businessLogic
305                 .getComponentInstancesFilteredByPropertiesAndInputs(componentId, userId);
306             if (actionResponse.isRight()) {
307                 log.debug("failed to get all component instances filtered by properties and inputs", componentType);
308                 return buildErrorResponse(actionResponse.right().value());
309             }
310             Object components = RepresentationUtils.toRepresentation(actionResponse.left().value());
311             return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), components);
312         } catch (Exception e) {
313             BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Get Component Instances filtered by properties & inputs" + componentType);
314             log.debug("getComponentInstancesFilteredByPropertiesAndInputs failed with exception", e);
315             throw e;
316         }
317     }
318
319     /**
320      * This API is a generic api for ui - the api get a list of strings and return the data on the component according to to list. for example: list
321      * of the string "properties, inputs" will return component with the list of properties and inputs.
322      *
323      * @param componentType
324      * @param componentId
325      * @param dataParamsToReturn
326      * @param request
327      * @param userId
328      * @return
329      */
330     @GET
331     @Path("/{componentType}/{componentId}/filteredDataByParams")
332     @Consumes(MediaType.APPLICATION_JSON)
333     @Produces(MediaType.APPLICATION_JSON)
334     @Operation(description = "Retrieve Resource", method = "GET", summary = "Returns resource according to resourceId", responses = {
335         @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))),
336         @ApiResponse(responseCode = "200", description = "Resource found"), @ApiResponse(responseCode = "403", description = "Restricted operation"),
337         @ApiResponse(responseCode = "404", description = "Resource not found")})
338     @ResponseView(mixin = {GroupCompositionMixin.class, PolicyCompositionMixin.class})
339     @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
340     public Response getComponentDataFilteredByParams(@PathParam("componentType") final String componentType,
341                                                      @PathParam("componentId") final String componentId,
342                                                      @QueryParam("include") final List<String> dataParamsToReturn,
343                                                      @Context final HttpServletRequest request,
344                                                      @HeaderParam(value = Constants.USER_ID_HEADER) String userId) throws IOException {
345         String url = request.getMethod() + " " + request.getRequestURI();
346         log.debug(START_HANDLE_REQUEST_OF, url);
347         // get modifier id
348         User modifier = new User();
349         modifier.setUserId(userId);
350         log.debug("modifier id is {}", userId);
351         try {
352             String resourceIdLower = componentId.toLowerCase();
353             ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(componentType);
354             ComponentBusinessLogic businessLogic = componentBusinessLogicProvider.getInstance(componentTypeEnum);
355             log.trace("get component with id {} filtered by ui params", componentId);
356             Either<UiComponentDataTransfer, ResponseFormat> actionResponse = businessLogic
357                 .getComponentDataFilteredByParams(resourceIdLower, modifier, dataParamsToReturn);
358             if (actionResponse.isRight()) {
359                 log.debug("failed to get component data filtered by ui params");
360                 return buildErrorResponse(actionResponse.right().value());
361             }
362             RepresentationUtils.toRepresentation(actionResponse.left().value());
363             return buildOkResponse(actionResponse.left().value());
364         } catch (Exception e) {
365             BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Get component filtered by ui params");
366             log.debug("get resource failed with exception", e);
367             throw e;
368         }
369     }
370
371     @GET
372     @Path("/{componentType}/{componentId}/filteredproperties/{propertyNameFragment}")
373     @Consumes(MediaType.APPLICATION_JSON)
374     @Produces(MediaType.APPLICATION_JSON)
375     @Operation(description = "Retrieve properties belonging to component instances of specific component by name and optionally resource type", method = "GET", summary = "Returns properties belonging to component instances of specific component by name and optionally resource type", responses = {
376         @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Map.class)))),
377         @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"),
378         @ApiResponse(responseCode = "404", description = "Component not found")})
379     @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
380     public Response getFilteredComponentInstanceProperties(@PathParam("componentType") final String componentType,
381                                                            @PathParam("componentId") final String componentId,
382                                                            @PathParam("propertyNameFragment") final String propertyNameFragment,
383                                                            @QueryParam("resourceType") List<String> resourceTypes,
384                                                            @Context final HttpServletRequest request,
385                                                            @HeaderParam(value = Constants.USER_ID_HEADER) String userId) throws IOException {
386         User user = new User();
387         user.setUserId(userId);
388         log.debug("User Id is {}", userId);
389         Response response;
390         try {
391             ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(componentType);
392             ComponentBusinessLogic businessLogic = componentBusinessLogicProvider.getInstance(componentTypeEnum);
393             Map<FilterKeyEnum, List<String>> filters = new EnumMap<>(FilterKeyEnum.class);
394             List<String> propertyNameFragments = new ArrayList<>();
395             propertyNameFragments.add(propertyNameFragment);
396             filters.put(FilterKeyEnum.NAME_FRAGMENT, propertyNameFragments);
397             if (CollectionUtils.isNotEmpty(resourceTypes)) {
398                 filters.put(FilterKeyEnum.RESOURCE_TYPE, resourceTypes);
399             }
400             Either<Map<String, List<IComponentInstanceConnectedElement>>, ResponseFormat> actionResponse = businessLogic
401                 .getFilteredComponentInstanceProperties(componentId, filters, userId);
402             if (actionResponse.isRight()) {
403                 response = buildErrorResponse(actionResponse.right().value());
404                 return response;
405             }
406             Object resource = RepresentationUtils.toRepresentation(actionResponse.left().value());
407             return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), resource);
408         } catch (Exception e) {
409             BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Get Filtered Component Instance Properties");
410             log.debug("Getting of filtered component instance properties failed with exception", e);
411             throw e;
412         }
413     }
414 }