Few Sonar Fixes
[cps.git] / cps-ri / src / main / java / org / onap / cps / spi / repository / FragmentRepository.java
index ba83f15..b1a8992 100755 (executable)
@@ -1,6 +1,7 @@
 /*-\r
  * ============LICENSE_START=======================================================\r
  *  Copyright (C) 2020 Nordix Foundation. All rights reserved.\r
+ *  Modifications Copyright (C) 2020 Bell Canada. All rights reserved.\r
  * ================================================================================\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
 \r
 package org.onap.cps.spi.repository;\r
 \r
+import java.util.Collection;\r
+import org.onap.cps.spi.entities.Dataspace;\r
 import org.onap.cps.spi.entities.Fragment;\r
 import org.springframework.data.jpa.repository.JpaRepository;\r
 import org.springframework.stereotype.Repository;\r
 \r
 @Repository\r
 public interface FragmentRepository extends JpaRepository<Fragment, Integer> {\r
+\r
+    default Collection<Fragment> findFragmentsThatAreAnchorsByDataspace(Dataspace dataspace) {\r
+        return findFragmentsByDataspaceAndParentFragmentIsNull(dataspace);\r
+    }\r
+\r
+    Collection<Fragment> findFragmentsByDataspaceAndParentFragmentIsNull(Dataspace dataspace);\r
 }
\ No newline at end of file