View Javadoc
1   /*
2    * Copyright 2007 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.gl.web.struts;
17  
18  import javax.servlet.http.HttpServletRequest;
19  
20  import org.kuali.ole.gl.GeneralLedgerConstants;
21  import org.kuali.ole.gl.businessobject.Entry;
22  import org.kuali.ole.sys.businessobject.GeneralLedgerPendingEntry;
23  import org.kuali.ole.sys.businessobject.lookup.LookupableSpringContext;
24  import org.kuali.rice.kns.lookup.Lookupable;
25  import org.kuali.rice.kns.web.struts.form.MultipleValueLookupForm;
26  
27  /**
28   * Balance inquiries are pretty much just lookups already, but are not used in the traditional sense. In most cases, balance
29   * inquiries only show the end-user data, and allow the end-user to drill-down into inquiries. A traditional lookup allows the user
30   * to return data to a form. This class is for balance inquiries implemented in the sense of a traditional lookup for forms that
31   * pull data out of inquiries.<br/> <br/> One example of this is the
32   * <code>{@link org.kuali.ole.module.ld.document.SalaryExpenseTransferDocument}</code> which creates source lines from a labor
33   * ledger balance inquiry screen.<br/> <br/> This is a <code>{@link KualiMultipleValueLookupAction}</code> which required some
34   * customization because requirements were not possible with displaytag. There are a number of properties/attributes that are used
35   * for pagination, formatting, etc...
36   * 
37   * @see org.kuali.ole.module.ld.document.SalaryExpenseTransferDocument
38   * @see org.kuali.ole.module.ld.document.web.struts.SalaryExpenseTransferAction;
39   * @see org.kuali.ole.module.ld.document.web.struts.SalaryExpenseTransferForm;
40   */
41  public class BalanceInquiryLookupForm extends MultipleValueLookupForm {
42      private static final long serialVersionUID = 1L;
43  
44      private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(BalanceInquiryForm.class);
45  
46      private Lookupable pendingEntryLookupable;
47      private LookupResultsSelectable selectable;
48      private boolean segmented;
49  
50      public BalanceInquiryLookupForm() {
51      }
52  
53      /**
54       * Picks out business object name from the request to get retrieve a lookupable and set properties.
55       * 
56       * @param request <code>{@link javax.servlet.http.HttpServletRequest}</code> instance for Struts
57       */
58      @Override
59      public void populate(HttpServletRequest request) {
60          Lookupable localPendingEntryLookupable = null;
61  
62          super.populate(request);
63  
64          if (Entry.class.getName().equals(getBusinessObjectClassName())) {
65              localPendingEntryLookupable = LookupableSpringContext.getLookupable(GeneralLedgerConstants.LookupableBeanKeys.PENDING_ENTRY);
66          }
67  
68          if (localPendingEntryLookupable != null) {
69              localPendingEntryLookupable.setBusinessObjectClass(GeneralLedgerPendingEntry.class);
70              localPendingEntryLookupable.setFieldConversions(getFieldConversions());
71          }
72          setPendingEntryLookupable(localPendingEntryLookupable);
73      }
74  
75  
76      /**
77       * @param pendingEntryLookupable
78       */
79      public void setPendingEntryLookupable(Lookupable pendingEntryLookupable) {
80          this.pendingEntryLookupable = pendingEntryLookupable;
81      }
82  
83  
84      /**
85       * @return Returns the pendingEntryLookupable.
86       */
87      public Lookupable getPendingEntryLookupable() {
88          return this.pendingEntryLookupable;
89      }
90  
91      /**
92       * Determines if the balance inquiry lookup should be segmented or not
93       * 
94       * @return boolean
95       */
96      public boolean isSegmented() {
97          return segmented;
98      }
99  
100     /**
101      * Tells the balance inquiry lookup whether to be segmented or not
102      * 
103      * @param seg
104      */
105     public void setSegmented(boolean seg) {
106         segmented = seg;
107     }
108 }