View Javadoc

1   // Created on 24.11.2003
2   package com.pnpconsult.zeiterfassung.actions.admin;
3   
4   import java.util.Collection;
5   
6   import org.apache.commons.logging.Log;
7   import org.apache.commons.logging.LogFactory;
8   import org.apache.struts.action.ActionForm;
9   
10  import com.pnpconsult.zeiterfassung.helper.ActivityManager;
11  import com.pnpconsult.zeiterfassung.helper.BillManager;
12  import com.pnpconsult.zeiterfassung.helper.CustomerManager;
13  import com.pnpconsult.zeiterfassung.helper.UserManager;
14  
15  /***
16   * @author <a href="mailto:powerpete@users.sf.net">M. Petersen</a>
17   * @version $Id: AdminMenuForm.java,v 1.7 2004/06/24 20:54:18 powerpete Exp $
18   * 
19   * @struts.form 
20   *      name="adminMenuForm"
21   */
22  public class AdminMenuForm extends ActionForm
23  {
24      private static final Log LOG = LogFactory.getLog(AdminMenuForm.class);
25      private boolean showActivities = false;
26      private boolean showBills = false;
27      private boolean showCustomers = false;
28      private boolean showUsers = false;
29  
30      public Collection getAllActivities()
31      {
32          try
33          {
34              return new ActivityManager().loadAll();
35          }
36          catch (Exception e)
37          {
38              LOG.fatal("getAllActivities()", e);
39              return null;
40          }
41      }
42  
43      public Collection getAllBills()
44      {
45          try
46          {
47              return new BillManager().loadPrinted();
48          }
49          catch (Exception e)
50          {
51              LOG.fatal("getAllBills()", e);
52              return null;
53          }
54      }
55  
56      public Collection getAllCustomers()
57      {
58          try
59          {
60              return new CustomerManager().loadAll();
61          }
62          catch (Exception e)
63          {
64              LOG.fatal("getAllCustomer()", e);
65              return null;
66          }
67      }
68      
69      /***
70       * @return Returns the allUsers.
71       */
72      public Collection getAllUsers()
73      {
74          try
75          {
76              return new UserManager().loadAll();
77          }
78          catch (Exception e)
79          {
80              e.printStackTrace();
81              LOG.fatal("getAllUsers()", e);
82              return null;
83          }
84      }
85  
86      /***
87       * @return Returns the showUsers.
88       */
89      public boolean isShowUsers()
90      {
91          return showUsers;
92      }
93  
94      /***
95       * @param showUsers The showUsers to set.
96       */
97      public void setShowUsers(boolean showUsers)
98      {
99          this.showUsers = showUsers;
100     }
101 
102     public boolean isShowBills()
103     {
104         return showBills;
105     }
106 
107     public void setShowBills(boolean showBills)
108     {
109         this.showBills = showBills;
110     }
111 
112     /***
113      * @return Returns the showCustomers.
114      */
115     public boolean isShowCustomers()
116     {
117         return showCustomers;
118     }
119 
120     /***
121      * @param showCustomers The showCustomers to set.
122      */
123     public void setShowCustomers(boolean showCustomers)
124     {
125         this.showCustomers = showCustomers;
126     }
127 
128     /***
129      * @return Returns the showActivities.
130      */
131     public boolean isShowActivities()
132     {
133         return showActivities;
134     }
135 
136     /***
137      * @param showActivities The showActivities to set.
138      */
139     public void setShowActivities(boolean showActivities)
140     {
141         this.showActivities = showActivities;
142     }
143 }