2
2
3
3
import org .apache .commons .lang3 .Validate ;
4
4
5
+ import edu .cornell .kfs .tax .util .TaxUtils ;
6
+
5
7
public final class TaxBatchConfig {
6
8
9
+ public enum Mode {
10
+ CREATE_TAX_FILES ,
11
+ CREATE_TRANSACTION_LIST_FILE ;
12
+ }
13
+
14
+ private final Mode mode ;
7
15
private final String taxType ;
8
16
private final int reportYear ;
9
17
private final java .util .Date processingStartDate ;
@@ -12,15 +20,30 @@ public final class TaxBatchConfig {
12
20
13
21
public TaxBatchConfig (final String taxType , final int reportYear ,
14
22
final java .util .Date processingStartDate , final java .sql .Date startDate , final java .sql .Date endDate ) {
23
+ this (Mode .CREATE_TAX_FILES , taxType , reportYear , processingStartDate , startDate , endDate );
24
+ }
25
+
26
+ public TaxBatchConfig (final Mode mode , final String taxType , final int reportYear ,
27
+ final java .util .Date processingStartDate , final java .sql .Date startDate , final java .sql .Date endDate ) {
28
+ Validate .notNull (mode , "mode cannot be null" );
15
29
Validate .notBlank (taxType , "taxType cannot be blank" );
16
30
Validate .notNull (processingStartDate , "processingStartDate cannot be null" );
17
31
Validate .notNull (startDate , "startDate cannot be null" );
18
32
Validate .notNull (endDate , "endDate cannot be null" );
33
+ this .mode = mode ;
19
34
this .taxType = taxType ;
20
35
this .reportYear = reportYear ;
21
- this .processingStartDate = processingStartDate ;
22
- this .startDate = startDate ;
23
- this .endDate = endDate ;
36
+ this .processingStartDate = TaxUtils .copyDate (processingStartDate );
37
+ this .startDate = TaxUtils .copyDate (startDate );
38
+ this .endDate = TaxUtils .copyDate (endDate );
39
+ }
40
+
41
+ public TaxBatchConfig withMode (final Mode newMode ) {
42
+ return new TaxBatchConfig (newMode , taxType , reportYear , processingStartDate , startDate , endDate );
43
+ }
44
+
45
+ public Mode getMode () {
46
+ return mode ;
24
47
}
25
48
26
49
public String getTaxType () {
@@ -32,15 +55,15 @@ public int getReportYear() {
32
55
}
33
56
34
57
public java .util .Date getProcessingStartDate () {
35
- return new java . util . Date (processingStartDate . getTime () );
58
+ return TaxUtils . copyDate (processingStartDate );
36
59
}
37
60
38
61
public java .sql .Date getStartDate () {
39
- return new java . sql . Date (startDate . getTime () );
62
+ return TaxUtils . copyDate (startDate );
40
63
}
41
64
42
65
public java .sql .Date getEndDate () {
43
- return new java . sql . Date (endDate . getTime () );
66
+ return TaxUtils . copyDate (endDate );
44
67
}
45
68
46
69
}
0 commit comments