diff options
author | 2021-08-04 12:13:36 +0100 | |
---|---|---|
committer | 2021-08-05 17:19:22 +0100 | |
commit | dce1d58005d90950e00b22078d82559748dcb255 (patch) | |
tree | 5db973dcd04d1f0d28b6dca3e807affac093c520 /cps-service/src/main/java/org | |
parent | 0e210d77ec39915046a95615f5f9d2a2dc65162b (diff) |
CPS-506: List all known modules and revision
Issue-ID: CPS-506
Signed-off-by: shivasubedi <shiva.subedi@est.tech>
Change-Id: Id76fecc7dd10625cc3ecb940b1181b1e8bf829a1
Diffstat (limited to 'cps-service/src/main/java/org')
3 files changed, 26 insertions, 0 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java b/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java index cd156d6dd..fee4daa51 100644 --- a/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java +++ b/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java @@ -21,10 +21,12 @@ package org.onap.cps.api; +import java.util.List; import java.util.Map; import org.checkerframework.checker.nullness.qual.NonNull; import org.onap.cps.spi.CascadeDeleteAllowed; import org.onap.cps.spi.exceptions.DataInUseException; +import org.onap.cps.spi.model.ModuleReference; import org.onap.cps.spi.model.SchemaSet; /** @@ -63,4 +65,11 @@ public interface CpsModuleService { */ void deleteSchemaSet(@NonNull String dataspaceName, @NonNull String schemaSetName, @NonNull CascadeDeleteAllowed cascadeDeleteAllowed); + + /** + * Retrieve all modules and revisions known by CPS for all Yang Resources. + * + * @return a list of ModuleReference objects + */ + List<ModuleReference> getAllYangResourcesModuleReferences(); } diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java index e4e6d1bef..34735f848 100644 --- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java +++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java @@ -21,10 +21,12 @@ package org.onap.cps.api.impl; +import java.util.List; import java.util.Map; import org.onap.cps.api.CpsModuleService; import org.onap.cps.spi.CascadeDeleteAllowed; import org.onap.cps.spi.CpsModulePersistenceService; +import org.onap.cps.spi.model.ModuleReference; import org.onap.cps.spi.model.SchemaSet; import org.onap.cps.yang.YangTextSchemaSourceSetBuilder; import org.springframework.beans.factory.annotation.Autowired; @@ -61,4 +63,10 @@ public class CpsModuleServiceImpl implements CpsModuleService { final CascadeDeleteAllowed cascadeDeleteAllowed) { cpsModulePersistenceService.deleteSchemaSet(dataspaceName, schemaSetName, cascadeDeleteAllowed); } + + @Override + public List<ModuleReference> getAllYangResourcesModuleReferences() { + return cpsModulePersistenceService.getAllYangResourcesModuleReferences(); + } + } diff --git a/cps-service/src/main/java/org/onap/cps/spi/CpsModulePersistenceService.java b/cps-service/src/main/java/org/onap/cps/spi/CpsModulePersistenceService.java index ec8a53cd1..bc62a23c5 100755 --- a/cps-service/src/main/java/org/onap/cps/spi/CpsModulePersistenceService.java +++ b/cps-service/src/main/java/org/onap/cps/spi/CpsModulePersistenceService.java @@ -21,9 +21,11 @@ package org.onap.cps.spi; +import java.util.List; import java.util.Map; import org.checkerframework.checker.nullness.qual.NonNull; import org.onap.cps.spi.exceptions.DataInUseException; +import org.onap.cps.spi.model.ModuleReference; /** * Service to manage modules. @@ -73,4 +75,11 @@ public interface CpsModulePersistenceService { @NonNull Map<String, String> getYangSchemaSetResources(@NonNull String dataspaceName, @NonNull String anchorName); + + /** + * Returns all YANG resources module references. + * + * @return List of all YANG resources module information in the database + */ + List<ModuleReference> getAllYangResourcesModuleReferences(); } |