001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.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/ecl1.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.module.vendor.bo;
018:
019: import java.util.LinkedHashMap;
020:
021: import org.apache.commons.lang.builder.EqualsBuilder;
022: import org.kuali.core.bo.Inactivateable;
023: import org.kuali.core.bo.PersistableBusinessObjectBase;
024: import org.kuali.core.util.KualiDecimal;
025: import org.kuali.core.util.ObjectUtils;
026: import org.kuali.module.chart.bo.Chart;
027: import org.kuali.module.chart.bo.Org;
028: import org.kuali.module.vendor.util.VendorRoutingComparable;
029:
030: /**
031: * A relation between a particular <code>Org</code> and a <code>VendorContract</code> indicating that the Org uses this Vendor
032: * Contract.
033: *
034: * @see org.kuali.module.vendor.bo.VendorContract
035: * @see org.kuali.module.chart.bo.Org
036: */
037: public class VendorContractOrganization extends
038: PersistableBusinessObjectBase implements
039: VendorRoutingComparable, Inactivateable {
040:
041: private Integer vendorContractGeneratedIdentifier;
042: private String chartOfAccountsCode;
043: private String organizationCode;
044: private KualiDecimal vendorContractPurchaseOrderLimitAmount;
045: private boolean vendorContractExcludeIndicator;
046: private boolean active;
047:
048: private VendorContract vendorContract;
049: private Org organization;
050: private Chart chartOfAccounts;
051:
052: /**
053: * Default constructor.
054: */
055: public VendorContractOrganization() {
056:
057: }
058:
059: public Integer getVendorContractGeneratedIdentifier() {
060:
061: return vendorContractGeneratedIdentifier;
062: }
063:
064: public void setVendorContractGeneratedIdentifier(
065: Integer vendorContractGeneratedIdentifier) {
066: this .vendorContractGeneratedIdentifier = vendorContractGeneratedIdentifier;
067: }
068:
069: public String getChartOfAccountsCode() {
070:
071: return chartOfAccountsCode;
072: }
073:
074: public void setChartOfAccountsCode(String chartOfAccountsCode) {
075: this .chartOfAccountsCode = chartOfAccountsCode;
076: }
077:
078: public String getOrganizationCode() {
079:
080: return organizationCode;
081: }
082:
083: public void setOrganizationCode(String organizationCode) {
084: this .organizationCode = organizationCode;
085: }
086:
087: public KualiDecimal getVendorContractPurchaseOrderLimitAmount() {
088:
089: return vendorContractPurchaseOrderLimitAmount;
090: }
091:
092: public void setVendorContractPurchaseOrderLimitAmount(
093: KualiDecimal vendorContractPurchaseOrderLimitAmount) {
094: this .vendorContractPurchaseOrderLimitAmount = vendorContractPurchaseOrderLimitAmount;
095: }
096:
097: public boolean isVendorContractExcludeIndicator() {
098:
099: return vendorContractExcludeIndicator;
100: }
101:
102: public void setVendorContractExcludeIndicator(
103: boolean vendorContractExcludeIndicator) {
104: this .vendorContractExcludeIndicator = vendorContractExcludeIndicator;
105: }
106:
107: public boolean isActive() {
108:
109: return active;
110: }
111:
112: public void setActive(boolean active) {
113: this .active = active;
114: }
115:
116: public Org getOrganization() {
117:
118: return organization;
119: }
120:
121: /**
122: * Sets the organization attribute.
123: *
124: * @param organization The organization to set.
125: * @deprecated
126: */
127: public void setOrganization(Org organization) {
128: this .organization = organization;
129: }
130:
131: public Chart getChartOfAccounts() {
132:
133: return chartOfAccounts;
134: }
135:
136: /**
137: * Sets the chartOfAccounts attribute.
138: *
139: * @param chartOfAccounts The chartOfAccounts to set.
140: * @deprecated
141: */
142: public void setChartOfAccounts(Chart chartOfAccounts) {
143: this .chartOfAccounts = chartOfAccounts;
144: }
145:
146: public VendorContract getVendorContract() {
147:
148: return vendorContract;
149: }
150:
151: /**
152: * Sets the vendorContract attribute value.
153: *
154: * @param vendorContract The vendorContract to set.
155: * @deprecated
156: */
157: public void setVendorContract(VendorContract vendorContract) {
158: this .vendorContract = vendorContract;
159: }
160:
161: /**
162: * @see org.kuali.module.vendor.util.VendorRoutingComparable#isEqualForRouting(java.lang.Object)
163: */
164: public boolean isEqualForRouting(Object toCompare) {
165: if ((ObjectUtils.isNull(toCompare))
166: || !(toCompare instanceof VendorContractOrganization)) {
167:
168: return false;
169: } else {
170: VendorContractOrganization vco = (VendorContractOrganization) toCompare;
171:
172: return new EqualsBuilder().append(
173: this .getVendorContractGeneratedIdentifier(),
174: vco.getVendorContractGeneratedIdentifier()).append(
175: this .getChartOfAccountsCode(),
176: vco.getChartOfAccountsCode()).append(
177: this .getOrganizationCode(),
178: vco.getOrganizationCode()).append(
179: this .getVendorContractPurchaseOrderLimitAmount(),
180: vco.getVendorContractPurchaseOrderLimitAmount())
181: .append(this .isVendorContractExcludeIndicator(),
182: vco.isVendorContractExcludeIndicator())
183: .isEquals();
184: }
185: }
186:
187: /**
188: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
189: */
190: protected LinkedHashMap toStringMapper() {
191: LinkedHashMap m = new LinkedHashMap();
192: if (this .vendorContractGeneratedIdentifier != null) {
193: m.put("vendorContractGeneratedIdentifier",
194: this .vendorContractGeneratedIdentifier.toString());
195: }
196: m.put("chartOfAccountsCode", this .chartOfAccountsCode);
197: m.put("organizationCode", this.organizationCode);
198:
199: return m;
200: }
201:
202: }
|