001: /*
002: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
003: * Distributed under the terms of either:
004: * - the common development and distribution license (CDDL), v1.0; or
005: * - the GNU Lesser General Public License, v2.1 or later
006: * $Id: BeanImpl.java 3634 2007-01-08 21:42:24Z gbevin $
007: */
008: package com.uwyn.rife.database.querymanagers.generic.beans;
009:
010: import com.uwyn.rife.database.querymanagers.generic.beans.BeanImpl;
011: import com.uwyn.rife.site.ConstrainedProperty;
012: import com.uwyn.rife.site.Validation;
013: import java.math.BigDecimal;
014: import java.sql.Time;
015: import java.sql.Timestamp;
016: import java.util.Calendar;
017:
018: public class BeanImpl extends Validation {
019: private int mId = -1;
020:
021: private String mPropertyString = null;
022: private StringBuffer mPropertyStringbuffer = null;
023: private java.util.Date mPropertyDate = null;
024: private java.util.Calendar mPropertyCalendar = null;
025: private java.sql.Date mPropertySqlDate = null;
026: private java.sql.Time mPropertyTime = null;
027: private java.sql.Timestamp mPropertyTimestamp = null;
028: private char mPropertyChar = 0;
029: private Character mPropertyCharacterObject = null;
030: private boolean mPropertyBoolean = false;
031: private Boolean mPropertyBooleanObject = null;
032: private byte mPropertyByte = 0;
033: private Byte mPropertyByteObject = null;
034: private double mPropertyDouble = 0.0d;
035: private Double mPropertyDoubleObject = null;
036: private float mPropertyFloat = 0.0f;
037: private Float mPropertyFloatObject = null;
038: private int mPropertyInt = 0;
039: private Integer mPropertyIntegerObject = null;
040: private long mPropertyLong = 0;
041: private Long mPropertyLongObject = null;
042: private short mPropertyShort = 0;
043: private Short mPropertyShortObject = null;
044: private BigDecimal mPropertyBigDecimal = null;
045:
046: public BeanImpl() {
047: }
048:
049: protected void activateValidation() {
050: addConstraint(new ConstrainedProperty("propertyBigDecimal")
051: .precision(18).scale(5));
052: }
053:
054: public void setId(int id) {
055: mId = id;
056: }
057:
058: public int getId() {
059: return mId;
060: }
061:
062: public String getPropertyString() {
063: return mPropertyString;
064: }
065:
066: public void setPropertyString(String propertyString) {
067: mPropertyString = propertyString;
068: }
069:
070: public StringBuffer getPropertyStringbuffer() {
071: return mPropertyStringbuffer;
072: }
073:
074: public void setPropertyStringbuffer(
075: StringBuffer propertyStringbuffer) {
076: mPropertyStringbuffer = propertyStringbuffer;
077: }
078:
079: public java.util.Date getPropertyDate() {
080: return mPropertyDate;
081: }
082:
083: public void setPropertyDate(java.util.Date propertyDate) {
084: mPropertyDate = propertyDate;
085: }
086:
087: public java.util.Calendar getPropertyCalendar() {
088: return mPropertyCalendar;
089: }
090:
091: public void setPropertyCalendar(java.util.Calendar propertyCalendar) {
092: mPropertyCalendar = propertyCalendar;
093: }
094:
095: public java.sql.Date getPropertySqlDate() {
096: return mPropertySqlDate;
097: }
098:
099: public void setPropertySqlDate(java.sql.Date propertySqlDate) {
100: mPropertySqlDate = propertySqlDate;
101: }
102:
103: public java.sql.Time getPropertyTime() {
104: return mPropertyTime;
105: }
106:
107: public void setPropertyTime(java.sql.Time propertyTime) {
108: mPropertyTime = propertyTime;
109: }
110:
111: public java.sql.Timestamp getPropertyTimestamp() {
112: return mPropertyTimestamp;
113: }
114:
115: public void setPropertyTimestamp(
116: java.sql.Timestamp propertyTimestamp) {
117: mPropertyTimestamp = propertyTimestamp;
118: }
119:
120: public boolean isPropertyBoolean() {
121: return mPropertyBoolean;
122: }
123:
124: public void setPropertyBoolean(boolean propertyBoolean) {
125: mPropertyBoolean = propertyBoolean;
126: }
127:
128: public Boolean getPropertyBooleanObject() {
129: return mPropertyBooleanObject;
130: }
131:
132: public void setPropertyBooleanObject(Boolean propertyBooleanObject) {
133: mPropertyBooleanObject = propertyBooleanObject;
134: }
135:
136: public byte getPropertyByte() {
137: return mPropertyByte;
138: }
139:
140: public Byte getPropertyByteObject() {
141: return mPropertyByteObject;
142: }
143:
144: public void setPropertyByte(byte propertyByte) {
145: mPropertyByte = propertyByte;
146: }
147:
148: public void setPropertyByteObject(Byte propertyByteObject) {
149: mPropertyByteObject = propertyByteObject;
150: }
151:
152: public double getPropertyDouble() {
153: return mPropertyDouble;
154: }
155:
156: public void setPropertyDouble(double propertyDouble) {
157: mPropertyDouble = propertyDouble;
158: }
159:
160: public void setPropertyDoubleObject(Double propertyDoubleObject) {
161: mPropertyDoubleObject = propertyDoubleObject;
162: }
163:
164: public Double getPropertyDoubleObject() {
165: return mPropertyDoubleObject;
166: }
167:
168: public float getPropertyFloat() {
169: return mPropertyFloat;
170: }
171:
172: public void setPropertyFloat(float propertyFloat) {
173: mPropertyFloat = propertyFloat;
174: }
175:
176: public void setPropertyFloatObject(Float propertyFloatObject) {
177: mPropertyFloatObject = propertyFloatObject;
178: }
179:
180: public Float getPropertyFloatObject() {
181: return mPropertyFloatObject;
182: }
183:
184: public int getPropertyInt() {
185: return mPropertyInt;
186: }
187:
188: public void setPropertyInt(int propertyInt) {
189: mPropertyInt = propertyInt;
190: }
191:
192: public Integer getPropertyIntegerObject() {
193: return mPropertyIntegerObject;
194: }
195:
196: public void setPropertyIntegerObject(Integer propertyIntegerObject) {
197: mPropertyIntegerObject = propertyIntegerObject;
198: }
199:
200: public long getPropertyLong() {
201: return mPropertyLong;
202: }
203:
204: public void setPropertyLong(long propertyLong) {
205: mPropertyLong = propertyLong;
206: }
207:
208: public Long getPropertyLongObject() {
209: return mPropertyLongObject;
210: }
211:
212: public void setPropertyLongObject(Long propertyLongObject) {
213: mPropertyLongObject = propertyLongObject;
214: }
215:
216: public short getPropertyShort() {
217: return mPropertyShort;
218: }
219:
220: public void setPropertyShort(short propertyShort) {
221: mPropertyShort = propertyShort;
222: }
223:
224: public Short getPropertyShortObject() {
225: return mPropertyShortObject;
226: }
227:
228: public void setPropertyShortObject(Short propertyShortObject) {
229: mPropertyShortObject = propertyShortObject;
230: }
231:
232: public char getPropertyChar() {
233: return mPropertyChar;
234: }
235:
236: public void setPropertyChar(char propertyChar) {
237: mPropertyChar = propertyChar;
238: }
239:
240: public Character getPropertyCharacterObject() {
241: return mPropertyCharacterObject;
242: }
243:
244: public void setPropertyCharacterObject(
245: Character propertyCharacterObject) {
246: mPropertyCharacterObject = propertyCharacterObject;
247: }
248:
249: public BigDecimal getPropertyBigDecimal() {
250: return mPropertyBigDecimal;
251: }
252:
253: public void setPropertyBigDecimal(BigDecimal propertyBigDecimal) {
254: mPropertyBigDecimal = propertyBigDecimal;
255: }
256:
257: public static BeanImpl getPopulatedBean() {
258: BeanImpl bean = new BeanImpl();
259: Calendar cal = Calendar.getInstance();
260: cal.set(2002, 5, 18, 15, 26, 14);
261: cal.set(Calendar.MILLISECOND, 764);
262: bean.setPropertyBigDecimal(new BigDecimal("219038743.392874"));
263: bean.setPropertyBoolean(true);
264: bean.setPropertyBooleanObject(false);
265: bean.setPropertyByte((byte) 89);
266: bean.setPropertyByteObject((byte) 34);
267: bean.setPropertyCalendar(cal);
268: bean.setPropertyChar('v');
269: bean.setPropertyCharacterObject('r');
270: bean.setPropertyDate(cal.getTime());
271: bean.setPropertyDouble(53348.34d);
272: bean.setPropertyDoubleObject(143298.692d);
273: bean.setPropertyFloat(98634.2f);
274: bean.setPropertyFloatObject(8734.7f);
275: bean.setPropertyInt(545);
276: bean.setPropertyIntegerObject(968);
277: bean.setPropertyLong(34563L);
278: bean.setPropertyLongObject(66875L);
279: bean.setPropertyShort((short) 43);
280: bean.setPropertyShortObject((short) 68);
281: bean.setPropertySqlDate(new java.sql.Date(cal.getTime()
282: .getTime()));
283: bean.setPropertyString("someotherstring");
284: bean.setPropertyStringbuffer(new StringBuffer(
285: "someotherstringbuff"));
286: bean.setPropertyTime(new Time(cal.getTime().getTime()));
287: bean
288: .setPropertyTimestamp(new Timestamp(cal.getTime()
289: .getTime()));
290:
291: return bean;
292: }
293:
294: public static BeanImpl getNullBean() {
295: BeanImpl bean = new BeanImpl();
296: bean.setPropertyBigDecimal(null);
297: bean.setPropertyBoolean(false);
298: bean.setPropertyBooleanObject(false);
299: bean.setPropertyByte((byte) 0);
300: bean.setPropertyByteObject((byte) 0);
301: bean.setPropertyDate(null);
302: bean.setPropertyCalendar(null);
303: bean.setPropertyChar((char) 0);
304: bean.setPropertyCharacterObject(null);
305: bean.setPropertyDouble(0d);
306: bean.setPropertyDoubleObject(0d);
307: bean.setPropertyFloat(0f);
308: bean.setPropertyFloatObject(0f);
309: bean.setPropertyInt(0);
310: bean.setPropertyIntegerObject(0);
311: bean.setPropertyLong(0L);
312: bean.setPropertyLongObject(0L);
313: bean.setPropertyShort((short) 0);
314: bean.setPropertyShortObject((short) 0);
315: bean.setPropertySqlDate(null);
316: bean.setPropertyString(null);
317: bean.setPropertyStringbuffer(null);
318: bean.setPropertyTime(null);
319: bean.setPropertyTimestamp(null);
320:
321: return bean;
322: }
323: }
|