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.sql.Date;
020: import java.util.LinkedHashMap;
021: import java.util.List;
022:
023: import org.apache.commons.lang.builder.EqualsBuilder;
024: import org.apache.log4j.Logger;
025: import org.kuali.core.bo.Campus;
026: import org.kuali.core.bo.Inactivateable;
027: import org.kuali.core.bo.PersistableBusinessObjectBase;
028: import org.kuali.core.util.KualiDecimal;
029: import org.kuali.core.util.ObjectUtils;
030: import org.kuali.core.util.TypedArrayList;
031: import org.kuali.kfs.context.SpringContext;
032: import org.kuali.module.vendor.service.VendorService;
033: import org.kuali.module.vendor.util.VendorRoutingComparable;
034:
035: /**
036: * Purchasing Contracts with specific Vendors.
037: */
038: public class VendorContract extends PersistableBusinessObjectBase
039: implements VendorRoutingComparable, Inactivateable {
040: private static Logger LOG = Logger.getLogger(VendorContract.class);
041:
042: private Integer vendorContractGeneratedIdentifier;
043: private Integer vendorHeaderGeneratedIdentifier;
044: private Integer vendorDetailAssignedIdentifier;
045: private String vendorContractName;
046: private String vendorContractDescription;
047: private String vendorCampusCode;
048: private Date vendorContractBeginningDate;
049: private Date vendorContractEndDate;
050: private Integer contractManagerCode;
051: private String purchaseOrderCostSourceCode;
052: private String vendorPaymentTermsCode;
053: private String vendorShippingPaymentTermsCode;
054: private String vendorShippingTitleCode;
055: private Date vendorContractExtensionDate;
056: private Boolean vendorB2bIndicator;
057: private KualiDecimal organizationAutomaticPurchaseOrderLimit;
058: private boolean active;
059:
060: private List<VendorContractOrganization> vendorContractOrganizations;
061:
062: private VendorDetail vendorDetail;
063: private Campus vendorCampus;
064: private ContractManager contractManager;
065: private PurchaseOrderCostSource purchaseOrderCostSource;
066: private PaymentTermType vendorPaymentTerms;
067: private ShippingPaymentTerms vendorShippingPaymentTerms;
068: private ShippingTitle vendorShippingTitle;
069:
070: /**
071: * Default constructor.
072: */
073: public VendorContract() {
074: vendorContractOrganizations = new TypedArrayList(
075: VendorContractOrganization.class);
076: }
077:
078: public Integer getVendorContractGeneratedIdentifier() {
079:
080: return vendorContractGeneratedIdentifier;
081: }
082:
083: public void setVendorContractGeneratedIdentifier(
084: Integer vendorContractGeneratedIdentifier) {
085: this .vendorContractGeneratedIdentifier = vendorContractGeneratedIdentifier;
086: }
087:
088: public Integer getVendorHeaderGeneratedIdentifier() {
089:
090: return vendorHeaderGeneratedIdentifier;
091: }
092:
093: public void setVendorHeaderGeneratedIdentifier(
094: Integer vendorHeaderGeneratedIdentifier) {
095: this .vendorHeaderGeneratedIdentifier = vendorHeaderGeneratedIdentifier;
096: }
097:
098: public Integer getVendorDetailAssignedIdentifier() {
099:
100: return vendorDetailAssignedIdentifier;
101: }
102:
103: public void setVendorDetailAssignedIdentifier(
104: Integer vendorDetailAssignedIdentifier) {
105: this .vendorDetailAssignedIdentifier = vendorDetailAssignedIdentifier;
106: }
107:
108: public String getVendorContractName() {
109:
110: return vendorContractName;
111: }
112:
113: public void setVendorContractName(String vendorContractName) {
114: this .vendorContractName = vendorContractName;
115: }
116:
117: public String getVendorContractDescription() {
118:
119: return vendorContractDescription;
120: }
121:
122: public void setVendorContractDescription(
123: String vendorContractDescription) {
124: this .vendorContractDescription = vendorContractDescription;
125: }
126:
127: public String getVendorCampusCode() {
128:
129: return vendorCampusCode;
130: }
131:
132: public void setVendorCampusCode(String vendorCampusCode) {
133: this .vendorCampusCode = vendorCampusCode;
134: }
135:
136: public Date getVendorContractBeginningDate() {
137:
138: return vendorContractBeginningDate;
139: }
140:
141: public void setVendorContractBeginningDate(
142: Date vendorContractBeginningDate) {
143: this .vendorContractBeginningDate = vendorContractBeginningDate;
144: }
145:
146: public Date getVendorContractEndDate() {
147:
148: return vendorContractEndDate;
149: }
150:
151: public void setVendorContractEndDate(Date vendorContractEndDate) {
152: this .vendorContractEndDate = vendorContractEndDate;
153: }
154:
155: public Integer getContractManagerCode() {
156:
157: return contractManagerCode;
158: }
159:
160: public void setContractManagerCode(Integer contractManagerCode) {
161: this .contractManagerCode = contractManagerCode;
162: }
163:
164: public String getPurchaseOrderCostSourceCode() {
165:
166: return purchaseOrderCostSourceCode;
167: }
168:
169: public void setPurchaseOrderCostSourceCode(
170: String purchaseOrderCostSourceCode) {
171: this .purchaseOrderCostSourceCode = purchaseOrderCostSourceCode;
172: }
173:
174: public String getVendorPaymentTermsCode() {
175:
176: return vendorPaymentTermsCode;
177: }
178:
179: public void setVendorPaymentTermsCode(String vendorPaymentTermsCode) {
180: this .vendorPaymentTermsCode = vendorPaymentTermsCode;
181: }
182:
183: public String getVendorShippingPaymentTermsCode() {
184:
185: return vendorShippingPaymentTermsCode;
186: }
187:
188: public void setVendorShippingPaymentTermsCode(
189: String vendorShippingPaymentTermsCode) {
190: this .vendorShippingPaymentTermsCode = vendorShippingPaymentTermsCode;
191: }
192:
193: public String getVendorShippingTitleCode() {
194:
195: return vendorShippingTitleCode;
196: }
197:
198: public void setVendorShippingTitleCode(
199: String vendorShippingTitleCode) {
200: this .vendorShippingTitleCode = vendorShippingTitleCode;
201: }
202:
203: public Date getVendorContractExtensionDate() {
204:
205: return vendorContractExtensionDate;
206: }
207:
208: public void setVendorContractExtensionDate(
209: Date vendorContractExtensionDate) {
210: this .vendorContractExtensionDate = vendorContractExtensionDate;
211: }
212:
213: public Boolean getVendorB2bIndicator() {
214:
215: return vendorB2bIndicator;
216: }
217:
218: public void setVendorB2bIndicator(Boolean vendorB2bIndicator) {
219: this .vendorB2bIndicator = vendorB2bIndicator;
220: }
221:
222: public KualiDecimal getOrganizationAutomaticPurchaseOrderLimit() {
223:
224: return organizationAutomaticPurchaseOrderLimit;
225: }
226:
227: public void setOrganizationAutomaticPurchaseOrderLimit(
228: KualiDecimal organizationAutomaticPurchaseOrderLimit) {
229: this .organizationAutomaticPurchaseOrderLimit = organizationAutomaticPurchaseOrderLimit;
230: }
231:
232: public boolean isActive() {
233:
234: return active;
235: }
236:
237: public void setActive(boolean active) {
238: this .active = active;
239: }
240:
241: public VendorDetail getVendorDetail() {
242:
243: return vendorDetail;
244: }
245:
246: /**
247: * Sets the vendorDetail attribute.
248: *
249: * @param vendorDetail The vendorDetail to set.
250: * @deprecated
251: */
252: public void setVendorDetail(VendorDetail vendorDetail) {
253: this .vendorDetail = vendorDetail;
254: }
255:
256: public Campus getVendorCampus() {
257:
258: return vendorCampus;
259: }
260:
261: /**
262: * Sets the vendorCampus attribute.
263: *
264: * @param vendorCampus The vendorCampus to set.
265: * @deprecated
266: */
267: public void setVendorCampus(Campus vendorCampus) {
268: this .vendorCampus = vendorCampus;
269: }
270:
271: public ContractManager getContractManager() {
272:
273: return contractManager;
274: }
275:
276: /**
277: * Sets the contractManager attribute.
278: *
279: * @param contractManager The contractManager to set.
280: * @deprecated
281: */
282: public void setContractManager(ContractManager contractManager) {
283: this .contractManager = contractManager;
284: }
285:
286: public PurchaseOrderCostSource getPurchaseOrderCostSource() {
287:
288: return purchaseOrderCostSource;
289: }
290:
291: /**
292: * Sets the purchaseOrderCostSource attribute.
293: *
294: * @param purchaseOrderCostSource The purchaseOrderCostSource to set.
295: * @deprecated
296: */
297: public void setPurchaseOrderCostSource(
298: PurchaseOrderCostSource purchaseOrderCostSource) {
299: this .purchaseOrderCostSource = purchaseOrderCostSource;
300: }
301:
302: public PaymentTermType getVendorPaymentTerms() {
303:
304: return vendorPaymentTerms;
305: }
306:
307: /**
308: * Sets the vendorPaymentTerms attribute.
309: *
310: * @param vendorPaymentTerms The vendorPaymentTerms to set.
311: * @deprecated
312: */
313: public void setVendorPaymentTerms(PaymentTermType vendorPaymentTerms) {
314: this .vendorPaymentTerms = vendorPaymentTerms;
315: }
316:
317: public ShippingPaymentTerms getVendorShippingPaymentTerms() {
318:
319: return vendorShippingPaymentTerms;
320: }
321:
322: /**
323: * Sets the vendorShippingPaymentTerms attribute.
324: *
325: * @param vendorShippingPaymentTerms The vendorShippingPaymentTerms to set.
326: * @deprecated
327: */
328: public void setVendorShippingPaymentTerms(
329: ShippingPaymentTerms vendorShippingPaymentTerms) {
330: this .vendorShippingPaymentTerms = vendorShippingPaymentTerms;
331: }
332:
333: public ShippingTitle getVendorShippingTitle() {
334:
335: return vendorShippingTitle;
336: }
337:
338: /**
339: * Sets the vendorShippingTitle attribute.
340: *
341: * @param vendorShippingTitle The vendorShippingTitle to set.
342: * @deprecated
343: */
344: public void setVendorShippingTitle(ShippingTitle vendorShippingTitle) {
345: this .vendorShippingTitle = vendorShippingTitle;
346: }
347:
348: public List<VendorContractOrganization> getVendorContractOrganizations() {
349:
350: return vendorContractOrganizations;
351: }
352:
353: public void setVendorContractOrganizations(
354: List<VendorContractOrganization> vendorContractOrganizations) {
355: this .vendorContractOrganizations = vendorContractOrganizations;
356: }
357:
358: /**
359: * @see org.kuali.module.vendor.util.VendorRoutingComparable#isEqualForRouting(java.lang.Object)
360: */
361: public boolean isEqualForRouting(Object toCompare) {
362: if ((ObjectUtils.isNull(toCompare))
363: || !(toCompare instanceof VendorContract)) {
364: return false;
365: } else {
366: VendorContract vc = (VendorContract) toCompare;
367: boolean eq = new EqualsBuilder().append(
368: this .getVendorContractGeneratedIdentifier(),
369: vc.getVendorContractGeneratedIdentifier()).append(
370: this .getVendorHeaderGeneratedIdentifier(),
371: vc.getVendorHeaderGeneratedIdentifier()).append(
372: this .getVendorDetailAssignedIdentifier(),
373: vc.getVendorDetailAssignedIdentifier()).append(
374: this .getVendorContractName(),
375: vc.getVendorContractName()).append(
376: this .getVendorContractDescription(),
377: vc.getVendorContractDescription()).append(
378: this .getVendorCampusCode(),
379: vc.getVendorCampusCode()).append(
380: this .getVendorContractBeginningDate(),
381: vc.getVendorContractBeginningDate()).append(
382: this .getVendorContractEndDate(),
383: vc.getVendorContractEndDate()).append(
384: this .getContractManagerCode(),
385: vc.getContractManagerCode()).append(
386: this .getPurchaseOrderCostSourceCode(),
387: vc.getPurchaseOrderCostSourceCode()).append(
388: this .getVendorPaymentTermsCode(),
389: vc.getVendorPaymentTermsCode()).append(
390: this .getVendorShippingPaymentTermsCode(),
391: vc.getVendorShippingPaymentTermsCode()).append(
392: this .getVendorShippingTitleCode(),
393: vc.getVendorShippingTitleCode()).append(
394: this .getVendorContractExtensionDate(),
395: vc.getVendorContractExtensionDate()).append(
396: this .getVendorB2bIndicator(),
397: vc.getVendorB2bIndicator()).append(
398: this .getOrganizationAutomaticPurchaseOrderLimit(),
399: vc.getOrganizationAutomaticPurchaseOrderLimit())
400: .isEquals();
401: eq &= SpringContext.getBean(VendorService.class)
402: .equalMemberLists(
403: this .getVendorContractOrganizations(),
404: vc.getVendorContractOrganizations());
405:
406: return eq;
407: }
408: }
409:
410: /**
411: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
412: */
413: protected LinkedHashMap toStringMapper() {
414: LinkedHashMap m = new LinkedHashMap();
415: if (this .vendorContractGeneratedIdentifier != null) {
416: m.put("vendorContractGeneratedIdentifier",
417: this.vendorContractGeneratedIdentifier.toString());
418: }
419:
420: return m;
421: }
422:
423: }
|