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     * @see org.kuali.kfs.vnd.businessobject.VendorAddress
030     */
031    public class VendorDefaultAddress extends PersistableBusinessObjectBase implements MutableInactivatable {
032    
033        private Integer vendorDefaultAddressGeneratedIdentifier;
034        private Integer vendorAddressGeneratedIdentifier;
035        private String vendorCampusCode;
036        private boolean active;
037    
038        private VendorAddress vendorAddress;
039    
040        /**
041         * Default constructor.
042         */
043        public VendorDefaultAddress() {
044            super();
045        }
046    
047        public String getVendorCampusCode() {
048    
049            return vendorCampusCode;
050        }
051    
052        public void setVendorCampusCode(String vendorCampusCode) {
053            this.vendorCampusCode = vendorCampusCode;
054        }
055    
056        public Integer getVendorAddressGeneratedIdentifier() {
057    
058            return vendorAddressGeneratedIdentifier;
059        }
060    
061        public void setVendorAddressGeneratedIdentifier(Integer vendorAddressGeneratedIdentifier) {
062            this.vendorAddressGeneratedIdentifier = vendorAddressGeneratedIdentifier;
063        }
064    
065        public boolean isActive() {
066    
067            return active;
068        }
069    
070        public void setActive(boolean active) {
071            this.active = active;
072        }
073    
074        public VendorAddress getVendorAddress() {
075    
076            return vendorAddress;
077        }
078    
079        /**
080         * Sets the vendorAddress attribute.
081         *
082         * @param vendorAddress The vendorAddress to set.
083         * @deprecated
084         */
085        public void setVendorAddress(VendorAddress vendorAddress) {
086            this.vendorAddress = vendorAddress;
087        }
088    
089        public Integer getVendorDefaultAddressGeneratedIdentifier() {
090    
091            return vendorDefaultAddressGeneratedIdentifier;
092        }
093    
094        public void setVendorDefaultAddressGeneratedIdentifier(Integer vendorDefaultAddressGeneratedIdentifier) {
095            this.vendorDefaultAddressGeneratedIdentifier = vendorDefaultAddressGeneratedIdentifier;
096        }
097    
098        /**
099         * @see org.kuali.kfs.vnd.document.routing.VendorRoutingComparable#isEqualForRouting(Object)
100         */
101        public boolean isEqualForRouting(Object toCompare) {
102            if ((ObjectUtils.isNull(toCompare)) || !(toCompare instanceof VendorDefaultAddress)) {
103    
104                return false;
105            } else {
106                VendorDefaultAddress vda = (VendorDefaultAddress) toCompare;
107    
108                return new EqualsBuilder().append(this.getVendorDefaultAddressGeneratedIdentifier(), vda.getVendorDefaultAddressGeneratedIdentifier()).append(this.getVendorAddressGeneratedIdentifier(), vda.getVendorAddressGeneratedIdentifier()).append(this.getVendorCampusCode(), vda.getVendorCampusCode()).isEquals();
109            }
110        }
111    
112    
113    }