1 package org.wcb.model.dao.impl;
2
3 import org.wcb.exception.DAOException;
4 import org.wcb.exception.InfrastructureException;
5 import org.wcb.model.vo.hibernate.AircraftBO;
6 import org.wcb.model.dao.IAircraftDAO;
7
8 import java.util.List;
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 public class AircraftDAO extends AbstractHibernateDAO implements IAircraftDAO {
31
32 public AircraftBO findAircraft(String registration) throws InfrastructureException {
33 try {
34 return (AircraftBO) super.getObjectsBy(AircraftBO.class, "registrationNumber", registration).get(0);
35 } catch (DAOException daoe) {
36 throw new InfrastructureException(daoe);
37 } catch (IndexOutOfBoundsException ioobe) {
38 throw new InfrastructureException("No entry found");
39 }
40 }
41
42 public List<AircraftBO> findAll() throws InfrastructureException {
43 try {
44 return super.getObjects(AircraftBO.class);
45 } catch (DAOException daoe) {
46 throw new InfrastructureException(daoe);
47 }
48 }
49
50 public void deleteAircraft(AircraftBO oCraft) throws InfrastructureException {
51 getHibernateTemplate().delete(oCraft);
52 }
53 }