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.labor.web.struts.form;
017:
018: import java.util.Map;
019:
020: import org.kuali.kfs.KFSConstants;
021: import org.kuali.kfs.KFSPropertyConstants;
022: import org.kuali.kfs.bo.SourceAccountingLine;
023: import org.kuali.kfs.bo.TargetAccountingLine;
024: import org.kuali.kfs.context.SpringContext;
025: import org.kuali.kfs.service.OptionsService;
026: import org.kuali.module.labor.LaborPropertyConstants;
027: import org.kuali.module.labor.bo.LaborAccountingLineOverride;
028:
029: /**
030: * Base Struts Action Form for all expense transfer documents.
031: */
032: public abstract class ExpenseTransferDocumentFormBase extends
033: LaborDocumentFormBase implements MultipleValueLookupBroker {
034:
035: private String lookupResultsSequenceNumber; // Indicates which result set we are using when refreshing/returning from a
036: // multi-value lookup.
037: private String lookupResultsBOClassName; // Type of result returned by the multi-value lookup. ?to be persisted in the lookup
038: // results service instead?
039: private String lookedUpCollectionName; // The name of the collection looked up (by a multiple value lookup)
040: private Integer universityFiscalYear;
041:
042: /**
043: * Constructs a ExpenseTransferDocumentFormBase instance for the dependent object.
044: */
045: public ExpenseTransferDocumentFormBase() {
046: super ();
047: setUniversityFiscalYear(SpringContext.getBean(
048: OptionsService.class).getCurrentYearOptions()
049: .getUniversityFiscalYear());
050: }
051:
052: /**
053: * @see org.kuali.core.web.struts.form.AccountingDocumentFormBase#getRefreshCaller()
054: */
055: @Override
056: public String getRefreshCaller() {
057: return KFSConstants.MULTIPLE_VALUE;
058: }
059:
060: /**
061: * @see org.kuali.module.labor.web.struts.form.MultipleValueLookupBroker#getLookupResultsSequenceNumber()
062: */
063: public String getLookupResultsSequenceNumber() {
064: return lookupResultsSequenceNumber;
065: }
066:
067: /**
068: * @see org.kuali.module.labor.web.struts.form.MultipleValueLookupBroker#setLookupResultsSequenceNumber(java.lang.String)
069: */
070: public void setLookupResultsSequenceNumber(
071: String lookupResultsSequenceNumber) {
072: this .lookupResultsSequenceNumber = lookupResultsSequenceNumber;
073: }
074:
075: /**
076: * @see org.kuali.module.labor.web.struts.form.MultipleValueLookupBroker#getLookupResultsBOClassName()
077: */
078: public String getLookupResultsBOClassName() {
079: return lookupResultsBOClassName;
080: }
081:
082: /**
083: * @see org.kuali.module.labor.web.struts.form.MultipleValueLookupBroker#setLookupResultsBOClassName(java.lang.String)
084: */
085: public void setLookupResultsBOClassName(
086: String lookupResultsBOClassName) {
087: this .lookupResultsBOClassName = lookupResultsBOClassName;
088: }
089:
090: /**
091: * @see org.kuali.module.labor.web.struts.form.MultipleValueLookupBroker#getLookedUpCollectionName()
092: */
093: public String getLookedUpCollectionName() {
094: return lookedUpCollectionName;
095: }
096:
097: /**
098: * @see org.kuali.module.labor.web.struts.form.MultipleValueLookupBroker#setLookedUpCollectionName(java.lang.String)
099: */
100: public void setLookedUpCollectionName(String lookedUpCollectionName) {
101: this .lookedUpCollectionName = lookedUpCollectionName;
102: }
103:
104: /**
105: * Gets the universityFiscalYear attribute.
106: *
107: * @return Returns the universityFiscalYear.
108: */
109: public Integer getUniversityFiscalYear() {
110: return universityFiscalYear;
111: }
112:
113: /**
114: * Sets the universityFiscalYear attribute value.
115: *
116: * @param universityFiscalYear The universityFiscalYear to set.
117: */
118: public void setUniversityFiscalYear(Integer universityFiscalYear) {
119: this .universityFiscalYear = universityFiscalYear;
120: }
121:
122: /**
123: * Populate the search fields with the last search criteria
124: */
125: public abstract void populateSearchFields();
126:
127: /**
128: * Gets forced read only source fields
129: *
130: * @return Returns a Map of read only source fields
131: */
132: public Map getForcedReadOnlySourceFields() {
133: Map map = super .getForcedReadOnlyFields();
134: map.put(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE,
135: Boolean.TRUE);
136: map.put(KFSPropertyConstants.ACCOUNT_NUMBER, Boolean.TRUE);
137: map.put(KFSPropertyConstants.SUB_ACCOUNT_NUMBER, Boolean.TRUE);
138: map.put(KFSPropertyConstants.FINANCIAL_OBJECT_CODE,
139: Boolean.TRUE);
140: map.put(KFSPropertyConstants.FINANCIAL_SUB_OBJECT_CODE,
141: Boolean.TRUE);
142: map.put(KFSPropertyConstants.PROJECT_CODE, Boolean.TRUE);
143: map.put(KFSPropertyConstants.ORGANIZATION_REFERENCE_ID,
144: Boolean.TRUE);
145: map.put(KFSPropertyConstants.POSITION_NUMBER, Boolean.TRUE);
146: map
147: .put(
148: LaborPropertyConstants.PAYROLL_END_DATE_FISCAL_PERIOD_CODE,
149: Boolean.TRUE);
150: map.put(LaborPropertyConstants.PAYROLL_END_DATE_FISCAL_YEAR,
151: Boolean.TRUE);
152: return map;
153: }
154:
155: /**
156: * Returns forced read only target fields (i.e read only fields plus payroll end date fiscal
157: * period code and payroll end date fiscal year)
158: *
159: * @see org.kuali.core.web.struts.form.KualiTransactionalDocumentFormBase#getForcedReadOnlyFields()
160: */
161: public Map getForcedReadOnlyTargetFields() {
162: Map map = super .getForcedReadOnlyFields();
163: map
164: .put(
165: LaborPropertyConstants.PAYROLL_END_DATE_FISCAL_PERIOD_CODE,
166: Boolean.TRUE);
167: map.put(LaborPropertyConstants.PAYROLL_END_DATE_FISCAL_YEAR,
168: Boolean.TRUE);
169: return map;
170: }
171:
172: /**
173: * Returns forced accounting line editable fields (i.e accounting line editable fields from LaborDocumentFormBase
174: * without chart of accounts code, account number, sub-account number, financial sub object code,\
175: * project code, organization reference id, and amount)
176: *
177: * @see org.kuali.core.web.struts.form.KualiTransactionalDocumentFormBase#getAccountingLineEditableFields()
178: */
179: @Override
180: public Map getAccountingLineEditableFields() {
181: Map map = super .getAccountingLineEditableFields();
182: map.remove(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE);
183: map.remove(KFSPropertyConstants.ACCOUNT_NUMBER);
184: map.remove(KFSPropertyConstants.SUB_ACCOUNT_NUMBER);
185: map.remove(KFSPropertyConstants.FINANCIAL_OBJECT_CODE);
186: map.remove(KFSPropertyConstants.FINANCIAL_SUB_OBJECT_CODE);
187: map.remove(KFSPropertyConstants.PROJECT_CODE);
188: map.remove(KFSPropertyConstants.ORGANIZATION_REFERENCE_ID);
189: map.remove(KFSPropertyConstants.POSITION_NUMBER);
190: return map;
191: }
192:
193: /**
194: * Deal with the labor-specific override code to the given source accounting line
195: *
196: * @see org.kuali.kfs.web.struts.form.KualiAccountingDocumentFormBase#populateSourceAccountingLine(org.kuali.kfs.bo.SourceAccountingLine)
197: */
198: @Override
199: public void populateSourceAccountingLine(
200: SourceAccountingLine sourceLine) {
201: super .populateSourceAccountingLine(sourceLine);
202: LaborAccountingLineOverride.populateFromInput(sourceLine);
203: }
204:
205: /**
206: * Deal with the labor-specific override code to the given target accounting line
207: *
208: * @see org.kuali.kfs.web.struts.form.KualiAccountingDocumentFormBase#populateTargetAccountingLine(org.kuali.kfs.bo.TargetAccountingLine)
209: */
210: @Override
211: public void populateTargetAccountingLine(
212: TargetAccountingLine targetLine) {
213: super.populateTargetAccountingLine(targetLine);
214: LaborAccountingLineOverride.populateFromInput(targetLine);
215: }
216: }
|