01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: OrderedRestricted.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.cmf.dam;
09:
10: import com.uwyn.rife.site.ConstrainedBean;
11: import com.uwyn.rife.site.ConstrainedProperty;
12: import com.uwyn.rife.site.Validation;
13:
14: public class OrderedRestricted extends
15: Validation<ConstrainedBean, ConstrainedProperty> {
16: private int mId = -1;
17: private String mName = null;
18: private int mPriority = -1;
19: private int mRestricted = -1;
20:
21: public OrderedRestricted() {
22: mPriority = 0;
23: }
24:
25: protected void activateValidation() {
26: addConstraint(new ConstrainedProperty("priority").rangeBegin(0));
27: addConstraint(new ConstrainedProperty("name").maxLength(64)
28: .notNull(true).notEmpty(true));
29: addConstraint(new ConstrainedProperty("restricted")
30: .rangeBegin(0));
31: addConstraint(new ConstrainedProperty("priority").ordinal(true,
32: "restricted"));
33: }
34:
35: public void setId(int id) {
36: mId = id;
37: }
38:
39: public int getId() {
40: return mId;
41: }
42:
43: public void setPriority(int priority) {
44: mPriority = priority;
45: }
46:
47: public int getPriority() {
48: return mPriority;
49: }
50:
51: public OrderedRestricted priority(int priority) {
52: mPriority = priority;
53:
54: return this ;
55: }
56:
57: public void setName(String name) {
58: mName = name;
59: }
60:
61: public String getName() {
62: return mName;
63: }
64:
65: public OrderedRestricted name(String name) {
66: mName = name;
67:
68: return this ;
69: }
70:
71: public int getRestricted() {
72: return mRestricted;
73: }
74:
75: public void setRestricted(int restricted) {
76: mRestricted = restricted;
77: }
78:
79: public OrderedRestricted restricted(int restricted) {
80: setRestricted(restricted);
81:
82: return this;
83: }
84: }
|