From 3bfa1d957d77f9e40c47e654a629e73bd77fdfcd Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Wed, 12 Feb 2020 12:28:59 +0200 Subject: Topology tree: enrich vfModules data from other versions of same model Depends on FLAG_EXP_TOPOLOGY_TREE_VFMODULE_NAMES_FROM_OTHER_TOSCA_VERSIONS Issue-ID: VID-771 Change-Id: Ib25c6cf7269614f2f4d332b3aa84b3307a59ebda Signed-off-by: Ittay Stern --- .../java/org/onap/vid/services/VidServiceImpl.java | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'vid-app-common/src/main/java/org/onap/vid/services/VidServiceImpl.java') diff --git a/vid-app-common/src/main/java/org/onap/vid/services/VidServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/VidServiceImpl.java index a5988a156..ef62bf9f6 100644 --- a/vid-app-common/src/main/java/org/onap/vid/services/VidServiceImpl.java +++ b/vid-app-common/src/main/java/org/onap/vid/services/VidServiceImpl.java @@ -52,6 +52,7 @@ import org.onap.vid.properties.VidProperties; import org.onap.vid.utils.Logging; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpMethod; +import org.springframework.lang.NonNull; import org.togglz.core.manager.FeatureManager; /** @@ -99,11 +100,6 @@ public class VidServiceImpl implements VidService { }); } - /* - * (non-Javadoc) - * - * @see org.onap.vid.controller.VidService#getService(java.lang.String) - */ @Override public ServiceModel getService(String uuid) throws AsdcCatalogException { if (featureManager.isActive(FLAG_SERVICE_MODEL_CACHE)) { @@ -113,6 +109,20 @@ public class VidServiceImpl implements VidService { } } + @NonNull + @Override + public ServiceModel getServiceModelOrThrow(String modelVersionId) { + try { + final ServiceModel serviceModel = getService(modelVersionId); + if (serviceModel == null) { + throw new GenericUncheckedException("Model version '" + modelVersionId + "' not found"); + } + return serviceModel; + } catch (AsdcCatalogException e) { + throw new GenericUncheckedException("Exception while loading model version '" + modelVersionId + "'", e); + } + } + private ServiceModel getServiceFromCache(String uuid) throws AsdcCatalogException { try { return serviceModelCache.get(uuid); -- cgit 1.2.3-korg