001    /*
002     * Copyright 2007 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 edu.sampleu.financial.bo;
018    
019    import java.util.LinkedHashMap;
020    
021    import org.apache.commons.lang.builder.EqualsBuilder;
022    import org.kuali.rice.kns.bo.Inactivateable;
023    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
024    import org.kuali.rice.kns.util.ObjectUtils;
025    
026    /**
027     * An association between a <code>Campus</code> and a <code>VendorAddress</code> to indicate that the Address is the default one
028     * for this Campus among the various Addresses available for this Vendor.
029     *
030     * @see org.kuali.rice.kns.bo.Campus
031     * @see org.kuali.kfs.vnd.businessobject.VendorAddress
032     */
033    public class VendorDefaultAddress extends PersistableBusinessObjectBase implements Inactivateable {
034    
035        private Integer vendorDefaultAddressGeneratedIdentifier;
036        private Integer vendorAddressGeneratedIdentifier;
037        private String vendorCampusCode;
038        private boolean active;
039    
040        private VendorAddress vendorAddress;
041    
042        /**
043         * Default constructor.
044         */
045        public VendorDefaultAddress() {
046            super();
047        }
048    
049        public String getVendorCampusCode() {
050    
051            return vendorCampusCode;
052        }
053    
054        public void setVendorCampusCode(String vendorCampusCode) {
055            this.vendorCampusCode = vendorCampusCode;
056        }
057    
058        public Integer getVendorAddressGeneratedIdentifier() {
059    
060            return vendorAddressGeneratedIdentifier;
061        }
062    
063        public void setVendorAddressGeneratedIdentifier(Integer vendorAddressGeneratedIdentifier) {
064            this.vendorAddressGeneratedIdentifier = vendorAddressGeneratedIdentifier;
065        }
066    
067        public boolean isActive() {
068    
069            return active;
070        }
071    
072        public void setActive(boolean active) {
073            this.active = active;
074        }
075    
076        public VendorAddress getVendorAddress() {
077    
078            return vendorAddress;
079        }
080    
081        /**
082         * Sets the vendorAddress attribute.
083         *
084         * @param vendorAddress The vendorAddress to set.
085         * @deprecated
086         */
087        public void setVendorAddress(VendorAddress vendorAddress) {
088            this.vendorAddress = vendorAddress;
089        }
090    
091        public Integer getVendorDefaultAddressGeneratedIdentifier() {
092    
093            return vendorDefaultAddressGeneratedIdentifier;
094        }
095    
096        public void setVendorDefaultAddressGeneratedIdentifier(Integer vendorDefaultAddressGeneratedIdentifier) {
097            this.vendorDefaultAddressGeneratedIdentifier = vendorDefaultAddressGeneratedIdentifier;
098        }
099    
100        /**
101         * @see org.kuali.kfs.vnd.document.routing.VendorRoutingComparable#isEqualForRouting(Object)
102         */
103        public boolean isEqualForRouting(Object toCompare) {
104            if ((ObjectUtils.isNull(toCompare)) || !(toCompare instanceof VendorDefaultAddress)) {
105    
106                return false;
107            } else {
108                VendorDefaultAddress vda = (VendorDefaultAddress) toCompare;
109    
110                return new EqualsBuilder().append(this.getVendorDefaultAddressGeneratedIdentifier(), vda.getVendorDefaultAddressGeneratedIdentifier()).append(this.getVendorAddressGeneratedIdentifier(), vda.getVendorAddressGeneratedIdentifier()).append(this.getVendorCampusCode(), vda.getVendorCampusCode()).isEquals();
111            }
112        }
113    
114    
115    }