001: /*
002: * Copyright (c) 2001 - 2005 ivata limited.
003: * All rights reserved.
004: * -----------------------------------------------------------------------------
005: * ivata groupware may be redistributed under the GNU General Public
006: * License as published by the Free Software Foundation;
007: * version 2 of the License.
008: *
009: * These programs are free software; you can redistribute them and/or
010: * modify them under the terms of the GNU General Public License
011: * as published by the Free Software Foundation; version 2 of the License.
012: *
013: * These programs are distributed in the hope that they will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016: *
017: * See the GNU General Public License in the file LICENSE.txt for more
018: * details.
019: *
020: * If you would like a copy of the GNU General Public License write to
021: *
022: * Free Software Foundation, Inc.
023: * 59 Temple Place - Suite 330
024: * Boston, MA 02111-1307, USA.
025: *
026: *
027: * To arrange commercial support and licensing, contact ivata at
028: * http://www.ivata.com/contact.jsp
029: * -----------------------------------------------------------------------------
030: * $Log: CountryDO.java,v $
031: * Revision 1.8 2005/10/11 18:53:07 colinmacleod
032: * Fixed some checkstyle and javadoc issues.
033: *
034: * Revision 1.7 2005/10/03 10:21:13 colinmacleod
035: * Fixed some style and javadoc issues.
036: *
037: * Revision 1.6 2005/10/02 14:08:55 colinmacleod
038: * Added/improved log4j logging.
039: *
040: * Revision 1.5 2005/09/29 13:22:44 colinmacleod
041: * Added read-only functionality to data object classes (with a check on each
042: * setter).
043: *
044: * Revision 1.4 2005/09/14 14:52:01 colinmacleod
045: * Added serialVersionUID.
046: *
047: * Revision 1.3 2005/04/10 20:09:34 colinmacleod
048: * Added new themes.
049: * Changed id type to String.
050: * Changed i tag to em and b tag to strong.
051: * Improved PicoContainerFactory with NanoContainer scripts.
052: *
053: * Revision 1.2 2005/04/09 17:19:07 colinmacleod
054: * Changed copyright text to GPL v2 explicitly.
055: *
056: * Revision 1.1.1.1 2005/03/10 17:50:22 colinmacleod
057: * Restructured ivata op around Hibernate/PicoContainer.
058: * Renamed ivata groupware.
059: *
060: * Revision 1.5 2004/11/12 15:57:05 colinmacleod
061: * Removed dependencies on SSLEXT.
062: * Moved Persistence classes to ivata masks.
063: *
064: * Revision 1.4 2004/07/13 19:41:13 colinmacleod
065: * Moved project to POJOs from EJBs.
066: * Applied PicoContainer to services layer (replacing session EJBs).
067: * Applied Hibernate to persistence layer (replacing entity EJBs).
068: *
069: * Revision 1.3 2004/03/21 21:16:06 colinmacleod
070: * Shortened name to ivata op.
071: *
072: * Revision 1.2 2004/02/01 22:00:32 colinmacleod
073: * Added full names to author tags
074: *
075: * Revision 1.1.1.1 2004/01/27 20:57:49 colinmacleod
076: * Moved ivata openportal to SourceForge..
077: *
078: * Revision 1.3 2003/10/17 12:36:12 jano
079: * fixing problems with building
080: * converting intranet -> portal
081: * Eclipse building
082: *
083: * Revision 1.2 2003/10/15 13:18:02 colin
084: * fixing for XDoclet
085: *
086: * Revision 1.1 2003/02/24 19:09:20 colin
087: * moved to business
088: *
089: * Revision 1.2 2003/02/04 17:43:44 colin
090: * copyright notice
091: *
092: * Revision 1.1 2002/09/02 08:51:47 colin
093: * first version of CountryDO for use in selects
094: * -----------------------------------------------------------------------------
095: */
096: package com.ivata.groupware.business.addressbook.address.country;
097:
098: import org.apache.log4j.Logger;
099:
100: import com.ivata.groupware.container.persistence.BaseDO;
101: import com.ivata.groupware.container.persistence.NamedDO;
102:
103: /**
104: * <p>Stores all valid countries in the system. These countries are used in
105: * public holidays, employee records as well as addresses.</p>
106: *
107: * @since 2002-09-01
108: * @author Colin MacLeod
109: * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
110: * @version $Revision: 1.8 $
111: *
112: * @hibernate.class
113: * table="address_country"
114: * @hibernate.cache
115: * usage="read-write"
116: */
117: public class CountryDO extends BaseDO implements NamedDO {
118: /**
119: * Logger for this class.
120: */
121: private static final Logger logger = Logger
122: .getLogger(CountryDO.class);
123:
124: /**
125: * Serialization version (for <code>Serializable</code> interface).
126: */
127: private static final long serialVersionUID = 1L;
128:
129: /**
130: * <p>Store the two-letter country code here.</p>
131: */
132: private String code;
133:
134: /**
135: * <p>Store the name of the country.</p>
136: */
137: private String name;
138:
139: /**
140: * <p>Priority of this country in the system. Lower = better.</p>
141: */
142: private int priority;
143:
144: /**
145: * <p>Get the country code for this country.</p>
146: *
147: * @return two letter country abbreviation following the standards of
148: * internet TLDs.
149: *
150: * @hibernate.property
151: */
152: public final String getCode() {
153: if (logger.isDebugEnabled()) {
154: logger.debug("getCode() - start");
155: }
156:
157: if (logger.isDebugEnabled()) {
158: logger.debug("getCode() - end - return value = " + code);
159: }
160: return code;
161: }
162:
163: /**
164: * Just returns the country name.
165: * <copyDoc>Refer to {@link #getName}.</copyDoc>
166: * @return <copyDoc>Refer to {@link #getName}.</copyDoc>
167: */
168: public String getDisplayValue() {
169: if (logger.isDebugEnabled()) {
170: logger.debug("getDisplayValue() - start");
171: }
172:
173: String returnString = getName();
174: if (logger.isDebugEnabled()) {
175: logger.debug("getDisplayValue() - end - return value = "
176: + returnString);
177: }
178: return returnString;
179: }
180:
181: /**
182: * <p>Get the name of the country.</p>
183: *
184: * @return US English clear-text country name.
185: *
186: * @hibernate.property
187: */
188: public final String getName() {
189: if (logger.isDebugEnabled()) {
190: logger.debug("getName() - start");
191: }
192:
193: if (logger.isDebugEnabled()) {
194: logger.debug("getName() - end - return value = " + name);
195: }
196: return name;
197: }
198:
199: /**
200: * <p>Priority of this country in the system for lists. Lower = better.</p>
201: *
202: * @return priority of this country in the system. Lower = better.
203: * @hibernate.property
204: */
205: public final int getPriority() {
206: if (logger.isDebugEnabled()) {
207: logger.debug("getPriority() - start");
208: }
209:
210: if (logger.isDebugEnabled()) {
211: logger.debug("getPriority() - end - return value = "
212: + priority);
213: }
214: return priority;
215: }
216:
217: /**
218: * <p>Set the country code for this country.</p>
219: *
220: * @param codeParam two letter country abbreviation following the standards
221: * of internet TLDs.
222: */
223: public final void setCode(final String codeParam) {
224: if (logger.isDebugEnabled()) {
225: logger.debug("setCode(String code = " + codeParam
226: + ") - start");
227: }
228:
229: checkSetter();
230: this .code = codeParam;
231:
232: if (logger.isDebugEnabled()) {
233: logger.debug("setCode(String) - end");
234: }
235: }
236:
237: /**
238: * <p>Set the name of the country.</p>
239: *
240: * @param nameParam US English clear-text country name.
241: */
242: public final void setName(final String nameParam) {
243: if (logger.isDebugEnabled()) {
244: logger.debug("setName(String name = " + nameParam
245: + ") - start");
246: }
247:
248: checkSetter();
249: this .name = nameParam;
250:
251: if (logger.isDebugEnabled()) {
252: logger.debug("setName(String) - end");
253: }
254: }
255:
256: /**
257: * <p>Priority of this country in the system for lists. Lower = better.</p>
258: * @param i priority of this country in the system. Lower = better.
259: */
260: public final void setPriority(final int i) {
261: if (logger.isDebugEnabled()) {
262: logger.debug("setPriority(int i = " + i + ") - start");
263: }
264:
265: checkSetter();
266: priority = i;
267:
268: if (logger.isDebugEnabled()) {
269: logger.debug("setPriority(int) - end");
270: }
271: }
272: }
|