diff options
Diffstat (limited to 'cps-service/src/main')
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. |