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