KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > cowsultants > itracker > ejb > client > util > NotificationUtilities


1 /*
2  * This software was designed and created by Jason Carroll.
3  * Copyright (c) 2002, 2003, 2004 Jason Carroll.
4  * The author can be reached at jcarroll@cowsultants.com
5  * ITracker website: http://www.cowsultants.com
6  * ITracker forums: http://www.cowsultants.com/phpBB/index.php
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it only under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  */

18
19 package cowsultants.itracker.ejb.client.util;
20
21 import java.util.*;
22
23 import cowsultants.itracker.ejb.client.resources.*;
24
25 public class NotificationUtilities {
26     public static final int ROLE_ANY = -1;
27     public static final int ROLE_CREATOR = 1;
28     public static final int ROLE_OWNER = 2;
29     public static final int ROLE_CONTRIBUTER = 3;
30     public static final int ROLE_QA = 4;
31     public static final int ROLE_PM = 5;
32     public static final int ROLE_PO = 6;
33     public static final int ROLE_CO = 7;
34     public static final int ROLE_VO = 8;
35     public static final int ROLE_IP = 9;
36
37     public static final int TYPE_CREATED = 1;
38     public static final int TYPE_UPDATED = 2;
39     public static final int TYPE_ASSIGNED = 3;
40     public static final int TYPE_CLOSED = 4;
41     public static final int TYPE_SELF_REGISTER = 5;
42     public static final int TYPE_ISSUE_REMINDER = 6;
43
44     private static HashMap roleNames;
45
46     public NotificationUtilities() {
47     }
48
49     public static String JavaDoc getRoleName(int value) {
50         return getRoleName(value, ITrackerResources.getLocale());
51     }
52
53     public static String JavaDoc getRoleName(int value, Locale locale) {
54         return ITrackerResources.getString("itracker.notification.role." + value, locale);
55     }
56
57     public static HashMap getRoleNames() {
58         return getRoleNames(ITrackerResources.getLocale());
59     }
60
61     public static HashMap getRoleNames(Locale locale) {
62         HashMap roles = (HashMap) roleNames.get(locale);
63         if(roles == null) {
64             roles = new HashMap();
65             roles.put(Integer.toString(ROLE_CREATOR), getRoleName(ROLE_CREATOR, locale));
66             roles.put(Integer.toString(ROLE_OWNER), getRoleName(ROLE_OWNER, locale));
67             roles.put(Integer.toString(ROLE_CONTRIBUTER), getRoleName(ROLE_CONTRIBUTER, locale));
68             roles.put(Integer.toString(ROLE_QA), getRoleName(ROLE_QA, locale));
69             roles.put(Integer.toString(ROLE_PM), getRoleName(ROLE_PM, locale));
70             roles.put(Integer.toString(ROLE_PO), getRoleName(ROLE_PO, locale));
71             roles.put(Integer.toString(ROLE_CO), getRoleName(ROLE_CO, locale));
72             roles.put(Integer.toString(ROLE_VO), getRoleName(ROLE_VO, locale));
73             roles.put(Integer.toString(ROLE_IP), getRoleName(ROLE_IP, locale));
74         }
75         roleNames.put(locale, roles);
76         return roles;
77     }
78
79     public static String JavaDoc getTypeName(int value) {
80         return getTypeName(value, ITrackerResources.getLocale());
81     }
82
83     public static String JavaDoc getTypeName(int value, Locale locale) {
84         return ITrackerResources.getString("itracker.notification.type." + value, locale);
85     }
86
87 }
88
Popular Tags