1
2
3
4
5 package org.directdemocracyportal.democracy.web;
6
7 import org.springframework.context.MessageSource;
8
9 /***
10 * The Class ApplicationMessageHolder.
11 */
12 public class ApplicationMessageHolder
13 {
14
15 /***
16 * The Class MessageConstans.
17 */
18 public static class MessageConstans
19 {
20
21 /*** The Constant APPLICATION_NAME. */
22 public static final String APPLICATION_NAME = "application.name";
23
24 /*** The Constant APPLICATION_VERSION. */
25 public static final String APPLICATION_VERSION = "application.version";
26
27 /*** The Constant APPLICATION_URL. */
28 public static final String APPLICATION_URL = "application.url";
29
30 /*** The Constant BUTTON_REGISTER. */
31 public static final String BUTTON_REGISTER = "button.register";
32
33 /*** The Constant BUTTON_LOGIN. */
34 public static final String BUTTON_LOGIN = "button.login";
35
36 /*** The Constant BUTTON_LOGOUT. */
37 public static final String BUTTON_LOGOUT = "button.logout";
38
39 /*** The Constant BUTTON_MY_PROFILE. */
40 public static final String BUTTON_MY_PROFILE = "button.myprofile";
41
42 /*** The Constant BUTTON_JOIN_PARTY. */
43 public static final String BUTTON_JOIN_PARTY = "button.joinparty";
44
45 /*** The Constant GROUPS. */
46 public static final String GROUPS = "groups";
47
48 /*** The Constant RECENT_ACTIONS. */
49 public static final String RECENT_ACTIONS = "recent.actions";
50
51 /*** The Constant POLITICAL_PARTY. */
52 public static final String POLITICAL_PARTY = "politicalparty";
53
54 /*** The Constant CREATE_POLITICAL_PARTY. */
55 public static final String CREATE_POLITICAL_PARTY = "create.politicalparty";
56
57 /*** The Constant GOVERNMENTS. */
58 public static final String GOVERNMENTS = "governments";
59
60 /*** The Constant HEADER_TIME. */
61 public static final String HEADER_TIME = "header.time";
62
63 /*** The Constant HEADER_ACTION. */
64 public static final String HEADER_ACTION = "header.action";
65
66 /*** The Constant HEADER_USERNAME. */
67 public static final String HEADER_USERNAME = "header.username";
68
69 /*** The Constant POLITICAL_PARTIES. */
70 public static final String POLITICAL_PARTIES = "politicalparties";
71
72 /*** The Constant PARTIES_IN_POWER. */
73 public static final String PARTIES_IN_POWER = "politicalparties.in.power";
74
75 /*** The Constant ELECTIONS. */
76 public static final String ELECTIONS = "elections";
77
78 /*** The Constant NAME. */
79 public static final String NAME = "name";
80
81 /*** The Constant TYPE. */
82 public static final String TYPE = "type";
83
84 /*** The Constant OVERVIEW. */
85 public static final String OVERVIEW = "overview";
86
87 /*** The Constant ORGANISATIONS. */
88 public static final String ORGANISATIONS = "organisations";
89
90 /*** The Constant HEADER_ID. */
91 public static final String HEADER_ID = "id";
92
93 /*** The Constant HEADER_NAME. */
94 public static final String HEADER_NAME = "header.name";
95
96 /*** The Constant HEAD_OF_STATE. */
97 public static final String HEAD_OF_STATE = "head.of.state";
98
99 /*** The Constant MEMBERS. */
100 public static final String MEMBERS = "members";
101
102 /*** The Constant ROLES. */
103 public static final String ROLES = "roles";
104
105 /*** The Constant ORGANISATION_TYPE. */
106 public static final String ORGANISATION_TYPE = "organisation.type";
107
108 /*** The Constant NUMBER_OF_MEMBERS. */
109 public static final String NUMBER_OF_MEMBERS = "number.of.members";
110
111 /*** The Constant POLITICAL_PARTIES_IN. */
112 public static final String POLITICAL_PARTIES_IN = "politicalparties.in";
113
114 /*** The Constant NUMBER_OF_ROLES. */
115 public static final String NUMBER_OF_ROLES = "number.of.roles";
116
117 /*** The Constant PROFILE. */
118 public static final String PROFILE = "profile";
119
120 /*** The Constant HEADER_ROLE. */
121 public static final String HEADER_ROLE = "header.role";
122
123 /*** The Constant ORGANISATION. */
124 public static final String ORGANISATION = "organisation";
125
126 /*** The Constant ALLOWED_ACTIONS. */
127 public static final String ALLOWED_ACTIONS = "allowed.actions";
128
129 /*** The Constant COUNTRY. */
130 public static final String COUNTRY = "country";
131
132 /*** The Constant BUTTON_OK. */
133 public static final String BUTTON_OK = "button.ok";
134
135 /*** The Constant BUTTON_CANCEL. */
136 public static final String BUTTON_CANCEL = "button.cancel";
137
138 /*** The Constant PASSWORD. */
139 public static final String PASSWORD = "password";
140
141 /*** The Constant EMAIL. */
142 public static final String EMAIL = "email";
143
144 /*** The Constant USERNAME. */
145 public static final String USERNAME = "username";
146
147 /*** The Constant LOCATION. */
148 public static final String LOCATION = "location";
149
150 /*** The Constant WELCOME. */
151 public static final String WELCOME = "welcome";
152
153 /*** The Constant INFORMATION. */
154 public static final String INFORMATION = "information";
155
156 /*** The Constant AccountNonExpired. */
157 public static final String AccountNonExpired = "account.non.expired";
158
159 /*** The Constant AccountNonLocked. */
160 public static final String AccountNonLocked = "account.non.locked";
161
162 /*** The Constant Enabled. */
163 public static final String Enabled = "account.enabled";
164
165 /*** The Constant CredentialsNonExpired. */
166 public static final String CredentialsNonExpired = "credentials.non.expired";
167
168 /*** The Constant REGISTER_USER. */
169 public static final String REGISTER_USER = "register.user";
170
171 /*** The Constant ERROR_MESSAGE. */
172 public static final String ERROR_MESSAGE = "error.message";
173
174 /*** The Constant USER_EXIST_CHOOSE_DIFFERENT. */
175 public static final String USER_EXIST_CHOOSE_DIFFERENT = "user.exist";
176
177 /*** The Constant DOCUMENT. */
178 public static final String DOCUMENT = "document";
179
180 /*** The Constant LINK. */
181 public static final String LINK = "link";
182
183 /*** The Constant DATE. */
184 public static final String DATE = "date";
185
186 /*** The Constant VOTE. */
187 public static final String VOTE = "vote";
188
189
190 }
191
192 /*** The message source. */
193 private static MessageSource messageSource = null;
194
195 /***
196 * Gets the message.
197 *
198 * @param code the code
199 * @return the message
200 */
201 public static String getMessage(String code) {
202 if (messageSource == null) {
203 messageSource = BeanLocator.getResourceBundleMessageSource();
204 }
205
206 String message = messageSource.getMessage(code, null, UserState.locale.get());
207 try {
208 return new String(message.getBytes("ISO-8859-1"), "UTF-8");
209 } catch (Exception e) {
210 return null;
211 }
212 }
213 }