1 /*
2 * Copyright (c) 2001 - 2005 ivata limited.
3 * All rights reserved.
4 * -----------------------------------------------------------------------------
5 * ivata masks may be redistributed under the GNU General Public
6 * License as published by the Free Software Foundation;
7 * version 2 of the License.
8 *
9 * These programs are free software; you can redistribute them and/or
10 * modify them under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; version 2 of the License.
12 *
13 * These programs are distributed in the hope that they will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 *
17 * See the GNU General Public License in the file LICENSE.txt for more
18 * details.
19 *
20 * If you would like a copy of the GNU General Public License write to
21 *
22 * Free Software Foundation, Inc.
23 * 59 Temple Place - Suite 330
24 * Boston, MA 02111-1307, USA.
25 *
26 *
27 * To arrange commercial support and licensing, contact ivata at
28 * http://www.ivata.com/contact.jsp
29 * -----------------------------------------------------------------------------
30 * $Log: DemoValueObject.java,v $
31 * Revision 1.4 2005/04/09 18:04:14 colinmacleod
32 * Changed copyright text to GPL v2 explicitly.
33 *
34 * Revision 1.3 2005/01/07 09:13:05 colinmacleod
35 * Added newline to end of file.
36 *
37 * Revision 1.2 2005/01/07 08:08:19 colinmacleod
38 * Moved up a version number.
39 * Changed copyright notices to 2005.
40 * Updated the documentation:
41 * - started working on multiproject:site docu.
42 * - changed the logo.
43 * Added checkstyle and fixed LOADS of style issues.
44 * Added separate thirdparty subproject.
45 * Added struts (in web), util and webgui (in webtheme) from ivata op.
46 *
47 * Revision 1.1 2004/11/10 17:18:21 colinmacleod
48 * New value object classes - first version in CVS.
49 * -----------------------------------------------------------------------------
50 */
51 package com.ivata.mask.web.demo.valueobject;
52 import com.ivata.mask.valueobject.ValueObject;
53 import com.ivata.mask.web.demo.catalog.Catalog;
54 /***
55 * <p>
56 * Inherited by all value objects in this demo.
57 * </p>
58 *
59 * @since ivata masks 0.2 (2004-05-24)
60 * @author Colin MacLeod
61 * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
62 * @version $Revision: 1.4 $
63 */
64 public abstract class DemoValueObject implements ValueObject {
65 /***
66 * <p>
67 * Unique identifier.
68 * </p>
69 */
70 private int id;
71 /***
72 * <p>
73 * Construct a new value object marked as invalid.
74 * </p>
75 */
76 public DemoValueObject() {
77 id = Catalog.INVALID_ID;
78 }
79 /***
80 * <p>
81 * Construct a new value object with the given id value.
82 * </p>
83 *
84 * @param idParam unique identifier of the object.
85 */
86 public DemoValueObject(final int idParam) {
87 super();
88 this.id = idParam;
89 }
90 /***
91 * Get the unique identifier of the value object, as a string.
92 *
93 * @see com.ivata.mask.ValueObject#getIdString()
94 */
95 public final String getIdString() {
96 if (id == Catalog.INVALID_ID) {
97 return null;
98 }
99 return Integer.toString(id);
100 }
101 /***
102 * Get the unique identifier of this value object, in its internal form:
103 * <code>int</code>.
104 *
105 * @return unique identifier as an <code>int</code>.
106 */
107 public final int getId() {
108 return id;
109 }
110 /***
111 * Get the unique identifier of this value object, in its internal form:
112 * <code>int</code>.
113 *
114 * @param idParam unique identifier of this value object, as an
115 * <code>int</code>.
116 */
117 public final void setId(final int idParam) {
118 id = idParam;
119 }
120 }
121