1 package org.wcb.model.manager.impl;
2
3 import org.wcb.model.dao.IAircraftTypeDAO;
4 import org.wcb.model.vo.hibernate.AircraftTypeBO;
5 import org.wcb.model.manager.IAircraftTypeManager;
6 import org.wcb.exception.ManagerException;
7 import org.wcb.exception.InfrastructureException;
8
9 import java.util.List;
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 public class AircraftTypeManager extends BaseManager implements IAircraftTypeManager {
32
33 private IAircraftTypeDAO iDAO;
34
35
36
37
38
39
40 public void setDao(IAircraftTypeDAO oDAO) {
41 this.iDAO = oDAO;
42 }
43
44
45
46
47
48
49 public IAircraftTypeDAO getDao() {
50 return this.iDAO;
51 }
52
53 public AircraftTypeBO getAircraftTypeById(Integer id) throws ManagerException {
54 try
55 {
56 return iDAO.findAircraftType(id);
57 }
58 catch (InfrastructureException ie)
59 {
60 throw new ManagerException("AircraftBO type problem trying to find it for " + id, ie);
61 }
62 }
63
64 public List<AircraftTypeBO> getAllAircraftTypes() throws ManagerException {
65 List<AircraftTypeBO> returnValue = null;
66 try
67 {
68 returnValue = iDAO.findAll();
69 if (returnValue == null)
70 {
71 throw new ManagerException("Failed to find AircraftBO types entries: ");
72 }
73 }
74 catch (InfrastructureException ie)
75 {
76 throw new ManagerException("Failed to find aircraft types entries due to InfrastructureException", ie);
77 }
78 return returnValue;
79 }
80
81 public void saveAircraftType(AircraftTypeBO aircraft) throws ManagerException {
82 try
83 {
84 iDAO.saveOrUpdateObject(aircraft);
85 }
86 catch (Exception ie)
87 {
88 throw new ManagerException("Unable to save aircraft type ", ie);
89 }
90 }
91 }