1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.jdtaus.banking.dtaus;
22
23 import java.io.Serializable;
24 import java.math.BigInteger;
25 import java.util.Arrays;
26 import java.util.Currency;
27 import org.jdtaus.banking.AlphaNumericText27;
28 import org.jdtaus.banking.Bankleitzahl;
29 import org.jdtaus.banking.Kontonummer;
30 import org.jdtaus.banking.Referenznummer11;
31 import org.jdtaus.banking.Textschluessel;
32
33
34
35
36
37
38
39 public class Transaction implements Cloneable, Serializable
40 {
41
42
43 public static final String PROP_TYPE = "org.jdtaus.banking.dtaus.Transaction.PROP_TYPE";
44
45
46 public static final String PROP_AMOUNT = "org.jdtaus.banking.dtaus.Transaction.PROP_AMOUNT";
47
48
49 public static final String PROP_REFERENCE = "org.jdtaus.banking.dtaus.Transaction.PROP_REFERENCE";
50
51
52 public static final String PROP_DESCRIPTIONS = "org.jdtaus.banking.dtaus.Transaction.PROP_DESCRIPTIONS";
53
54
55 public static final String PROP_PRIMARYBANK = "org.jdtaus.banking.dtaus.Transaction.PROP_PRIMARYBANK";
56
57
58 public static final String PROP_EXECUTIVEACCOUNT = "org.jdtaus.banking.dtaus.Transaction.PROP_EXECUTIVEACCOUNT";
59
60
61 public static final String PROP_EXECUTIVEBANK = "org.jdtaus.banking.dtaus.Transaction.PROP_EXECUTIVEBANK";
62
63
64 public static final String PROP_EXECUTIVENAME = "org.jdtaus.banking.dtaus.Transaction.PROP_EXECUTIVENAME";
65
66
67 public static final String PROP_EXECUTIVEEXT = "org.jdtaus.banking.dtaus.Transaction.PROP_EXECUTIVEEXT";
68
69
70 public static final String PROP_TARGETACCOUNT = "org.jdtaus.banking.dtaus.Transaction.PROP_TARGETACCOUNT";
71
72
73 public static final String PROP_TARGETBANK = "org.jdtaus.banking.dtaus.Transaction.PROP_TARGETBANK";
74
75
76 public static final String PROP_TARGETNAME = "org.jdtaus.banking.dtaus.Transaction.PROP_TARGETNAME";
77
78
79 public static final String PROP_TARGETEXT = "org.jdtaus.banking.dtaus.Transaction.PROP_TARGETEXT";
80
81
82 public static final String PROP_CURRENCY = "org.jdtaus.banking.dtaus.Transaction.PROP_CURRENCY";
83
84
85 private static final long serialVersionUID = 1450133285078489771L;
86
87
88
89
90
91 private Textschluessel type;
92
93
94
95
96
97 private BigInteger amount;
98
99
100
101
102
103 private Currency currency;
104
105
106
107
108
109 private Referenznummer11 reference;
110
111
112
113
114
115 private AlphaNumericText27[] descriptions;
116
117
118
119
120
121 private Bankleitzahl primaryBank;
122
123
124
125
126
127 private Kontonummer executiveAccount;
128
129
130
131
132
133 private Bankleitzahl executiveBank;
134
135
136
137
138
139 private AlphaNumericText27 executiveName;
140
141
142
143
144
145 private AlphaNumericText27 executiveExt;
146
147
148
149
150
151 private Kontonummer targetAccount;
152
153
154
155
156
157 private Bankleitzahl targetBank;
158
159
160
161
162
163 private AlphaNumericText27 targetName;
164
165
166
167
168
169 private AlphaNumericText27 targetExt;
170
171
172 private transient int hashCode = NO_HASHCODE;
173 private static final int NO_HASHCODE = Integer.MIN_VALUE;
174
175
176 public Transaction()
177 {
178 super();
179 }
180
181
182
183
184
185
186 public Textschluessel getType()
187 {
188 return this.type;
189 }
190
191
192
193
194
195
196 public void setType( final Textschluessel value )
197 {
198 this.type = value;
199 this.hashCode = NO_HASHCODE;
200 }
201
202
203
204
205
206
207 public BigInteger getAmount()
208 {
209 return this.amount;
210 }
211
212
213
214
215
216
217 public void setAmount( final BigInteger value )
218 {
219 this.amount = value;
220 this.hashCode = NO_HASHCODE;
221 }
222
223
224
225
226
227
228 public Currency getCurrency()
229 {
230 return this.currency;
231 }
232
233
234
235
236
237
238 public void setCurrency( final Currency value )
239 {
240 this.currency = value;
241 this.hashCode = NO_HASHCODE;
242 }
243
244
245
246
247
248
249 public Referenznummer11 getReference()
250 {
251 return this.reference;
252 }
253
254
255
256
257
258
259 public void setReference( final Referenznummer11 value )
260 {
261 this.reference = value;
262 this.hashCode = NO_HASHCODE;
263 }
264
265
266
267
268
269
270 public AlphaNumericText27[] getDescriptions()
271 {
272 if ( this.descriptions == null )
273 {
274 this.descriptions = new AlphaNumericText27[ 0 ];
275 this.hashCode = NO_HASHCODE;
276 }
277
278 return (AlphaNumericText27[]) this.descriptions.clone();
279 }
280
281
282
283
284
285
286 public void setDescriptions( final AlphaNumericText27[] value )
287 {
288 this.descriptions = value != null ? (AlphaNumericText27[]) value.clone() : null;
289 this.hashCode = NO_HASHCODE;
290 }
291
292
293
294
295
296
297 public Bankleitzahl getPrimaryBank()
298 {
299 return this.primaryBank;
300 }
301
302
303
304
305
306
307 public void setPrimaryBank( final Bankleitzahl value )
308 {
309 this.primaryBank = value;
310 this.hashCode = NO_HASHCODE;
311 }
312
313
314
315
316
317
318 public Kontonummer getExecutiveAccount()
319 {
320 return this.executiveAccount;
321 }
322
323
324
325
326
327
328 public void setExecutiveAccount( final Kontonummer value )
329 {
330 this.executiveAccount = value;
331 this.hashCode = NO_HASHCODE;
332 }
333
334
335
336
337
338
339 public Bankleitzahl getExecutiveBank()
340 {
341 return this.executiveBank;
342 }
343
344
345
346
347
348
349 public void setExecutiveBank( final Bankleitzahl value )
350 {
351 this.executiveBank = value;
352 this.hashCode = NO_HASHCODE;
353 }
354
355
356
357
358
359
360 public AlphaNumericText27 getExecutiveName()
361 {
362 return this.executiveName;
363 }
364
365
366
367
368
369
370 public void setExecutiveName( final AlphaNumericText27 value )
371 {
372 this.executiveName = value;
373 this.hashCode = NO_HASHCODE;
374 }
375
376
377
378
379
380
381 public AlphaNumericText27 getExecutiveExt()
382 {
383 return this.executiveExt;
384 }
385
386
387
388
389
390
391 public void setExecutiveExt( final AlphaNumericText27 value )
392 {
393 this.executiveExt = value;
394 this.hashCode = NO_HASHCODE;
395 }
396
397
398
399
400
401
402 public Kontonummer getTargetAccount()
403 {
404 return this.targetAccount;
405 }
406
407
408
409
410
411
412 public void setTargetAccount( final Kontonummer value )
413 {
414 this.targetAccount = value;
415 this.hashCode = NO_HASHCODE;
416 }
417
418
419
420
421
422
423 public Bankleitzahl getTargetBank()
424 {
425 return this.targetBank;
426 }
427
428
429
430
431
432
433 public void setTargetBank( final Bankleitzahl value )
434 {
435 this.targetBank = value;
436 this.hashCode = NO_HASHCODE;
437 }
438
439
440
441
442
443
444 public AlphaNumericText27 getTargetName()
445 {
446 return this.targetName;
447 }
448
449
450
451
452
453
454 public void setTargetName( final AlphaNumericText27 value )
455 {
456 this.targetName = value;
457 this.hashCode = NO_HASHCODE;
458 }
459
460
461
462
463
464
465 public AlphaNumericText27 getTargetExt()
466 {
467 return this.targetExt;
468 }
469
470
471
472
473
474
475 public void setTargetExt( final AlphaNumericText27 value )
476 {
477 this.targetExt = value;
478 this.hashCode = NO_HASHCODE;
479 }
480
481
482
483
484
485
486
487
488 public boolean equals( final Object o )
489 {
490 boolean equal = this == o;
491
492 if ( !equal && o instanceof Transaction )
493 {
494 final Transaction that = (Transaction) o;
495 equal = ( this.getAmount() == null
496 ? that.getAmount() == null : this.getAmount().equals( that.getAmount() ) ) &&
497 ( this.getCurrency() == null
498 ? that.getCurrency() == null : this.getCurrency().equals( that.getCurrency() ) ) &&
499 ( this.getExecutiveAccount() == null
500 ? that.getExecutiveAccount() == null
501 : this.getExecutiveAccount().equals( that.getExecutiveAccount() ) ) &&
502 ( this.getExecutiveBank() == null
503 ? that.getExecutiveBank() == null : this.getExecutiveBank().equals( that.getExecutiveBank() ) ) &&
504 ( this.getExecutiveName() == null
505 ? that.getExecutiveName() == null : this.getExecutiveName().equals( that.getExecutiveName() ) ) &&
506 ( this.getExecutiveExt() == null
507 ? that.getExecutiveExt() == null : this.getExecutiveExt().equals( that.getExecutiveExt() ) ) &&
508 ( this.getPrimaryBank() == null
509 ? that.getPrimaryBank() == null : this.getPrimaryBank().equals( that.getPrimaryBank() ) ) &&
510 ( this.getReference() == null
511 ? that.getReference() == null : this.getReference().equals( that.getReference() ) ) &&
512 ( this.getTargetAccount() == null
513 ? that.getTargetAccount() == null : this.getTargetAccount().equals( that.getTargetAccount() ) ) &&
514 ( this.getTargetBank() == null
515 ? that.getTargetBank() == null : this.getTargetBank().equals( that.getTargetBank() ) ) &&
516 ( this.getTargetName() == null
517 ? that.getTargetName() == null : this.getTargetName().equals( that.getTargetName() ) ) &&
518 ( this.getTargetExt() == null
519 ? that.getTargetExt() == null : this.getTargetExt().equals( that.getTargetExt() ) ) &&
520 ( this.getType() == null
521 ? that.getType() == null : this.getType().equals( that.getType() ) );
522
523 if ( equal )
524 {
525 if ( this.getDescriptions() == null || this.getDescriptions().length == 0 )
526 {
527 equal = that.getDescriptions() == null || that.getDescriptions().length == 0;
528 }
529 else
530 {
531 equal = that.getDescriptions() != null && that.getDescriptions().length != 0
532 ? Arrays.equals( this.getDescriptions(), that.getDescriptions() ) : false;
533
534 }
535 }
536 }
537
538 return equal;
539 }
540
541
542
543
544
545
546 public int hashCode()
547 {
548 if ( this.hashCode == NO_HASHCODE )
549 {
550 int hc = 23;
551 hc = 37 * hc + ( this.amount == null ? 0 : this.amount.hashCode() );
552 hc = 37 * hc + ( this.currency == null ? 0 : this.currency.hashCode() );
553 hc = 37 * hc + ( this.executiveAccount == null ? 0 : this.executiveAccount.hashCode() );
554 hc = 37 * hc + ( this.executiveBank == null ? 0 : this.executiveBank.hashCode() );
555 hc = 37 * hc + ( this.executiveExt == null ? 0 : this.executiveExt.hashCode() );
556 hc = 37 * hc + ( this.executiveName == null ? 0 : this.executiveName.hashCode() );
557 hc = 37 * hc + ( this.primaryBank == null ? 0 : this.primaryBank.hashCode() );
558 hc = 37 * hc + ( this.reference == null ? 0 : this.reference.hashCode() );
559 hc = 37 * hc + ( this.targetAccount == null ? 0 : this.targetAccount.hashCode() );
560 hc = 37 * hc + ( this.targetBank == null ? 0 : this.targetBank.hashCode() );
561 hc = 37 * hc + ( this.targetExt == null ? 0 : this.targetExt.hashCode() );
562 hc = 37 * hc + ( this.targetName == null ? 0 : this.targetName.hashCode() );
563 hc = 37 * hc + ( this.type == null ? 0 : this.type.hashCode() );
564
565 if ( this.descriptions == null || this.descriptions.length == 0 )
566 {
567 hc = 37 * hc;
568 }
569 else
570 {
571 for ( int i = this.descriptions.length - 1; i >= 0; i-- )
572 {
573 hc = 37 * hc + this.descriptions[i].hashCode();
574 }
575 }
576
577 this.hashCode = hc;
578 }
579
580 return this.hashCode;
581 }
582
583
584
585
586
587
588 public Object clone()
589 {
590 try
591 {
592 return super.clone();
593 }
594 catch ( final CloneNotSupportedException e )
595 {
596 throw new AssertionError( e );
597 }
598 }
599
600
601
602
603
604
605 public String toString()
606 {
607 return super.toString() + this.internalString();
608 }
609
610
611
612
613
614
615 private String internalString()
616 {
617 return new StringBuffer( 300 ).append( '{' ).
618 append( "amount=" ).append( this.amount ).
619 append( ", currency=" ).append( this.currency ).
620 append( ", descriptions=" ).append( toString( this.descriptions ) ).
621 append( ", executiveAccount=" ).append( this.executiveAccount ).
622 append( ", executiveBank=" ).append( this.executiveBank ).
623 append( ", executiveName=" ).append( (Object) this.executiveName ).
624 append( ", executiveExt=" ).append( (Object) this.executiveExt ).
625 append( ", primaryBank=" ).append( this.primaryBank ).
626 append( ", reference=" ).append( this.reference ).
627 append( ", targetAccount=" ).append( this.targetAccount ).
628 append( ", targetBank=" ).append( this.targetBank ).
629 append( ", targetName=" ).append( (Object) this.targetName ).
630 append( ", targetExt=" ).append( (Object) this.targetExt ).
631 append( ", type=" ).append( this.type ).
632 append( '}' ).toString();
633
634 }
635
636 private static String toString( final AlphaNumericText27[] texts )
637 {
638 String string = null;
639
640 if ( texts != null )
641 {
642 final StringBuffer stringBuilder =
643 new StringBuffer( texts.length * AlphaNumericText27.MAX_LENGTH + texts.length * 2 + 2 );
644
645 stringBuilder.append( '[' );
646
647 for ( int i = 0, max = texts.length - 1; i < max; i++ )
648 {
649 texts[i].format( stringBuilder );
650
651 if ( i < max )
652 {
653 stringBuilder.append( ", " );
654 }
655 }
656
657 string = stringBuilder.append( ']' ).toString();
658 }
659
660 return string;
661 }
662
663 }