KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > interfaces > CustomerValue


1 /*
2  * Generated by XDoclet - Do not edit!
3  */

4 package test.interfaces;
5
6 /**
7  * Value object for Customer.
8  *
9  * Notice, this object is used to represent the state of an
10  * Customer object. This value object
11  * Is not connected to the database in any way, it is just a normal object used
12  * as a container for data from an EJB.
13  *
14  * @xdoclet-generated at 16-04-05
15  * @copyright The XDoclet Team
16  * @author XDoclet
17  * @version 1.2.3
18  */

19 public class CustomerValue
20    extends java.lang.Object JavaDoc
21    implements java.io.Serializable JavaDoc, java.lang.Cloneable JavaDoc
22 {
23
24    private float credit;
25    private boolean creditHasBeenSet = false;
26
27    private java.lang.String JavaDoc[][] array;
28    private boolean arrayHasBeenSet = false;
29
30    private byte[] image;
31    private boolean imageHasBeenSet = false;
32
33    private float tax;
34    private boolean taxHasBeenSet = false;
35
36    private java.lang.String JavaDoc id;
37    private boolean idHasBeenSet = false;
38
39    private java.lang.String JavaDoc name;
40    private boolean nameHasBeenSet = false;
41
42    private java.lang.String JavaDoc firstName;
43    private boolean firstNameHasBeenSet = false;
44
45    private java.lang.String JavaDoc phone;
46    private boolean phoneHasBeenSet = false;
47
48    private java.lang.String JavaDoc fax;
49    private boolean faxHasBeenSet = false;
50    private java.util.Collection JavaDoc AccountViews = wrapCollection(new java.util.ArrayList JavaDoc() );
51
52    private java.util.Collection JavaDoc ShippingAddressValues = wrapCollection(new java.util.ArrayList JavaDoc() );
53
54    private test.interfaces.CustomerPK primaryKey;
55
56    private int _version = 0;
57
58    public CustomerValue()
59    {
60       primaryKey = new test.interfaces.CustomerPK();
61    }
62
63    public CustomerValue( float credit,java.lang.String JavaDoc[][] array,byte[] image,float tax,java.lang.String JavaDoc id,java.lang.String JavaDoc name,java.lang.String JavaDoc firstName,java.lang.String JavaDoc phone,java.lang.String JavaDoc fax )
64    {
65        setCredit(credit);
66        setArray(array);
67        setImage(image);
68        setTax(tax);
69        setId(id);
70        setName(name);
71        setFirstName(firstName);
72        setPhone(phone);
73        setFax(fax);
74        primaryKey = new test.interfaces.CustomerPK(this.getId());
75    }
76
77    /**
78     * @deprecated use {@link #clone}
79     */

80    public CustomerValue( CustomerValue otherValue )
81    {
82       this.credit = otherValue.credit;
83       creditHasBeenSet = true;
84       this.array = otherValue.array;
85       arrayHasBeenSet = true;
86       this.image = otherValue.image;
87       imageHasBeenSet = true;
88       this.tax = otherValue.tax;
89       taxHasBeenSet = true;
90       this.id = otherValue.id;
91       idHasBeenSet = true;
92       this.name = otherValue.name;
93       nameHasBeenSet = true;
94       this.firstName = otherValue.firstName;
95       firstNameHasBeenSet = true;
96       this.phone = otherValue.phone;
97       phoneHasBeenSet = true;
98       this.fax = otherValue.fax;
99       faxHasBeenSet = true;
100       this.AccountViews.addAll(otherValue.AccountViews);
101       this.ShippingAddressValues.addAll(otherValue.ShippingAddressValues);
102
103       primaryKey = new test.interfaces.CustomerPK(this.getId());
104    }
105
106    public test.interfaces.CustomerPK getPrimaryKey()
107    {
108       return primaryKey;
109    }
110
111    public void setPrimaryKey( test.interfaces.CustomerPK primaryKey)
112    {
113       // it's also nice to update PK object - just in case
114
// somebody would ask for it later...
115
this.primaryKey = primaryKey;
116       setId( primaryKey.id );
117    }
118
119    public float getCredit()
120    {
121       return this.credit;
122    }
123
124    public void setCredit( float credit )
125    {
126       this.credit = credit;
127       creditHasBeenSet = true;
128
129    }
130
131    public boolean creditHasBeenSet(){
132       return creditHasBeenSet;
133    }
134    public java.lang.String JavaDoc[][] getArray()
135    {
136       return this.array;
137    }
138
139    private void setArray( java.lang.String JavaDoc[][] array )
140    {
141       this.array = array;
142       arrayHasBeenSet = true;
143
144    }
145
146    public byte[] getImage()
147    {
148       return this.image;
149    }
150
151    private void setImage( byte[] image )
152    {
153       this.image = image;
154       imageHasBeenSet = true;
155
156    }
157
158    public float getTax()
159    {
160       return this.tax;
161    }
162
163    private void setTax( float tax )
164    {
165       this.tax = tax;
166       taxHasBeenSet = true;
167
168    }
169
170    public java.lang.String JavaDoc getId()
171    {
172       return this.id;
173    }
174
175    public void setId( java.lang.String JavaDoc id )
176    {
177       this.id = id;
178       idHasBeenSet = true;
179
180       primaryKey.setId(id);
181    }
182
183    public boolean idHasBeenSet(){
184       return idHasBeenSet;
185    }
186    public java.lang.String JavaDoc getName()
187    {
188       return this.name;
189    }
190
191    public void setName( java.lang.String JavaDoc name )
192    {
193       this.name = name;
194       nameHasBeenSet = true;
195
196    }
197
198    public boolean nameHasBeenSet(){
199       return nameHasBeenSet;
200    }
201    public java.lang.String JavaDoc getFirstName()
202    {
203       return this.firstName;
204    }
205
206    public void setFirstName( java.lang.String JavaDoc firstName )
207    {
208       this.firstName = firstName;
209       firstNameHasBeenSet = true;
210
211    }
212
213    public boolean firstNameHasBeenSet(){
214       return firstNameHasBeenSet;
215    }
216    public java.lang.String JavaDoc getPhone()
217    {
218       return this.phone;
219    }
220
221    public void setPhone( java.lang.String JavaDoc phone )
222    {
223       this.phone = phone;
224       phoneHasBeenSet = true;
225
226    }
227
228    public boolean phoneHasBeenSet(){
229       return phoneHasBeenSet;
230    }
231    public java.lang.String JavaDoc getFax()
232    {
233       return this.fax;
234    }
235
236    public void setFax( java.lang.String JavaDoc fax )
237    {
238       this.fax = fax;
239       faxHasBeenSet = true;
240
241    }
242
243    public boolean faxHasBeenSet(){
244       return faxHasBeenSet;
245    }
246
247    protected java.util.Collection JavaDoc addedAccountViews = wrapCollection(new java.util.ArrayList JavaDoc());
248    protected java.util.Collection JavaDoc onceAddedAccountViews = wrapCollection(new java.util.ArrayList JavaDoc());
249    protected java.util.Collection JavaDoc removedAccountViews = wrapCollection(new java.util.ArrayList JavaDoc());
250    protected java.util.Collection JavaDoc updatedAccountViews = wrapCollection(new java.util.ArrayList JavaDoc());
251
252    /**
253     * Important: This method returns an unmodifiable collection.
254     */

255    public java.util.Collection JavaDoc getAddedAccountViews() { return wrapReadOnly(addedAccountViews); }
256
257    /**
258     * Important: This method returns an unmodifiable collection.
259     */

260     public java.util.Collection JavaDoc getOnceAddedAccountViews() { return wrapReadOnly(onceAddedAccountViews); }
261    /**
262     * Important: This method returns an unmodifiable collection.
263     */

264     public java.util.Collection JavaDoc getRemovedAccountViews() { return wrapReadOnly(removedAccountViews); }
265    /**
266     * Important: This method returns an unmodifiable collection.
267     */

268     public java.util.Collection JavaDoc getUpdatedAccountViews() { return wrapReadOnly(updatedAccountViews); }
269    /**
270     * Important: This method returns an unmodifiable collection.
271     */

272     public java.util.Collection JavaDoc getAccountViewCollection() { return wrapReadOnly(AccountViews); }
273
274    /**
275     * This will set the contents of the underlying collection to the contents of the
276     * given collection. This means that any unmodifiable collections given out will
277     * also change. The collections are guaranteed to be consistent, but not correct.
278     * In this case, it is possible to see a collection in the process of changing,
279     * it might appear to be empty for an instant, but it will behave correctly.
280     * Also, the update will be atomic with respect to the input collection
281     * if the input collection is a synchronized collection.
282     *
283     * This method has been deprecated, as it strains the imagination to conceive of
284     * a reason for outsiders to modify these collections, which are really for our
285     * own internal bookkeeping.
286     *
287     * @deprecated
288     */

289    public void setAddedAccountViews(java.util.Collection JavaDoc addedAccountViews)
290    {
291       //This operation is atomic if the input collection is synchronized.
292
java.util.List JavaDoc tempList = java.util.Arrays.asList(addedAccountViews.toArray());
293       this.addedAccountViews.clear();
294       this.addedAccountViews.addAll(tempList);
295    }
296
297    /**
298     * This will set the contents of the underlying collection to the contents of the
299     * given collection. This means that any unmodifiable collections given out will
300     * also change. The collections are guaranteed to be consistent, but not correct.
301     * In this case, it is possible to see a collection in the process of changing,
302     * it might appear to be empty for an instant, but it will behave correctly.
303     * Also, the update will be atomic with respect to the input collection
304     * if the input collection is a synchronized collection.
305     *
306     * This method has been deprecated, as it strains the imagination to conceive of
307     * a reason for outsiders to modify these collections, which are really for our
308     * own internal bookkeeping.
309     *
310     * @deprecated
311     */

312    public void setOnceAddedAccountViews(java.util.Collection JavaDoc onceAddedAccountViews)
313    {
314       //This operation is atomic if the input collection is synchronized.
315
java.util.List JavaDoc tempList = java.util.Arrays.asList(onceAddedAccountViews.toArray());
316       this.onceAddedAccountViews.clear();
317       this.onceAddedAccountViews.addAll(tempList);
318     }
319
320    /**
321     * This will set the contents of the underlying collection to the contents of the
322     * given collection. This means that any unmodifiable collections given out will
323     * also change. The collections are guaranteed to be consistent, but not correct.
324     * In this case, it is possible to see a collection in the process of changing,
325     * it might appear to be empty for an instant, but it will behave correctly.
326     * Also, the update will be atomic with respect to the input collection
327     * if the input collection is a synchronized collection.
328     *
329     * This method has been deprecated, as it strains the imagination to conceive of
330     * a reason for outsiders to modify these collections, which are really for our
331     * own internal bookkeeping.
332     *
333     * @deprecated
334     */

335    public void setRemovedAccountViews(java.util.Collection JavaDoc removedAccountViews)
336    {
337       //This operation is atomic if the input collection is synchronized.
338
java.util.List JavaDoc tempList = java.util.Arrays.asList(removedAccountViews.toArray());
339       this.removedAccountViews.clear();
340       this.removedAccountViews.addAll(tempList);
341    }
342
343    /**
344     * This will set the contents of the underlying collection to the contents of the
345     * given collection. This means that any unmodifiable collections given out will
346     * also change. The collections are guaranteed to be consistent, but not correct.
347     * In this case, it is possible to see a collection in the process of changing,
348     * it might appear to be empty for an instant, but it will behave correctly.
349     * Also, the update will be atomic with respect to the input collection
350     * if the input collection is a synchronized collection.
351     *
352     * This method has been deprecated, as it strains the imagination to conceive of
353     * a reason for outsiders to modify these collections, which are really for our
354     * own internal bookkeeping.
355     *
356     * @deprecated
357     */

358    public void setUpdatedAccountViews(java.util.Collection JavaDoc updatedAccountViews)
359    {
360       //This operation is atomic if the input collection is synchronized.
361
java.util.List JavaDoc tempList = java.util.Arrays.asList(updatedAccountViews.toArray());
362       this.updatedAccountViews.clear();
363       this.updatedAccountViews.addAll(tempList);
364    }
365
366    /**
367     * This method fetches the contents of the underlying collection as an Array.
368     * It is a relatively expensive operation, so use the collections if you can.
369     *
370     * This operation is atomic and threadsafe unless the synchronization type is "none".
371     *
372     * This operation is deprecated, as it is fairly expensive and should be discouraged.
373     *
374     * @deprecated
375     */

376    public test.interfaces.AccountValue[] getAccountViews()
377    {
378     return (test.interfaces.AccountValue[])this.AccountViews.toArray(new test.interfaces.AccountValue[AccountViews.size()]);
379    }
380
381    /**
382     * This method sets the contents of the given attribute to the contents of the
383     * given array.
384     *
385     * This operation is atomic and threadsafe unless the synchronization type is "none".
386     *
387     * This operation is deprecated, as it is fairly expensive and should be discouraged.
388     *
389     * @deprecated
390     */

391    public void setAccountViews(test.interfaces.AccountValue[] AccountViews)
392    {
393       this.AccountViews.clear();
394       for (int i=0; i < AccountViews.length; i++) {
395         this.AccountViews.add(AccountViews[i]);
396       }
397    }
398
399    public void clearAccountViews()
400    {
401       this.AccountViews.clear();
402    }
403
404    /**
405     * When we're adding an aggregate object, we check if it was previously removed, and
406     * if it was, we check if it was ever added. If the user adds an object, then removes
407     * it then adds it again, we keep the object in the added collection. If the user
408     * just removes an object (thas wasn't added in this session, just existed before) then
409     * adds it again, we assume the user is updating a current existing object, so it will
410     * end in the updated collection.
411     */

412    public void addAccountView(test.interfaces.AccountValue added)
413    {
414       this.AccountViews.add(added);
415
416       if (this.removedAccountViews.contains(added))
417       {
418         this.removedAccountViews.remove(added);
419         if (this.onceAddedAccountViews.contains(added))
420         {
421           if (! this.addedAccountViews.contains(added))
422             this.addedAccountViews.add(added);
423         }
424         else if (! this.updatedAccountViews.contains(added))
425         {
426             this.updatedAccountViews.add(added);
427         }
428       }
429       else
430       {
431         if (! this.onceAddedAccountViews.contains(added))
432           this.onceAddedAccountViews.add(added);
433         if (! this.addedAccountViews.contains(added))
434           this.addedAccountViews.add(added);
435       }
436    }
437
438    /**
439     * If we're removing an object that was previously added, we just remove it from
440     * the added collection and don't add it in the remove collection. The user has
441     * just given up on creating the object. If we're removing a previously updated
442     * object, we remove it from the updated collection, since it will be removed
443     * anyway.
444     */

445    public void removeAccountView(test.interfaces.AccountValue removed)
446    {
447       this.AccountViews.remove(removed);
448
449       if (this.addedAccountViews.contains(removed))
450         this.addedAccountViews.remove(removed);
451       else if (! this.removedAccountViews.contains(removed))
452         this.removedAccountViews.add(removed);
453
454       if (this.updatedAccountViews.contains(removed))
455         this.updatedAccountViews.remove(removed);
456    }
457
458    public void updateAccountView(test.interfaces.AccountValue updated)
459    {
460       if ( !this.updatedAccountViews.contains(updated) && !this.addedAccountViews.contains(updated))
461              this.updatedAccountViews.add(updated);
462
463       if (this.removedAccountViews.contains(updated))
464          this.removedAccountViews.remove(updated);
465    }
466
467    public void cleanAccountView(){
468     this.addedAccountViews.clear();
469         this.onceAddedAccountViews.clear();
470     this.removedAccountViews.clear();
471     this.updatedAccountViews.clear();
472    }
473
474    public void copyAccountViewsFrom(test.interfaces.CustomerValue from)
475    {
476         this.AccountViews.clear();
477         this.AccountViews.addAll(from.AccountViews);
478    }
479    protected java.util.Collection JavaDoc addedShippingAddressValues = wrapCollection(new java.util.ArrayList JavaDoc());
480    protected java.util.Collection JavaDoc onceAddedShippingAddressValues = wrapCollection(new java.util.ArrayList JavaDoc());
481    protected java.util.Collection JavaDoc removedShippingAddressValues = wrapCollection(new java.util.ArrayList JavaDoc());
482    protected java.util.Collection JavaDoc updatedShippingAddressValues = wrapCollection(new java.util.ArrayList JavaDoc());
483
484    /**
485     * Important: This method returns an unmodifiable collection.
486     */

487    public java.util.Collection JavaDoc getAddedShippingAddressValues() { return wrapReadOnly(addedShippingAddressValues); }
488
489    /**
490     * Important: This method returns an unmodifiable collection.
491     */

492     public java.util.Collection JavaDoc getOnceAddedShippingAddressValues() { return wrapReadOnly(onceAddedShippingAddressValues); }
493    /**
494     * Important: This method returns an unmodifiable collection.
495     */

496     public java.util.Collection JavaDoc getRemovedShippingAddressValues() { return wrapReadOnly(removedShippingAddressValues); }
497    /**
498     * Important: This method returns an unmodifiable collection.
499     */

500     public java.util.Collection JavaDoc getUpdatedShippingAddressValues() { return wrapReadOnly(updatedShippingAddressValues); }
501    /**
502     * Important: This method returns an unmodifiable collection.
503     */

504     public java.util.Collection JavaDoc getShippingAddressValueCollection() { return wrapReadOnly(ShippingAddressValues); }
505
506    /**
507     * This will set the contents of the underlying collection to the contents of the
508     * given collection. This means that any unmodifiable collections given out will
509     * also change. The collections are guaranteed to be consistent, but not correct.
510     * In this case, it is possible to see a collection in the process of changing,
511     * it might appear to be empty for an instant, but it will behave correctly.
512     * Also, the update will be atomic with respect to the input collection
513     * if the input collection is a synchronized collection.
514     *
515     * This method has been deprecated, as it strains the imagination to conceive of
516     * a reason for outsiders to modify these collections, which are really for our
517     * own internal bookkeeping.
518     *
519     * @deprecated
520     */

521    public void setAddedShippingAddressValues(java.util.Collection JavaDoc addedShippingAddressValues)
522    {
523       //This operation is atomic if the input collection is synchronized.
524
java.util.List JavaDoc tempList = java.util.Arrays.asList(addedShippingAddressValues.toArray());
525       this.addedShippingAddressValues.clear();
526       this.addedShippingAddressValues.addAll(tempList);
527    }
528
529    /**
530     * This will set the contents of the underlying collection to the contents of the
531     * given collection. This means that any unmodifiable collections given out will
532     * also change. The collections are guaranteed to be consistent, but not correct.
533     * In this case, it is possible to see a collection in the process of changing,
534     * it might appear to be empty for an instant, but it will behave correctly.
535     * Also, the update will be atomic with respect to the input collection
536     * if the input collection is a synchronized collection.
537     *
538     * This method has been deprecated, as it strains the imagination to conceive of
539     * a reason for outsiders to modify these collections, which are really for our
540     * own internal bookkeeping.
541     *
542     * @deprecated
543     */

544    public void setOnceAddedShippingAddressValues(java.util.Collection JavaDoc onceAddedShippingAddressValues)
545    {
546       //This operation is atomic if the input collection is synchronized.
547
java.util.List JavaDoc tempList = java.util.Arrays.asList(onceAddedShippingAddressValues.toArray());
548       this.onceAddedShippingAddressValues.clear();
549       this.onceAddedShippingAddressValues.addAll(tempList);
550     }
551
552    /**
553     * This will set the contents of the underlying collection to the contents of the
554     * given collection. This means that any unmodifiable collections given out will
555     * also change. The collections are guaranteed to be consistent, but not correct.
556     * In this case, it is possible to see a collection in the process of changing,
557     * it might appear to be empty for an instant, but it will behave correctly.
558     * Also, the update will be atomic with respect to the input collection
559     * if the input collection is a synchronized collection.
560     *
561     * This method has been deprecated, as it strains the imagination to conceive of
562     * a reason for outsiders to modify these collections, which are really for our
563     * own internal bookkeeping.
564     *
565     * @deprecated
566     */

567    public void setRemovedShippingAddressValues(java.util.Collection JavaDoc removedShippingAddressValues)
568    {
569       //This operation is atomic if the input collection is synchronized.
570
java.util.List JavaDoc tempList = java.util.Arrays.asList(removedShippingAddressValues.toArray());
571       this.removedShippingAddressValues.clear();
572       this.removedShippingAddressValues.addAll(tempList);
573    }
574
575    /**
576     * This will set the contents of the underlying collection to the contents of the
577     * given collection. This means that any unmodifiable collections given out will
578     * also change. The collections are guaranteed to be consistent, but not correct.
579     * In this case, it is possible to see a collection in the process of changing,
580     * it might appear to be empty for an instant, but it will behave correctly.
581     * Also, the update will be atomic with respect to the input collection
582     * if the input collection is a synchronized collection.
583     *
584     * This method has been deprecated, as it strains the imagination to conceive of
585     * a reason for outsiders to modify these collections, which are really for our
586     * own internal bookkeeping.
587     *
588     * @deprecated
589     */

590    public void setUpdatedShippingAddressValues(java.util.Collection JavaDoc updatedShippingAddressValues)
591    {
592       //This operation is atomic if the input collection is synchronized.
593
java.util.List JavaDoc tempList = java.util.Arrays.asList(updatedShippingAddressValues.toArray());
594       this.updatedShippingAddressValues.clear();
595       this.updatedShippingAddressValues.addAll(tempList);
596    }
597
598    /**
599     * This method fetches the contents of the underlying collection as an Array.
600     * It is a relatively expensive operation, so use the collections if you can.
601     *
602     * This operation is atomic and threadsafe unless the synchronization type is "none".
603     *
604     * This operation is deprecated, as it is fairly expensive and should be discouraged.
605     *
606     * @deprecated
607     */

608    public test.interfaces.AddressValue[] getShippingAddressValues()
609    {
610     return (test.interfaces.AddressValue[])this.ShippingAddressValues.toArray(new test.interfaces.AddressValue[ShippingAddressValues.size()]);
611    }
612
613    /**
614     * This method sets the contents of the given attribute to the contents of the
615     * given array.
616     *
617     * This operation is atomic and threadsafe unless the synchronization type is "none".
618     *
619     * This operation is deprecated, as it is fairly expensive and should be discouraged.
620     *
621     * @deprecated
622     */

623    public void setShippingAddressValues(test.interfaces.AddressValue[] ShippingAddressValues)
624    {
625       this.ShippingAddressValues.clear();
626       for (int i=0; i < ShippingAddressValues.length; i++) {
627         this.ShippingAddressValues.add(ShippingAddressValues[i]);
628       }
629    }
630
631    public void clearShippingAddressValues()
632    {
633       this.ShippingAddressValues.clear();
634    }
635
636    /**
637     * When we're adding an aggregate object, we check if it was previously removed, and
638     * if it was, we check if it was ever added. If the user adds an object, then removes
639     * it then adds it again, we keep the object in the added collection. If the user
640     * just removes an object (thas wasn't added in this session, just existed before) then
641     * adds it again, we assume the user is updating a current existing object, so it will
642     * end in the updated collection.
643     */

644    public void addShippingAddressValue(test.interfaces.AddressValue added)
645    {
646       this.ShippingAddressValues.add(added);
647
648       if (this.removedShippingAddressValues.contains(added))
649       {
650         this.removedShippingAddressValues.remove(added);
651         if (this.onceAddedShippingAddressValues.contains(added))
652         {
653           if (! this.addedShippingAddressValues.contains(added))
654             this.addedShippingAddressValues.add(added);
655         }
656         else if (! this.updatedShippingAddressValues.contains(added))
657         {
658             this.updatedShippingAddressValues.add(added);
659         }
660       }
661       else
662       {
663         if (! this.onceAddedShippingAddressValues.contains(added))
664           this.onceAddedShippingAddressValues.add(added);
665         if (! this.addedShippingAddressValues.contains(added))
666           this.addedShippingAddressValues.add(added);
667       }
668    }
669
670    /**
671     * If we're removing an object that was previously added, we just remove it from
672     * the added collection and don't add it in the remove collection. The user has
673     * just given up on creating the object. If we're removing a previously updated
674     * object, we remove it from the updated collection, since it will be removed
675     * anyway.
676     */

677    public void removeShippingAddressValue(test.interfaces.AddressValue removed)
678    {
679       this.ShippingAddressValues.remove(removed);
680
681       if (this.addedShippingAddressValues.contains(removed))
682         this.addedShippingAddressValues.remove(removed);
683       else if (! this.removedShippingAddressValues.contains(removed))
684         this.removedShippingAddressValues.add(removed);
685
686       if (this.updatedShippingAddressValues.contains(removed))
687         this.updatedShippingAddressValues.remove(removed);
688    }
689
690    public void updateShippingAddressValue(test.interfaces.AddressValue updated)
691    {
692       if ( !this.updatedShippingAddressValues.contains(updated) && !this.addedShippingAddressValues.contains(updated))
693              this.updatedShippingAddressValues.add(updated);
694
695       if (this.removedShippingAddressValues.contains(updated))
696          this.removedShippingAddressValues.remove(updated);
697    }
698
699    public void cleanShippingAddressValue(){
700     this.addedShippingAddressValues.clear();
701         this.onceAddedShippingAddressValues.clear();
702     this.removedShippingAddressValues.clear();
703     this.updatedShippingAddressValues.clear();
704    }
705
706    public void copyShippingAddressValuesFrom(test.interfaces.CustomerValue from)
707    {
708         this.ShippingAddressValues.clear();
709         this.ShippingAddressValues.addAll(from.ShippingAddressValues);
710    }
711
712    public int getVersion()
713    {
714       return _version;
715    }
716    public void setVersion(int version)
717    {
718       this._version = version;
719    }
720
721    public String JavaDoc toString()
722    {
723       StringBuffer JavaDoc str = new StringBuffer JavaDoc("{");
724
725       str.append("credit=" + getCredit() + " " + "array=" + getArray() + " " + "image=" + getImage() + " " + "tax=" + getTax() + " " + "id=" + getId() + " " + "name=" + getName() + " " + "firstName=" + getFirstName() + " " + "phone=" + getPhone() + " " + "fax=" + getFax());
726       str.append(",version=");
727       str.append(_version);
728       str.append('}');
729
730       return(str.toString());
731    }
732
733    /**
734     * A Value Object has an identity if the attributes making its Primary Key have all been set. An object without identity is never equal to any other object.
735     *
736     * @return true if this instance has an identity.
737     */

738    protected boolean hasIdentity()
739    {
740       boolean ret = true;
741       ret = ret && idHasBeenSet;
742       return ret;
743    }
744
745    /**
746     *
747     * @deprecated use {@link #equals}
748     */

749    public boolean isIdentical(Object JavaDoc other)
750    {
751           if (other instanceof CustomerValue)
752           {
753                  CustomerValue that = (CustomerValue) other;
754                  boolean lEquals = true;
755                  lEquals = lEquals && this.credit == that.credit;
756                  if( this.array == null )
757                  {
758                         lEquals = lEquals && ( that.array == null );
759                  }
760                  else
761                  {
762                         lEquals = lEquals && this.array.equals( that.array );
763                  }
764                  lEquals = lEquals && this.image == that.image;
765                  lEquals = lEquals && this.tax == that.tax;
766                  if( this.name == null )
767                  {
768                         lEquals = lEquals && ( that.name == null );
769                  }
770                  else
771                  {
772                         lEquals = lEquals && this.name.equals( that.name );
773                  }
774                  if( this.firstName == null )
775                  {
776                         lEquals = lEquals && ( that.firstName == null );
777                  }
778                  else
779                  {
780                         lEquals = lEquals && this.firstName.equals( that.firstName );
781                  }
782                  if( this.phone == null )
783                  {
784                         lEquals = lEquals && ( that.phone == null );
785                  }
786                  else
787                  {
788                         lEquals = lEquals && this.phone.equals( that.phone );
789                  }
790                  if( this.fax == null )
791                  {
792                         lEquals = lEquals && ( that.fax == null );
793                  }
794                  else
795                  {
796                         lEquals = lEquals && this.fax.equals( that.fax );
797                  }
798                  if( this.getAccountViews() == null )
799                  {
800                         lEquals = lEquals && ( that.getAccountViews() == null );
801                  }
802                  else
803                  {
804                         lEquals = lEquals && java.util.Arrays.equals(this.getAccountViews() , that.getAccountViews()) ;
805                  }
806                  if( this.getShippingAddressValues() == null )
807                  {
808                         lEquals = lEquals && ( that.getShippingAddressValues() == null );
809                  }
810                  else
811                  {
812                         lEquals = lEquals && java.util.Arrays.equals(this.getShippingAddressValues() , that.getShippingAddressValues()) ;
813                  }
814
815                  return lEquals;
816           }
817           else
818           {
819                  return false;
820           }
821    }
822
823     public boolean equals(Object JavaDoc other) {
824
825         //If it's not the correct type, clearly it isn't equal to this.
826
if (!(other instanceof CustomerValue)) {
827             return false;
828         }
829
830         return equals((CustomerValue) other);
831     }
832
833     /**
834      * This class is not using strict ordering. This means that the object is not Comparable, and
835      * each check for equality will test all members for equality. We do not check collections for
836      * equality however, so you would be wise to not use this if you have collection typed EJB References.
837      */

838     public boolean equals(CustomerValue that) {
839
840         //try to get lucky.
841
if (this == that) {
842             return true;
843         }
844         //this clearly isn't null.
845
if(null == that) {
846             return false;
847         }
848
849         if(this.credit != that.credit) {
850             return false;
851         }
852
853         if(this.array != that.array) {
854
855             if( this.array == null || that.array == null ) {
856                 return false;
857             }
858
859             if(!this.array.equals(that.array)) {
860                 return false;
861             }
862
863         }
864
865         if(!java.util.Arrays.equals(this.image, that.image)) {
866             return false;
867         }
868
869         if(this.tax != that.tax) {
870             return false;
871         }
872
873         if(this.id != that.id) {
874
875             if( this.id == null || that.id == null ) {
876                 return false;
877             }
878
879             if(!this.id.equals(that.id)) {
880                 return false;
881             }
882
883         }
884
885         if(this.name != that.name) {
886
887             if( this.name == null || that.name == null ) {
888                 return false;
889             }
890
891             if(!this.name.equals(that.name)) {
892                 return false;
893             }
894
895         }
896
897         if(this.firstName != that.firstName) {
898
899             if( this.firstName == null || that.firstName == null ) {
900                 return false;
901             }
902
903             if(!this.firstName.equals(that.firstName)) {
904                 return false;
905             }
906
907         }
908
909         if(this.phone != that.phone) {
910
911             if( this.phone == null || that.phone == null ) {
912                 return false;
913             }
914
915             if(!this.phone.equals(that.phone)) {
916                 return false;
917             }
918
919         }
920
921         if(this.fax != that.fax) {
922
923             if( this.fax == null || that.fax == null ) {
924                 return false;
925             }
926
927             if(!this.fax.equals(that.fax)) {
928                 return false;
929             }
930
931         }
932
933          // AccountView is an aggregate type. We won't compare the contents of collections (for performance reasons), so note
934
//that these will not be considered when calculating equality or hash codes. You would be wise to use strict ordering if possible, as that makes
935
//for more tractable behavior.
936
// ShippingAddressValue is an aggregate type. We won't compare the contents of collections (for performance reasons), so note
937
//that these will not be considered when calculating equality or hash codes. You would be wise to use strict ordering if possible, as that makes
938
//for more tractable behavior.
939

940         return true;
941
942     }
943
944     public Object JavaDoc clone() throws java.lang.CloneNotSupportedException JavaDoc {
945         CustomerValue other = (CustomerValue) super.clone();
946
947         {
948         //Anonymous block to protect from namespace collisions.
949
java.util.Collection JavaDoc tempData;
950         tempData = wrapCollection(new java.util.ArrayList JavaDoc());
951         tempData.addAll(this.AccountViews);
952         this.AccountViews = tempData;
953         tempData = wrapCollection(new java.util.ArrayList JavaDoc());
954         tempData.addAll(this.addedAccountViews);
955         this.addedAccountViews = tempData;
956         tempData = wrapCollection(new java.util.ArrayList JavaDoc());
957         tempData.addAll(this.onceAddedAccountViews);
958         this.onceAddedAccountViews = tempData;
959         tempData = wrapCollection(new java.util.ArrayList JavaDoc());
960         tempData.addAll(this.removedAccountViews);
961         this.removedAccountViews = tempData;
962         tempData = wrapCollection(new java.util.ArrayList JavaDoc());
963         tempData.addAll(this.updatedAccountViews);
964         this.updatedAccountViews = tempData;
965         }
966         {
967         //Anonymous block to protect from namespace collisions.
968
java.util.Collection JavaDoc tempData;
969         tempData = wrapCollection(new java.util.ArrayList JavaDoc());
970         tempData.addAll(this.ShippingAddressValues);
971         this.ShippingAddressValues = tempData;
972         tempData = wrapCollection(new java.util.ArrayList JavaDoc());
973         tempData.addAll(this.addedShippingAddressValues);
974         this.addedShippingAddressValues = tempData;
975         tempData = wrapCollection(new java.util.ArrayList JavaDoc());
976         tempData.addAll(this.onceAddedShippingAddressValues);
977         this.onceAddedShippingAddressValues = tempData;
978         tempData = wrapCollection(new java.util.ArrayList JavaDoc());
979         tempData.addAll(this.removedShippingAddressValues);
980         this.removedShippingAddressValues = tempData;
981         tempData = wrapCollection(new java.util.ArrayList JavaDoc());
982         tempData.addAll(this.updatedShippingAddressValues);
983         this.updatedShippingAddressValues = tempData;
984         }
985
986         return other;
987     }
988
989     public ReadOnlyCustomerValue getReadOnlyCustomerValue() {
990         return new ReadOnlyCustomerValue();
991     }
992
993     public int hashCode(){
994       int result = 17;
995       result = 37*result + Float.floatToIntBits(credit);
996
997       result = 37*result + ((this.array != null) ? this.array.hashCode() : 0);
998
999       if (image != null) {
1000        for (int i=0; i<image.length; i++)
1001        {
1002          long l = image[i];
1003          result = 37*result + (int)(l^(l>>>32));
1004        }
1005      }
1006
1007      result = 37*result + Float.floatToIntBits(tax);
1008
1009      result = 37*result + ((this.id != null) ? this.id.hashCode() : 0);
1010
1011      result = 37*result + ((this.name != null) ? this.name.hashCode() : 0);
1012
1013      result = 37*result + ((this.firstName != null) ? this.firstName.hashCode() : 0);
1014
1015      result = 37*result + ((this.phone != null) ? this.phone.hashCode() : 0);
1016
1017      result = 37*result + ((this.fax != null) ? this.fax.hashCode() : 0);
1018
1019      // AccountView is an aggregate type. We won't compare the contents of collections (for performance reasons), so note
1020
//that these will not be considered when calculating equality or hash codes. You would be wise to use strict ordering if possible, as that makes
1021
//for more tractable behavior.
1022
// ShippingAddressValue is an aggregate type. We won't compare the contents of collections (for performance reasons), so note
1023
//that these will not be considered when calculating equality or hash codes. You would be wise to use strict ordering if possible, as that makes
1024
//for more tractable behavior.
1025

1026      return result;
1027    }
1028
1029    /**
1030     * Covariant function so the compiler can choose the proper one at compile time,
1031     * eliminates the need for XDoclet to really understand compiletime typing.
1032     *
1033     * Read only collections need to be synchronized. Once we start giving out handles
1034     * to these collections, they'll be used in other threads sooner or later.
1035     */

1036    private static java.util.Collection JavaDoc wrapCollection(java.util.Collection JavaDoc input) {
1037        return java.util.Collections.synchronizedCollection(input);
1038    }
1039    /**
1040     * Covariant function so the compiler can choose the proper one at compile time,
1041     * eliminates the need for XDoclet to really understand compiletime typing.
1042     *
1043     * Read only collections need to be synchronized. Once we start giving out handles
1044     * to these collections, they'll be used in other threads sooner or later.
1045     */

1046    private static java.util.Set JavaDoc wrapCollection(java.util.Set JavaDoc input) {
1047        return java.util.Collections.synchronizedSet(input);
1048    }
1049    /**
1050     * Covariant function. This is used in covariant form so that the compiler
1051     * can do some of our conditional branches for us. If I made these functions
1052     * have different names, then XDoclet would have to choose between them based on
1053     * compiletime types, that wouldn't be easy.
1054     */

1055    private static java.util.Collection JavaDoc wrapReadOnly(java.util.Collection JavaDoc input) {
1056        return java.util.Collections.unmodifiableCollection(input);
1057    }
1058    /**
1059     * Covariant function. This is used in covariant form so that the compiler
1060     * can do some of our conditional branches for us. If I made these functions
1061     * have different names, then XDoclet would have to choose between them based on
1062     * compiletime types, that wouldn't be easy.
1063     */

1064    private static java.util.Set JavaDoc wrapReadOnly(java.util.Set JavaDoc input) {
1065        return java.util.Collections.unmodifiableSet(input);
1066    }
1067
1068    private final class ReadOnlyCustomerValue
1069    implements java.lang.Cloneable JavaDoc, java.io.Serializable JavaDoc
1070    {
1071        private CustomerValue underlying() {
1072            return CustomerValue.this;
1073        }
1074
1075       public float getCredit() {
1076              return underlying().credit;
1077       }
1078
1079       public java.lang.String JavaDoc[][] getArray() {
1080              return underlying().array;
1081       }
1082
1083       public byte[] getImage() {
1084              return underlying().image;
1085       }
1086
1087       public float getTax() {
1088              return underlying().tax;
1089       }
1090
1091       public java.lang.String JavaDoc getId() {
1092              return underlying().id;
1093       }
1094
1095       public java.lang.String JavaDoc getName() {
1096              return underlying().name;
1097       }
1098
1099       public java.lang.String JavaDoc getFirstName() {
1100              return underlying().firstName;
1101       }
1102
1103       public java.lang.String JavaDoc getPhone() {
1104              return underlying().phone;
1105       }
1106
1107       public java.lang.String JavaDoc getFax() {
1108              return underlying().fax;
1109       }
1110
1111       public java.util.Collection JavaDoc getAddedAccountViews() {
1112            return underlying().getAddedAccountViews();
1113       }
1114       public java.util.Collection JavaDoc getOnceAddedAccountViews() {
1115            return underlying().getOnceAddedAccountViews();
1116       }
1117       public java.util.Collection JavaDoc getRemovedAccountViews() {
1118            return underlying().getRemovedAccountViews();
1119       }
1120       public java.util.Collection JavaDoc getUpdatedAccountViews() {
1121            return underlying().getUpdatedAccountViews();
1122       }
1123       public java.util.Collection JavaDoc getAccountViewCollection() {
1124            return underlying().getAccountViewCollection();
1125       }
1126       public java.util.Collection JavaDoc getAddedShippingAddressValues() {
1127            return underlying().getAddedShippingAddressValues();
1128       }
1129       public java.util.Collection JavaDoc getOnceAddedShippingAddressValues() {
1130            return underlying().getOnceAddedShippingAddressValues();
1131       }
1132       public java.util.Collection JavaDoc getRemovedShippingAddressValues() {
1133            return underlying().getRemovedShippingAddressValues();
1134       }
1135       public java.util.Collection JavaDoc getUpdatedShippingAddressValues() {
1136            return underlying().getUpdatedShippingAddressValues();
1137       }
1138       public java.util.Collection JavaDoc getShippingAddressValueCollection() {
1139            return underlying().getShippingAddressValueCollection();
1140       }
1141
1142        public int hashCode() {
1143            return 101 * underlying().hashCode();
1144        }
1145
1146        public boolean equals(Object JavaDoc o) {
1147            if(o instanceof ReadOnlyCustomerValue) {
1148                return this.equals((ReadOnlyCustomerValue) o);
1149            }
1150            return false;
1151        }
1152
1153        public boolean equals(ReadOnlyCustomerValue that) {
1154            if(null == that) {
1155                return false;
1156            }
1157
1158            return this.underlying().equals(that.underlying());
1159        }
1160
1161    }
1162
1163}
1164
Popular Tags