1 | package com.ether; |
---|
2 | |
---|
3 | import com.ether.dao.ParameterDAO; |
---|
4 | import com.ether.dao.PlateformDAO; |
---|
5 | import org.apache.commons.logging.Log; |
---|
6 | import org.apache.commons.logging.LogFactory; |
---|
7 | import org.jetbrains.annotations.NotNull; |
---|
8 | import org.jetbrains.annotations.Nullable; |
---|
9 | import org.springframework.beans.factory.annotation.Required; |
---|
10 | import org.springframework.transaction.annotation.Transactional; |
---|
11 | |
---|
12 | import java.util.List; |
---|
13 | |
---|
14 | /** |
---|
15 | * @author vmipsl |
---|
16 | * @date 07 mar 2011 |
---|
17 | */ |
---|
18 | public class TapasServiceImpl |
---|
19 | implements TapasService |
---|
20 | { |
---|
21 | @Nullable |
---|
22 | @Transactional(readOnly = true) |
---|
23 | public List<Plateform> getAllPlateforms() |
---|
24 | throws ServiceException |
---|
25 | { |
---|
26 | try |
---|
27 | { |
---|
28 | return _plateformDAO.getAllPlateforms(); |
---|
29 | } |
---|
30 | catch( PersistenceException e ) |
---|
31 | { |
---|
32 | throw new ServiceException( ServiceException.ServiceCode.PLATEFORM_NOT_FOUND, e ); |
---|
33 | } |
---|
34 | } |
---|
35 | |
---|
36 | @Nullable |
---|
37 | @Transactional(readOnly = true) |
---|
38 | public Plateform getPlateformById( @Nullable final Integer plateformId ) |
---|
39 | throws ServiceException |
---|
40 | { |
---|
41 | if( null == plateformId ) |
---|
42 | return null; |
---|
43 | try |
---|
44 | { |
---|
45 | return _plateformDAO.getPlateformById( plateformId ); |
---|
46 | } |
---|
47 | catch( PersistenceException e ) |
---|
48 | { |
---|
49 | throw new ServiceException( ServiceException.ServiceCode.PLATEFORM_NOT_FOUND, e ); |
---|
50 | } |
---|
51 | } |
---|
52 | |
---|
53 | @Nullable |
---|
54 | @Transactional(readOnly = true) |
---|
55 | public List<Parameter> getAllParametersByPlateformId( @NotNull final Integer plateformId ) |
---|
56 | throws ServiceException |
---|
57 | { |
---|
58 | try |
---|
59 | { |
---|
60 | return _parameterDAO.getAllParametersByPlateformId( plateformId ); |
---|
61 | } |
---|
62 | catch( PersistenceException e ) |
---|
63 | { |
---|
64 | throw new ServiceException( ServiceException.ServiceCode.PARAMETER_NOT_FOUND, e ); |
---|
65 | } |
---|
66 | } |
---|
67 | |
---|
68 | @Required |
---|
69 | public void setPlateformDAO( final PlateformDAO plateformDAO ) |
---|
70 | { |
---|
71 | _plateformDAO = plateformDAO; |
---|
72 | } |
---|
73 | |
---|
74 | @Required |
---|
75 | public void setParameterDAO( final ParameterDAO parameterDAO ) |
---|
76 | { |
---|
77 | _parameterDAO = parameterDAO; |
---|
78 | } |
---|
79 | |
---|
80 | private static final Log LOGGER = LogFactory.getLog( TapasServiceImpl.class ); |
---|
81 | |
---|
82 | |
---|
83 | private PlateformDAO _plateformDAO; |
---|
84 | private ParameterDAO _parameterDAO; |
---|
85 | } |
---|