001 /*
002 * Copyright 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
017 package org.kuali.kfs.vnd.businessobject;
018
019 import java.util.LinkedHashMap;
020
021 import org.apache.commons.lang.builder.EqualsBuilder;
022 import org.kuali.rice.kns.bo.Inactivateable;
023 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
024 import org.kuali.rice.kns.util.ObjectUtils;
025
026 /**
027 * Relationship between a Vendor and a <code>ShippingSpecialCondition</code>.
028 *
029 * @see org.kuali.kfs.vnd.businessobject.ShippingSpecialCondition
030 */
031 public class VendorShippingSpecialCondition extends PersistableBusinessObjectBase implements VendorRoutingComparable, Inactivateable {
032
033 private Integer vendorHeaderGeneratedIdentifier;
034 private Integer vendorDetailAssignedIdentifier;
035 private String vendorShippingSpecialConditionCode;
036 private boolean active;
037
038 private VendorDetail vendorDetail;
039 private ShippingSpecialCondition vendorShippingSpecialCondition;
040
041 /**
042 * Default constructor.
043 */
044 public VendorShippingSpecialCondition() {
045
046 }
047
048 public Integer getVendorHeaderGeneratedIdentifier() {
049
050 return vendorHeaderGeneratedIdentifier;
051 }
052
053 public void setVendorHeaderGeneratedIdentifier(Integer vendorHeaderGeneratedIdentifier) {
054 this.vendorHeaderGeneratedIdentifier = vendorHeaderGeneratedIdentifier;
055 }
056
057 public Integer getVendorDetailAssignedIdentifier() {
058
059 return vendorDetailAssignedIdentifier;
060 }
061
062 public void setVendorDetailAssignedIdentifier(Integer vendorDetailAssignedIdentifier) {
063 this.vendorDetailAssignedIdentifier = vendorDetailAssignedIdentifier;
064 }
065
066 public String getVendorShippingSpecialConditionCode() {
067
068 return vendorShippingSpecialConditionCode;
069 }
070
071 public void setVendorShippingSpecialConditionCode(String vendorShippingSpecialConditionCode) {
072 this.vendorShippingSpecialConditionCode = vendorShippingSpecialConditionCode;
073 }
074
075 public boolean isActive() {
076
077 return active;
078 }
079
080 public void setActive(boolean active) {
081 this.active = active;
082 }
083
084 public VendorDetail getVendorDetail() {
085
086 return vendorDetail;
087 }
088
089 /**
090 * Sets the vendorDetail attribute value.
091 *
092 * @param vendorDetail The vendorDetail to set.
093 * @deprecated
094 */
095 public void setVendorDetail(VendorDetail vendorDetail) {
096 this.vendorDetail = vendorDetail;
097 }
098
099 public ShippingSpecialCondition getVendorShippingSpecialCondition() {
100
101 return vendorShippingSpecialCondition;
102 }
103
104 /**
105 * Sets the vendorShippingSpecialCondition attribute value.
106 *
107 * @param vendorShippingSpecialCondition The vendorShippingSpecialCondition to set.
108 * @deprecated
109 */
110 public void setVendorShippingSpecialCondition(ShippingSpecialCondition vendorShippingSpecialCondition) {
111 this.vendorShippingSpecialCondition = vendorShippingSpecialCondition;
112 }
113
114 /**
115 * @see org.kuali.kfs.vnd.document.routing.VendorRoutingComparable#isEqualForRouting(java.lang.Object)
116 */
117 public boolean isEqualForRouting(Object toCompare) {
118 if ((ObjectUtils.isNull(toCompare)) || !(toCompare instanceof VendorShippingSpecialCondition)) {
119 return false;
120 }
121 else {
122 VendorShippingSpecialCondition vssc = (VendorShippingSpecialCondition) toCompare;
123
124 return new EqualsBuilder().append(this.getVendorHeaderGeneratedIdentifier(), vssc.getVendorHeaderGeneratedIdentifier()).append(this.getVendorDetailAssignedIdentifier(), vssc.getVendorDetailAssignedIdentifier()).append(this.getVendorShippingSpecialConditionCode(), vssc.getVendorShippingSpecialConditionCode()).isEquals();
125 }
126 }
127
128 /**
129 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
130 */
131 protected LinkedHashMap toStringMapper() {
132 LinkedHashMap m = new LinkedHashMap();
133 if (this.vendorHeaderGeneratedIdentifier != null) {
134 m.put("vendorHeaderGeneratedIdentifier", this.vendorHeaderGeneratedIdentifier.toString());
135 }
136 if (this.vendorDetailAssignedIdentifier != null) {
137 m.put("vendorDetailAssignedIdentifier", this.vendorDetailAssignedIdentifier.toString());
138 }
139 m.put("vendorShippingSpecialConditionCode", this.vendorShippingSpecialConditionCode);
140
141 return m;
142 }
143 }