001: /*
002: * Copyright (c) 2001 - 2005 ivata limited.
003: * All rights reserved.
004: * -----------------------------------------------------------------------------
005: * ivata masks 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: DemoValueObject.java,v $
031: * Revision 1.4 2005/04/09 18:04:14 colinmacleod
032: * Changed copyright text to GPL v2 explicitly.
033: *
034: * Revision 1.3 2005/01/07 09:13:05 colinmacleod
035: * Added newline to end of file.
036: *
037: * Revision 1.2 2005/01/07 08:08:19 colinmacleod
038: * Moved up a version number.
039: * Changed copyright notices to 2005.
040: * Updated the documentation:
041: * - started working on multiproject:site docu.
042: * - changed the logo.
043: * Added checkstyle and fixed LOADS of style issues.
044: * Added separate thirdparty subproject.
045: * Added struts (in web), util and webgui (in webtheme) from ivata op.
046: *
047: * Revision 1.1 2004/11/10 17:18:21 colinmacleod
048: * New value object classes - first version in CVS.
049: * -----------------------------------------------------------------------------
050: */
051: package com.ivata.mask.web.demo.valueobject;
052:
053: import com.ivata.mask.valueobject.ValueObject;
054: import com.ivata.mask.web.demo.catalog.Catalog;
055:
056: /**
057: * <p>
058: * Inherited by all value objects in this demo.
059: * </p>
060: *
061: * @since ivata masks 0.2 (2004-05-24)
062: * @author Colin MacLeod
063: * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
064: * @version $Revision: 1.4 $
065: */
066: public abstract class DemoValueObject implements ValueObject {
067: /**
068: * <p>
069: * Unique identifier.
070: * </p>
071: */
072: private int id;
073:
074: /**
075: * <p>
076: * Construct a new value object marked as invalid.
077: * </p>
078: */
079: public DemoValueObject() {
080: id = Catalog.INVALID_ID;
081: }
082:
083: /**
084: * <p>
085: * Construct a new value object with the given id value.
086: * </p>
087: *
088: * @param idParam unique identifier of the object.
089: */
090: public DemoValueObject(final int idParam) {
091: super ();
092: this .id = idParam;
093: }
094:
095: /**
096: * Get the unique identifier of the value object, as a string.
097: *
098: * @see com.ivata.mask.ValueObject#getIdString()
099: */
100: public final String getIdString() {
101: if (id == Catalog.INVALID_ID) {
102: return null;
103: }
104: return Integer.toString(id);
105: }
106:
107: /**
108: * Get the unique identifier of this value object, in its internal form:
109: * <code>int</code>.
110: *
111: * @return unique identifier as an <code>int</code>.
112: */
113: public final int getId() {
114: return id;
115: }
116:
117: /**
118: * Get the unique identifier of this value object, in its internal form:
119: * <code>int</code>.
120: *
121: * @param idParam unique identifier of this value object, as an
122: * <code>int</code>.
123: */
124: public final void setId(final int idParam) {
125: id = idParam;
126: }
127: }
|