View Javadoc
1   /*
2    * Copyright 2013 The Kuali Foundation.
3    * 
4    * Licensed under the Educational Community License, Version 1.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/ecl1.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.select.document.web.struts;
17  
18  import org.kuali.ole.fp.document.service.DisbursementVoucherCoverSheetService;
19  import org.kuali.ole.fp.document.web.struts.DisbursementVoucherForm;
20  import org.kuali.ole.select.businessobject.OleDisbursementVoucherPayeeDetail;
21  import org.kuali.ole.select.document.OleDisbursementVoucherDocument;
22  import org.kuali.ole.sys.context.SpringContext;
23  import org.kuali.rice.kns.service.BusinessObjectDictionaryService;
24  
25  import javax.servlet.http.HttpServletRequest;
26  
27  public class OleDisbursementVoucherForm extends DisbursementVoucherForm {
28  
29      /**
30       * Constructs a OleDisbursementVoucherForm.java.
31       */
32      public OleDisbursementVoucherForm() {
33          super();
34      }
35  
36      /**
37       * @see org.kuali.rice.kns.web.struts.form.KualiTransactionalDocumentFormBase#populate(javax.servlet.http.HttpServletRequest)
38       */
39      @Override
40      public void populate(HttpServletRequest request) {
41          super.populate(request);
42          OleDisbursementVoucherPayeeDetail payeeDetail = getDisbursementVoucherDocument().getDvPayeeDetail();
43          SpringContext.getBean(BusinessObjectDictionaryService.class).performForceUppercase(payeeDetail);
44  
45      }
46  
47      /**
48       * determines if the DV document is in a state that allows printing of the cover sheet
49       *
50       * @return true if the DV document is in a state that allows printing of the cover sheet; otherwise, return false
51       */
52      @Override
53      public boolean getCanPrintCoverSheet() {
54          OleDisbursementVoucherDocument oleDisbursementVoucherDocument = (OleDisbursementVoucherDocument) this.getDocument();
55          return SpringContext.getBean(DisbursementVoucherCoverSheetService.class).isCoverSheetPrintable(oleDisbursementVoucherDocument);
56      }
57  
58      /**
59       * Returns the instance of OleDisbursementVoucherDocument
60       */
61      @Override
62      public OleDisbursementVoucherDocument getDisbursementVoucherDocument() {
63          return (OleDisbursementVoucherDocument) getDocument();
64  
65      }
66  
67      /**
68       * determine whether the selected payee is an employee
69       */
70      @Override
71      public boolean isEmployee() {
72          OleDisbursementVoucherDocument oleDisbursementVoucherDocument = (OleDisbursementVoucherDocument) this.getDocument();
73          return oleDisbursementVoucherDocument.getDvPayeeDetail().isEmployee();
74      }
75  
76      /**
77       * determine whether the selected payee is a vendor
78       */
79      @Override
80      public boolean isVendor() {
81          OleDisbursementVoucherDocument oleDisbursementVoucherDocument = (OleDisbursementVoucherDocument) this.getDocument();
82          return oleDisbursementVoucherDocument.getDvPayeeDetail().isVendor();
83      }
84  }