Retrieve the SchemaSet resources for an Anchor
[cps.git] / cps-ri / src / main / java / org / onap / cps / spi / impl / CpsAdminPersistenceServiceImpl.java
old mode 100644 (file)
new mode 100755 (executable)
index dfe3ecc..ddbfeb2
@@ -82,6 +82,14 @@ public class CpsAdminPersistenceServiceImpl implements CpsAdminPersistenceServic
         return anchorEntities.stream().map(CpsAdminPersistenceServiceImpl::toAnchor).collect(Collectors.toList());
     }
 
+    @Override
+    public Anchor getAnchor(final String dataspaceName, final String anchorName) {
+        final DataspaceEntity dataspaceEntity = dataspaceRepository.getByName(dataspaceName);
+        final AnchorEntity anchorEntity =
+            anchorRepository.getByDataspaceAndName(dataspaceEntity, anchorName);
+        return toAnchor(anchorEntity);
+    }
+
     private static Anchor toAnchor(final AnchorEntity anchorEntity) {
         return Anchor.builder()
             .name(anchorEntity.getName())
@@ -89,4 +97,4 @@ public class CpsAdminPersistenceServiceImpl implements CpsAdminPersistenceServic
             .schemaSetName(anchorEntity.getSchemaSet().getName())
             .build();
     }
-}
+}
\ No newline at end of file