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