import org.onap.cps.spi.entities.AnchorEntity;\r
import org.onap.cps.spi.entities.DataspaceEntity;\r
import org.onap.cps.spi.entities.FragmentEntity;\r
+import org.onap.cps.spi.entities.FragmentExtract;\r
import org.onap.cps.spi.exceptions.DataNodeNotFoundException;\r
import org.springframework.data.jpa.repository.JpaRepository;\r
import org.springframework.data.jpa.repository.Modifying;\r
@Modifying\r
@Query("DELETE FROM FragmentEntity fe WHERE fe.anchor IN (:anchors)")\r
void deleteByAnchorIn(@NotNull @Param("anchors") Collection<AnchorEntity> anchorEntities);\r
+\r
+ @Query(value = "SELECT id, anchor_id AS anchorId, xpath, parent_id AS parentId,"\r
+ + " CAST(attributes AS TEXT) AS attributes"\r
+ + " FROM FRAGMENT WHERE anchor_id = :anchorId"\r
+ + " AND ( xpath = :parentXpath OR xpath LIKE CONCAT(:parentXpath,'/%') )",\r
+ nativeQuery = true)\r
+ List<FragmentExtract> findByAnchorIdAndParentXpath(@Param("anchorId") int anchorId,\r
+ @Param("parentXpath") String parentXpath);\r
}\r