1
2
3
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
15
16
17 @SuppressWarnings("serial")
18 public abstract class OrderLineImplBase implements java.io.Serializable {
19
20
21
22
23
24
25 protected BusinessRuleValidationSupport validation = new BusinessRuleValidationSupport(this);
26
27
28
29
30 private long id;
31
32 @SuppressWarnings("unused")
33 private int version = -1;
34
35
36
37
38
39 public Long getId() {
40 return this.id;
41 }
42
43
44
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
54
55 private String description;
56
57
58
59
60 private float lineAmount;
61
62
63
64
65 private Record record;
66
67
68
69
70 public Record getRecord() {
71 return this.record;
72 }
73
74
75
76
77 public void setRecord(Record element) {
78 if (this.record != element) {
79
80 if (this.record != null) {
81 this.record.z_internalRemoveorderLine((OrderLine) this);
82 }
83
84 this.record = element;
85
86 if (element != null) {
87
88 element.setOrderLine((OrderLine) this);
89 }
90
91 }
92 }
93
94
95
96
97
98
99
100 public void z_internalSetrecord(Record element) {
101 this.record = null;
102 }
103
104
105
106
107
108
109
110 public void z_internalRemoverecord(Record element) {
111 this.record = null;
112 }
113
114
115
116
117 protected OrderLineImplBase() {
118
119 }
120
121
122
123
124
125
126
127
128
129
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
149
150 public int getLineNumber() {
151 return this.lineNumber;
152 }
153
154
155
156
157
158 public String getDescription() {
159 return this.description;
160 }
161
162
163
164
165
166 public float getLineAmount() {
167 return this.lineAmount;
168 }
169
170
171
172
173
174 public void setLineNumber(final int lineNumber) {
175 this.lineNumber = lineNumber;
176 validation.validate();
177 }
178
179
180
181
182
183 public void setDescription(final String description) {
184 this.description = description;
185 validation.validate();
186 }
187
188
189
190
191
192 public void setLineAmount(final float lineAmount) {
193 this.lineAmount = lineAmount;
194 validation.validate();
195 }
196
197
198
199
200
201
202
203
204 public void activateValidation(final boolean value) {
205
206 this.validation.setActive(value);
207 if (value) {
208 validation.validate();
209 }
210 }
211
212 }