1 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 getRoleName(int value) { 50 return getRoleName(value, ITrackerResources.getLocale()); 51 } 52 53 public static String 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 getTypeName(int value) { 80 return getTypeName(value, ITrackerResources.getLocale()); 81 } 82 83 public static String getTypeName(int value, Locale locale) { 84 return ITrackerResources.getString("itracker.notification.type." + value, locale); 85 } 86 87 } 88 | Popular Tags |