View Javadoc
1   /*
2    * Copyright 2006 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.fp.document.web.struts;
17  
18  import java.util.ArrayList;
19  import java.util.List;
20  
21  import javax.servlet.http.HttpServletRequest;
22  
23  import org.kuali.ole.fp.businessobject.CapitalAssetInformation;
24  import org.kuali.ole.fp.businessobject.CreditCardDetail;
25  import org.kuali.ole.fp.document.CapitalAssetEditable;
26  import org.kuali.ole.fp.document.CreditCardReceiptDocument;
27  import org.kuali.ole.sys.context.SpringContext;
28  import org.kuali.rice.kns.service.BusinessObjectDictionaryService;
29  
30  /**
31   * This class is the struts form for Credit Card Receipt document.
32   */
33  public class CreditCardReceiptForm extends CapitalAccountingLinesFormBase implements CapitalAssetEditable {
34      protected CreditCardDetail newCreditCardReceipt;
35      protected List<CapitalAssetInformation> capitalAssetInformation;
36  
37      /**
38       * Constructs a CreditCardReceiptForm.java.
39       */
40      public CreditCardReceiptForm() {
41          super();
42          
43          setNewCreditCardReceipt(new CreditCardDetail());
44          
45          capitalAssetInformation = new ArrayList<CapitalAssetInformation>();
46          this.capitalAccountingLine.setCanCreateAsset(false); //This document can only edit asset information
47      }
48  
49      @Override
50      protected String getDefaultDocumentTypeName() {
51          return "OLE_CCR";
52      }
53      
54      /**
55       * @return CreditCardReceiptDocument
56       */
57      public CreditCardReceiptDocument getCreditCardReceiptDocument() {
58          return (CreditCardReceiptDocument) getDocument();
59      }
60  
61      /**
62       * @return CreditCardDetail
63       */
64      public CreditCardDetail getNewCreditCardReceipt() {
65          return newCreditCardReceipt;
66      }
67  
68      /**
69       * @param newCreditCardReceipt
70       */
71      public void setNewCreditCardReceipt(CreditCardDetail newCreditCardReceipt) {
72          this.newCreditCardReceipt = newCreditCardReceipt;
73      }
74  
75      /**
76       * Overrides the parent to call super.populate and then tells each line to check the associated data dictionary and modify the
77       * values entered to follow all the attributes set for the values of the accounting line.
78       * 
79       * @see org.kuali.rice.kns.web.struts.form.KualiTransactionalDocumentFormBase#populate(javax.servlet.http.HttpServletRequest)
80       */
81      @Override
82      public void populate(HttpServletRequest request) {
83          super.populate(request);
84  
85          //
86          // now run through all of the accounting lines and make sure they've been uppercased and populated appropriately
87          SpringContext.getBean(BusinessObjectDictionaryService.class).performForceUppercase(getNewCreditCardReceipt());
88  
89          List<CreditCardDetail> creditCardReceipts = getCreditCardReceiptDocument().getCreditCardReceipts();
90          for (CreditCardDetail detail : creditCardReceipts) {
91              SpringContext.getBean(BusinessObjectDictionaryService.class).performForceUppercase(detail);
92          }
93  
94      }
95  
96      /**
97       * @see org.kuali.ole.fp.document.CapitalAssetEditable#getCapitalAssetInformation()
98       */
99      public List<CapitalAssetInformation> getCapitalAssetInformation() {
100         return this.capitalAssetInformation;
101     }
102 
103     /**
104      * @see org.kuali.ole.fp.document.CapitalAssetEditable#setCapitalAssetInformation(org.kuali.ole.fp.businessobject.CapitalAssetInformation)
105      */
106     public void setCapitalAssetInformation(List<CapitalAssetInformation> capitalAssetInformation) {
107         this.capitalAssetInformation = capitalAssetInformation;        
108     }
109 }