2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Copyright (C) 2018 IBM.
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.so.adapters.catalogdb.rest;
26 Create an initial query to retrieve a VNF Resource definition (including a list of possible module types)
27 within the context of a given service. Input is a vnf resource model customization ID (new field for 1702),
28 or a composite key (from 1610) of service name, service version, vnf instance name
30 Returns a structure (JSON?) containing VNF RESOURCE attributes, plus a list of VF Module structures.
32 Query a NETWORK_RESOURCE from the MSO Catalog, based on a networkModelCustomizationUUID (new for 1702),
33 a network type (unique type identifier in 1610), or based on network role within a service.
35 Create Adapter framework for access to Catalog DB, including connection management,
36 login/password access, transaction logic, etc. This can be modeled after the Request DB Adapter
38 Update the MSO Catalog DB schema to include the new fields defined in this user story.
40 Note that the resourceModelCustomizationUUID (or vfModuleModelCustomizationUUID) will be unique keys (indexes)
41 on the VNF_RESOURCE and VF_MODULE tables respectively.
42 The previously constructed "vnf-type" and "vf-module-type" field may continue to be populated,
43 but should no longer be needed and can deprecate in future release.
45 For migration, a new randomly generated UUID field may be generated for the *ModelCustomizationUUID" fields
46 until such time that the model is redistributed from ASDC.
48 All other fields Check with Mike Z for appropriate value for the vfModuleLabel.
49 We might be able to derive it's value from the current vnf-type (using the "middle" piece that identifies the module type).
51 min and initial counts can be 0. max can be null to indicate no maximum.
53 Once the network-level distribution artifacts are defined, similar updates can be made to the NETWORK_RESOURCE table.
56 import org.apache.http.HttpStatus;
57 import org.onap.so.adapters.catalogdb.catalogrest.CatalogQuery;
58 import org.onap.so.adapters.catalogdb.catalogrest.CatalogQueryException;
59 import org.onap.so.adapters.catalogdb.catalogrest.CatalogQueryExceptionCategory;
60 import org.onap.so.adapters.catalogdb.catalogrest.QueryAllottedResourceCustomization;
61 import org.onap.so.adapters.catalogdb.catalogrest.QueryResourceRecipe;
62 import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceCsar;
63 import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceMacroHolder;
64 import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceNetworks;
65 import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceVnfs;
66 import org.onap.so.adapters.catalogdb.catalogrest.QueryVfModule;
67 import org.onap.so.db.catalog.beans.AllottedResource;
68 import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
69 import org.onap.so.db.catalog.beans.NetworkResource;
70 import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
71 import org.onap.so.db.catalog.beans.Recipe;
72 import org.onap.so.db.catalog.beans.Service;
73 import org.onap.so.db.catalog.beans.ToscaCsar;
74 import org.onap.so.db.catalog.beans.VfModule;
75 import org.onap.so.db.catalog.beans.VfModuleCustomization;
76 import org.onap.so.db.catalog.beans.VnfResource;
77 import org.onap.so.db.catalog.beans.VnfResourceCustomization;
78 import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository;
79 import org.onap.so.db.catalog.data.repository.AllottedResourceRepository;
80 import org.onap.so.db.catalog.data.repository.ArRecipeRepository;
81 import org.onap.so.db.catalog.data.repository.NetworkRecipeRepository;
82 import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository;
83 import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
84 import org.onap.so.db.catalog.data.repository.ServiceRepository;
85 import org.onap.so.db.catalog.data.repository.ToscaCsarRepository;
86 import org.onap.so.db.catalog.data.repository.VFModuleRepository;
87 import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository;
88 import org.onap.so.db.catalog.data.repository.VnfRecipeRepository;
89 import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
90 import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder;
91 import org.slf4j.Logger;
92 import org.slf4j.LoggerFactory;
93 import org.springframework.beans.factory.annotation.Autowired;
94 import org.springframework.stereotype.Component;
95 import org.springframework.transaction.annotation.Transactional;
97 import javax.ws.rs.GET;
98 import javax.ws.rs.Path;
99 import javax.ws.rs.PathParam;
100 import javax.ws.rs.Produces;
101 import javax.ws.rs.QueryParam;
102 import javax.ws.rs.core.GenericEntity;
103 import javax.ws.rs.core.HttpHeaders;
104 import javax.ws.rs.core.MediaType;
105 import javax.ws.rs.core.Response;
106 import java.util.ArrayList;
107 import java.util.List;
110 * This class services calls to the REST interface for VF Modules (http://host:port/ecomp/mso/catalog/v1)
111 * Both XML and JSON can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default.
112 * Requests respond synchronously only
114 @Path("/{version: v[0-9]+}")
116 public class CatalogDbAdapterRest {
117 protected static Logger logger = LoggerFactory.getLogger(CatalogDbAdapterRest.class);
118 private static final boolean IS_ARRAY = true;
121 private VnfCustomizationRepository vnfCustomizationRepo;
124 private ServiceRepository serviceRepo;
127 private NetworkResourceCustomizationRepository networkCustomizationRepo;
130 private NetworkResourceRepository networkResourceRepo;
133 private AllottedResourceCustomizationRepository allottedCustomizationRepo;
136 private ToscaCsarRepository toscaCsarRepo;
139 private VFModuleRepository vfModuleRepo;
142 private VnfRecipeRepository vnfRecipeRepo;
145 private NetworkRecipeRepository networkRecipeRepo;
148 private ArRecipeRepository arRecipeRepo;
151 private VnfResourceRepository vnfResourceRepo;
154 private AllottedResourceRepository arResourceRepo;
156 private static final String NO_MATCHING_PARAMETERS = "no matching parameters";
158 public Response respond(String version, int respStatus, boolean isArray, CatalogQuery qryResp) {
161 //.entity(new GenericEntity<QueryServiceVnfs>(qryResp) {})
162 .entity(qryResp.toJsonString(version, isArray))
163 .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
168 @Path("vnfResources/{vnfModelCustomizationUuid}")
169 @Transactional( readOnly = true)
170 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
171 public Response serviceVnfs (
172 @PathParam("version") String version,
173 @PathParam("vnfModelCustomizationUuid") String vnfUuid
175 return serviceVnfsImpl (version, !IS_ARRAY, vnfUuid, null, null, null, null);
180 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
181 @Transactional( readOnly = true)
182 public Response serviceVnfs(
183 @PathParam("version") String version,
184 @QueryParam("vnfModelCustomizationUuid") String vnfUuid,
185 @QueryParam("serviceModelUuid") String smUuid,
186 @QueryParam("serviceModelInvariantUuid") String smiUuid,
187 @QueryParam("serviceModelVersion") String smVer,
188 @QueryParam("serviceModelName") String smName
190 return serviceVnfsImpl (version, IS_ARRAY, vnfUuid, smUuid, smiUuid, smVer, smName);
193 public Response serviceVnfsImpl(String version, boolean isArray, String vnfUuid, String serviceModelUUID, String smiUuid, String smVer, String smName) {
194 QueryServiceVnfs qryResp = null;
195 int respStatus = HttpStatus.SC_OK;
196 List<VnfResourceCustomization> ret = new ArrayList<>();
197 Service service = null;
199 if (vnfUuid != null && !"".equals(vnfUuid))
200 ret = vnfCustomizationRepo.findByModelCustomizationUUID(vnfUuid);
201 else if (serviceModelUUID != null && !"".equals(serviceModelUUID))
202 service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(serviceModelUUID);
203 else if (smiUuid != null && !"".equals(smiUuid))
204 if (smVer != null && !"".equals(smVer))
205 service = serviceRepo.findFirstByModelVersionAndModelInvariantUUID(smVer,smiUuid);
207 service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(smiUuid);
208 else if (smName != null && !"".equals(smName)) {
209 if (smVer != null && !"".equals(smVer))
210 service = serviceRepo.findByModelNameAndModelVersion(smName, smVer);
212 service = serviceRepo.findFirstByModelNameOrderByModelVersionDesc(smName);
215 throw(new Exception(NO_MATCHING_PARAMETERS));
218 if (service == null && ret.isEmpty()) {
219 respStatus = HttpStatus.SC_NOT_FOUND;
220 qryResp = new QueryServiceVnfs();
221 }else if( service == null && !ret.isEmpty()){
222 qryResp = new QueryServiceVnfs(ret);
223 } else if (service != null) {
224 qryResp = new QueryServiceVnfs(service.getVnfCustomizations());
226 logger.debug ("serviceVnfs qryResp= {}", qryResp);
227 return respond(version, respStatus, isArray, qryResp);
228 } catch (Exception e) {
229 logger.error("Exception - queryServiceVnfs", e);
230 CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
232 .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
233 .entity(new GenericEntity<CatalogQueryException>(excResp) {})
239 @Path("networkResources/{networkModelCustomizationUuid}")
240 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
241 @Transactional( readOnly = true)
242 public Response serviceNetworks (
243 @PathParam("version") String version,
244 @PathParam("networkModelCustomizationUuid") String nUuid
246 return serviceNetworksImpl (version, !IS_ARRAY, nUuid, null, null, null, null);
250 @Path("serviceNetworks")
251 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
252 @Transactional( readOnly = true)
253 public Response serviceNetworks (
254 @PathParam("version") String version,
255 @QueryParam("networkModelCustomizationUuid") String networkModelCustomizationUuid,
256 @QueryParam("networkType") String networkType,
257 @QueryParam("networkModelName") String networkModelName,
258 @QueryParam("serviceModelUuid") String serviceModelUuid,
259 @QueryParam("serviceModelInvariantUuid") String serviceModelInvariantUuid,
260 @QueryParam("serviceModelVersion") String serviceModelVersion,
261 @QueryParam("networkModelVersion") String networkModelVersion
263 if (networkModelName != null && !"".equals(networkModelName)) {
264 networkType = networkModelName;
266 return serviceNetworksImpl (version, IS_ARRAY, networkModelCustomizationUuid, networkType, serviceModelUuid, serviceModelInvariantUuid, serviceModelVersion);
269 public Response serviceNetworksImpl (String version, boolean isArray, String networkModelCustomizationUuid, String networkType, String serviceModelUuid, String serviceModelInvariantUuid, String serviceModelVersion) {
270 QueryServiceNetworks qryResp;
271 int respStatus = HttpStatus.SC_OK;
273 List<NetworkResourceCustomization> ret = new ArrayList<>();
274 Service service = null;
277 if (networkModelCustomizationUuid != null && !"".equals(networkModelCustomizationUuid)) {
278 uuid = networkModelCustomizationUuid;
279 ret = networkCustomizationRepo.findByModelCustomizationUUID(networkModelCustomizationUuid);
280 }else if (networkType != null && !"".equals(networkType)) {
282 NetworkResource networkResources = networkResourceRepo.findFirstByModelNameOrderByModelVersionDesc(networkType);
283 if(networkResources != null)
284 ret=networkResources.getNetworkResourceCustomization();
286 else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) {
287 uuid = serviceModelInvariantUuid;
288 if (serviceModelVersion != null && !"".equals(serviceModelVersion)) {
289 service = serviceRepo.findFirstByModelVersionAndModelInvariantUUID(serviceModelVersion, uuid);
292 service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
294 }else if (serviceModelUuid != null && !"".equals(serviceModelUuid)) {
295 uuid = serviceModelUuid;
296 service = serviceRepo.findOneByModelUUID(serviceModelUuid);
299 throw(new Exception(NO_MATCHING_PARAMETERS));
303 ret = service.getNetworkCustomizations();
305 if (ret == null || ret.isEmpty()) {
306 logger.debug ("serviceNetworks not found");
307 respStatus = HttpStatus.SC_NOT_FOUND;
308 qryResp = new QueryServiceNetworks();
310 qryResp = new QueryServiceNetworks(ret);
311 logger.debug ("serviceNetworks found qryResp= {}", qryResp);
313 return respond(version, respStatus, isArray, qryResp);
314 } catch (Exception e) {
315 logger.error ("Exception - queryServiceNetworks", e);
316 CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
318 .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
319 .entity(new GenericEntity<CatalogQueryException>(excResp) {})
325 @Path("serviceResources")
326 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
327 @Transactional(readOnly = true)
328 public Response serviceResources(
329 @PathParam("version") String version,
330 @QueryParam("serviceModelUuid") String modelUUID,
331 @QueryParam("serviceModelInvariantUuid") String modelInvariantUUID,
332 @QueryParam("serviceModelVersion") String modelVersion) {
333 QueryServiceMacroHolder qryResp;
334 int respStatus = HttpStatus.SC_OK;
336 ServiceMacroHolder ret = new ServiceMacroHolder();
339 if (modelUUID != null && !"".equals(modelUUID)) {
341 logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelUuid serviceModelUuid: {}" , uuid);
342 Service serv =serviceRepo.findOneByModelUUID(uuid);
343 ret.setService(serv);
345 else if (modelInvariantUUID != null && !"".equals(modelInvariantUUID)) {
346 uuid = modelInvariantUUID;
347 if (modelVersion != null && !"".equals(modelVersion)) {
348 logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelInvariantUuid: {} serviceModelVersion: {}",uuid, modelVersion);
349 Service serv = serviceRepo.findFirstByModelVersionAndModelInvariantUUID(modelVersion, uuid);
350 ret.setService(serv);
353 logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelUuid: {}" , uuid);
354 Service serv = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
355 ret.setService(serv);
359 throw(new Exception(NO_MATCHING_PARAMETERS));
362 if (ret.getService() == null) {
363 logger.debug ("serviceMacroHolder not found");
364 respStatus = HttpStatus.SC_NOT_FOUND;
365 qryResp = new QueryServiceMacroHolder();
367 qryResp = new QueryServiceMacroHolder(ret);
368 logger.debug ("serviceMacroHolder qryResp= {}", qryResp);
370 return respond(version, respStatus, IS_ARRAY, qryResp);
371 } catch (Exception e) {
372 logger.error ("Exception - queryServiceMacroHolder", e);
373 CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
375 .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
376 .entity(new GenericEntity<CatalogQueryException>(excResp){} )
383 @Path("allottedResources/{arModelCustomizationUuid}")
384 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
385 @Transactional( readOnly = true)
386 public Response serviceAllottedResources (
387 @PathParam("version") String version,
388 @PathParam("arModelCustomizationUuid") String aUuid
390 return serviceAllottedResourcesImpl(version, !IS_ARRAY, aUuid, null, null, null);
394 @Path("serviceAllottedResources")
395 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
396 @Transactional( readOnly = true)
397 public Response serviceAllottedResources(
398 @PathParam("version") String version,
399 @QueryParam("serviceModelUuid") String smUuid,
400 @QueryParam("serviceModelInvariantUuid") String smiUuid,
401 @QueryParam("serviceModelVersion") String smVer,
402 @QueryParam("arModelCustomizationUuid") String aUuid
404 return serviceAllottedResourcesImpl(version, IS_ARRAY, aUuid, smUuid, smiUuid, smVer);
407 public Response serviceAllottedResourcesImpl(String version, boolean isArray, String aUuid, String smUuid, String serviceModelInvariantUuid, String smVer) {
408 QueryAllottedResourceCustomization qryResp;
409 int respStatus = HttpStatus.SC_OK;
411 List<AllottedResourceCustomization> ret = new ArrayList<>();
412 Service service = null;
414 if (smUuid != null && !"".equals(smUuid)) {
416 service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(uuid);
418 else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) {
419 uuid = serviceModelInvariantUuid;
420 if (smVer != null && !"".equals(smVer)) {
421 service = serviceRepo.findFirstByModelVersionAndModelInvariantUUID(smVer, uuid);
424 service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
427 else if (aUuid != null && !"".equals(aUuid)) {
429 ret = allottedCustomizationRepo.findByModelCustomizationUUID(uuid);
432 throw(new Exception(NO_MATCHING_PARAMETERS));
436 ret=service.getAllottedCustomizations();
438 if (ret == null || ret.isEmpty()) {
439 logger.debug ("AllottedResourceCustomization not found");
440 respStatus = HttpStatus.SC_NOT_FOUND;
441 qryResp = new QueryAllottedResourceCustomization();
443 qryResp = new QueryAllottedResourceCustomization(ret);
444 logger.debug ("AllottedResourceCustomization qryResp= {}", qryResp);
446 return respond(version, respStatus, isArray, qryResp);
447 } catch (Exception e) {
448 logger.error ("Exception - queryAllottedResourceCustomization", e);
449 CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
451 .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
452 .entity(new GenericEntity<CatalogQueryException>(excResp) {})
459 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
460 @Transactional( readOnly = true)
461 public Response vfModules(@QueryParam("vfModuleModelName") String vfModuleModelName) {
462 QueryVfModule qryResp;
463 int respStatus = HttpStatus.SC_OK;
464 List<VfModuleCustomization> ret = null;
466 if(vfModuleModelName != null && !"".equals(vfModuleModelName)){
467 VfModule vfModule = vfModuleRepo.findFirstByModelNameOrderByModelVersionDesc(vfModuleModelName);
469 ret = vfModule.getVfModuleCustomization();
471 throw(new Exception(NO_MATCHING_PARAMETERS));
474 if(ret == null || ret.isEmpty()){
475 logger.debug ("vfModules not found");
476 respStatus = HttpStatus.SC_NOT_FOUND;
477 qryResp = new QueryVfModule();
479 qryResp = new QueryVfModule(ret);
480 if(logger.isDebugEnabled())
481 logger.debug ("vfModules tojsonstring is: {}", qryResp.JSON2(false, false));
485 .entity(qryResp.JSON2(false, false))
486 .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
489 logger.error ("Exception during query VfModules by vfModuleModuleName: ", e);
490 CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
492 .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
493 .entity(new GenericEntity<CatalogQueryException>(excResp) {})
498 * Get the tosca csar info from catalog
501 * @param smUuid service model uuid
502 * @return the tosca csar information of the serivce.
503 * @since ONAP Beijing Release
506 @Path("serviceToscaCsar")
507 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
508 public Response serviceToscaCsar(@QueryParam("serviceModelUuid") String smUuid) {
509 int respStatus = HttpStatus.SC_OK;
512 if (smUuid != null && !"".equals(smUuid)) {
513 logger.debug("Query Csar by service model uuid: {}",smUuid);
514 ToscaCsar toscaCsar = toscaCsarRepo.findOne(smUuid);
515 if (toscaCsar != null) {
516 QueryServiceCsar serviceCsar = new QueryServiceCsar(toscaCsar);
517 entity = serviceCsar.JSON2(false, false);
519 respStatus = HttpStatus.SC_NOT_FOUND;
522 throw (new Exception("Incoming parameter is null or blank"));
527 .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
529 } catch (Exception e) {
530 logger.error("Exception during query csar by service model uuid: ", e);
531 CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
532 CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
534 .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
535 .entity(new GenericEntity<CatalogQueryException>(excResp) {
542 * Get the resource recipe info from catalog
545 * @param rmUuid resource model uuid
546 * @return the recipe information of the resource.
547 * @since ONAP Beijing Release
550 @Path("resourceRecipe")
551 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
552 public Response resourceRecipe(@QueryParam("resourceModelUuid") String rmUuid, @QueryParam("action") String action) {
553 int respStatus = HttpStatus.SC_OK;
556 if (rmUuid != null && !"".equals(rmUuid)) {
557 logger.debug("Query recipe by resource model uuid: {}", rmUuid);
558 //check vnf and network and ar, the resource could be any resource.
559 VnfResource vnf = vnfResourceRepo.findResourceByModelUUID(rmUuid);
560 Recipe recipe = vnfRecipeRepo.findFirstVnfRecipeByNfRoleAndAction(vnf.getModelName(), action);
561 if (null == recipe) {
562 NetworkResource nResource = networkResourceRepo.findResourceByModelUUID(rmUuid);
563 recipe = networkRecipeRepo.findFirstByModelNameAndAction(nResource.getModelName(), action);
565 if (null == recipe) {
566 AllottedResource arResource = arResourceRepo.findResourceByModelUUID(rmUuid);
567 recipe = arRecipeRepo.findByModelNameAndAction(arResource.getModelName(), action);
569 if (recipe != null) {
570 QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe);
571 entity = resourceRecipe.JSON2(false, false);
573 respStatus = HttpStatus.SC_NOT_FOUND;
576 throw new Exception("Incoming parameter is null or blank");
581 .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
583 } catch (Exception e) {
584 logger.error("Exception during query recipe by resource model uuid: ", e);
585 CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
586 CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
588 .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
589 .entity(new GenericEntity<CatalogQueryException>(excResp) {