Rev 1306 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
208 | jmachado | 1 | package pt.estgp.estgweb.services.courseunits; |
2 | |||
3 | import pt.utl.ist.berserk.logic.serviceManager.IService; |
||
4 | import pt.estgp.estgweb.services.data.RepositoryService; |
||
5 | import pt.estgp.estgweb.services.expceptions.ServiceException; |
||
6 | import pt.estgp.estgweb.services.blogs.CreateBlogService; |
||
7 | import pt.estgp.estgweb.domain.views.CourseUnitView; |
||
8 | import pt.estgp.estgweb.domain.views.CourseUnitAssignementView; |
||
9 | import pt.estgp.estgweb.domain.views.BlogView; |
||
214 | jmachado | 10 | import pt.estgp.estgweb.domain.*; |
208 | jmachado | 11 | import pt.estgp.estgweb.domain.dao.DaoFactory; |
12 | import org.apache.log4j.Logger; |
||
13 | |||
14 | /* |
||
15 | * @author Goncalo Luiz gedl [AT] rnl [DOT] ist [DOT] utl [DOT] pt |
||
16 | * |
||
17 | * |
||
18 | * Created at 17/Out/2003 , 23:45:24 |
||
19 | * |
||
20 | */ |
||
21 | /** |
||
22 | * @author Jorge Machado |
||
23 | * |
||
24 | * |
||
25 | * Created at 17/Out/2003 , 23:45:24 |
||
26 | * |
||
27 | */ |
||
28 | public class CourseUnitBlogService implements IService |
||
29 | { |
||
30 | CreateBlogService createBlogService = new CreateBlogService(); |
||
31 | LoadCourseUnitService loadCourseUnitService = new LoadCourseUnitService(); |
||
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(CourseUnitBlogService.class); |
||
34 | |||
35 | public CourseUnitView startUnitBlog(long courseUnitId, UserSession userSession) throws ServiceException |
||
36 | { |
||
37 | CourseUnitImpl courseUnit = (CourseUnitImpl) DaoFactory.getCourseUnitDaoImpl().get(courseUnitId); |
||
38 | |||
39 | if(courseUnit.getUnitBlog() == null) |
||
40 | { |
||
41 | BlogView b = new BlogView(); |
||
42 | b.setTitle(courseUnit.getName() + " Blog"); |
||
43 | b.setInternal(true); |
||
44 | b.setAutoValidation(true); |
||
45 | b.setStatus(true); |
||
46 | b.setCourseUnitInternal(true); |
||
47 | b.setCourseUnitView(new CourseUnitView(courseUnit)); |
||
214 | jmachado | 48 | b = createBlogService.run(b,userSession); |
49 | Blog blog = DaoFactory.getCourseUnitBlogDaoImpl().load(b.getId()); |
||
50 | blog.setStatus(true); |
||
208 | jmachado | 51 | } |
52 | return loadCourseUnitService.run(courseUnitId,false,false,true,userSession); |
||
53 | } |
||
54 | } |