1 /* 2 * The Kuali Financial System, a comprehensive financial management system for higher education. 3 * 4 * Copyright 2005-2014 The Kuali Foundation 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU Affero General Public License as 8 * published by the Free Software Foundation, either version 3 of the 9 * License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU Affero General Public License for more details. 15 * 16 * You should have received a copy of the GNU Affero General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 package org.kuali.kfs.gl.web.struts; 20 21 import javax.servlet.http.HttpServletRequest; 22 23 import org.kuali.kfs.gl.GeneralLedgerConstants; 24 import org.kuali.kfs.gl.businessobject.Entry; 25 import org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry; 26 import org.kuali.kfs.sys.businessobject.lookup.LookupableSpringContext; 27 import org.kuali.rice.kns.lookup.Lookupable; 28 import org.kuali.rice.kns.web.struts.form.MultipleValueLookupForm; 29 30 /** 31 * Balance inquiries are pretty much just lookups already, but are not used in the traditional sense. In most cases, balance 32 * inquiries only show the end-user data, and allow the end-user to drill-down into inquiries. A traditional lookup allows the user 33 * to return data to a form. This class is for balance inquiries implemented in the sense of a traditional lookup for forms that 34 * pull data out of inquiries.<br/> <br/> One example of this is the 35 * <code>{@link org.kuali.kfs.module.ld.document.SalaryExpenseTransferDocument}</code> which creates source lines from a labor 36 * ledger balance inquiry screen.<br/> <br/> This is a <code>{@link KualiMultipleValueLookupAction}</code> which required some 37 * customization because requirements were not possible with displaytag. There are a number of properties/attributes that are used 38 * for pagination, formatting, etc... 39 * 40 * @see org.kuali.kfs.module.ld.document.SalaryExpenseTransferDocument 41 * @see org.kuali.kfs.module.ld.document.web.struts.SalaryExpenseTransferAction; 42 * @see org.kuali.kfs.module.ld.document.web.struts.SalaryExpenseTransferForm; 43 */ 44 public class BalanceInquiryLookupForm extends MultipleValueLookupForm { 45 private static final long serialVersionUID = 1L; 46 47 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(BalanceInquiryForm.class); 48 49 private Lookupable pendingEntryLookupable; 50 private LookupResultsSelectable selectable; 51 private boolean segmented; 52 53 public BalanceInquiryLookupForm() { 54 } 55 56 /** 57 * Picks out business object name from the request to get retrieve a lookupable and set properties. 58 * 59 * @param request <code>{@link javax.servlet.http.HttpServletRequest}</code> instance for Struts 60 */ 61 @Override 62 public void populate(HttpServletRequest request) { 63 Lookupable localPendingEntryLookupable = null; 64 65 super.populate(request); 66 67 if (Entry.class.getName().equals(getBusinessObjectClassName())) { 68 localPendingEntryLookupable = LookupableSpringContext.getLookupable(GeneralLedgerConstants.LookupableBeanKeys.PENDING_ENTRY); 69 } 70 71 if (localPendingEntryLookupable != null) { 72 localPendingEntryLookupable.setBusinessObjectClass(GeneralLedgerPendingEntry.class); 73 localPendingEntryLookupable.setFieldConversions(getFieldConversions()); 74 } 75 setPendingEntryLookupable(localPendingEntryLookupable); 76 } 77 78 79 /** 80 * @param pendingEntryLookupable 81 */ 82 public void setPendingEntryLookupable(Lookupable pendingEntryLookupable) { 83 this.pendingEntryLookupable = pendingEntryLookupable; 84 } 85 86 87 /** 88 * @return Returns the pendingEntryLookupable. 89 */ 90 public Lookupable getPendingEntryLookupable() { 91 return this.pendingEntryLookupable; 92 } 93 94 /** 95 * Determines if the balance inquiry lookup should be segmented or not 96 * 97 * @return boolean 98 */ 99 public boolean isSegmented() { 100 return segmented; 101 } 102 103 /** 104 * Tells the balance inquiry lookup whether to be segmented or not 105 * 106 * @param seg 107 */ 108 public void setSegmented(boolean seg) { 109 segmented = seg; 110 } 111 }