92d42e0d856988bf267334200b471ad40a4baf4f
[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.view.ResponseView;
75 import org.openecomp.sdc.common.api.Constants;
76 import org.openecomp.sdc.common.log.wrappers.Logger;
77 import org.openecomp.sdc.common.util.ValidationUtils;
78 import org.openecomp.sdc.exception.ResponseFormat;
79 import org.springframework.stereotype.Controller;
80
81 @Loggable(prepend = true, value = Loggable.DEBUG, trim = false)
82 @Path("/v1/catalog")
83 @Tags({@Tag(name = "SDCE-2 APIs")})
84 @Servers({@Server(url = "/sdc2/rest")})
85 @Controller
86 public class ComponentServlet extends BeGenericServlet {
87
88     private static final String GET_CERTIFIED_NOT_ABSTRACT_COMPONENTS_FAILED_WITH_EXCEPTION = "getCertifiedNotAbstractComponents failed with exception";
89     private static final String GET_CERTIFIED_NON_ABSTRACT = "Get Certified Non Abstract";
90     private static final String FAILED_TO_GET_ALL_NON_ABSTRACT = "failed to get all non abstract {}";
91     private static final String START_HANDLE_REQUEST_OF = "Start handle request of {}";
92     private static final Logger log = Logger.getLogger(ComponentServlet.class);
93     private final ComponentBusinessLogicProvider componentBusinessLogicProvider;
94
95     @Inject
96     public ComponentServlet(ComponentsUtils componentsUtils,
97                             ComponentBusinessLogicProvider componentBusinessLogicProvider) {
98         super(componentsUtils);
99         this.componentBusinessLogicProvider = componentBusinessLogicProvider;
100     }
101
102     @GET
103     @Path("/{componentType}/{componentUuid}/conformanceLevelValidation")
104     @Consumes(MediaType.APPLICATION_JSON)
105     @Produces(MediaType.APPLICATION_JSON)
106     @Operation(description = "Validate Component Conformance Level", method = "GET", summary = "Returns the result according to conformance level in BE config", responses = {
107         @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))),
108         @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"),
109         @ApiResponse(responseCode = "404", description = "Component not found")})
110     @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
111     public Response conformanceLevelValidation(@PathParam("componentType") final String componentType,
112                                                @PathParam("componentUuid") final String componentUuid, @Context final HttpServletRequest request,
113                                                @HeaderParam(value = Constants.USER_ID_HEADER) String userId) {
114         Response response;
115         String url = request.getMethod() + " " + request.getRequestURI();
116         log.debug(START_HANDLE_REQUEST_OF, url);
117         ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(componentType);
118         if (componentTypeEnum != null) {
119             ComponentBusinessLogic compBL = componentBusinessLogicProvider.getInstance(componentTypeEnum);
120             Either<Boolean, ResponseFormat> eitherConformanceLevel = compBL.validateConformanceLevel(componentUuid, componentTypeEnum, userId);
121             if (eitherConformanceLevel.isRight()) {
122                 response = buildErrorResponse(eitherConformanceLevel.right().value());
123             } else {
124                 response = buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK),
125                     gson.toJson(eitherConformanceLevel.left().value()));
126             }
127         } else {
128             response = buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.INVALID_CONTENT));
129         }
130         return response;
131     }
132
133     @GET
134     @Path("/{componentType}/{componentId}/requirmentsCapabilities")
135     @Consumes(MediaType.APPLICATION_JSON)
136     @Produces(MediaType.APPLICATION_JSON)
137     @Operation(description = "Get Component Requirments And Capabilities", method = "GET", summary = "Returns Requirements And Capabilities according to componentId", responses = {
138         @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))),
139         @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"),
140         @ApiResponse(responseCode = "404", description = "Component not found")})
141     @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
142     public Response getRequirementAndCapabilities(@PathParam("componentType") final String componentType,
143                                                   @PathParam("componentId") final String componentId, @Context final HttpServletRequest request,
144                                                   @HeaderParam(value = Constants.USER_ID_HEADER) String userId) throws IOException {
145         Response response;
146         String url = request.getMethod() + " " + request.getRequestURI();
147         log.debug(START_HANDLE_REQUEST_OF, url);
148         ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(componentType);
149         if (componentTypeEnum != null) {
150             try {
151                 ComponentBusinessLogic compBL = componentBusinessLogicProvider.getInstance(componentTypeEnum);
152                 response = buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK),
153                     RepresentationUtils.toRepresentation(compBL.getRequirementsAndCapabilities(componentId, componentTypeEnum, userId)));
154             } catch (IOException e) {
155                 BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Get Capabilities and requirements for " + componentId);
156                 log.debug("getRequirementAndCapabilities failed with exception", e);
157                 throw e;
158             }
159         } else {
160             response = buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.INVALID_CONTENT));
161         }
162         return response;
163     }
164
165     @GET
166     @Path("/{componentType}/latestversion/notabstract")
167     @Consumes(MediaType.APPLICATION_JSON)
168     @Produces(MediaType.APPLICATION_JSON)
169     @Operation(description = "Get Component Requirments And Capabilities", method = "GET", summary = "Returns Requirments And Capabilities according to componentId", responses = {
170         @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))),
171         @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"),
172         @ApiResponse(responseCode = "404", description = "Component not found")})
173     @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
174     public Response getLatestVersionNotAbstractCheckoutComponents(@PathParam("componentType") final String componentType,
175                                                                   @Context final HttpServletRequest request,
176                                                                   @QueryParam("internalComponentType") String internalComponentType,
177                                                                   @QueryParam("componentUids") List<String> componentUids,
178                                                                   @HeaderParam(value = Constants.USER_ID_HEADER) String userId) throws IOException {
179         String url = request.getMethod() + " " + request.getRequestURI();
180         log.debug("(get) Start handle request of {}", url);
181         try {
182             ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(componentType);
183             ComponentBusinessLogic businessLogic = componentBusinessLogicProvider.getInstance(componentTypeEnum);
184             log.debug("Received componentUids size is {}", componentUids == null ? 0 : componentUids.size());
185             Either<List<Component>, ResponseFormat> actionResponse = businessLogic
186                 .getLatestVersionNotAbstractComponents(false, componentTypeEnum, internalComponentType, componentUids, userId);
187             if (actionResponse.isRight()) {
188                 log.debug(FAILED_TO_GET_ALL_NON_ABSTRACT, componentType);
189                 return buildErrorResponse(actionResponse.right().value());
190             }
191             Object components = RepresentationUtils.toRepresentation(actionResponse.left().value());
192             return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), components);
193         } catch (Exception e) {
194             BeEcompErrorManager.getInstance().logBeRestApiGeneralError(GET_CERTIFIED_NON_ABSTRACT + componentType);
195             log.debug(GET_CERTIFIED_NOT_ABSTRACT_COMPONENTS_FAILED_WITH_EXCEPTION, e);
196             throw e;
197         }
198     }
199
200     @POST
201     @Path("/{componentType}/latestversion/notabstract")
202     @Consumes(MediaType.APPLICATION_JSON)
203     @Produces(MediaType.APPLICATION_JSON)
204     @Operation(description = "Get Component Requirments And Capabilities", method = "GET", summary = "Returns Requirments And Capabilities according to componentId", responses = {
205         @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))),
206         @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"),
207         @ApiResponse(responseCode = "404", description = "Component not found")})
208     @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
209     public Response getLatestVersionNotAbstractCheckoutComponentsByBody(@PathParam("componentType") final String componentType,
210                                                                         @Context final HttpServletRequest request,
211                                                                         @QueryParam("internalComponentType") String internalComponentType,
212                                                                         @HeaderParam(value = Constants.USER_ID_HEADER) String userId,
213                                                                         @Parameter(description = "Consumer Object to be created", required = true) List<String> data)
214         throws IOException {
215         String url = request.getMethod() + " " + request.getRequestURI();
216         log.debug("(GET) Start handle request of {}", url);
217         Response response;
218         try {
219             ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(componentType);
220             ComponentBusinessLogic businessLogic = componentBusinessLogicProvider.getInstance(componentTypeEnum);
221             if (log.isDebugEnabled()) {
222                 log.debug("Received componentUids size is {}", data == null ? 0 : data.size());
223             }
224             Either<List<Component>, ResponseFormat> actionResponse = businessLogic
225                 .getLatestVersionNotAbstractComponents(false, componentTypeEnum, internalComponentType, data, userId);
226             if (actionResponse.isRight()) {
227                 log.debug(FAILED_TO_GET_ALL_NON_ABSTRACT, componentType);
228                 return buildErrorResponse(actionResponse.right().value());
229             }
230             Object components = RepresentationUtils.toRepresentation(actionResponse.left().value());
231             return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), components);
232         } catch (Exception e) {
233             BeEcompErrorManager.getInstance().logBeRestApiGeneralError(GET_CERTIFIED_NON_ABSTRACT + componentType);
234             log.debug(GET_CERTIFIED_NOT_ABSTRACT_COMPONENTS_FAILED_WITH_EXCEPTION, e);
235             throw e;
236         }
237     }
238
239     @GET
240     @Path("/{componentType}/latestversion/notabstract/metadata")
241     @Consumes(MediaType.APPLICATION_JSON)
242     @Produces(MediaType.APPLICATION_JSON)
243     @Operation(description = "Get Component uid only", method = "GET", summary = "Returns componentId", responses = {
244         @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))),
245         @ApiResponse(responseCode = "200", description = "Component found"), @ApiResponse(responseCode = "403", description = "Restricted operation"),
246         @ApiResponse(responseCode = "404", description = "Component not found")})
247     @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
248     public Response getLatestVersionNotAbstractCheckoutComponentsIdesOnly(@PathParam("componentType") final String componentType,
249                                                                           @Context final HttpServletRequest request,
250                                                                           @QueryParam("internalComponentType") String internalComponentType,
251                                                                           @QueryParam("componentModel") String internalComponentModel,
252                                                                           @QueryParam("includeNormativeExtensionModels") boolean includeNormativeExtensionModels,
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, includeNormativeExtensionModels);
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 }