View Javadoc

1   /**
2    * Generated by Mod4j BusinessDomain DSL by BeanClassImplBase in JavaBean.xpt at: Mon Oct 20 22:16:44 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   * 
19   * 
20   * @author Generated by Mod4j BusinessDomain DSL
21   */
22  
23  @SuppressWarnings("serial")
24  public abstract class ProductImplBase 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       * productNumnber:
50       */
51      private String productNumnber;
52  
53      /**
54       * price:
55       */
56      private int price;
57  
58      private Set<Record> record = new HashSet<Record>();
59  
60      public Set<Record> getRecord() {
61          return this.record;
62      }
63  
64      /**
65       * Implements the setter of association end
66       * 
67       * @param element
68       */
69      public void addToRecord(Record element) {
70          if (element == null) {
71              return;
72          }
73          if (this.record.contains(element)) {
74              return;
75          }
76          this.record.add(element);
77          if (element.getProduct() != null) {
78              element.getProduct().z_internalRemoveFromRecord(element);
79          }
80          element.z_internalSetProduct((Product) this);
81  
82      }
83  
84      public void removeFromRecord(Record element) {
85          if (element == null) {
86              return;
87          }
88          this.record.remove(element);
89          element.z_internalRemoveProduct((Product) this);
90  
91      }
92  
93      /**
94       * Should NOT be used by clients! Implements the correct setting of the link for + owner : Customer when a single
95       * element is added to it.
96       * 
97       * @param element
98       */
99      public void z_internalAddToRecord(Record element) {
100         this.record.add(element);
101     }
102 
103     /**
104      * Should NOT be used by clients! Implements the correct setting of the link for + owner : Customer when a single
105      * element is removed to it.
106      * 
107      * @param element
108      */
109     public void z_internalRemoveFromRecord(Record element) {
110         this.record.remove(element);
111     }
112 
113     /**
114      * Default no-argument constructor for ProductImplBase
115      */
116     protected ProductImplBase() {
117 
118     }
119 
120     /**
121      * Minimal constructor for ProductImplBase
122      * 
123      * @param productNumnber
124      *            (string)
125      * @param price
126      *            (integer)
127      */
128     public ProductImplBase(String productNumnber, int price) {
129 
130         this.productNumnber = productNumnber;
131         this.price = price;
132 
133         validation.validate();
134     }
135 
136     /**
137      * 
138      * @return productNumnber (String)
139      */
140     public String getProductNumnber() {
141         return this.productNumnber;
142     }
143 
144     /**
145      * 
146      * @return price (int)
147      */
148     public int getPrice() {
149         return this.price;
150     }
151 
152     /**
153      * @param productNumnber
154      *            (String)
155      */
156     public void setProductNumnber(final String productNumnber) {
157         this.productNumnber = productNumnber;
158         validation.validate();
159     }
160 
161     /**
162      * @param price
163      *            (int)
164      */
165     public void setPrice(final int price) {
166         this.price = price;
167         validation.validate();
168     }
169 
170     /**
171      * Activate/deactivate validation for this business class. When set to active the validation will immediately be
172      * executed.
173      * 
174      * @param value
175      *            (boolean)
176      */
177     public void activateValidation(boolean value) {
178 
179         this.validation.setActive(value);
180         if (value) {
181             validation.validate();
182         }
183     }
184 
185 }