01: /*
02: * The contents of this file are subject to the
03: * Mozilla Public License Version 1.1 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
06: *
07: * Software distributed under the License is distributed on an "AS IS"
08: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
09: * See the License for the specific language governing rights and
10: * limitations under the License.
11: *
12: * The Initial Developer of the Original Code is Simulacra Media Ltd.
13: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14: *
15: * All Rights Reserved.
16: *
17: * Contributor(s):
18: */
19:
20: package org.openharmonise.rm.publishing;
21:
22: import java.util.HashMap;
23:
24: /**
25: * Utility class holding error codes and messages used in publishing
26: * <code>Publishable</code> objects.
27: *
28: * @author Michael Bell
29: * @version $Revision: 1.1 $
30: *
31: */
32: public class XMLFormErrorCodes {
33: public static final String TAG_ERRORTEXT = "ErrorText";
34: public static final String ATTRIB_ERRORCODE = "errorCode";
35: public static String OBJECT_NAME_EXISTS = "OBJECT_NAME_EXISTS";
36: public static String NO_VALUE = "NO_VALUE";
37: public static String EXCEEDS_SIZE = "EXCEEDS_SIZE";
38: public static String MANDATORY_FIELD = "MANDATORY_FIELD";
39: private static XMLFormErrorCodes m_instance;
40: private static HashMap code_map;
41:
42: private XMLFormErrorCodes() {
43: code_map = new HashMap(10);
44: code_map.put("OBJECT_NAME_EXISTS",
45: "An object with this name already exists");
46: code_map.put("NO_VALUE", "A value must be entered"); // for fields where mandatory is not optional
47: code_map.put("EXCEEDS_SIZE",
48: "This entry exceeds the maximum size");
49: code_map.put("MANDATORY_FIELD", "This field is mandatory");
50: }
51:
52: public static synchronized XMLFormErrorCodes getInstance() {
53: if (m_instance == null) {
54: m_instance = new XMLFormErrorCodes();
55: }
56:
57: return m_instance;
58: }
59:
60: public String getErrorText(String error_code) {
61: return (String) code_map.get(error_code);
62: }
63: }
|