diff options
author | niamhcore <niamh.core@est.tech> | 2021-10-28 13:39:24 +0100 |
---|---|---|
committer | niamhcore <niamh.core@est.tech> | 2021-11-02 15:05:39 +0000 |
commit | b0d930752fd6be436061226c7395038f6828438e (patch) | |
tree | 206389f51db0ffe46dae7c7c0e5d21c2f880e548 /cps-service/src/main/java/org | |
parent | 6fda688fa63ea7ccd450002fb94a18b07095bea9 (diff) |
Add get cm handles by modules names - service layer
Issue-ID: CPS-644
Signed-off-by: niamhcore <niamh.core@est.tech>
Change-Id: Ic2a57df02d533a0066382c12c35be8d524b6cdad
Diffstat (limited to 'cps-service/src/main/java/org')
3 files changed, 23 insertions, 3 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/api/CpsAdminService.java b/cps-service/src/main/java/org/onap/cps/api/CpsAdminService.java index 5b2e104289..1d08cde7ba 100755 --- a/cps-service/src/main/java/org/onap/cps/api/CpsAdminService.java +++ b/cps-service/src/main/java/org/onap/cps/api/CpsAdminService.java @@ -77,4 +77,15 @@ public interface CpsAdminService { * @param anchorName anchor name */ void deleteAnchor(@NonNull String dataspaceName, @NonNull String anchorName); + + /** + * Query anchor names for the given module names in the provided dataspace. + * + * + * @param dataspaceName dataspace name + * @param moduleNames a collection of module names + * @return a collection of anchor names in the given dataspace. The schema set for each anchor must include all the + * given module names + */ + Collection<String> queryAnchorNames(String dataspaceName, Collection<String> moduleNames); } diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsAdminServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsAdminServiceImpl.java index 47da64895e..4640a0fb31 100755 --- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsAdminServiceImpl.java +++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsAdminServiceImpl.java @@ -23,6 +23,7 @@ package org.onap.cps.api.impl; import java.util.Collection; +import java.util.stream.Collectors; import org.onap.cps.api.CpsAdminService; import org.onap.cps.spi.CpsAdminPersistenceService; import org.onap.cps.spi.model.Anchor; @@ -59,4 +60,10 @@ public class CpsAdminServiceImpl implements CpsAdminService { public void deleteAnchor(final String dataspaceName, final String anchorName) { cpsAdminPersistenceService.deleteAnchor(dataspaceName, anchorName); } + + @Override + public Collection<String> queryAnchorNames(final String dataspaceName, final Collection<String> moduleNames) { + final Collection<Anchor> anchors = cpsAdminPersistenceService.queryAnchors(dataspaceName, moduleNames); + return anchors.stream().map(anchor -> anchor.getName()).collect(Collectors.toList()); + } } 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 f29735fa01..104ac4f3f6 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 @@ -59,13 +59,15 @@ public interface CpsAdminPersistenceService { Collection<Anchor> getAnchors(@NonNull String dataspaceName); /** - * Get anchors for the given dataspace name and collection of module names. + * Query anchor names for the given module names in the provided dataspace. + * * * @param dataspaceName dataspace name * @param moduleNames a collection of module names - * @return a collection of anchors + * @return a collection of anchor names in the given dataspace. The schema set for each anchor must include all the + * given module names */ - Collection<Anchor> getAnchors(String dataspaceName, Collection<String> moduleNames); + Collection<Anchor> queryAnchors(String dataspaceName, Collection<String> moduleNames); /** * Get an anchor in the given dataspace using the anchor name. |