Interface FileRepository

  • All Superinterfaces:
    org.springframework.data.repository.CrudRepository<File,​Long>, org.springframework.data.jpa.repository.JpaRepository<File,​Long>, org.springframework.data.repository.PagingAndSortingRepository<File,​Long>, org.springframework.data.repository.query.QueryByExampleExecutor<File>, org.springframework.data.repository.Repository<File,​Long>

    public interface FileRepository
    extends org.springframework.data.jpa.repository.JpaRepository<File,​Long>
    Spring Data JPA repository for the File entity.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      List<File> findByOwnerIsCurrentUser​(String login, FileType type)  
      List<File> findByOwnerIsCurrentUserOrShared​(String login, FileType type)  
      • Methods inherited from interface org.springframework.data.repository.CrudRepository

        count, delete, deleteAll, deleteAll, deleteById, existsById, findById, save
      • 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 org.springframework.data.repository.PagingAndSortingRepository

        findAll
      • Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

        count, exists, findAll, findOne
    • Method Detail

      • findByOwnerIsCurrentUser

        @Query("select file from File file where file.owner.login = :login and (:type = NULL or file.type = :type)")
        List<File> findByOwnerIsCurrentUser​(@Param("login")
                                            String login,
                                            @Param("type")
                                            FileType type)
      • findByOwnerIsCurrentUserOrShared

        @Query("select file from File file where (file.shared = TRUE or file.owner.login = :login) and (:type = NULL or file.type = :type)")
        List<File> findByOwnerIsCurrentUserOrShared​(@Param("login")
                                                    String login,
                                                    @Param("type")
                                                    FileType type)