Package usecase.post
Class PostService
- java.lang.Object
-
- usecase.post.PostService
-
@ApplicationScoped public class PostService extends Object
Classe che fornisce i servizi relativi ai post.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPostService()protectedPostService(GenericRepository genericRepository, PostRepository postRepo, MediaRepository bcRepo, CurrentUser currentUser)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete(int id)Elimina un post dato il suo idPostPagegetPost(int id)Ritorna un entità DTO relativa ad un postList<PostPage>loadPosts(PostSearchForm form)Ritorna una lista di post che rispettano determinati parametriintnewPost(@NotBlank @Size(max=255) String title, @NotNull BufferedInputStream content, @NotNull String sectionName)Aggiunge un post ad una sezioneintnewPost(@NotBlank String title, @Size(max=65535) String body, @NotNull String sectionName)Aggiunge un post ad una sezione
-
-
-
Constructor Detail
-
PostService
protected PostService()
-
PostService
@Inject protected PostService(GenericRepository genericRepository, PostRepository postRepo, MediaRepository bcRepo, CurrentUser currentUser)
-
-
Method Detail
-
getPost
public PostPage getPost(@PostExists int id)
Ritorna un entità DTO relativa ad un post- Parameters:
id- identificativo post- Returns:
- DTO di un post
-
loadPosts
public List<PostPage> loadPosts(PostSearchForm form)
Ritorna una lista di post che rispettano determinati parametri- Parameters:
form- entità con i parametri di ricerca- Returns:
- lista di PostPage
-
delete
@AuthenticationRequired @DenyBannedUsers public void delete(@PostExists int id)
Elimina un post dato il suo id- Parameters:
id- identificativo del post
-
newPost
@AuthenticationRequired @DenyBannedUsers public int newPost(@NotBlank @NotBlank String title, @Size(max=65535) @Size(max=65535) String body, @NotNull @SectionExists @NotNull String sectionName)
Aggiunge un post ad una sezione- Parameters:
title- titolo del postbody- testo del postsectionName- nome della sezione- Returns:
- identificativo del nuovo post creato
-
newPost
@AuthenticationRequired @DenyBannedUsers public int newPost(@NotBlank @Size(max=255) @NotBlank @Size(max=255) String title, @NotNull @Image @NotNull BufferedInputStream content, @NotNull @SectionExists @NotNull String sectionName)
Aggiunge un post ad una sezione- Parameters:
title- titolo del postcontent- file di tipo immaginesectionName- nome della sezione- Returns:
- identificativo del nuovo post creato
-
-