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.businessobject;
017    
018    import java.math.BigDecimal;
019    import java.util.LinkedHashMap;
020    import java.util.List;
021    
022    import org.kuali.rice.kns.bo.TransientBusinessObjectBase;
023    
024    public class GainLossDistributionTotalReportLine extends TransientBusinessObjectBase {
025    
026        protected String documentType;
027        protected String documentId;
028        protected String securityId;
029        protected int totalNumberOfTransactionLines = 0;
030        protected BigDecimal unitAdjustmentAmount = BigDecimal.ZERO;
031        protected BigDecimal totalHoldingAdjustmentAmount = BigDecimal.ZERO;
032    
033        /**
034         * Constructs a GainLossDistributionTotalReportLine.java.
035         * 
036         * @param documentType
037         * @param documentId
038         * @param securityId
039         */
040        public GainLossDistributionTotalReportLine(String documentType, String documentId, String securityId) {
041            this.documentType = documentType;
042            this.documentId = documentId;
043            this.securityId = securityId;
044        }
045    
046        /**
047         * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
048         */
049        @Override
050        protected LinkedHashMap toStringMapper() {
051            // TODO Auto-generated method stub
052            return null;
053        }
054    
055        /**
056         * Gets the documentType.
057         * 
058         * @return documentType
059         */
060        public String getDocumentType() {
061            return documentType;
062        }
063    
064        /**
065         * Sets the documentType.
066         * 
067         * @param documentType
068         */
069        public void setDocumentType(String documentType) {
070            this.documentType = documentType;
071        }
072    
073        /**
074         * Gets the documentId.
075         * 
076         * @return documentId
077         */
078        public String getDocumentId() {
079            return documentId;
080        }
081    
082        /**
083         * Sets the documentId.
084         * 
085         * @param documentId
086         */
087        public void setDocumentId(String documentId) {
088            this.documentId = documentId;
089        }
090    
091        /**
092         * Gets the securityId.
093         * 
094         * @return securityId
095         */
096        public String getSecurityId() {
097            return securityId;
098        }
099    
100        /**
101         * Sets the securityId.
102         * 
103         * @param securityId
104         */
105        public void setSecurityId(String securityId) {
106            this.securityId = securityId;
107        }
108    
109        /**
110         * Gets the totalNumberOfTransactionLines.
111         * 
112         * @return totalNumberOfTransactionLines
113         */
114        public int getTotalNumberOfTransactionLines() {
115            return totalNumberOfTransactionLines;
116        }
117    
118        /**
119         * Sets the totalNumberOfTransactionLines.
120         * 
121         * @param totalNumberOfTransactionLines
122         */
123        public void setTotalNumberOfTransactionLines(int totalNumberOfTransactionLines) {
124            this.totalNumberOfTransactionLines = totalNumberOfTransactionLines;
125        }
126    
127        /**
128         * Gets the unitAdjustmentAmount.
129         * 
130         * @return unitAdjustmentAmount
131         */
132        public BigDecimal getUnitAdjustmentAmount() {
133            return unitAdjustmentAmount;
134        }
135    
136        /**
137         * Sets the unitAdjustmentAmount.
138         * 
139         * @param unitAdjustmentAmount
140         */
141        public void setUnitAdjustmentAmount(BigDecimal unitAdjustmentAmount) {
142            this.unitAdjustmentAmount = unitAdjustmentAmount;
143        }
144    
145        /**
146         * Gets the totalHoldingAdjustmentAmount.
147         * 
148         * @return totalHoldingAdjustmentAmount
149         */
150        public BigDecimal getTotalHoldingAdjustmentAmount() {
151            return totalHoldingAdjustmentAmount;
152        }
153    
154        /**
155         * Sets the totalHoldingAdjustmentAmount.
156         * 
157         * @param totalHoldingAdjustmentAmount
158         */
159        public void setTotalHoldingAdjustmentAmount(BigDecimal totalHoldingAdjustmentAmount) {
160            this.totalHoldingAdjustmentAmount = totalHoldingAdjustmentAmount;
161        }
162    
163        /**
164         * Adds the unitAdjustmentAmount.
165         * 
166         * @param unitAdjustmentAmount
167         */
168        public void addUnitAdjustmentAmount(BigDecimal unitAdjustmentAmount) {
169            this.unitAdjustmentAmount = this.unitAdjustmentAmount.add(unitAdjustmentAmount);
170            totalNumberOfTransactionLines++;
171        }
172    
173        /**
174         * Computes the total holding adjustment based on the tax lots holding cost and adds it to totalHoldingAdjustmentAmount.
175         * 
176         * @param endowmentTransactionLine
177         */
178        public void addTotalHoldingAdjustmentAmount(EndowmentTransactionLine endowmentTransactionLine) {
179    
180            List<EndowmentTransactionTaxLotLine> taxLotLines = endowmentTransactionLine.getTaxLotLines();
181            BigDecimal totalHoldingAmount = BigDecimal.ZERO;
182    
183            for (EndowmentTransactionTaxLotLine taxLotLine : taxLotLines) {
184                totalHoldingAmount = totalHoldingAmount.add(taxLotLine.getLotHoldingCost());
185            }
186    
187            this.totalHoldingAdjustmentAmount = this.totalHoldingAdjustmentAmount.add(totalHoldingAmount);
188        }
189    
190    }