1 | |
|
2 | |
|
3 | |
|
4 | |
package org.homeunix.thecave.buddi.model.impl; |
5 | |
|
6 | |
import java.util.Date; |
7 | |
import java.util.Map; |
8 | |
|
9 | |
import org.homeunix.thecave.buddi.model.Document; |
10 | |
import org.homeunix.thecave.buddi.model.ModelObject; |
11 | |
import org.homeunix.thecave.buddi.model.ScheduledTransaction; |
12 | |
import org.homeunix.thecave.buddi.model.Source; |
13 | |
import org.homeunix.thecave.buddi.model.Transaction; |
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | 0 | public class ScheduledTransactionImpl extends TransactionImpl implements ScheduledTransaction { |
23 | |
|
24 | |
|
25 | |
private Day startDate; |
26 | |
private Day endDate; |
27 | |
private Day lastDayCreated; |
28 | |
|
29 | |
|
30 | |
private String frequencyType; |
31 | |
private int scheduleDay; |
32 | |
private int scheduleWeek; |
33 | |
private int scheduleMonth; |
34 | |
|
35 | |
|
36 | |
private String scheduleName; |
37 | |
private String message; |
38 | |
|
39 | |
@Override |
40 | |
public int compareTo(ModelObject arg0) { |
41 | 0 | if (arg0 instanceof Transaction){ |
42 | 0 | ScheduledTransaction st = (ScheduledTransaction) arg0; |
43 | |
|
44 | |
|
45 | 0 | return this.getScheduleName().compareTo(st.getScheduleName()); |
46 | |
} |
47 | 0 | return super.compareTo(arg0); |
48 | |
} |
49 | |
public Date getEndDate() { |
50 | 0 | return endDate; |
51 | |
} |
52 | |
public String getFrequencyType() { |
53 | 0 | return frequencyType; |
54 | |
} |
55 | |
public Date getLastDayCreated() { |
56 | 0 | return lastDayCreated; |
57 | |
} |
58 | |
public String getMessage() { |
59 | 0 | return message; |
60 | |
} |
61 | |
public int getScheduleDay() { |
62 | 0 | return scheduleDay; |
63 | |
} |
64 | |
public int getScheduleMonth() { |
65 | 0 | return scheduleMonth; |
66 | |
} |
67 | |
public String getScheduleName() { |
68 | 0 | return scheduleName; |
69 | |
} |
70 | |
public int getScheduleWeek() { |
71 | 0 | return scheduleWeek; |
72 | |
} |
73 | |
public Date getStartDate() { |
74 | 0 | return startDate; |
75 | |
} |
76 | |
public void setEndDate(Date endDate) { |
77 | 0 | this.endDate = new Day(endDate); |
78 | 0 | setChanged(); |
79 | 0 | } |
80 | |
public void setFrequencyType(String frequencyType) { |
81 | 0 | this.frequencyType = frequencyType; |
82 | 0 | setChanged(); |
83 | 0 | } |
84 | |
public void setLastDayCreated(Date lastDayCreated) { |
85 | 0 | this.lastDayCreated = new Day(lastDayCreated); |
86 | 0 | setChanged(); |
87 | 0 | } |
88 | |
public void setMessage(String message) { |
89 | 0 | this.message = message; |
90 | 0 | setChanged(); |
91 | 0 | } |
92 | |
public void setScheduleDay(int scheduleDay) { |
93 | 0 | this.scheduleDay = scheduleDay; |
94 | 0 | setChanged(); |
95 | 0 | } |
96 | |
public void setScheduleMonth(int scheduleMonth) { |
97 | 0 | this.scheduleMonth = scheduleMonth; |
98 | 0 | setChanged(); |
99 | 0 | } |
100 | |
public void setScheduleName(String scheduleName) { |
101 | 0 | this.scheduleName = scheduleName; |
102 | 0 | setChanged(); |
103 | 0 | } |
104 | |
public void setScheduleWeek(int scheduleWeek) { |
105 | 0 | this.scheduleWeek = scheduleWeek; |
106 | 0 | setChanged(); |
107 | 0 | } |
108 | |
public void setStartDate(Date startDate) { |
109 | 0 | this.startDate = new Day(startDate); |
110 | 0 | setChanged(); |
111 | 0 | } |
112 | |
|
113 | |
ScheduledTransaction clone(Map<ModelObject, ModelObject> originalToCloneMap) throws CloneNotSupportedException { |
114 | |
|
115 | 0 | if (originalToCloneMap.get(this) != null) |
116 | 0 | return (ScheduledTransaction) originalToCloneMap.get(this); |
117 | |
|
118 | 0 | ScheduledTransactionImpl st = new ScheduledTransactionImpl(); |
119 | |
|
120 | 0 | st.document = (Document) originalToCloneMap.get(document); |
121 | 0 | st.amount = amount; |
122 | 0 | st.clearedFrom = clearedFrom; |
123 | 0 | st.clearedTo = clearedTo; |
124 | 0 | if (date != null) |
125 | 0 | st.date = new Day(date); |
126 | 0 | st.deleted = deleted; |
127 | 0 | st.description = description; |
128 | 0 | if (from != null) |
129 | 0 | st.from = (Source) ((SourceImpl) from).clone(originalToCloneMap); |
130 | 0 | st.memo = memo; |
131 | 0 | st.number = number; |
132 | 0 | st.reconciledFrom = reconciledFrom; |
133 | 0 | st.reconciledTo = reconciledTo; |
134 | 0 | st.scheduled = scheduled; |
135 | 0 | if (to != null) |
136 | 0 | st.to = (Source) ((SourceImpl) to).clone(originalToCloneMap); |
137 | 0 | st.modifiedTime = new Time(modifiedTime); |
138 | |
|
139 | 0 | if (endDate != null) |
140 | 0 | st.endDate = new Day(endDate); |
141 | 0 | st.frequencyType = frequencyType; |
142 | |
|
143 | 0 | if (lastDayCreated != null) |
144 | 0 | st.lastDayCreated = new Day(lastDayCreated); |
145 | 0 | st.message = message; |
146 | 0 | st.scheduleDay = scheduleDay; |
147 | 0 | st.scheduleMonth = scheduleMonth; |
148 | 0 | st.scheduleName = scheduleName; |
149 | 0 | st.scheduleWeek = scheduleWeek; |
150 | 0 | if (startDate != null) |
151 | 0 | st.startDate = new Day(startDate); |
152 | |
|
153 | 0 | originalToCloneMap.put(this, st); |
154 | |
|
155 | 0 | return st; |
156 | |
} |
157 | |
} |