Rev 1310 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
187 | jmachado | 1 | package pt.estgp.estgweb.services.blogs; |
2 | |||
3 | import pt.utl.ist.berserk.logic.serviceManager.IService; |
||
4 | import pt.estgp.estgweb.domain.views.BlogView; |
||
5 | import pt.estgp.estgweb.domain.views.BlogPostView; |
||
6 | import pt.estgp.estgweb.domain.UserSession; |
||
7 | import pt.estgp.estgweb.domain.BlogPost; |
||
8 | import pt.estgp.estgweb.domain.BlogPostImpl; |
||
9 | import pt.estgp.estgweb.domain.dao.DaoFactory; |
||
10 | import pt.estgp.estgweb.services.expceptions.ServiceException; |
||
11 | import org.apache.log4j.Logger; |
||
12 | |||
13 | import java.util.List; |
||
14 | import java.util.ArrayList; |
||
15 | |||
16 | /* |
||
17 | * @author Goncalo Luiz gedl [AT] rnl [DOT] ist [DOT] utl [DOT] pt |
||
18 | * |
||
19 | * |
||
20 | * Created at 17/Out/2003 , 23:45:24 |
||
21 | * |
||
22 | */ |
||
23 | /** |
||
24 | * @author Jorge Machado |
||
25 | * |
||
26 | * |
||
27 | * Created at 17/Out/2003 , 23:45:24 |
||
28 | * |
||
29 | */ |
||
30 | public class LoadBlogPostsService implements IService |
||
31 | { |
||
32 | |||
33 | private static final 1.5.0/docs/api/java/util/logging/Logger.html">Logger logger = 1.5.0/docs/api/java/util/logging/Logger.html">Logger.getLogger(LoadBlogPostsService.class); |
||
34 | |||
35 | public List<BlogPostView> loadByDate(long blogId, int month, int year, UserSession userSession) throws ServiceException |
||
36 | { |
||
37 | |||
38 | List<BlogPostView> bPV = new ArrayList<BlogPostView>(); |
||
39 | List<BlogPostImpl> blogPost = DaoFactory.getBlogPostDaoImpl().loadBlogPosts(blogId,month,year); |
||
40 | for(BlogPostImpl b: blogPost) |
||
41 | { |
||
42 | bPV.add(new BlogPostView(b)); |
||
43 | } |
||
44 | return bPV; |
||
45 | } |
||
46 | |||
47 | public List<BlogPostView> loadLastPosts(long blogId, UserSession userSession) throws ServiceException |
||
48 | { |
||
49 | |||
50 | List<BlogPostView> bPV = new ArrayList<BlogPostView>(); |
||
51 | List<BlogPostImpl> blogPost = DaoFactory.getBlogPostDaoImpl().loadLastPosts(blogId,20); |
||
52 | for(BlogPostImpl b: blogPost) |
||
53 | { |
||
54 | bPV.add(new BlogPostView(b)); |
||
55 | } |
||
56 | return bPV; |
||
57 | } |
||
202 | jmachado | 58 | |
59 | |||
187 | jmachado | 60 | } |