diff options
author | Ruslan Kashapov <ruslan.kashapov@pantheon.tech> | 2020-11-24 11:13:43 +0200 |
---|---|---|
committer | Ruslan Kashapov <ruslan.kashapov@pantheon.tech> | 2020-12-17 14:40:53 +0200 |
commit | 8a1e3c9f90d2111835460fc042b4a63f93b80384 (patch) | |
tree | c26fa83be590816686d239580e161cc04e298197 /cps-service/src/main | |
parent | 84ac94d2f3f9ebd6a3a7befa244beef851eac126 (diff) |
Associate anchor to schema set
- db schema updated
- db layer tests provided for ancor create and reading by dataspace
- anchor model is removed from rest api as extra
- api/spi updated to use string references instead of object
Issue-ID: CPS-99
Change-Id: Ideeb83fa9e91ec1816308d8327a6589b999c64c5
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Diffstat (limited to 'cps-service/src/main')
4 files changed, 29 insertions, 23 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 a2c05bfe5a..5090e3a3c4 100644 --- a/cps-service/src/main/java/org/onap/cps/api/CpsAdminService.java +++ b/cps-service/src/main/java/org/onap/cps/api/CpsAdminService.java @@ -21,6 +21,7 @@ package org.onap.cps.api; import java.util.Collection; +import org.checkerframework.checker.nullness.qual.NonNull; import org.onap.cps.spi.exceptions.CpsException; import org.onap.cps.spi.model.Anchor; @@ -30,13 +31,14 @@ import org.onap.cps.spi.model.Anchor; public interface CpsAdminService { /** - * Create an anchor using provided anchorDetails object. + * Create an Anchor. * - * @param anchor the anchor details object. - * @return the anchor name. + * @param dataspaceName dataspace name + * @param schemaSetName schema set name + * @param anchorName anchor name * @throws CpsException if input data is invalid. */ - String createAnchor(Anchor anchor); + void createAnchor(@NonNull String dataspaceName, @NonNull String schemaSetName, @NonNull String anchorName); /** * Read all anchors in the given a dataspace. @@ -44,5 +46,6 @@ public interface CpsAdminService { * @param dataspaceName dataspace name * @return a collection of anchors */ - Collection<Anchor> getAnchors(String dataspaceName); + @NonNull + Collection<Anchor> getAnchors(@NonNull String dataspaceName); } 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 5d9bc015fd..f93a827079 100644 --- 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 @@ -34,8 +34,8 @@ public class CpsAdminServiceImpl implements CpsAdminService { private CpsAdminPersistenceService cpsAdminPersistenceService; @Override - public String createAnchor(final Anchor anchor) { - return cpsAdminPersistenceService.createAnchor(anchor); + public void createAnchor(final String dataspaceName, final String schemaSetName, final String anchorName) { + cpsAdminPersistenceService.createAnchor(dataspaceName, schemaSetName, anchorName); } @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 4e88d49a63..1b7ddb724c 100644 --- a/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java +++ b/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java @@ -22,6 +22,7 @@ package org.onap.cps.spi; import java.util.Collection; +import org.checkerframework.checker.nullness.qual.NonNull; import org.onap.cps.spi.model.Anchor; /* @@ -32,10 +33,12 @@ public interface CpsAdminPersistenceService { /** * Create an Anchor. * - * @param anchor the anchorDetails object. - * @return the anchor name. + * @param dataspaceName dataspace name + * @param schemaSetName schema set name + * @param anchorName anchor name */ - String createAnchor(Anchor anchor); + void createAnchor(@NonNull String dataspaceName, @NonNull String schemaSetName, @NonNull String anchorName); + /** * Read all anchors in the given a dataspace. @@ -43,5 +46,7 @@ public interface CpsAdminPersistenceService { * @param dataspaceName dataspace name * @return a collection of anchors */ - Collection<Anchor> getAnchors(String dataspaceName); + @NonNull + Collection<Anchor> getAnchors(@NonNull String dataspaceName); + } diff --git a/cps-service/src/main/java/org/onap/cps/spi/model/Anchor.java b/cps-service/src/main/java/org/onap/cps/spi/model/Anchor.java index cd1c774476..456f733935 100644 --- a/cps-service/src/main/java/org/onap/cps/spi/model/Anchor.java +++ b/cps-service/src/main/java/org/onap/cps/spi/model/Anchor.java @@ -21,23 +21,21 @@ package org.onap.cps.spi.model; import java.io.Serializable; -import java.util.Map; -import lombok.Getter; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; import lombok.NoArgsConstructor; -import lombok.Setter; -@Setter -@Getter +@Data +@Builder @NoArgsConstructor +@AllArgsConstructor public class Anchor implements Serializable { - // anchor will support both a single module and schema set until CPS-99 is complete private static final long serialVersionUID = 1464791260718603291L; - private String anchorName; + + private String name; private String dataspaceName; - private String namespace; - private String revision; - private String moduleSetName; - private Map<String, String> externalReferences; - private String xpath; + private String schemaSetName; + }
\ No newline at end of file |