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