Class FileService


  • @Service
    @Transactional
    public class FileService
    extends Object
    Service Implementation for managing File.
    • Constructor Detail

    • Method Detail

      • save

        public File save​(File file)
        Save a file.
        Parameters:
        file - the entity to save
        Returns:
        the persisted entity
      • findAll

        @Transactional(readOnly=true)
        public org.springframework.data.domain.Page<File> findAll​(org.springframework.data.domain.Pageable pageable)
        Get all the files.
        Parameters:
        pageable - the pagination information
        Returns:
        the list of entities
      • findByOwnerIsCurrentUser

        @Transactional(readOnly=true)
        public List<File> findByOwnerIsCurrentUser​(String login,
                                                   FileType type)
        Get all the files owned by this user, plus all shared files.
        Returns:
        the list of entities
      • findByOwnerIsCurrentUserOrShared

        @Transactional(readOnly=true)
        public List<File> findByOwnerIsCurrentUserOrShared​(String login,
                                                           FileType type)
        Get all the files owned by this user, plus all shared files.
        Returns:
        the list of entities
      • findOne

        @Transactional(readOnly=true)
        public Optional<File> findOne​(Long id)
        Get one file by id.
        Parameters:
        id - the id of the entity
        Returns:
        the entity
      • delete

        public void delete​(File file)
        Delete the file.
        Parameters:
        file - the File to delete
      • createFile

        public File createFile​(FileType type,
                               String name,
                               User owner)
        Create a new file
        Parameters:
        type -
        name -
        owner -
        Returns:
        The new file