001 /* 002 * Copyright 2011 The Kuali Foundation. 003 * 004 * Licensed under the Educational Community License, Version 2.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/ecl2.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.kfs.fp.document.web.struts; 017 018 import java.util.List; 019 020 import javax.servlet.http.HttpServletRequest; 021 022 import org.kuali.kfs.fp.businessobject.AdvanceDepositDetail; 023 import org.kuali.kfs.fp.businessobject.CapitalAssetInformation; 024 import org.kuali.kfs.fp.document.AdvanceDepositDocument; 025 import org.kuali.kfs.fp.document.CapitalAssetEditable; 026 import org.kuali.kfs.sys.context.SpringContext; 027 import org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase; 028 import org.kuali.rice.kns.service.BusinessObjectDictionaryService; 029 030 /** 031 * This class is the struts form for Advance Deposit document. 032 */ 033 public class AdvanceDepositForm extends KualiAccountingDocumentFormBase implements CapitalAssetEditable { 034 protected AdvanceDepositDetail newAdvanceDeposit; 035 036 protected CapitalAssetInformation capitalAssetInformation; 037 038 /** 039 * Constructs a AdvanceDepositForm.java. 040 */ 041 public AdvanceDepositForm() { 042 super(); 043 044 AdvanceDepositDetail advanceDepositDetail = new AdvanceDepositDetail(); 045 advanceDepositDetail.setDefautBankCode(); 046 setNewAdvanceDeposit(advanceDepositDetail); 047 048 this.setCapitalAssetInformation(new CapitalAssetInformation()); 049 } 050 051 @Override 052 protected String getDefaultDocumentTypeName() { 053 return "AD"; 054 } 055 056 /** 057 * @return AdvanceDepositDocument 058 */ 059 public AdvanceDepositDocument getAdvanceDepositDocument() { 060 return (AdvanceDepositDocument) getDocument(); 061 } 062 063 /** 064 * @return AdvanceDepositDetail 065 */ 066 public AdvanceDepositDetail getNewAdvanceDeposit() { 067 return newAdvanceDeposit; 068 } 069 070 /** 071 * @param newAdvanceDeposit 072 */ 073 public void setNewAdvanceDeposit(AdvanceDepositDetail newAdvanceDeposit) { 074 this.newAdvanceDeposit = newAdvanceDeposit; 075 } 076 077 /** 078 * Overrides the parent to call super.populate and then tells each line to check the associated data dictionary and modify the 079 * values entered to follow all the attributes set for the values of the accounting line. 080 * 081 * @see org.kuali.rice.kns.web.struts.form.KualiTransactionalDocumentFormBase#populate(javax.servlet.http.HttpServletRequest) 082 */ 083 @Override 084 public void populate(HttpServletRequest request) { 085 super.populate(request); 086 087 // 088 // now run through all of the accounting lines and make sure they've been uppercased and populated appropriately 089 SpringContext.getBean(BusinessObjectDictionaryService.class).performForceUppercase(getNewAdvanceDeposit()); 090 091 List<AdvanceDepositDetail> advancedDeposits = getAdvanceDepositDocument().getAdvanceDeposits(); 092 for (AdvanceDepositDetail detail : advancedDeposits) { 093 SpringContext.getBean(BusinessObjectDictionaryService.class).performForceUppercase(detail); 094 } 095 } 096 097 /** 098 * @see org.kuali.kfs.fp.document.CapitalAssetEditable#getCapitalAssetInformation() 099 */ 100 public CapitalAssetInformation getCapitalAssetInformation() { 101 return capitalAssetInformation; 102 } 103 104 /** 105 * @see org.kuali.kfs.fp.document.CapitalAssetEditable#setCapitalAssetInformation(org.kuali.kfs.fp.businessobject.CapitalAssetInformation) 106 */ 107 public void setCapitalAssetInformation(CapitalAssetInformation capitalAssetInformation) { 108 this.capitalAssetInformation = capitalAssetInformation; 109 } 110 }