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 java.util.LinkedHashMap;
20  
21  import org.apache.commons.lang.builder.EqualsBuilder;
22  import org.apache.log4j.Logger;
23  import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
24  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
25  import org.kuali.rice.krad.util.ObjectUtils;
26  
27  /**
28   * Relationship between a Vendor and a <code>SupplierDiversity</code>.
29   * 
30   * @see org.kuali.ole.vnd.businessobject.SupplierDiversity
31   */
32  public class VendorSupplierDiversity extends PersistableBusinessObjectBase implements VendorRoutingComparable, MutableInactivatable {
33      private static Logger LOG = Logger.getLogger(VendorSupplierDiversity.class);
34  
35      private Integer vendorHeaderGeneratedIdentifier;
36      private String vendorSupplierDiversityCode;
37      private boolean active;
38  
39      private VendorHeader vendorHeader;
40      private SupplierDiversity vendorSupplierDiversity;
41  
42  
43      /**
44       * Default constructor.
45       */
46      public VendorSupplierDiversity() {
47  
48      }
49  
50      public Integer getVendorHeaderGeneratedIdentifier() {
51  
52          return vendorHeaderGeneratedIdentifier;
53      }
54  
55      public void setVendorHeaderGeneratedIdentifier(Integer vendorHeaderGeneratedIdentifier) {
56          this.vendorHeaderGeneratedIdentifier = vendorHeaderGeneratedIdentifier;
57      }
58  
59      public String getVendorSupplierDiversityCode() {
60  
61          return vendorSupplierDiversityCode;
62      }
63  
64      public void setVendorSupplierDiversityCode(String vendorSupplierDiversityCode) {
65          this.vendorSupplierDiversityCode = vendorSupplierDiversityCode;
66      }
67  
68      public boolean isActive() {
69  
70          return active;
71      }
72  
73      public void setActive(boolean active) {
74          this.active = active;
75      }
76  
77      public VendorHeader getVendorHeader() {
78  
79          return vendorHeader;
80      }
81  
82      /**
83       * Sets the vendorHeader attribute value.
84       * 
85       * @param vendorHeader The vendorHeader to set.
86       * @deprecated
87       */
88      public void setVendorHeader(VendorHeader vendorHeader) {
89          this.vendorHeader = vendorHeader;
90      }
91  
92      public SupplierDiversity getVendorSupplierDiversity() {
93  
94          return vendorSupplierDiversity;
95      }
96  
97      /**
98       * Sets the vendorSupplierDiversity attribute value.
99       * 
100      * @param vendorSupplierDiversity The vendorSupplierDiversity to set.
101      * @deprecated
102      */
103     public void setVendorSupplierDiversity(SupplierDiversity vendorSupplierDiversity) {
104         this.vendorSupplierDiversity = vendorSupplierDiversity;
105     }
106 
107     /**
108      * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper()
109      */
110     protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
111         LinkedHashMap m = new LinkedHashMap();
112 
113         if (this.vendorHeaderGeneratedIdentifier != null) {
114             m.put("vendorHeaderGeneratedIdentifier", this.vendorHeaderGeneratedIdentifier.toString());
115         }
116         m.put("vendorSupplierDiversityCode", this.vendorSupplierDiversityCode);
117 
118         return m;
119     }
120 
121     /**
122      * @see org.kuali.ole.vnd.document.routing.VendorRoutingComparable#isEqualForRouting(java.lang.Object)
123      */
124     public boolean isEqualForRouting(Object toCompare) {
125         LOG.debug("Entering isEqualForRouting.");
126         if ((ObjectUtils.isNull(toCompare)) || !(toCompare instanceof VendorSupplierDiversity)) {
127 
128             return false;
129         }
130         else {
131             VendorSupplierDiversity vsd = (VendorSupplierDiversity) toCompare;
132 
133             return new EqualsBuilder().append(this.getVendorHeaderGeneratedIdentifier(), vsd.getVendorHeaderGeneratedIdentifier()).append(this.getVendorSupplierDiversityCode(), vsd.getVendorSupplierDiversityCode()).isEquals();
134         }
135     }
136 
137 }