KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > za > org > coefficient > util > common > Roles


1 /*
2  * Coefficient - facilitates project based collaboration
3  * Copyright (C) 2003, Dylan Etkin, CSIR icomtek
4  * PO Box 395
5  * Pretoria 0001, RSA
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19
20 package za.org.coefficient.util.common;
21
22 import net.sf.hibernate.HibernateException;
23 import net.sf.hibernate.util.HibernateUtil;
24
25 import za.org.coefficient.authentication.Role;
26 import za.org.coefficient.util.ejb.*;
27
28 import java.util.List JavaDoc;
29
30 /**
31  * @pojo2ejb.class
32  * name="Role"
33  * jndi-prefix="za/org/coefficient/util/"
34  *
35  * @web.resource-env-ref
36  * name="za/org/coefficient/util/Role"
37  * type="za.org.coefficient.util.common.Roles"
38  * @web.resource-env-ref
39  * name="Role"
40  * type="za.org.coefficient.util.common.Roles"
41  */

42 public class Roles {
43
44     //~ Methods ================================================================
45
public List JavaDoc getAllRoles() {
46         List JavaDoc roles = null;
47         try {
48             roles =
49                 HibernateUtil.find("from " + Role.class.getName()
50                     + " as roles order by roles.roleValue");
51         } catch (HibernateException he) {
52             he.printStackTrace();
53         } catch (Throwable JavaDoc e) {
54             e.printStackTrace();
55         }
56
57         return roles;
58     }
59 }
60
Popular Tags