Merge "Reduce dataspace/anchor lookups in CpsDataPersistenceService"
authorToine Siebelink <toine.siebelink@est.tech>
Mon, 13 Mar 2023 14:18:02 +0000 (14:18 +0000)
committerGerrit Code Review <gerrit@onap.org>
Mon, 13 Mar 2023 14:18:02 +0000 (14:18 +0000)
1  2 
cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java

@@@ -334,13 -302,9 +307,11 @@@ public class CpsDataPersistenceServiceI
      }
  
      @Override
 +    @Timed(value = "cps.data.persistence.service.datanode.query",
 +            description = "Time taken to query data nodes")
      public List<DataNode> queryDataNodes(final String dataspaceName, final String anchorName, final String cpsPath,
                                           final FetchDescendantsOption fetchDescendantsOption) {
-         final DataspaceEntity dataspaceEntity = dataspaceRepository.getByName(dataspaceName);
-         final AnchorEntity anchorEntity = anchorRepository.getByDataspaceAndName(dataspaceEntity, anchorName);
+         final AnchorEntity anchorEntity = getAnchorEntity(dataspaceName, anchorName);
          final CpsPathQuery cpsPathQuery;
          try {
              cpsPathQuery = CpsPathUtil.getCpsPathQuery(cpsPath);