View Javadoc
1   /*
2    * Copyright 2007 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.kuali.ole.vnd.businessobject;
18  
19  import org.apache.commons.lang.builder.EqualsBuilder;
20  import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
21  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
22  import org.kuali.rice.krad.util.ObjectUtils;
23  
24  /**
25   * An association between a <code>Campus</code> and a <code>VendorAddress</code> to indicate that the Address is the default one
26   * for this Campus among the various Addresses available for this Vendor.
27   * 
28   * @see org.kuali.rice.location.framework.campus.CampusEbo
29   * @see org.kuali.ole.vnd.businessobject.VendorAddress
30   */
31  public class VendorDefaultAddress extends PersistableBusinessObjectBase implements VendorRoutingComparable, MutableInactivatable {
32  
33      protected Integer vendorDefaultAddressGeneratedIdentifier;
34      protected Integer vendorAddressGeneratedIdentifier;
35      protected String vendorCampusCode;
36      protected boolean active;
37  
38      protected VendorAddress vendorAddress;
39      protected CampusParameter vendorCampus;
40  
41      /**
42       * Default constructor.
43       */
44      public VendorDefaultAddress() {
45  
46      }
47  
48      public String getVendorCampusCode() {
49  
50          return vendorCampusCode;
51      }
52  
53      public void setVendorCampusCode(String vendorCampusCode) {
54          this.vendorCampusCode = vendorCampusCode;
55      }
56  
57      public Integer getVendorAddressGeneratedIdentifier() {
58  
59          return vendorAddressGeneratedIdentifier;
60      }
61  
62      public void setVendorAddressGeneratedIdentifier(Integer vendorAddressGeneratedIdentifier) {
63          this.vendorAddressGeneratedIdentifier = vendorAddressGeneratedIdentifier;
64      }
65  
66      @Override
67      public boolean isActive() {
68  
69          return active;
70      }
71  
72      @Override
73      public void setActive(boolean active) {
74          this.active = active;
75      }
76  
77      public VendorAddress getVendorAddress() {
78  
79          return vendorAddress;
80      }
81  
82      /**
83       * Sets the vendorAddress attribute.
84       * 
85       * @param vendorAddress The vendorAddress to set.
86       * @deprecated
87       */
88      public void setVendorAddress(VendorAddress vendorAddress) {
89          this.vendorAddress = vendorAddress;
90      }
91  
92  
93      public CampusParameter getVendorCampus() {
94          return vendorCampus;
95      }
96  
97      /**
98       * Sets the vendorCampus attribute.
99       * 
100      * @param vendorCampus The vendorCampus to set.
101      * @deprecated
102      */
103     public void setVendorCampus(CampusParameter vendorCampus) {
104         this.vendorCampus = vendorCampus;
105     }
106 
107     public Integer getVendorDefaultAddressGeneratedIdentifier() {
108 
109         return vendorDefaultAddressGeneratedIdentifier;
110     }
111 
112     public void setVendorDefaultAddressGeneratedIdentifier(Integer vendorDefaultAddressGeneratedIdentifier) {
113         this.vendorDefaultAddressGeneratedIdentifier = vendorDefaultAddressGeneratedIdentifier;
114     }
115 
116     /**
117      * @see org.kuali.ole.vnd.document.routing.VendorRoutingComparable#isEqualForRouting(java.lang.Object)
118      */
119     @Override
120     public boolean isEqualForRouting(Object toCompare) {
121         if ((ObjectUtils.isNull(toCompare)) || !(toCompare instanceof VendorDefaultAddress)) {
122 
123             return false;
124         }
125         else {
126             VendorDefaultAddress vda = (VendorDefaultAddress) toCompare;
127 
128             return new EqualsBuilder().append(this.getVendorDefaultAddressGeneratedIdentifier(), vda.getVendorDefaultAddressGeneratedIdentifier()).append(this.getVendorAddressGeneratedIdentifier(), vda.getVendorAddressGeneratedIdentifier()).append(this.getVendorCampusCode(), vda.getVendorCampusCode()).isEquals();
129         }
130     }
131 }