1   package org.wcb.model.manager.impl;
2   
3   import org.wcb.model.dao.IApplicantDAO;
4   import org.wcb.model.vo.hibernate.FAA8710ApplicationBO;
5   import org.wcb.model.manager.IApplicantManager;
6   import org.wcb.exception.ManagerException;
7   import org.wcb.exception.InfrastructureException;
8   
9   /**
10   * <small>
11   * Copyright (c)  2006  wbogaardt.
12   * Permission is granted to copy, distribute and/or modify this document
13   * under the terms of the GNU Free Documentation License, Version 1.2
14   * or any later version published by the Free Software Foundation;
15   * with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
16   * Texts.  A copy of the license is included in the section entitled "GNU
17   * Free Documentation License".
18   * <p/>
19   * $File:  $ <br>
20   * $Change:  $ submitted by $Author: wbogaardt $ at $DateTime: Mar 24, 2006 11:14:01 AM $ <br>
21   * </small>
22   *
23   * @author wbogaardt
24   * @version 1
25   *          Date: June 11, 2007
26   *          Time: 10:00:01 AM
27   */
28  public class ApplicantManager extends BaseManager implements IApplicantManager {
29  
30      private IApplicantDAO iDAO;
31  
32      public IApplicantDAO getDao() {
33          return iDAO;
34      }
35  
36      public void setDao(IApplicantDAO dao) {
37          this.iDAO = dao;
38      }
39  
40      /**
41       * Allows finding of a specified entry
42       * @param i The item number in the log book database
43       * @return The logbook entry
44       * @throws org.wcb.exception.ManagerException
45       */
46      public FAA8710ApplicationBO findEntry(Integer i) throws ManagerException {
47          FAA8710ApplicationBO returnValue;
48          try
49          {
50              returnValue = iDAO.findEntry(i);
51              if (returnValue == null)
52              {
53                  throw new ManagerException("Failed to find applicant entry: " + i.intValue());
54              }
55          }
56          catch (InfrastructureException ie)
57          {
58              throw new ManagerException("Failed to find applicant entry due to InfrastructureException " + i.intValue(), ie);
59          }
60          return returnValue;
61      }
62  
63       /**
64       * Allows an entry to be saved
65       * @param entry log book entry object
66       * @throws ManagerException
67       */
68      public void saveApplicant(FAA8710ApplicationBO entry) throws ManagerException {
69          try
70          {
71              iDAO.saveOrUpdateObject(entry);
72          }
73          catch (Exception ie) {
74              throw new ManagerException("Failed to save applicant entry due to InfrastructureException ", ie);
75          }
76      }
77  
78  }