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   import org.mod4j.runtime.validation.MaxValueValidator;
9   import org.mod4j.runtime.validation.MinValueValidator;
10  
11  /**
12   * 
13   * 
14   * @author Generated by Mod4j BusinessDomain DSL
15   */
16  
17  @SuppressWarnings("serial")
18  public abstract class OrderLineImplBase implements java.io.Serializable {
19  
20      /**
21       * validation : Responsible for validating attribute constraints and businessrules for this
22       * business class.
23       * 
24       */
25      protected BusinessRuleValidationSupport validation = new BusinessRuleValidationSupport(this);
26  
27      /**
28       * id: The identifier of this object.
29       */
30      private long id;
31  
32      @SuppressWarnings("unused")
33      private int version = -1;
34  
35      /**
36       * 
37       * @return id (Long) The identifier of this object.
38       */
39      public Long getId() {
40          return this.id;
41      }
42  
43      /**
44       * lineNumber:
45       */
46      private int lineNumber;
47  
48      public static final int LINENUMBER_MINVALUE = 1;
49  
50      public static final int LINENUMBER_MAXVALUE = 50;
51  
52      /**
53       * description:
54       */
55      private String description;
56  
57      /**
58       * lineAmount:
59       */
60      private float lineAmount;
61  
62      /**
63       * record: One 2 One bidirectional: An ordelrine contains a record
64       */
65      private Record record;
66  
67      /**
68       * @return record (Set<Record>)
69       */
70      public Record getRecord() {
71          return this.record;
72      }
73  
74      /**
75       * Implements adding single element to a collection
76       */
77      public void setRecord(Record element) {
78          if (this.record != element) { // prevent infinite loop
79  
80              if (this.record != null) { // there is a previous link X
81                  this.record.z_internalRemoveorderLine((OrderLine) this);
82              }
83  
84              this.record = element; // set the field to the new value
85  
86              if (element != null) {
87                  // make the new link aware of this
88                  element.setOrderLine((OrderLine) this);
89              }
90  
91          }
92      }
93  
94      /**
95       * This operation should NOT be used by clients. It implements the correct setting of an element
96       * in an association.
97       * 
98       * @param element
99       */
100     public void z_internalSetrecord(Record element) {
101         this.record = null;
102     }
103 
104     /**
105      * This operation should NOT be used by clients. It implements the correct removal of an element
106      * in an association.
107      * 
108      * @param element
109      */
110     public void z_internalRemoverecord(Record element) {
111         this.record = null;
112     }
113 
114     /**
115      * Default no-argument constructor for OrderLineImplBase
116      */
117     protected OrderLineImplBase() {
118 
119     }
120 
121     /**
122      * Minimal constructor for OrderLineImplBase
123      * 
124      * @param lineNumber
125      *            (integer)
126      * @param description
127      *            (string)
128      * @param lineAmount
129      *            (decimal)
130      */
131     public OrderLineImplBase(int lineNumber, String description, float lineAmount) {
132 
133         this.lineNumber = lineNumber;
134         this.description = description;
135         this.lineAmount = lineAmount;
136 
137         validation.addValidator(new MinValueValidator(OrderLine.class, "lineNumber",
138                 LINENUMBER_MINVALUE));
139 
140         validation.addValidator(new MaxValueValidator(OrderLine.class, "lineNumber",
141                 LINENUMBER_MAXVALUE));
142 
143         validation.validate();
144     }
145 
146     /**
147      * 
148      * @return lineNumber (int)
149      */
150     public int getLineNumber() {
151         return this.lineNumber;
152     }
153 
154     /**
155      * 
156      * @return description (String)
157      */
158     public String getDescription() {
159         return this.description;
160     }
161 
162     /**
163      * 
164      * @return lineAmount (float)
165      */
166     public float getLineAmount() {
167         return this.lineAmount;
168     }
169 
170     /**
171      * @param lineNumber
172      *            (int)
173      */
174     public void setLineNumber(final int lineNumber) {
175         this.lineNumber = lineNumber;
176         validation.validate();
177     }
178 
179     /**
180      * @param description
181      *            (String)
182      */
183     public void setDescription(final String description) {
184         this.description = description;
185         validation.validate();
186     }
187 
188     /**
189      * @param lineAmount
190      *            (float)
191      */
192     public void setLineAmount(final float lineAmount) {
193         this.lineAmount = lineAmount;
194         validation.validate();
195     }
196 
197     /**
198      * Activate/deactivate validation for this business class. When set to active the validation
199      * will immediately be executed.
200      * 
201      * @param value
202      *            (boolean)
203      */
204     public void activateValidation(final boolean value) {
205 
206         this.validation.setActive(value);
207         if (value) {
208             validation.validate();
209         }
210     }
211 
212 }