1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.ole.coa.businessobject;
18
19 import java.sql.Date;
20 import java.util.Calendar;
21 import java.util.LinkedHashMap;
22
23 import org.kuali.ole.sys.OLEConstants;
24 import org.kuali.ole.sys.businessobject.FiscalYearBasedBusinessObject;
25 import org.kuali.ole.sys.businessobject.SystemOptions;
26 import org.kuali.ole.sys.context.SpringContext;
27 import org.kuali.rice.core.api.datetime.DateTimeService;
28 import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
29 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
30
31
32
33
34 public class AccountingPeriod extends PersistableBusinessObjectBase implements MutableInactivatable, FiscalYearBasedBusinessObject {
35
36 public static final String CACHE_NAME = OLEConstants.APPLICATION_NAMESPACE_CODE + "/" + "AccountingPeriod";
37
38 private Integer universityFiscalYear;
39 private String universityFiscalPeriodCode;
40 private String universityFiscalPeriodName;
41 private boolean active;
42 private boolean budgetRolloverIndicator;
43
44 private Date universityFiscalPeriodEndDate;
45 private SystemOptions options;
46
47
48
49
50 public AccountingPeriod() {
51
52 }
53
54
55
56
57
58
59 public Integer getUniversityFiscalYear() {
60 return universityFiscalYear;
61 }
62
63
64
65
66
67
68 public void setUniversityFiscalYear(Integer universityFiscalYear) {
69 this.universityFiscalYear = universityFiscalYear;
70 }
71
72
73
74
75
76
77
78 public String getUniversityFiscalPeriodCode() {
79 return universityFiscalPeriodCode;
80 }
81
82
83
84
85
86
87 public void setUniversityFiscalPeriodCode(String universityFiscalPeriodCode) {
88 this.universityFiscalPeriodCode = universityFiscalPeriodCode;
89 }
90
91
92
93
94
95
96
97 public String getUniversityFiscalPeriodName() {
98 return universityFiscalPeriodName;
99 }
100
101
102
103
104
105
106 public void setUniversityFiscalPeriodName(String universityFiscalPeriodName) {
107 this.universityFiscalPeriodName = universityFiscalPeriodName;
108 }
109
110
111
112
113
114
115
116 public boolean isActive() {
117 return active;
118 }
119
120
121
122
123
124
125 public void setActive(boolean active) {
126 this.active = active;
127 }
128
129
130
131
132
133
134
135 public boolean isBudgetRolloverIndicator() {
136 return budgetRolloverIndicator;
137 }
138
139
140
141
142
143
144
145 public void setBudgetRolloverIndicator(boolean budgetRolloverIndicator) {
146 this.budgetRolloverIndicator = budgetRolloverIndicator;
147 }
148
149
150
151
152
153
154
155 public Date getUniversityFiscalPeriodEndDate() {
156 return universityFiscalPeriodEndDate;
157 }
158
159
160
161
162
163
164 public void setUniversityFiscalPeriodEndDate(Date universityFiscalPeriodEndDate) {
165 this.universityFiscalPeriodEndDate = universityFiscalPeriodEndDate;
166 }
167
168
169
170
171
172
173 public boolean isOpen() {
174 return this.isActive();
175 }
176
177
178
179
180 public SystemOptions getOptions() {
181 return options;
182 }
183
184
185
186
187
188 public void setOptions(SystemOptions options) {
189 this.options = options;
190 }
191
192
193
194
195
196
197 public int getMonth() {
198 DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class);
199 Calendar cal = dateTimeService.getCalendar(new Date(this.universityFiscalPeriodEndDate.getTime()));
200 return cal.get(Calendar.MONTH) + 1;
201 }
202
203
204
205
206 protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
207 LinkedHashMap m = new LinkedHashMap();
208 m.put("universityFiscalYear", "" + this.universityFiscalYear);
209 m.put("universityFiscalPeriodCode", this.universityFiscalPeriodCode);
210 return m;
211 }
212
213
214
215
216
217
218
219 @Override
220 public int hashCode() {
221 final int PRIME = 31;
222 int result = 1;
223 result = PRIME * result + ((universityFiscalPeriodCode == null) ? 0 : universityFiscalPeriodCode.hashCode());
224 result = PRIME * result + ((universityFiscalYear == null) ? 0 : universityFiscalYear.hashCode());
225 return result;
226 }
227
228
229
230
231
232
233
234 @Override
235 public boolean equals(Object obj) {
236
237
238 if (this == obj)
239 return true;
240 if (obj == null)
241 return false;
242 if (getClass() != obj.getClass())
243 return false;
244 final AccountingPeriod other = (AccountingPeriod) obj;
245 if (universityFiscalPeriodCode == null) {
246 if (other.universityFiscalPeriodCode != null)
247 return false;
248 }
249 else if (!universityFiscalPeriodCode.equals(other.universityFiscalPeriodCode))
250 return false;
251 if (universityFiscalYear == null) {
252 if (other.universityFiscalYear != null)
253 return false;
254 }
255 else if (!universityFiscalYear.equals(other.universityFiscalYear))
256 return false;
257 return true;
258 }
259 }