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 java.math.BigDecimal;
019    
020    import org.kuali.kfs.module.endow.businessobject.EndowmentTransactionLine;
021    import org.kuali.kfs.module.endow.document.EndowmentTransactionLinesDocument;
022    import org.kuali.kfs.module.endow.document.HoldingAdjustmentDocument;
023    import org.kuali.kfs.module.endow.document.service.UpdateHoldingAdjustmentDocumentTaxLotsService;
024    import org.kuali.kfs.sys.context.SpringContext;
025    import org.kuali.rice.kns.util.ObjectUtils;
026    
027    /**
028     * HoldingAdjustmentDocumentAction class
029     */
030    public class HoldingAdjustmentDocumentAction extends EndowmentTaxLotLinesDocumentActionBase {
031    
032        /**
033         * @see org.kuali.kfs.module.endow.document.web.struts.EndowmentTaxLotLinesDocumentActionBase#updateTransactionLineTaxLots(boolean,
034         *      boolean, org.kuali.kfs.module.endow.document.EndowmentTransactionLinesDocument,
035         *      org.kuali.kfs.module.endow.businessobject.EndowmentTransactionLine)
036         */
037        @Override
038        protected void updateTransactionLineTaxLots(boolean isUpdate, boolean isSource, EndowmentTransactionLinesDocument etlDocument, EndowmentTransactionLine transLine) {
039            UpdateHoldingAdjustmentDocumentTaxLotsService updateHoldingAdjustmentDocumentTaxLotsService = SpringContext.getBean(UpdateHoldingAdjustmentDocumentTaxLotsService.class);
040            HoldingAdjustmentDocument holdingAdjustmentDocument = (HoldingAdjustmentDocument) etlDocument;
041    
042            // call service to update the tax lot lines if transaction amount is entered
043            if (ObjectUtils.isNotNull(transLine.getTransactionAmount()) && !transLine.getTransactionAmount().isZero()) {
044                updateHoldingAdjustmentDocumentTaxLotsService.updateTransactionLineTaxLotsByTransactionAmount(isUpdate, holdingAdjustmentDocument, transLine, isSource);
045            }
046    
047            // call service to update the tax lot lines if unit adjustment amount is entered
048            if (ObjectUtils.isNotNull(transLine.getUnitAdjustmentAmount()) && (transLine.getUnitAdjustmentAmount().compareTo(BigDecimal.ZERO) != 0)) {
049                updateHoldingAdjustmentDocumentTaxLotsService.updateTransactionLineTaxLotsByUnitAdjustmentAmount(isUpdate, holdingAdjustmentDocument, transLine, isSource);
050            }
051        }
052    
053        /**
054         * @see org.kuali.kfs.module.endow.document.web.struts.EndowmentTaxLotLinesDocumentActionBase#getRefreshTaxLotsOnSaveOrSubmit()
055         */
056        @Override
057        protected boolean getRefreshTaxLotsOnSaveOrSubmit() {
058            return false;
059        }
060    
061    }