View Javadoc

1   /**
2    * Generated by Mod4j BusinessDomain DSL by BeanClassImplBase in JavaBean.xpt at: Mon Oct 20
3    * 22:16:43 CEST 2008
4    */
5   package org.company.thesandbox.domain;
6   
7   import org.mod4j.runtime.validation.BusinessRuleValidationSupport;
8   
9   import java.util.Collections;
10  import java.util.Set;
11  import java.util.HashSet;
12  import org.mod4j.runtime.validation.MinValueValidator;
13  import org.mod4j.runtime.validation.MaxValueValidator;
14  import org.mod4j.runtime.validation.MinLengthValidator;
15  import org.mod4j.runtime.validation.MaxLengthValidator;
16  import org.mod4j.runtime.validation.RegExpValidator;
17  
18  /**
19   * A Record is a representation of a physical medium containing one or more musical compositions.
20   * 
21   * @author Generated by Mod4j BusinessDomain DSL
22   */
23  
24  @SuppressWarnings("serial")
25  public abstract class RecordImplBase implements java.io.Serializable {
26  
27      /**
28       * validation : Responsible for validating attribute constraints and businessrules for this
29       * business class.
30       * 
31       */
32      protected BusinessRuleValidationSupport validation = new BusinessRuleValidationSupport(this);
33  
34      /**
35       * id: The identifier of this object.
36       */
37      private long id;
38  
39      @SuppressWarnings("unused")
40      private int version = -1;
41  
42      /**
43       * 
44       * @return id (Long) The identifier of this object.
45       */
46      public Long getId() {
47          return this.id;
48      }
49  
50      /**
51       * asin:
52       */
53      private String asin;
54  
55      /**
56       * title:
57       */
58      private String title = "Title unknown";
59  
60      /**
61       * mediumCode:
62       */
63      private int mediumCode = 111;
64  
65      /**
66       * price:
67       */
68      private float price;
69  
70      /**
71       * type:
72       */
73      private RecordType type = RecordType.CD;
74  
75      /**
76       * product: Many to One bidirectional:
77       */
78      private Product product;
79  
80      /**
81       * @return product (Set<Product>)
82       */
83      public Product getProduct() {
84          return this.product;
85      }
86  
87      /**
88       * Implements adding single element to a collection
89       */
90      public void setProduct(Product element) {
91          if (this.product != element) {
92  
93              if (this.product != null) {
94                  this.product.z_internalRemoveFromRecord((Record) this);
95              }
96  
97              this.product = element;
98  
99              if (element != null) {
100                 element.z_internalAddToRecord((Record) this);
101             }
102 
103         }
104     }
105 
106     /**
107      * This operation should NOT be used by clients. It implements the correct addition of an
108      * element in an association.
109      * 
110      * @param element
111      */
112     public void z_internalSetProduct(Product element) {
113         this.product = element;
114     }
115 
116     /**
117      * This operation should NOT be used by clients. It implements the correct removal of an element
118      * in an association.
119      * 
120      * @param element
121      */
122     public void z_internalRemoveProduct(Product element) {
123         this.product = null;
124     }
125 
126     /**
127      * contributors: Many to Many unidirectional: an Artist has contributed to a Record
128      */
129     private Set<Artist> contributors = new HashSet<Artist>();
130 
131     /**
132      * @return contributors (Set<Artist>).
133      */
134     public Set<Artist> getContributors() {
135         return Collections.unmodifiableSet(this.contributors);
136     }
137 
138     /**
139      * Implements adding single element to a collection.
140      */
141     public void addToContributors(Artist element) {
142         this.contributors.add(element);
143         validation.validate();
144     }
145 
146     /**
147      * Implements removing a single element from a collection.
148      */
149     public void removeFromContributors(Artist element) {
150         this.contributors.remove(element);
151         validation.validate();
152     }
153 
154     private OrderLine orderLine;
155 
156     /**
157      * @return orderLine (Set<OrderLine>)
158      */
159     public OrderLine getOrderLine() {
160         return this.orderLine;
161     }
162 
163     /**
164      * Implements adding single element to a collection.
165      */
166     public void setOrderLine(OrderLine element) {
167         if (this.orderLine != element) { // prevent infinite loop
168 
169             if (this.orderLine != null) { // there is a previous link Y
170                 this.orderLine.z_internalRemoverecord((Record) this);
171             }
172 
173             this.orderLine = element; // set the field to the new value
174 
175             if (element != null) {
176                 // make the new link aware of this
177                 element.setRecord((Record) this);
178             }
179 
180         }
181     }
182 
183     /**
184      * This operation should NOT be used by clients. It implements the correct removal of an element
185      * in an association.
186      * 
187      * @param element
188      *            Element
189      */
190     public void z_internalRemoveorderLine(final OrderLine element) {
191         this.orderLine = null;
192     }
193 
194     /**
195      * Default no-argument constructor for RecordImplBase.
196      */
197     protected RecordImplBase() {
198 
199     }
200 
201     /**
202      * Minimal constructor for RecordImplBase.
203      * 
204      * @param asin2
205      *            (string)
206      * @param price2
207      *            (decimal)
208      */
209     public RecordImplBase(final String asin2, final float price2) {
210 
211         this.asin = asin2;
212         this.price = price2;
213 
214         validation.validate();
215     }
216 
217     /**
218      * 
219      * @return asin (String)
220      */
221     public String getAsin() {
222         return this.asin;
223     }
224 
225     /**
226      * 
227      * @return title (String)
228      */
229     public String getTitle() {
230         return this.title;
231     }
232 
233     /**
234      * 
235      * @return mediumCode (int)
236      */
237     public int getMediumCode() {
238         return this.mediumCode;
239     }
240 
241     /**
242      * 
243      * @return price (float)
244      */
245     public float getPrice() {
246         return this.price;
247     }
248 
249     /**
250      * 
251      * @return type (RecordType)
252      */
253     public RecordType getType() {
254         return this.type;
255     }
256 
257     /**
258      * @param asin
259      *            (String)
260      */
261     public void setAsin(final String asin) {
262         this.asin = asin;
263         validation.validate();
264     }
265 
266     /**
267      * @param title
268      *            (String)
269      */
270     public void setTitle(final String title) {
271         this.title = title;
272         validation.validate();
273     }
274 
275     /**
276      * @param mediumCode
277      *            (int)
278      */
279     public void setMediumCode(final int mediumCode) {
280         this.mediumCode = mediumCode;
281         validation.validate();
282     }
283 
284     /**
285      * @param price
286      *            (float)
287      */
288     public void setPrice(final float price) {
289         this.price = price;
290         validation.validate();
291     }
292 
293     /**
294      * @param type
295      *            (RecordType)
296      */
297     public void setType(final RecordType type) {
298         this.type = type;
299         validation.validate();
300     }
301 
302     /**
303      * Activate/deactivate validation for this business class. When set to active the validation
304      * will immediately be executed.
305      * 
306      * @param value
307      *            (boolean)
308      */
309     public void activateValidation(boolean value) {
310 
311         this.validation.setActive(value);
312         if (value) {
313             validation.validate();
314         }
315     }
316 
317 }