Package org.powertac.visualizer.service
Class FileService
- java.lang.Object
-
- org.powertac.visualizer.service.FileService
-
@Service @Transactional public class FileService extends Object
Service Implementation for managing File.
-
-
Constructor Summary
Constructors Constructor Description FileService(FileRepository fileRepository)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FilecreateFile(FileType type, String name, User owner)Create a new filevoiddelete(File file)Delete the file.org.springframework.data.domain.Page<File>findAll(org.springframework.data.domain.Pageable pageable)Get all the files.List<File>findByOwnerIsCurrentUser(String login, FileType type)Get all the files owned by this user, plus all shared files.List<File>findByOwnerIsCurrentUserOrShared(String login, FileType type)Get all the files owned by this user, plus all shared files.Optional<File>findOne(Long id)Get one file by id.Filesave(File file)Save a file.
-
-
-
Constructor Detail
-
FileService
public FileService(FileRepository fileRepository)
-
-
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
-
-