1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.coa.businessobject;
17
18 import java.lang.reflect.InvocationTargetException;
19 import java.util.LinkedHashMap;
20 import java.util.SortedSet;
21 import java.util.TreeSet;
22
23 import org.apache.commons.beanutils.PropertyUtils;
24 import org.apache.commons.lang.StringUtils;
25 import org.kuali.ole.coa.service.ObjectCodeService;
26 import org.kuali.ole.sys.OLEConstants;
27 import org.kuali.ole.sys.OLEPropertyConstants;
28 import org.kuali.ole.sys.context.SpringContext;
29 import org.kuali.rice.krad.bo.GlobalBusinessObjectDetailBase;
30
31
32
33
34
35
36 public class OrganizationReversionGlobalDetail extends GlobalBusinessObjectDetailBase {
37 protected static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OrganizationReversionGlobalDetail.class);
38
39 private String documentNumber;
40 private String organizationReversionCategoryCode;
41 private String organizationReversionObjectCode;
42 private String organizationReversionCode;
43
44 private OrganizationReversionCategory organizationReversionCategory;
45 private OrganizationReversionGlobal parentGlobalOrganizationReversion;
46 private ObjectCode organizationReversionObject;
47
48
49
50
51
52 protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
53 LinkedHashMap stringMapper = new LinkedHashMap();
54 stringMapper.put(OLEPropertyConstants.DOCUMENT_NUMBER, this.documentNumber);
55 stringMapper.put("OrganizationReversionCategoryCode", this.organizationReversionCategoryCode);
56 return stringMapper;
57 }
58
59
60
61
62 public OrganizationReversionGlobalDetail() {
63 }
64
65
66
67
68
69
70 public String getDocumentNumber() {
71 return documentNumber;
72 }
73
74
75
76
77
78
79 public void setDocumentNumber(String documentNumber) {
80 this.documentNumber = documentNumber;
81 }
82
83
84
85
86
87
88 public String getOrganizationReversionCode() {
89 return organizationReversionCode;
90 }
91
92
93
94
95
96
97 public void setOrganizationReversionCode(String organizationReversionCode) {
98 this.organizationReversionCode = organizationReversionCode;
99 }
100
101
102
103
104
105
106 public OrganizationReversionCategory getOrganizationReversionCategory() {
107 return organizationReversionCategory;
108 }
109
110
111
112
113
114
115 public void setOrganizationReversionCategory(OrganizationReversionCategory organizationReversionCategory) {
116 this.organizationReversionCategory = organizationReversionCategory;
117 }
118
119
120
121
122
123
124 public String getOrganizationReversionCategoryCode() {
125 return organizationReversionCategoryCode;
126 }
127
128
129
130
131
132
133 public void setOrganizationReversionCategoryCode(String organizationReversionCategoryCode) {
134 this.organizationReversionCategoryCode = organizationReversionCategoryCode;
135 }
136
137
138
139
140
141
142 public String getOrganizationReversionObjectCode() {
143 return organizationReversionObjectCode;
144 }
145
146
147
148
149
150
151 public void setOrganizationReversionObjectCode(String organizationReversionObjectCode) {
152 this.organizationReversionObjectCode = organizationReversionObjectCode;
153 }
154
155
156
157
158
159
160
161 public OrganizationReversionGlobal getParentGlobalOrganizationReversion() {
162 return parentGlobalOrganizationReversion;
163 }
164
165
166
167
168
169
170
171 public void setParentGlobalOrganizationReversion(OrganizationReversionGlobal parentGlobalOrganizationReversion) {
172 this.parentGlobalOrganizationReversion = parentGlobalOrganizationReversion;
173 }
174
175
176
177
178
179 public ObjectCode getOrganizationReversionObject() {
180 return organizationReversionObject;
181 }
182
183
184
185
186
187 public void setOrganizationReversionObject(ObjectCode organizationReversionObject) {
188 this.organizationReversionObject = organizationReversionObject;
189 }
190
191
192
193
194
195
196
197 private String convertKeyToLockingRepresentation(String keyName) {
198 StringBuffer sb = new StringBuffer();
199 sb.append(keyName);
200 sb.append(OLEConstants.Maintenance.AFTER_FIELDNAME_DELIM);
201 String keyValue = "";
202 try {
203 Object keyValueObj = PropertyUtils.getProperty(this, keyName);
204 if (keyValueObj != null) {
205 keyValue = keyValueObj.toString();
206 }
207 }
208 catch (IllegalAccessException iae) {
209 LOG.info("Illegal access exception while attempting to read property " + keyName, iae);
210 }
211 catch (InvocationTargetException ite) {
212 LOG.info("Illegal Target Exception while attempting to read property " + keyName, ite);
213 }
214 catch (NoSuchMethodException nsme) {
215 LOG.info("There is no such method to read property " + keyName + " in this class.", nsme);
216 }
217 finally {
218 sb.append(keyValue);
219 }
220 sb.append(OLEConstants.Maintenance.AFTER_VALUE_DELIM);
221 return sb.toString();
222 }
223
224
225
226
227
228
229 public String getObjectCodeNames() {
230 String objectCodeNames = "";
231 if (!StringUtils.isBlank(this.getOrganizationReversionObjectCode())) {
232 if (this.getParentGlobalOrganizationReversion().getUniversityFiscalYear() != null && this.getParentGlobalOrganizationReversion().getOrganizationReversionGlobalOrganizations() != null && this.getParentGlobalOrganizationReversion().getOrganizationReversionGlobalOrganizations().size() > 0) {
233
234 SortedSet<String> chartCodes = new TreeSet<String>();
235 for (OrganizationReversionGlobalOrganization org : this.getParentGlobalOrganizationReversion().getOrganizationReversionGlobalOrganizations()) {
236 chartCodes.add(org.getChartOfAccountsCode());
237 }
238 String[] chartCodesArray = new String[chartCodes.size()];
239 int i = 0;
240 for (String chartCode : chartCodes) {
241 chartCodesArray[i] = chartCode;
242 i++;
243 }
244 objectCodeNames = (String) SpringContext.getBean(ObjectCodeService.class).getObjectCodeNamesByCharts(this.getParentGlobalOrganizationReversion().getUniversityFiscalYear(), chartCodesArray, this.getOrganizationReversionObjectCode());
245 }
246 }
247 return objectCodeNames;
248 }
249 }