Interface LaunchRepository

    • 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 by Launch.id 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:
        id - Launch.id
        Returns:
        Optional with Launch object
      • 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 by Launch.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:
        Optional with Launch object
      • 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 a Launch has items with retries.
        Parameters:
        launchId - Current Launch.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` and TestItemResults.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)
        Finds the latest(that has max Launch.number Launch with specified name and projectId
        Parameters:
        name - Name of Launch
        projectId - Id of Project
        Returns:
        Optional if exists, Optional.empty() if not