Package com.epam.ta.reportportal.dao
Interface LaunchRepository
-
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Launch,java.lang.Long>,FilterableRepository<Launch>,org.springframework.data.jpa.repository.JpaRepository<Launch,java.lang.Long>,LaunchRepositoryCustom,org.springframework.data.repository.PagingAndSortingRepository<Launch,java.lang.Long>,org.springframework.data.repository.query.QueryByExampleExecutor<Launch>,ReportPortalRepository<Launch,java.lang.Long>,org.springframework.data.repository.Repository<Launch,java.lang.Long>
public interface LaunchRepository extends ReportPortalRepository<Launch,java.lang.Long>, LaunchRepositoryCustom
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intdeleteAllByIdIn(java.util.Collection<java.lang.Long> ids)voiddeleteByProjectId(java.lang.Long projectId)java.util.List<Launch>findAllByName(java.lang.String name)java.util.Optional<Launch>findByIdForUpdate(java.lang.Long id)Finds launch byLaunch.idand sets a lock on the found launch row in the database.java.util.List<Launch>findByProjectIdAndStartTimeGreaterThanAndMode(java.lang.Long projectId, java.time.LocalDateTime after, LaunchModeEnum mode)java.util.Optional<Launch>findByUuid(java.lang.String uuid)java.util.Optional<Launch>findByUuidForUpdate(java.lang.String uuid)Finds launch byLaunch.getUuid()and sets a lock on the found launch row in the database.java.util.List<java.lang.Long>findIdsByProjectIdModifiedBefore(java.lang.Long projectId, java.time.LocalDateTime before)java.util.Optional<Launch>findLatestByNameAndProjectId(java.lang.String name, java.lang.Long projectId)java.util.List<Launch>findLaunchesHistory(int historyDepth, java.lang.Long startingLaunchId, java.lang.String launchName, java.lang.Long projectId)booleanhasItems(java.lang.Long launchId)booleanhasItemsWithStatusEqual(java.lang.Long launchId, StatusEnum status)booleanhasRetries(java.lang.Long launchId)Checks if aLaunchhas items with retries.booleanhasRootItemsWithStatusNotEqual(java.lang.Long launchId, java.lang.String... statuses)voidmergeLaunchTestItems(java.lang.Long launchId)java.util.stream.Stream<java.lang.Long>streamIdsModifiedBefore(java.lang.Long projectId, java.time.LocalDateTime before)java.util.stream.Stream<java.lang.Long>streamIdsWithStatusModifiedBefore(java.lang.Long projectId, StatusEnum status, java.time.LocalDateTime before)-
Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteById, existsById, findById, save
-
Methods inherited from interface com.epam.ta.reportportal.dao.FilterableRepository
findByFilter, findByFilter
-
Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getOne, saveAll, saveAndFlush
-
Methods inherited from interface com.epam.ta.reportportal.dao.LaunchRepositoryCustom
countLaunches, countLaunches, countLaunchesGroupedByOwner, findAllLatestByFilter, findLastRun, findLatestByFilter, findLaunchIdsByProjectId, getLaunchNamesByModeExcludedByStatus, getOwnerNames, getStatuses, hasItemsInStatuses
-
Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAll
-
Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findOne
-
Methods inherited from interface com.epam.ta.reportportal.dao.ReportPortalRepository
exists, refresh
-
-
-
-
Method Detail
-
findByIdForUpdate
@Query("SELECT l FROM Launch l WHERE l.id = :id") @Lock(PESSIMISTIC_WRITE) java.util.Optional<Launch> findByIdForUpdate(@Param("id") java.lang.Long id)Finds launch byLaunch.idand sets a lock on the found launch row in the database. Required for fetching launch from the concurrent environment to provide synchronization between dependant entities
-
deleteByProjectId
void deleteByProjectId(java.lang.Long projectId)
-
findAllByName
java.util.List<Launch> findAllByName(java.lang.String name)
-
findByUuid
java.util.Optional<Launch> findByUuid(java.lang.String uuid)
-
findByUuidForUpdate
@Query("SELECT l FROM Launch l WHERE l.uuid = :uuid") @Lock(PESSIMISTIC_WRITE) java.util.Optional<Launch> findByUuidForUpdate(@Param("uuid") java.lang.String uuid)Finds launch byLaunch.getUuid()and sets a lock on the found launch row in the database. Required for fetching launch from the concurrent environment to provide synchronization between dependant entities- Parameters:
uuid-Launch.getUuid()- Returns:
OptionalwithLaunchobject
-
findByProjectIdAndStartTimeGreaterThanAndMode
java.util.List<Launch> findByProjectIdAndStartTimeGreaterThanAndMode(java.lang.Long projectId, java.time.LocalDateTime after, LaunchModeEnum mode)
-
findIdsByProjectIdModifiedBefore
@Query("SELECT l.id FROM Launch l WHERE l.projectId = :projectId AND l.lastModified < :before") java.util.List<java.lang.Long> findIdsByProjectIdModifiedBefore(@Param("projectId") java.lang.Long projectId, @Param("before") java.time.LocalDateTime before)
-
deleteAllByIdIn
int deleteAllByIdIn(java.util.Collection<java.lang.Long> ids)
-
streamIdsModifiedBefore
@QueryHints() @Query("SELECT l.id FROM Launch l WHERE l.projectId = :projectId AND l.lastModified < :before") java.util.stream.Stream<java.lang.Long> streamIdsModifiedBefore(@Param("projectId") java.lang.Long projectId, @Param("before") java.time.LocalDateTime before)
-
streamIdsWithStatusModifiedBefore
@QueryHints() @Query("SELECT l.id FROM Launch l WHERE l.status = :status AND l.projectId = :projectId AND l.lastModified < :before") java.util.stream.Stream<java.lang.Long> streamIdsWithStatusModifiedBefore(@Param("projectId") java.lang.Long projectId, @Param("status") StatusEnum status, @Param("before") java.time.LocalDateTime before)
-
findLaunchesHistory
@Query(value="SELECT * FROM launch l WHERE l.id <= :startingLaunchId AND l.name = :launchName AND l.project_id = :projectId AND l.mode <> \'DEBUG\' ORDER BY start_time DESC, number DESC LIMIT :historyDepth", nativeQuery=true) java.util.List<Launch> findLaunchesHistory(@Param("historyDepth") int historyDepth, @Param("startingLaunchId") java.lang.Long startingLaunchId, @Param("launchName") java.lang.String launchName, @Param("projectId") java.lang.Long projectId)
-
mergeLaunchTestItems
@Query(value="SELECT merge_launch(?1)", nativeQuery=true) void mergeLaunchTestItems(java.lang.Long launchId)
-
hasRetries
@Query(value="SELECT exists(SELECT 1 FROM launch JOIN test_item ON launch.id = test_item.launch_id WHERE launch.id = :launchId AND test_item.has_retries LIMIT 1)", nativeQuery=true) boolean hasRetries(@Param("launchId") java.lang.Long launchId)Checks if aLaunchhas items with retries.- Parameters:
launchId- CurrentLaunch.id- Returns:
- True if has
-
hasRootItemsWithStatusNotEqual
@Query(value="SELECT exists(SELECT 1 FROM test_item ti JOIN test_item_results tir ON ti.item_id = tir.result_id WHERE ti.launch_id = :launchId AND ti.parent_id IS NULL AND ti.has_stats = TRUE AND CAST(tir.status AS VARCHAR) NOT IN (:statuses))", nativeQuery=true) boolean hasRootItemsWithStatusNotEqual(@Param("launchId") java.lang.Long launchId, @Param("statuses") java.lang.String... statuses)- Parameters:
launchId-Launch.getId()status-TestItemResults.getStatus()- Returns:
- `true` if
TestItem.getLaunchId()equal to provided `launchId`,TestItem.getParent()equal to `NULL` andTestItemResults.getStatus()is not equal to provided `status`, otherwise return `false`
-
hasItemsWithStatusEqual
@Query(value="SELECT exists(SELECT 1 FROM test_item ti JOIN test_item_results tir ON ti.item_id = tir.result_id WHERE ti.launch_id = :launchId AND ti.has_stats = TRUE AND tir.status = cast(:#{#status.name()} AS STATUS_ENUM) LIMIT 1)", nativeQuery=true) boolean hasItemsWithStatusEqual(@Param("launchId") java.lang.Long launchId, @Param("status") StatusEnum status)
-
hasItems
@Query(value="SELECT exists(SELECT 1 FROM test_item ti WHERE ti.launch_id = :launchId LIMIT 1)", nativeQuery=true) boolean hasItems(@Param("launchId") java.lang.Long launchId)
-
findLatestByNameAndProjectId
@Query(value="SELECT * FROM launch l WHERE l.name =:name AND l.project_id=:projectId ORDER BY l.number DESC LIMIT 1", nativeQuery=true) java.util.Optional<Launch> findLatestByNameAndProjectId(@Param("name") java.lang.String name, @Param("projectId") java.lang.Long projectId)
-
-