Class ClipService
- java.lang.Object
- 
- edu.cnm.deepdive.tunefull.service.ClipService
 
- 
 @Service public class ClipService extends java.lang.ObjectClipServiceprovides a layer betweenClipRepositoryandClipControllerfor business logic.This class also contains a nested enum, which enumerates types of lists of clips that can be returned by methods in this class. - Since:
- 1.0
- Version:
- 1.0
- Author:
- Robert Dominugez, Roderick Frechette, Laura Steiner
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classClipService.SourceThe Source enum enumerates the different types of lists of clips available for access.
 - 
Constructor SummaryConstructors Constructor Description ClipService(ClipRepository clipRepository, UserRepository userRepository, RelationshipRepository relationshipRepository)Autowired constructor forClipService.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete(Clip clip)Deletes a clip.java.util.Optional<Clip>get(long id)Returns a single clip by id.java.util.List<Clip>getAllFiltered(User user, int limit, int offset, ClipService.Source source)Returns a list of clips, limited and controlled by the parameters.java.util.List<Clip>getAllForDiscovery(int limit, int offset)Returns all clips, limited by parameters.Clippost(Clip clip)Posts a clip.
 
- 
- 
- 
Constructor Detail- 
ClipService@Autowired public ClipService(ClipRepository clipRepository, UserRepository userRepository, RelationshipRepository relationshipRepository) Autowired constructor forClipService.- Parameters:
- clipRepository- ClipRepository
- userRepository- UserRepository
- relationshipRepository- RelationshipRepository
 
 
- 
 - 
Method Detail- 
getpublic java.util.Optional<Clip> get(long id) Returns a single clip by id.- Parameters:
- id- long type
- Returns:
- Optional<Clip>
 
 - 
getAllFilteredpublic java.util.List<Clip> getAllFiltered(User user, int limit, int offset, ClipService.Source source) Returns a list of clips, limited and controlled by the parameters. The source parameter controls whether to return all clips, clips from the current user, or clips from the user's friends, follows, or relationships in general.- Parameters:
- user- User
- limit- int
- offset- int
- source- Source
- Returns:
- List<Clips>
 
 - 
getAllForDiscoverypublic java.util.List<Clip> getAllForDiscovery(int limit, int offset) Returns all clips, limited by parameters. Does not require the current user to be authenticated, and so is used in Discovery mode for users who are not logged in.- Parameters:
- limit- int
- offset- int
- Returns:
- List<Clips>
 
 - 
deletepublic void delete(Clip clip) Deletes a clip.- Parameters:
- clip- Clip
 
 
- 
 
-