01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com> and
03: * JR Boyens <gnu-jrb[remove] at gmx dot net>
04: * Distributed under the terms of either:
05: * - the common development and distribution license (CDDL), v1.0; or
06: * - the GNU Lesser General Public License, v2.1 or later
07: * $Id: UniqueBean.java 3657 2007-02-15 23:39:06Z gbevin $
08: */
09: package com.uwyn.rife.database.querymanagers.generic.beans;
10:
11: import com.uwyn.rife.site.ConstrainedProperty;
12: import com.uwyn.rife.site.Validation;
13:
14: public class UniqueBean extends Validation {
15: private int mIdentifier = -1;
16: private String mTestString = null;
17: private String mAnotherString = null;
18: private String mThirdString = null;
19:
20: public UniqueBean() {
21: }
22:
23: protected void activateValidation() {
24: addConstraint(new ConstrainedProperty("identifier")
25: .identifier(true));
26: addGroup("group1").addConstraint(
27: new ConstrainedProperty("testString").unique(true)
28: .maxLength(20).notNull(true)).addConstraint(
29: new ConstrainedProperty("anotherString").maxLength(20)
30: .notNull(true));
31: addGroup("group2").addConstraint(
32: new ConstrainedProperty("thirdString").maxLength(20));
33:
34: addConstraint(new com.uwyn.rife.site.ConstrainedBean().unique(
35: "anotherString", "thirdString"));
36: }
37:
38: public void setIdentifier(int identifier) {
39: mIdentifier = identifier;
40: }
41:
42: public int getIdentifier() {
43: return mIdentifier;
44: }
45:
46: public void setTestString(String testString) {
47: this .mTestString = testString;
48: }
49:
50: public String getTestString() {
51: return mTestString;
52: }
53:
54: public void setAnotherString(String anotherString) {
55: mAnotherString = anotherString;
56: }
57:
58: public String getAnotherString() {
59: return mAnotherString;
60: }
61:
62: public void setThirdString(String thirdString) {
63: mThirdString = thirdString;
64: }
65:
66: public String getThirdString() {
67: return mThirdString;
68: }
69: }
|