Query data nodes across all anchors under one dataspace
[cps.git] / cps-ri / src / main / java / org / onap / cps / spi / repository / FragmentRepositoryCpsPathQueryImpl.java
index 6e8f05f..b95491c 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2021-2022 Nordix Foundation.
+ *  Modifications Copyright (C) 2023 TechMahindra Ltd.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -48,4 +49,13 @@ public class FragmentRepositoryCpsPathQueryImpl implements FragmentRepositoryCps
         return fragmentEntities;
     }
 
+    @Override
+    @Transactional
+    public List<FragmentEntity> findByCpsPath(final CpsPathQuery cpsPathQuery) {
+        final Query query = fragmentQueryBuilder.getQueryForCpsPath(cpsPathQuery);
+        final List<FragmentEntity> fragmentEntities = query.getResultList();
+        log.debug("Fetched {} fragment entities by cps path across all anchors.", fragmentEntities.size());
+        return fragmentEntities;
+    }
+
 }