Interface IntegrationRepository

    • Method Detail

      • existsByNameAndTypeIdAndProjectIdIsNull

        boolean existsByNameAndTypeIdAndProjectIdIsNull​(java.lang.String name,
                                                        java.lang.Long typeId)
      • existsByNameAndTypeIdAndProjectId

        boolean existsByNameAndTypeIdAndProjectId​(java.lang.String name,
                                                  java.lang.Long typeId,
                                                  java.lang.Long projectId)
      • findByIdAndProjectId

        java.util.Optional<Integration> findByIdAndProjectId​(java.lang.Long id,
                                                             java.lang.Long projectId)
        Retrieve integration by ID and project ID
        Parameters:
        id - ID of integrations
        projectId - ID of project
        Returns:
        Optional of integration
      • findAllByProjectId

        java.util.List<Integration> findAllByProjectId​(java.lang.Long projectId)
        Retrieve given project's integrations
        Parameters:
        projectId - ID of project
        Returns:
        Found integrations
      • deleteAllGlobalByIntegrationTypeId

        @Modifying
        @Query(value="DELETE FROM integration WHERE project_id IS NULL AND type = :typeId",
               nativeQuery=true)
        int deleteAllGlobalByIntegrationTypeId​(@Param("typeId")
                                               java.lang.Long typeId)
        Delete all Integration with Integration.project == NULL by integration type ID
        Parameters:
        typeId - IntegrationType.id
      • deleteAllByProjectIdAndIntegrationTypeId

        @Modifying
        @Query(value="DELETE FROM integration WHERE project_id = :projectId AND type = :typeId",
               nativeQuery=true)
        int deleteAllByProjectIdAndIntegrationTypeId​(@Param("projectId")
                                                     java.lang.Long projectId,
                                                     @Param("typeId")
                                                     java.lang.Long typeId)
        Delete all Integration by projectID and integration type ID
        Parameters:
        typeId - IntegrationType.id
      • findProjectBtsByUrlAndLinkedProject

        @Query(value="SELECT i.id, i.name, i.enabled, i.project_id, i.creator, i.creation_date, i.params, i.type, 0 AS clazz_ FROM integration i WHERE (params->\'params\'->>\'url\' = :url AND params->\'params\'->>\'project\' = :btsProject AND i.project_id = :projectId) LIMIT 1",
               nativeQuery=true)
        java.util.Optional<Integration> findProjectBtsByUrlAndLinkedProject​(@Param("url")
                                                                            java.lang.String url,
                                                                            @Param("btsProject")
                                                                            java.lang.String btsProject,
                                                                            @Param("projectId")
                                                                            java.lang.Long projectId)
        Find BTS integration by BTS url, BTS project name and Report Portal project id
        Parameters:
        url - Bug Tracking System url
        btsProject - Bug Tracking System project name
        projectId - Project.id
        Returns:
        The Integration wrapped in the Optional
      • findGlobalBtsByUrlAndLinkedProject

        @Query(value="SELECT i.id, i.name, i.enabled, i.project_id, i.creator, i.creation_date, i.params, i.type, 0 AS clazz_ FROM integration i  WHERE params->\'params\'->>\'url\' = :url AND i.params->\'params\'->>\'project\' = :btsProject AND i.project_id IS NULL",
               nativeQuery=true)
        java.util.Optional<Integration> findGlobalBtsByUrlAndLinkedProject​(@Param("url")
                                                                           java.lang.String url,
                                                                           @Param("btsProject")
                                                                           java.lang.String btsProject)
        Find BTS integration by BTS url, BTS project name and Integration.project == null
        Parameters:
        url - Bug Tracking System url
        btsProject - Bug Tracking System project name
        Returns:
        The Integration wrapped in the Optional
      • updateEnabledStateById

        @Modifying
        @Query(value="UPDATE integration SET enabled = :enabled WHERE id = :integrationId",
               nativeQuery=true)
        void updateEnabledStateById​(@Param("enabled")
                                    boolean enabled,
                                    @Param("integrationId")
                                    java.lang.Long integrationId)
        Update Integration.enabled by integration ID
        Parameters:
        enabled - Enabled state flag
        integrationId - Integration.id
      • updateEnabledStateByIntegrationTypeId

        @Modifying
        @Query(value="UPDATE integration SET enabled = :enabled WHERE type = :integrationTypeId",
               nativeQuery=true)
        void updateEnabledStateByIntegrationTypeId​(@Param("enabled")
                                                   boolean enabled,
                                                   @Param("integrationTypeId")
                                                   java.lang.Long integrationTypeId)
        Update Integration.enabled of all integrations by integration type id
        Parameters:
        enabled - Enabled state flag
        integrationTypeId - IntegrationType.id
      • findByNameAndTypeId

        java.util.Optional<Integration> findByNameAndTypeId​(java.lang.String name,
                                                            java.lang.Long integrationTypeId)
      • findAuthByNameAndTypeName

        @Query(value="SELECT i.id, i.name, i.enabled, i.project_id, i.creator, i.creation_date, i.params, i.type FROM integration i JOIN integration_type it ON i.type = it.id WHERE i.name = :name AND it.name = :typeName AND it.group_type = cast(\'AUTH\' AS INTEGRATION_GROUP_ENUM)",
               nativeQuery=true)
        java.util.Optional<Integration> findAuthByNameAndTypeName​(@Param("name")
                                                                  java.lang.String name,
                                                                  @Param("typeName")
                                                                  java.lang.String typeName)
      • findExclusiveAuth

        @Query(value="SELECT i.id, i.name, i.enabled, i.project_id, i.creator, i.creation_date, i.params, i.type FROM integration i JOIN integration_type it ON i.type = it.id WHERE i.name = :name AND it.name = :name AND it.group_type = cast(\'AUTH\' AS INTEGRATION_GROUP_ENUM)",
               nativeQuery=true)
        java.util.Optional<Integration> findExclusiveAuth​(@Param("name")
                                                          java.lang.String name)
      • findAllByTypeIn

        @Query(value="SELECT * FROM integration i LEFT OUTER JOIN integration_type it ON i.type = it.id WHERE it.name IN (:types)",
               nativeQuery=true)
        java.util.List<Integration> findAllByTypeIn​(@Param("types")
                                                    java.lang.String... types)