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.action;
017:
018: import javax.servlet.http.HttpServletRequest;
019: import javax.servlet.http.HttpServletResponse;
020:
021: import org.apache.commons.lang.StringUtils;
022: import org.apache.struts.action.ActionForm;
023: import org.apache.struts.action.ActionForward;
024: import org.apache.struts.action.ActionMapping;
025: import org.kuali.kfs.KFSConstants;
026: import org.kuali.module.labor.LaborConstants;
027: import org.kuali.module.labor.bo.LaborLedgerPendingEntry;
028: import org.kuali.module.labor.bo.LedgerBalance;
029: import org.kuali.module.labor.util.ObjectUtil;
030: import org.kuali.module.labor.web.struts.form.BenefitExpenseTransferForm;
031: import org.kuali.module.labor.web.struts.form.ExpenseTransferDocumentFormBase;
032:
033: /**
034: * Struts Action class for the Benefit Expense Transfer Document.
035: */
036: public class BenefitExpenseTransferAction extends
037: ExpenseTransferDocumentActionBase {
038: private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
039: .getLogger(BenefitExpenseTransferAction.class);
040:
041: /**
042: * Gets the Business object class name
043: *
044: * @param expenseTransferDocumentFormBase ExpenseTransferDocumentForm type
045: * @return String classname
046: * @see org.kuali.module.labor.web.struts.action.ExpenseTransferDocumentActionBase#getLookupResultsBOClassName(org.kuali.module.labor.web.struts.form.ExpenseTransferDocumentFormBase)
047: */
048: @Override
049: protected String getLookupResultsBOClassName(
050: ExpenseTransferDocumentFormBase expenseTransferDocumentForm) {
051: return LedgerBalance.class.getName();
052: }
053:
054: /**
055: * @param expenseTransferDocumentFormBase ExpenseTransferDocumentForm type
056: * @param balance LedgerBalance type
057: * @return none
058: * @see org.kuali.module.labor.web.struts.action.ExpenseTransferDocumentActionBase#resetLookupFields(org.kuali.module.labor.web.struts.form.ExpenseTransferDocumentFormBase,
059: * org.kuali.module.labor.bo.LedgerBalance)
060: */
061: @Override
062: protected void resetLookupFields(
063: ExpenseTransferDocumentFormBase expenseTransferDocumentForm,
064: LedgerBalance balance) {
065: BenefitExpenseTransferForm benefitExpenseTransferForm = (BenefitExpenseTransferForm) expenseTransferDocumentForm;
066: ObjectUtil.buildObject(benefitExpenseTransferForm, balance);
067: }
068:
069: /**
070: * @param mapping ActionMapping
071: * @param form ActionForm
072: * @param request HttpServletRequest
073: * @param response HttpServletResponse
074: * @see org.kuali.core.web.struts.action.KualiAction#performLookup(org.apache.struts.action.ActionMapping,
075: * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
076: */
077: @Override
078: public ActionForward performLookup(ActionMapping mapping,
079: ActionForm form, HttpServletRequest request,
080: HttpServletResponse response) throws Exception {
081: // parse out the business object name from our methodToCall parameter
082: String fullParameter = (String) request
083: .getAttribute(KFSConstants.METHOD_TO_CALL_ATTRIBUTE);
084: String boClassName = StringUtils.substringBetween(
085: fullParameter,
086: KFSConstants.METHOD_TO_CALL_BOPARM_LEFT_DEL,
087: KFSConstants.METHOD_TO_CALL_BOPARM_RIGHT_DEL);
088:
089: if (!StringUtils.equals(boClassName,
090: LaborLedgerPendingEntry.class.getName())) {
091: return super
092: .performLookup(mapping, form, request, response);
093: }
094:
095: String path = super .performLookup(mapping, form, request,
096: response).getPath();
097: path = path.replaceFirst(KFSConstants.LOOKUP_ACTION,
098: LaborConstants.LONG_ROW_TABLE_INRUIRY_ACTION);
099: return new ActionForward(path, true);
100: }
101: }
|