View Javadoc

1   /**
2    * Generated by Mod4j BusinessDomain DSL by BeanClassImplBase in JavaBean.xpt at: Mon Oct 20 22:16:42 CEST 2008
3    */
4   package org.company.thesandbox.domain;
5   
6   import org.mod4j.runtime.validation.BusinessRuleValidationSupport;
7   
8   import java.util.Collections;
9   import java.util.Set;
10  import java.util.HashSet;
11  import org.mod4j.runtime.validation.MinValueValidator;
12  import org.mod4j.runtime.validation.MaxValueValidator;
13  import org.mod4j.runtime.validation.MinLengthValidator;
14  import org.mod4j.runtime.validation.MaxLengthValidator;
15  import org.mod4j.runtime.validation.RegExpValidator;
16  
17  /**
18   * A Person represents a legal person.
19   * 
20   * @author Generated by Mod4j BusinessDomain DSL
21   */
22  
23  @SuppressWarnings("serial")
24  public abstract class PersonImplBase implements java.io.Serializable {
25  
26      /**
27       * validation : Responsible for validating attribute constraints and businessrules for this business class.
28       * 
29       */
30      protected BusinessRuleValidationSupport validation = new BusinessRuleValidationSupport(this);
31  
32      /**
33       * id: The identifier of this object.
34       */
35      private long id;
36  
37      @SuppressWarnings("unused")
38      private int version = -1;
39  
40      /**
41       * 
42       * @return id (Long) The identifier of this object.
43       */
44      public Long getId() {
45          return this.id;
46      }
47  
48      /**
49       * firstName: First name of the person.
50       */
51      private String firstName;
52  
53      /**
54       * lastName: Last name of the person.
55       */
56      private String lastName;
57  
58      /**
59       * age: The age of this person in years
60       */
61      private Integer age;
62  
63      /**
64       * numberOfEars: Number of ears (we allow Vulcans in this system).
65       */
66      private int numberOfEars = 0;
67  
68      public static final int NUMBEROFEARS_MINVALUE = 0;
69  
70      public static final int NUMBEROFEARS_MAXVALUE = 4;
71  
72      /**
73       * sexe: Gender
74       */
75      private Sexe sexe;
76  
77      /**
78       * Default no-argument constructor for PersonImplBase
79       */
80      protected PersonImplBase() {
81  
82      }
83  
84      /**
85       * Minimal constructor for PersonImplBase
86       * 
87       * @param firstName
88       *            (string) First name of the person.
89       * @param lastName
90       *            (string) Last name of the person.
91       */
92      public PersonImplBase(String firstName, String lastName) {
93  
94          this.firstName = firstName;
95          this.lastName = lastName;
96  
97          validation.addValidator(new MinValueValidator(Person.class, "numberOfEars", NUMBEROFEARS_MINVALUE));
98  
99          validation.addValidator(new MaxValueValidator(Person.class, "numberOfEars", NUMBEROFEARS_MAXVALUE));
100 
101         validation.validate();
102     }
103 
104     /**
105      * 
106      * @return firstName (String) First name of the person.
107      */
108     public String getFirstName() {
109         return this.firstName;
110     }
111 
112     /**
113      * 
114      * @return lastName (String) Last name of the person.
115      */
116     public String getLastName() {
117         return this.lastName;
118     }
119 
120     /**
121      * 
122      * @return age (Integer) The age of this person in years
123      */
124     public Integer getAge() {
125         return this.age;
126     }
127 
128     /**
129      * 
130      * @return numberOfEars (int) Number of ears (we allow Vulcans in this system).
131      */
132     public int getNumberOfEars() {
133         return this.numberOfEars;
134     }
135 
136     /**
137      * 
138      * @return sexe (Sexe) Gender
139      */
140     public Sexe getSexe() {
141         return this.sexe;
142     }
143 
144     /**
145      * @param firstName
146      *            (String) First name of the person.
147      */
148     public void setFirstName(final String firstName) {
149         this.firstName = firstName;
150         validation.validate();
151     }
152 
153     /**
154      * @param lastName
155      *            (String) Last name of the person.
156      */
157     public void setLastName(final String lastName) {
158         this.lastName = lastName;
159         validation.validate();
160     }
161 
162     /**
163      * @param age
164      *            (Integer) The age of this person in years
165      */
166     public void setAge(final Integer age) {
167         this.age = age;
168         validation.validate();
169     }
170 
171     /**
172      * @param numberOfEars
173      *            (int) Number of ears (we allow Vulcans in this system).
174      */
175     public void setNumberOfEars(final int numberOfEars) {
176         this.numberOfEars = numberOfEars;
177         validation.validate();
178     }
179 
180     /**
181      * @param sexe
182      *            (Sexe) Gender
183      */
184     public void setSexe(final Sexe sexe) {
185         this.sexe = sexe;
186         validation.validate();
187     }
188 
189     /**
190      * Activate/deactivate validation for this business class. When set to active the validation will immediately be
191      * executed.
192      * 
193      * @param value
194      *            (boolean)
195      */
196     public void activateValidation(boolean value) {
197 
198         this.validation.setActive(value);
199         if (value) {
200             validation.validate();
201         }
202     }
203 
204 }