From 2830723b8c5d5bb40c171c88f055adbc1a808f68 Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Fri, 26 Apr 2024 10:09:54 +0100 Subject: Faster module searches (CPS-2190 #3) This greatly improves performance of module searches by eliminating unneeded SQL queries via Hibernate lazy fetching. Issue-ID: CPS-2190 Signed-off-by: danielhanrahan Change-Id: Ie9e65017d0027366456f1741cc37b10679317b25 --- .../src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java | 4 +--- .../src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'cps-service/src/main/java/org') diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java index f09a795a66..aa9c45d09a 100644 --- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java +++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java @@ -21,7 +21,6 @@ package org.onap.cps.api.impl; import java.util.Collection; -import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import org.onap.cps.api.CpsAnchorService; import org.onap.cps.spi.CpsAdminPersistenceService; @@ -87,8 +86,7 @@ public class CpsAnchorServiceImpl implements CpsAnchorService { @Override public Collection queryAnchorNames(final String dataspaceName, final Collection moduleNames) { cpsValidator.validateNameCharacters(dataspaceName); - final Collection anchors = cpsAdminPersistenceService.queryAnchors(dataspaceName, moduleNames); - return anchors.stream().map(Anchor::getName).collect(Collectors.toList()); + return cpsAdminPersistenceService.queryAnchorNames(dataspaceName, moduleNames); } @Override diff --git a/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java b/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java index 5a1810f473..2b21619cb7 100755 --- a/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java +++ b/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java @@ -107,7 +107,7 @@ public interface CpsAdminPersistenceService { * @return a collection of anchor names in the given dataspace. The schema set for each anchor must include all the * given module names */ - Collection queryAnchors(String dataspaceName, Collection moduleNames); + Collection queryAnchorNames(String dataspaceName, Collection moduleNames); /** * Get an anchor in the given dataspace using the anchor name. -- cgit 1.2.3-korg