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    
017    package org.kuali.kfs.vnd.businessobject;
018    
019    import java.util.LinkedHashMap;
020    
021    import org.apache.commons.lang.builder.EqualsBuilder;
022    import org.kuali.kfs.coa.businessobject.Chart;
023    import org.kuali.kfs.coa.businessobject.Organization;
024    import org.kuali.rice.kns.bo.Inactivateable;
025    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
026    import org.kuali.rice.kns.util.KualiDecimal;
027    import org.kuali.rice.kns.util.ObjectUtils;
028    
029    /**
030     * A relation between a particular <code>Org</code> and a <code>VendorContract</code> indicating that the Org uses this Vendor
031     * Contract.
032     * 
033     * @see org.kuali.kfs.vnd.businessobject.VendorContract
034     * @see org.kuali.kfs.coa.businessobject.Org
035     */
036    public class VendorContractOrganization extends PersistableBusinessObjectBase implements VendorRoutingComparable, Inactivateable {
037    
038        private Integer vendorContractGeneratedIdentifier;
039        private String chartOfAccountsCode;
040        private String organizationCode;
041        private KualiDecimal vendorContractPurchaseOrderLimitAmount;
042        private boolean vendorContractExcludeIndicator;
043        private boolean active;
044    
045        private VendorContract vendorContract;
046        private Organization organization;
047        private Chart chartOfAccounts;
048    
049        /**
050         * Default constructor.
051         */
052        public VendorContractOrganization() {
053    
054        }
055    
056        public Integer getVendorContractGeneratedIdentifier() {
057    
058            return vendorContractGeneratedIdentifier;
059        }
060    
061        public void setVendorContractGeneratedIdentifier(Integer vendorContractGeneratedIdentifier) {
062            this.vendorContractGeneratedIdentifier = vendorContractGeneratedIdentifier;
063        }
064    
065        public String getChartOfAccountsCode() {
066    
067            return chartOfAccountsCode;
068        }
069    
070        public void setChartOfAccountsCode(String chartOfAccountsCode) {
071            this.chartOfAccountsCode = chartOfAccountsCode;
072        }
073    
074        public String getOrganizationCode() {
075    
076            return organizationCode;
077        }
078    
079        public void setOrganizationCode(String organizationCode) {
080            this.organizationCode = organizationCode;
081        }
082    
083        public KualiDecimal getVendorContractPurchaseOrderLimitAmount() {
084    
085            return vendorContractPurchaseOrderLimitAmount;
086        }
087    
088        public void setVendorContractPurchaseOrderLimitAmount(KualiDecimal vendorContractPurchaseOrderLimitAmount) {
089            this.vendorContractPurchaseOrderLimitAmount = vendorContractPurchaseOrderLimitAmount;
090        }
091    
092        public boolean isVendorContractExcludeIndicator() {
093    
094            return vendorContractExcludeIndicator;
095        }
096    
097        public void setVendorContractExcludeIndicator(boolean vendorContractExcludeIndicator) {
098            this.vendorContractExcludeIndicator = vendorContractExcludeIndicator;
099        }
100    
101        public boolean isActive() {
102    
103            return active;
104        }
105    
106        public void setActive(boolean active) {
107            this.active = active;
108        }
109    
110        public Organization getOrganization() {
111    
112            return organization;
113        }
114    
115        /**
116         * Sets the organization attribute.
117         * 
118         * @param organization The organization to set.
119         * @deprecated
120         */
121        public void setOrganization(Organization organization) {
122            this.organization = organization;
123        }
124    
125        public Chart getChartOfAccounts() {
126    
127            return chartOfAccounts;
128        }
129    
130        /**
131         * Sets the chartOfAccounts attribute.
132         * 
133         * @param chartOfAccounts The chartOfAccounts to set.
134         * @deprecated
135         */
136        public void setChartOfAccounts(Chart chartOfAccounts) {
137            this.chartOfAccounts = chartOfAccounts;
138        }
139    
140        public VendorContract getVendorContract() {
141    
142            return vendorContract;
143        }
144    
145        /**
146         * Sets the vendorContract attribute value.
147         * 
148         * @param vendorContract The vendorContract to set.
149         * @deprecated
150         */
151        public void setVendorContract(VendorContract vendorContract) {
152            this.vendorContract = vendorContract;
153        }
154    
155        /**
156         * @see org.kuali.kfs.vnd.document.routing.VendorRoutingComparable#isEqualForRouting(java.lang.Object)
157         */
158        public boolean isEqualForRouting(Object toCompare) {
159            if ((ObjectUtils.isNull(toCompare)) || !(toCompare instanceof VendorContractOrganization)) {
160    
161                return false;
162            }
163            else {
164                VendorContractOrganization vco = (VendorContractOrganization) toCompare;
165    
166                return new EqualsBuilder().append(this.getVendorContractGeneratedIdentifier(), vco.getVendorContractGeneratedIdentifier()).append(this.getChartOfAccountsCode(), vco.getChartOfAccountsCode()).append(this.getOrganizationCode(), vco.getOrganizationCode()).append(this.getVendorContractPurchaseOrderLimitAmount(), vco.getVendorContractPurchaseOrderLimitAmount()).append(this.isVendorContractExcludeIndicator(), vco.isVendorContractExcludeIndicator()).isEquals();
167            }
168        }
169    
170        /**
171         * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
172         */
173        protected LinkedHashMap toStringMapper() {
174            LinkedHashMap m = new LinkedHashMap();
175            if (this.vendorContractGeneratedIdentifier != null) {
176                m.put("vendorContractGeneratedIdentifier", this.vendorContractGeneratedIdentifier.toString());
177            }
178            m.put("chartOfAccountsCode", this.chartOfAccountsCode);
179            m.put("organizationCode", this.organizationCode);
180    
181            return m;
182        }
183    
184    }