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.module.endow.document.web.struts;
017    
018    import javax.servlet.http.HttpServletRequest;
019    import javax.servlet.http.HttpServletResponse;
020    
021    import org.apache.struts.action.ActionForm;
022    import org.apache.struts.action.ActionForward;
023    import org.apache.struts.action.ActionMapping;
024    import org.kuali.kfs.module.endow.businessobject.EndowmentTransactionLine;
025    import org.kuali.kfs.module.endow.document.EndowmentTransactionLinesDocument;
026    import org.kuali.kfs.module.endow.document.LiabilityDecreaseDocument;
027    import org.kuali.kfs.module.endow.document.service.LiabilityDocumentService;
028    import org.kuali.kfs.sys.KFSConstants;
029    import org.kuali.kfs.sys.context.SpringContext;
030    
031    
032    public class LiabilityDecreaseDocumentAction extends EndowmentTaxLotLinesDocumentActionBase {
033        @Override
034        public ActionForward refresh(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
035            super.refresh(mapping, form, request, response);
036    
037            // LiabilityIncreaseDocument liabilityIncreaseDocument = ((LiabilityIncreaseDocumentForm)
038            // form).getLiabilityIncreaseDocument();
039    
040            /*
041             * //Target //Saving a Trans Line EndowmentTransactionLine tranLine = new EndowmentTargetTransactionLine();
042             * tranLine.setTransactionLineNumber(new KualiInteger("1")); tranLine.setKemid("099PLTF013");
043             * tranLine.setEtranCode("00100"); tranLine.setTransactionIPIndicatorCode("I"); tranLine.setTransactionAmount(new
044             * KualiDecimal(2.1)); //Setting the transaction line. List tranList = new ArrayList(); tranList.add(tranLine);
045             * liabilityIncreaseDocument.setTargetTransactionLines(tranList); tranLine = new EndowmentTargetTransactionLine();
046             * tranLine.setDocumentNumber("4160"); tranLine.setTransactionLineNumber(new KualiInteger("2"));
047             * tranLine.setKemid("099PLTF013"); tranLine.setEtranCode("00100"); tranLine.setTransactionIPIndicatorCode("I");
048             * tranLine.setTransactionAmount(new KualiDecimal(2.2)); tranList.add(tranLine); //Source tranLine = new
049             * EndowmentSourceTransactionLine(); tranLine.setDocumentNumber("4160"); tranLine.setTransactionLineNumber(new
050             * KualiInteger("3")); tranLine.setKemid("099PLTF013"); tranLine.setEtranCode("00100");
051             * tranLine.setTransactionIPIndicatorCode("I"); tranLine.setTransactionAmount(new KualiDecimal(2.3)); //Setting the
052             * transaction line. List stranList = new ArrayList(); stranList.add(tranLine);
053             * liabilityIncreaseDocument.setSourceTransactionLines(stranList); EndowmentTransactionTaxLotLine hldg = new
054             * EndowmentTransactionTaxLotLine(); hldg.setDocumentNumber("4160"); hldg.setDocumentLineNumber(new KualiInteger("1"));
055             * hldg.setDocumentLineTypeCode("F"); hldg.setTransactionHoldingLongTermNumber(new KualiInteger("99")); hldg.setLotUnits(new
056             * KualiDecimal("22")); List taxList = new ArrayList(); taxList.add(hldg); EndowmentTransactionTaxLotLine hldg = new
057             * EndowmentTransactionTaxLotLine(); hldg.setDocumentLineNumber(new KualiInteger("2")); hldg.setDocumentLineTypeCode("F");
058             * hldg.setTransactionHoldingLongTermNumber(new KualiInteger("99")); hldg.setLotUnits(new KualiDecimal("22")); List taxList
059             * = new ArrayList(); taxList.add(hldg); tranLine.setTaxLotLines(taxList);
060             */
061    
062            return mapping.findForward(KFSConstants.MAPPING_BASIC);
063        }
064    
065    
066        /**
067         * @see org.kuali.kfs.module.endow.document.web.struts.EndowmentTaxLotLinesDocumentActionBase#updateTransactionLineTaxLots(boolean, boolean, org.kuali.kfs.module.endow.document.EndowmentTransactionLinesDocument, org.kuali.kfs.module.endow.businessobject.EndowmentTransactionLine)
068         */
069        @Override
070        protected void updateTransactionLineTaxLots(boolean isUpdate, boolean isSource, EndowmentTransactionLinesDocument etlDocument, EndowmentTransactionLine transLine) {
071    
072            LiabilityDocumentService taxLotsService = SpringContext.getBean(LiabilityDocumentService.class);
073            LiabilityDecreaseDocument liabilityDecreaseDocument = (LiabilityDecreaseDocument) etlDocument;
074            taxLotsService.updateLiabilityDecreaseTransactionLineTaxLots(isSource, liabilityDecreaseDocument, transLine);
075    
076        }
077    
078    
079        /**
080         * @see org.kuali.kfs.module.endow.document.web.struts.EndowmentTaxLotLinesDocumentActionBase#getRefreshTaxLotsOnSaveOrSubmit()
081         */
082        @Override
083        protected boolean getRefreshTaxLotsOnSaveOrSubmit() {
084            return true;
085        }
086    
087    }