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 java.util.ArrayList;
57 import java.util.List;
59 import javax.ws.rs.GET;
60 import javax.ws.rs.Path;
61 import javax.ws.rs.PathParam;
62 import javax.ws.rs.Produces;
63 import javax.ws.rs.QueryParam;
64 import javax.ws.rs.core.GenericEntity;
65 import javax.ws.rs.core.HttpHeaders;
66 import javax.ws.rs.core.MediaType;
67 import javax.ws.rs.core.Response;
69 import org.apache.http.HttpStatus;
70 import org.onap.so.adapters.catalogdb.catalogrest.CatalogQuery;
71 import org.onap.so.adapters.catalogdb.catalogrest.CatalogQueryException;
72 import org.onap.so.adapters.catalogdb.catalogrest.CatalogQueryExceptionCategory;
73 import org.onap.so.adapters.catalogdb.catalogrest.QueryAllottedResourceCustomization;
74 import org.onap.so.adapters.catalogdb.catalogrest.QueryResourceRecipe;
75 import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceCsar;
76 import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceMacroHolder;
77 import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceNetworks;
78 import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceVnfs;
79 import org.onap.so.adapters.catalogdb.catalogrest.QueryVfModule;
80 import org.onap.so.db.catalog.beans.AllottedResource;
81 import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
82 import org.onap.so.db.catalog.beans.NetworkResource;
83 import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
84 import org.onap.so.db.catalog.beans.Recipe;
85 import org.onap.so.db.catalog.beans.Service;
86 import org.onap.so.db.catalog.beans.ToscaCsar;
87 import org.onap.so.db.catalog.beans.VfModule;
88 import org.onap.so.db.catalog.beans.VfModuleCustomization;
89 import org.onap.so.db.catalog.beans.VnfResource;
90 import org.onap.so.db.catalog.beans.VnfResourceCustomization;
91 import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository;
92 import org.onap.so.db.catalog.data.repository.AllottedResourceRepository;
93 import org.onap.so.db.catalog.data.repository.ArRecipeRepository;
94 import org.onap.so.db.catalog.data.repository.NetworkRecipeRepository;
95 import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository;
96 import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
97 import org.onap.so.db.catalog.data.repository.ServiceRepository;
98 import org.onap.so.db.catalog.data.repository.ToscaCsarRepository;
99 import org.onap.so.db.catalog.data.repository.VFModuleRepository;
100 import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository;
101 import org.onap.so.db.catalog.data.repository.VnfRecipeRepository;
102 import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
103 import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder;
104 import org.slf4j.Logger;
105 import org.slf4j.LoggerFactory;
106 import org.springframework.beans.factory.annotation.Autowired;
107 import org.springframework.stereotype.Component;
108 import org.springframework.transaction.annotation.Transactional;
111 * This class services calls to the REST interface for VF Modules (http://host:port/ecomp/mso/catalog/v1)
112 * Both XML and JSON can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default.
113 * Requests respond synchronously only
115 @Path("/{version: v[0-9]+}")
117 public class CatalogDbAdapterRest {
118 protected static Logger logger = LoggerFactory.getLogger(CatalogDbAdapterRest.class);
119 private static final boolean IS_ARRAY = true;
122 private VnfCustomizationRepository vnfCustomizationRepo;
125 private ServiceRepository serviceRepo;
128 private NetworkResourceCustomizationRepository networkCustomizationRepo;
131 private NetworkResourceRepository networkResourceRepo;
134 private AllottedResourceCustomizationRepository allottedCustomizationRepo;
137 private ToscaCsarRepository toscaCsarRepo;
140 private VFModuleRepository vfModuleRepo;
143 private VnfRecipeRepository vnfRecipeRepo;
146 private NetworkRecipeRepository networkRecipeRepo;
149 private ArRecipeRepository arRecipeRepo;
152 private VnfResourceRepository vnfResourceRepo;
155 private AllottedResourceRepository arResourceRepo;
157 private static final String NO_MATCHING_PARAMETERS = "no matching parameters";
159 public Response respond(String version, int respStatus, boolean isArray, CatalogQuery qryResp) {
162 //.entity(new GenericEntity<QueryServiceVnfs>(qryResp) {})
163 .entity(qryResp.toJsonString(version, isArray))
164 .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
169 @Path("vnfResources/{vnfModelCustomizationUuid}")
170 @Transactional( readOnly = true)
171 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
172 public Response serviceVnfs (
173 @PathParam("version") String version,
174 @PathParam("vnfModelCustomizationUuid") String vnfUuid
176 return serviceVnfsImpl (version, !IS_ARRAY, vnfUuid, null, null, null, null);
181 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
182 @Transactional( readOnly = true)
183 public Response serviceVnfs(
184 @PathParam("version") String version,
185 @QueryParam("vnfModelCustomizationUuid") String vnfUuid,
186 @QueryParam("serviceModelUuid") String smUuid,
187 @QueryParam("serviceModelInvariantUuid") String smiUuid,
188 @QueryParam("serviceModelVersion") String smVer,
189 @QueryParam("serviceModelName") String smName
191 return serviceVnfsImpl (version, IS_ARRAY, vnfUuid, smUuid, smiUuid, smVer, smName);
194 public Response serviceVnfsImpl(String version, boolean isArray, String vnfUuid, String serviceModelUUID, String smiUuid, String smVer, String smName) {
195 QueryServiceVnfs qryResp = null;
196 int respStatus = HttpStatus.SC_OK;
197 List<VnfResourceCustomization> ret = new ArrayList<>();
198 Service service = null;
200 if (vnfUuid != null && !"".equals(vnfUuid))
201 ret = vnfCustomizationRepo.findByModelCustomizationUUID(vnfUuid);
202 else if (serviceModelUUID != null && !"".equals(serviceModelUUID))
203 service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(serviceModelUUID);
204 else if (smiUuid != null && !"".equals(smiUuid))
205 if (smVer != null && !"".equals(smVer))
206 service = serviceRepo.findByModelVersionAndModelInvariantUUID(smVer,smiUuid);
208 service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(smiUuid);
209 else if (smName != null && !"".equals(smName)) {
210 if (smVer != null && !"".equals(smVer))
211 service = serviceRepo.findByModelNameAndModelVersion(smName, smVer);
213 service = serviceRepo.findFirstByModelNameOrderByModelVersionDesc(smName);
216 throw(new Exception(NO_MATCHING_PARAMETERS));
219 if (service == null && ret.isEmpty()) {
220 respStatus = HttpStatus.SC_NOT_FOUND;
221 qryResp = new QueryServiceVnfs();
222 }else if( service == null && !ret.isEmpty()){
223 qryResp = new QueryServiceVnfs(ret);
224 } else if (service != null) {
225 qryResp = new QueryServiceVnfs(service.getVnfCustomizations());
227 logger.debug ("serviceVnfs qryResp= {}", qryResp);
228 return respond(version, respStatus, isArray, qryResp);
229 } catch (Exception e) {
230 logger.error("Exception - queryServiceVnfs", e);
231 CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
233 .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
234 .entity(new GenericEntity<CatalogQueryException>(excResp) {})
240 @Path("networkResources/{networkModelCustomizationUuid}")
241 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
242 @Transactional( readOnly = true)
243 public Response serviceNetworks (
244 @PathParam("version") String version,
245 @PathParam("networkModelCustomizationUuid") String nUuid
247 return serviceNetworksImpl (version, !IS_ARRAY, nUuid, null, null, null, null);
251 @Path("serviceNetworks")
252 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
253 @Transactional( readOnly = true)
254 public Response serviceNetworks (
255 @PathParam("version") String version,
256 @QueryParam("networkModelCustomizationUuid") String networkModelCustomizationUuid,
257 @QueryParam("networkType") String networkType,
258 @QueryParam("networkModelName") String networkModelName,
259 @QueryParam("serviceModelUuid") String serviceModelUuid,
260 @QueryParam("serviceModelInvariantUuid") String serviceModelInvariantUuid,
261 @QueryParam("serviceModelVersion") String serviceModelVersion,
262 @QueryParam("networkModelVersion") String networkModelVersion
264 if (networkModelName != null && !"".equals(networkModelName)) {
265 networkType = networkModelName;
267 return serviceNetworksImpl (version, IS_ARRAY, networkModelCustomizationUuid, networkType, serviceModelUuid, serviceModelInvariantUuid, serviceModelVersion);
270 public Response serviceNetworksImpl (String version, boolean isArray, String networkModelCustomizationUuid, String networkType, String serviceModelUuid, String serviceModelInvariantUuid, String serviceModelVersion) {
271 QueryServiceNetworks qryResp;
272 int respStatus = HttpStatus.SC_OK;
274 List<NetworkResourceCustomization> ret = new ArrayList<>();
275 Service service = null;
278 if (networkModelCustomizationUuid != null && !"".equals(networkModelCustomizationUuid)) {
279 uuid = networkModelCustomizationUuid;
280 ret = networkCustomizationRepo.findByModelCustomizationUUID(networkModelCustomizationUuid);
281 }else if (networkType != null && !"".equals(networkType)) {
283 NetworkResource networkResources = networkResourceRepo.findFirstByModelNameOrderByModelVersionDesc(networkType);
284 if(networkResources != null)
285 ret=networkResources.getNetworkResourceCustomization();
287 else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) {
288 uuid = serviceModelInvariantUuid;
289 if (serviceModelVersion != null && !"".equals(serviceModelVersion)) {
290 service = serviceRepo.findByModelVersionAndModelInvariantUUID(serviceModelVersion, uuid);
293 service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
295 }else if (serviceModelUuid != null && !"".equals(serviceModelUuid)) {
296 uuid = serviceModelUuid;
297 service = serviceRepo.findOneByModelUUID(serviceModelUuid);
300 throw(new Exception(NO_MATCHING_PARAMETERS));
304 ret = service.getNetworkCustomizations();
306 if (ret == null || ret.isEmpty()) {
307 logger.debug ("serviceNetworks not found");
308 respStatus = HttpStatus.SC_NOT_FOUND;
309 qryResp = new QueryServiceNetworks();
311 qryResp = new QueryServiceNetworks(ret);
312 logger.debug ("serviceNetworks found qryResp= {}", qryResp);
314 return respond(version, respStatus, isArray, qryResp);
315 } catch (Exception e) {
316 logger.error ("Exception - queryServiceNetworks", e);
317 CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
319 .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
320 .entity(new GenericEntity<CatalogQueryException>(excResp) {})
326 @Path("serviceResources")
327 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
328 @Transactional(readOnly = true)
329 public Response serviceResources(
330 @PathParam("version") String version,
331 @QueryParam("serviceModelUuid") String modelUUID,
332 @QueryParam("serviceModelInvariantUuid") String modelInvariantUUID,
333 @QueryParam("serviceModelVersion") String modelVersion) {
334 QueryServiceMacroHolder qryResp;
335 int respStatus = HttpStatus.SC_OK;
337 ServiceMacroHolder ret = new ServiceMacroHolder();
340 if (modelUUID != null && !"".equals(modelUUID)) {
342 logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelUuid serviceModelUuid: {}" , uuid);
343 Service serv =serviceRepo.findOneByModelUUID(uuid);
344 ret.setService(serv);
346 else if (modelInvariantUUID != null && !"".equals(modelInvariantUUID)) {
347 uuid = modelInvariantUUID;
348 if (modelVersion != null && !"".equals(modelVersion)) {
349 logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelInvariantUuid: {} serviceModelVersion: {}",uuid, modelVersion);
350 Service serv = serviceRepo.findByModelVersionAndModelInvariantUUID(modelVersion, uuid);
351 ret.setService(serv);
354 logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelUuid: {}" , uuid);
355 Service serv = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
356 ret.setService(serv);
360 throw(new Exception(NO_MATCHING_PARAMETERS));
363 if (ret.getService() == null) {
364 logger.debug ("serviceMacroHolder not found");
365 respStatus = HttpStatus.SC_NOT_FOUND;
366 qryResp = new QueryServiceMacroHolder();
368 qryResp = new QueryServiceMacroHolder(ret);
369 logger.debug ("serviceMacroHolder qryResp= {}", qryResp);
371 return respond(version, respStatus, IS_ARRAY, qryResp);
372 } catch (Exception e) {
373 logger.error ("Exception - queryServiceMacroHolder", e);
374 CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
376 .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
377 .entity(new GenericEntity<CatalogQueryException>(excResp){} )
384 @Path("allottedResources/{arModelCustomizationUuid}")
385 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
386 @Transactional( readOnly = true)
387 public Response serviceAllottedResources (
388 @PathParam("version") String version,
389 @PathParam("arModelCustomizationUuid") String aUuid
391 return serviceAllottedResourcesImpl(version, !IS_ARRAY, aUuid, null, null, null);
395 @Path("serviceAllottedResources")
396 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
397 @Transactional( readOnly = true)
398 public Response serviceAllottedResources(
399 @PathParam("version") String version,
400 @QueryParam("serviceModelUuid") String smUuid,
401 @QueryParam("serviceModelInvariantUuid") String smiUuid,
402 @QueryParam("serviceModelVersion") String smVer,
403 @QueryParam("arModelCustomizationUuid") String aUuid
405 return serviceAllottedResourcesImpl(version, IS_ARRAY, aUuid, smUuid, smiUuid, smVer);
408 public Response serviceAllottedResourcesImpl(String version, boolean isArray, String aUuid, String smUuid, String serviceModelInvariantUuid, String smVer) {
409 QueryAllottedResourceCustomization qryResp;
410 int respStatus = HttpStatus.SC_OK;
412 List<AllottedResourceCustomization> ret = new ArrayList<>();
413 Service service = null;
415 if (smUuid != null && !"".equals(smUuid)) {
417 service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(uuid);
419 else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) {
420 uuid = serviceModelInvariantUuid;
421 if (smVer != null && !"".equals(smVer)) {
422 service = serviceRepo.findByModelVersionAndModelInvariantUUID(smVer, uuid);
425 service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
428 else if (aUuid != null && !"".equals(aUuid)) {
430 ret = allottedCustomizationRepo.findByModelCustomizationUUID(uuid);
433 throw(new Exception(NO_MATCHING_PARAMETERS));
437 ret=service.getAllottedCustomizations();
439 if (ret == null || ret.isEmpty()) {
440 logger.debug ("AllottedResourceCustomization not found");
441 respStatus = HttpStatus.SC_NOT_FOUND;
442 qryResp = new QueryAllottedResourceCustomization();
444 qryResp = new QueryAllottedResourceCustomization(ret);
445 logger.debug ("AllottedResourceCustomization qryResp= {}", qryResp);
447 return respond(version, respStatus, isArray, qryResp);
448 } catch (Exception e) {
449 logger.error ("Exception - queryAllottedResourceCustomization", e);
450 CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
452 .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
453 .entity(new GenericEntity<CatalogQueryException>(excResp) {})
460 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
461 @Transactional( readOnly = true)
462 public Response vfModules(@QueryParam("vfModuleModelName") String vfModuleModelName) {
463 QueryVfModule qryResp;
464 int respStatus = HttpStatus.SC_OK;
465 List<VfModuleCustomization> ret = null;
467 if(vfModuleModelName != null && !"".equals(vfModuleModelName)){
468 VfModule vfModule = vfModuleRepo.findFirstByModelNameOrderByModelVersionDesc(vfModuleModelName);
470 ret = vfModule.getVfModuleCustomization();
472 throw(new Exception(NO_MATCHING_PARAMETERS));
475 if(ret == null || ret.isEmpty()){
476 logger.debug ("vfModules not found");
477 respStatus = HttpStatus.SC_NOT_FOUND;
478 qryResp = new QueryVfModule();
480 qryResp = new QueryVfModule(ret);
481 if(logger.isDebugEnabled())
482 logger.debug ("vfModules tojsonstring is: {}", qryResp.JSON2(false, false));
486 .entity(qryResp.JSON2(false, false))
487 .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
490 logger.error ("Exception during query VfModules by vfModuleModuleName: ", e);
491 CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
493 .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
494 .entity(new GenericEntity<CatalogQueryException>(excResp) {})
499 * Get the tosca csar info from catalog
502 * @param smUuid service model uuid
503 * @return the tosca csar information of the serivce.
504 * @since ONAP Beijing Release
507 @Path("serviceToscaCsar")
508 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
509 public Response serviceToscaCsar(@QueryParam("serviceModelUuid") String smUuid) {
510 int respStatus = HttpStatus.SC_OK;
513 if (smUuid != null && !"".equals(smUuid)) {
514 logger.debug("Query Csar by service model uuid: {}",smUuid);
515 ToscaCsar toscaCsar = toscaCsarRepo.findOne(smUuid);
516 if (toscaCsar != null) {
517 QueryServiceCsar serviceCsar = new QueryServiceCsar(toscaCsar);
518 entity = serviceCsar.JSON2(false, false);
520 respStatus = HttpStatus.SC_NOT_FOUND;
523 throw (new Exception("Incoming parameter is null or blank"));
528 .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
530 } catch (Exception e) {
531 logger.error("Exception during query csar by service model uuid: ", e);
532 CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
533 CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
535 .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
536 .entity(new GenericEntity<CatalogQueryException>(excResp) {
543 * Get the resource recipe info from catalog
546 * @param rmUuid resource model uuid
547 * @return the recipe information of the resource.
548 * @since ONAP Beijing Release
551 @Path("resourceRecipe")
552 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
553 public Response resourceRecipe(@QueryParam("resourceModelUuid") String rmUuid, @QueryParam("action") String action) {
554 int respStatus = HttpStatus.SC_OK;
557 if (rmUuid != null && !"".equals(rmUuid)) {
558 logger.debug("Query recipe by resource model uuid: {}", rmUuid);
559 //check vnf and network and ar, the resource could be any resource.
560 VnfResource vnf = vnfResourceRepo.findResourceByModelUUID(rmUuid);
561 Recipe recipe = vnfRecipeRepo.findVnfRecipeByNfRoleAndAction(vnf.getModelName(), action);
562 if (null == recipe) {
563 NetworkResource nResource = networkResourceRepo.findResourceByModelUUID(rmUuid);
564 recipe = networkRecipeRepo.findByModelNameAndAction(nResource.getModelName(), action);
566 if (null == recipe) {
567 AllottedResource arResource = arResourceRepo.findResourceByModelUUID(rmUuid);
568 recipe = arRecipeRepo.findByModelNameAndAction(arResource.getModelName(), action);
570 if (recipe != null) {
571 QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe);
572 entity = resourceRecipe.JSON2(false, false);
574 respStatus = HttpStatus.SC_NOT_FOUND;
577 throw new Exception("Incoming parameter is null or blank");
582 .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
584 } catch (Exception e) {
585 logger.error("Exception during query recipe by resource model uuid: ", e);
586 CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
587 CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
589 .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
590 .entity(new GenericEntity<CatalogQueryException>(excResp) {