001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.kuali.module.gl.bo;
017:
018: import java.util.LinkedHashMap;
019:
020: import org.kuali.core.bo.DocumentType;
021: import org.kuali.core.util.KualiDecimal;
022: import org.kuali.kfs.KFSConstants;
023: import org.kuali.kfs.KFSPropertyConstants;
024: import org.kuali.kfs.bo.GeneralLedgerPendingEntry;
025: import org.kuali.kfs.bo.Options;
026: import org.kuali.kfs.bo.OriginationCode;
027: import org.kuali.module.chart.bo.A21SubAccount;
028: import org.kuali.module.chart.bo.Account;
029: import org.kuali.module.chart.bo.AccountingPeriod;
030: import org.kuali.module.chart.bo.Chart;
031: import org.kuali.module.chart.bo.ObjectCode;
032: import org.kuali.module.chart.bo.ObjectType;
033: import org.kuali.module.chart.bo.ProjectCode;
034: import org.kuali.module.chart.bo.SubAccount;
035: import org.kuali.module.chart.bo.SubObjCd;
036: import org.kuali.module.chart.bo.codes.BalanceTyp;
037: import org.kuali.module.gl.exception.LoadException;
038:
039: /**
040: * This class represents a full origin entry
041: */
042: public class OriginEntryFull extends OriginEntryLite implements
043: Transaction, OriginEntry, FlexibleAccountUpdateable {
044: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
045: .getLogger(OriginEntryFull.class);
046:
047: // bo references
048: private OriginEntryGroup group;
049: private Account account;
050: private SubAccount subAccount;
051: private A21SubAccount a21SubAccount;
052: private BalanceTyp balanceType;
053: private Chart chart;
054: private ObjectCode financialObject;
055: private SubObjCd financialSubObject;
056: private ObjectType objectType;
057: private ProjectCode project;
058: private DocumentType documentType;
059: private UniversityDate universityDate;
060: private Options option;
061: private AccountingPeriod accountingPeriod;
062: private UniversityDate reversalDate;
063: private OriginationCode origination;
064: private DocumentType referenceDocumentType;
065:
066: public OriginEntryFull(GeneralLedgerPendingEntry glpe) {
067: accountNumber = glpe.getAccountNumber();
068: documentNumber = glpe.getDocumentNumber();
069: referenceFinancialDocumentNumber = glpe
070: .getReferenceFinancialDocumentNumber();
071: referenceFinancialDocumentTypeCode = glpe
072: .getReferenceFinancialDocumentTypeCode();
073: financialDocumentReversalDate = glpe
074: .getFinancialDocumentReversalDate();
075: financialDocumentTypeCode = glpe.getFinancialDocumentTypeCode();
076: financialBalanceTypeCode = glpe.getFinancialBalanceTypeCode();
077: chartOfAccountsCode = glpe.getChartOfAccountsCode();
078: financialObjectTypeCode = glpe.getFinancialObjectTypeCode();
079: financialObjectCode = glpe.getFinancialObjectCode();
080: financialSubObjectCode = glpe.getFinancialSubObjectCode();
081: financialSystemOriginationCode = glpe
082: .getFinancialSystemOriginationCode();
083: referenceFinancialSystemOriginationCode = glpe
084: .getReferenceFinancialSystemOriginationCode();
085: organizationDocumentNumber = glpe
086: .getOrganizationDocumentNumber();
087: organizationReferenceId = glpe.getOrganizationReferenceId();
088: projectCode = glpe.getProjectCode();
089: subAccountNumber = glpe.getSubAccountNumber();
090: transactionDate = glpe.getTransactionDate();
091: transactionDebitCreditCode = glpe
092: .getTransactionDebitCreditCode();
093: transactionEncumbranceUpdateCode = glpe
094: .getTransactionEncumbranceUpdateCode();
095: transactionLedgerEntrySequenceNumber = glpe
096: .getTransactionLedgerEntrySequenceNumber();
097: transactionLedgerEntryAmount = glpe
098: .getTransactionLedgerEntryAmount();
099: transactionLedgerEntryDescription = glpe
100: .getTransactionLedgerEntryDescription();
101: universityFiscalPeriodCode = glpe
102: .getUniversityFiscalPeriodCode();
103: universityFiscalYear = glpe.getUniversityFiscalYear();
104: }
105:
106: /**
107: *
108: */
109: public OriginEntryFull(String financialDocumentTypeCode,
110: String financialSystemOriginationCode) {
111: super ();
112:
113: setChartOfAccountsCode(KFSConstants.EMPTY_STRING);
114: setAccountNumber(KFSConstants.EMPTY_STRING);
115: setSubAccountNumber(KFSConstants.getDashSubAccountNumber());
116: setProjectCode(KFSConstants.getDashProjectCode());
117:
118: setFinancialDocumentTypeCode(financialDocumentTypeCode);
119: setFinancialSystemOriginationCode(financialSystemOriginationCode);
120:
121: setFinancialObjectCode(KFSConstants.EMPTY_STRING);
122: setFinancialSubObjectCode(KFSConstants
123: .getDashFinancialSubObjectCode());
124: setFinancialBalanceTypeCode(KFSConstants.EMPTY_STRING);
125: setFinancialObjectTypeCode(KFSConstants.EMPTY_STRING);
126: setDocumentNumber(KFSConstants.EMPTY_STRING);
127: setFinancialDocumentReversalDate(null);
128:
129: setUniversityFiscalYear(new Integer(0));
130: setUniversityFiscalPeriodCode(KFSConstants.EMPTY_STRING);
131:
132: setTransactionLedgerEntrySequenceNumber(new Integer(1));
133: setTransactionLedgerEntryAmount(new KualiDecimal(0));
134: setTransactionLedgerEntryDescription(KFSConstants.EMPTY_STRING);
135: setTransactionDate(null);
136: setTransactionDebitCreditCode(KFSConstants.EMPTY_STRING);
137: setTransactionEncumbranceUpdateCode(null);
138:
139: setOrganizationDocumentNumber(KFSConstants.EMPTY_STRING);
140: setOrganizationReferenceId(KFSConstants.EMPTY_STRING);
141:
142: setReferenceFinancialDocumentTypeCode(KFSConstants.EMPTY_STRING);
143: setReferenceFinancialSystemOriginationCode(KFSConstants.EMPTY_STRING);
144: setReferenceFinancialDocumentNumber(KFSConstants.EMPTY_STRING);
145: }
146:
147: /**
148: *
149: */
150: public OriginEntryFull() {
151: this (null, null);
152: }
153:
154: public OriginEntryFull(Transaction t) {
155: this ();
156: copyFieldsFromTransaction(t);
157: }
158:
159: public OriginEntryFull(String line) {
160: try {
161: setFromTextFile(line, 0);
162: } catch (LoadException e) {
163: LOG.error("OriginEntryFull() Error loading line", e);
164: }
165: }
166:
167: protected LinkedHashMap toStringMapper() {
168: LinkedHashMap map = new LinkedHashMap();
169: map.put("entryId", getEntryId());
170: map.put("entryGroupId", getEntryGroupId());
171: map.put("universityFiscalYear", getUniversityFiscalYear());
172: map.put("universityFiscalPeriodCode",
173: getUniversityFiscalPeriodCode());
174: map.put("chartOfAccountsCode", getChartOfAccountsCode());
175: map.put("accountNumber", getAccountNumber());
176: map.put("subAccountNumber", getSubAccountNumber());
177: map.put("financialObjectCode", getFinancialObjectCode());
178: map
179: .put("financialObjectTypeCode",
180: getFinancialObjectTypeCode());
181: map.put("financialSubObjectCode", getFinancialSubObjectCode());
182: map.put("financialBalanceTypeCode",
183: getFinancialBalanceTypeCode());
184: map.put(KFSPropertyConstants.DOCUMENT_NUMBER,
185: getDocumentNumber());
186: map.put("financialDocumentTypeCode",
187: getFinancialDocumentTypeCode());
188: map.put("financialSystemOriginationCode",
189: getFinancialSystemOriginationCode());
190: map.put("transactionLedgerEntrySequenceNumber",
191: getTransactionLedgerEntrySequenceNumber());
192: map.put("transactionLedgerEntryDescription",
193: getTransactionLedgerEntryDescription());
194: return map;
195: }
196:
197: public OriginEntryGroup getGroup() {
198: return group;
199: }
200:
201: public void setGroup(OriginEntryGroup oeg) {
202: if (oeg != null) {
203: setEntryGroupId(oeg.getId());
204: group = oeg;
205: } else {
206: setEntryGroupId(null);
207: group = null;
208: }
209: }
210:
211: public A21SubAccount getA21SubAccount() {
212: return a21SubAccount;
213: }
214:
215: public void setA21SubAccount(A21SubAccount subAccount) {
216: a21SubAccount = subAccount;
217: }
218:
219: public Account getAccount() {
220: return account;
221: }
222:
223: public void setAccount(Account account) {
224: this .account = account;
225: }
226:
227: public BalanceTyp getBalanceType() {
228: return balanceType;
229: }
230:
231: public void setBalanceType(BalanceTyp balanceType) {
232: this .balanceType = balanceType;
233: }
234:
235: public Chart getChart() {
236: return chart;
237: }
238:
239: public void setChart(Chart chart) {
240: this .chart = chart;
241: }
242:
243: public DocumentType getDocumentType() {
244: return documentType;
245: }
246:
247: public void setDocumentType(DocumentType documentType) {
248: this .documentType = documentType;
249: }
250:
251: public ObjectCode getFinancialObject() {
252: return financialObject;
253: }
254:
255: public void setFinancialObject(ObjectCode financialObject) {
256: this .financialObject = financialObject;
257: }
258:
259: public SubObjCd getFinancialSubObject() {
260: return financialSubObject;
261: }
262:
263: public void setFinancialSubObject(SubObjCd financialSubObject) {
264: this .financialSubObject = financialSubObject;
265: }
266:
267: public ObjectType getObjectType() {
268: return objectType;
269: }
270:
271: public void setObjectType(ObjectType objectType) {
272: this .objectType = objectType;
273: }
274:
275: public Options getOption() {
276: return option;
277: }
278:
279: public void setOption(Options option) {
280: this .option = option;
281: }
282:
283: public ProjectCode getProject() {
284: return project;
285: }
286:
287: public void setProject(ProjectCode project) {
288: this .project = project;
289: }
290:
291: public SubAccount getSubAccount() {
292: return subAccount;
293: }
294:
295: public void setSubAccount(SubAccount subAccount) {
296: this .subAccount = subAccount;
297: }
298:
299: public UniversityDate getUniversityDate() {
300: return universityDate;
301: }
302:
303: public void setUniversityDate(UniversityDate universityDate) {
304: this .universityDate = universityDate;
305: }
306:
307: public AccountingPeriod getAccountingPeriod() {
308: return accountingPeriod;
309: }
310:
311: public void setAccountingPeriod(AccountingPeriod accountingPeriod) {
312: this .accountingPeriod = accountingPeriod;
313: }
314:
315: public UniversityDate getReversalDate() {
316: return reversalDate;
317: }
318:
319: public void setReversalDate(UniversityDate reversalDate) {
320: this .reversalDate = reversalDate;
321: }
322:
323: public OriginationCode getOrigination() {
324: return origination;
325: }
326:
327: public void setOrigination(OriginationCode origination) {
328: this .origination = origination;
329: }
330:
331: public DocumentType getReferenceDocumentType() {
332: return referenceDocumentType;
333: }
334:
335: public void setReferenceDocumentType(
336: DocumentType referenceDocumentType) {
337: this .referenceDocumentType = referenceDocumentType;
338: }
339:
340: public static OriginEntryFull copyFromOriginEntryable(OriginEntry oe) {
341: OriginEntryFull newOriginEntry = new OriginEntryFull();
342: newOriginEntry.setAccountNumber(oe.getAccountNumber());
343: newOriginEntry.setDocumentNumber(oe.getDocumentNumber());
344: newOriginEntry.setReferenceFinancialDocumentNumber(oe
345: .getReferenceFinancialDocumentNumber());
346: newOriginEntry.setReferenceFinancialDocumentTypeCode(oe
347: .getReferenceFinancialDocumentTypeCode());
348: newOriginEntry.setFinancialDocumentReversalDate(oe
349: .getFinancialDocumentReversalDate());
350: newOriginEntry.setFinancialDocumentTypeCode(oe
351: .getFinancialDocumentTypeCode());
352: newOriginEntry.setFinancialBalanceTypeCode(oe
353: .getFinancialBalanceTypeCode());
354: newOriginEntry.setChartOfAccountsCode(oe
355: .getChartOfAccountsCode());
356: newOriginEntry.setFinancialObjectTypeCode(oe
357: .getFinancialObjectTypeCode());
358: newOriginEntry.setFinancialObjectCode(oe
359: .getFinancialObjectCode());
360: newOriginEntry.setFinancialSubObjectCode(oe
361: .getFinancialSubObjectCode());
362: newOriginEntry.setFinancialSystemOriginationCode(oe
363: .getFinancialSystemOriginationCode());
364: newOriginEntry.setReferenceFinancialSystemOriginationCode(oe
365: .getReferenceFinancialSystemOriginationCode());
366: newOriginEntry.setOrganizationDocumentNumber(oe
367: .getOrganizationDocumentNumber());
368: newOriginEntry.setOrganizationReferenceId(oe
369: .getOrganizationReferenceId());
370: newOriginEntry.setProjectCode(oe.getProjectCode());
371: newOriginEntry.setSubAccountNumber(oe.getSubAccountNumber());
372: newOriginEntry.setTransactionDate(oe.getTransactionDate());
373: newOriginEntry.setTransactionDebitCreditCode(oe
374: .getTransactionDebitCreditCode());
375: newOriginEntry.setTransactionEncumbranceUpdateCode(oe
376: .getTransactionEncumbranceUpdateCode());
377: newOriginEntry.setTransactionLedgerEntrySequenceNumber(oe
378: .getTransactionLedgerEntrySequenceNumber());
379: newOriginEntry.setTransactionLedgerEntryAmount(oe
380: .getTransactionLedgerEntryAmount());
381: newOriginEntry.setTransactionLedgerEntryDescription(oe
382: .getTransactionLedgerEntryDescription());
383: newOriginEntry.setUniversityFiscalPeriodCode(oe
384: .getUniversityFiscalPeriodCode());
385: newOriginEntry.setUniversityFiscalYear(oe
386: .getUniversityFiscalYear());
387: return newOriginEntry;
388: }
389: }
|