Rev 1310 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
901 | jmachado | 1 | package pt.estgp.estgweb.services.common; |
2 | |||
3 | import jomm.dao.utils.HibernateUtils; |
||
4 | import org.apache.log4j.Logger; |
||
5 | import pt.estgp.estgweb.domain.CourseUnit; |
||
6 | import pt.estgp.estgweb.domain.UserSession; |
||
7 | import pt.estgp.estgweb.domain.views.CourseUnitView; |
||
8 | import pt.estgp.estgweb.services.expceptions.ServiceException; |
||
9 | import pt.utl.ist.berserk.logic.serviceManager.IService; |
||
10 | |||
11 | import java.io.Serializable; |
||
12 | import java.util.List; |
||
13 | |||
14 | /** |
||
15 | * @author Jorge Machado |
||
16 | * @date 22/Mai/2008 |
||
17 | * @see pt.estgp.estgweb.services.common |
||
18 | */ |
||
19 | public class LoadObjectService implements IService |
||
20 | { |
||
21 | 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(LoadObjectService.class); |
||
22 | |||
23 | public 5+0%2Fdocs%2Fapi+Object">Object load(1.5.0/docs/api/java/lang/String.html">String className, 1.5.0/docs/api/java/io/Serializable.html">Serializable id, UserSession userSession) throws ServiceException |
||
24 | { |
||
25 | try |
||
26 | { |
||
27 | 5+0%2Fdocs%2Fapi+Object">Object obj = HibernateUtils.getCurrentSession().load(className,id); |
||
28 | if(obj instanceof CourseUnit) |
||
29 | return new CourseUnitView((CourseUnit) obj); |
||
30 | else |
||
31 | { |
||
32 | logger.info("Atention LoadObjectService Only implemented for CourseUnits"); |
||
33 | return null; |
||
34 | } |
||
35 | } |
||
36 | catch (1.5.0/docs/api/java/lang/Throwable.html">Throwable throwable) |
||
37 | { |
||
38 | logger.error(throwable,throwable); |
||
39 | throw new ServiceException("", throwable); |
||
40 | } |
||
41 | } |
||
42 | } |