View Javadoc
1   /*
2    * The Kuali Financial System, a comprehensive financial management system for higher education.
3    * 
4    * Copyright 2005-2014 The Kuali Foundation
5    * 
6    * This program is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU Affero General Public License as
8    * published by the Free Software Foundation, either version 3 of the
9    * License, or (at your option) any later version.
10   * 
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU Affero General Public License for more details.
15   * 
16   * You should have received a copy of the GNU Affero General Public License
17   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  package org.kuali.kfs.module.purap.document;
20  
21  import java.sql.Date;
22  import java.util.ArrayList;
23  import java.util.Iterator;
24  import java.util.List;
25  
26  import org.apache.commons.lang.StringUtils;
27  import org.kuali.kfs.coa.businessobject.Account;
28  import org.kuali.kfs.coa.businessobject.Chart;
29  import org.kuali.kfs.coa.businessobject.Organization;
30  import org.kuali.kfs.integration.purap.CapitalAssetSystem;
31  import org.kuali.kfs.integration.purap.ItemCapitalAsset;
32  import org.kuali.kfs.module.purap.PurapConstants;
33  import org.kuali.kfs.module.purap.PurapParameterConstants;
34  import org.kuali.kfs.module.purap.PurapPropertyConstants;
35  import org.kuali.kfs.module.purap.businessobject.BillingAddress;
36  import org.kuali.kfs.module.purap.businessobject.CapitalAssetSystemState;
37  import org.kuali.kfs.module.purap.businessobject.CapitalAssetSystemType;
38  import org.kuali.kfs.module.purap.businessobject.DeliveryRequiredDateReason;
39  import org.kuali.kfs.module.purap.businessobject.FundingSource;
40  import org.kuali.kfs.module.purap.businessobject.PurApItem;
41  import org.kuali.kfs.module.purap.businessobject.PurchaseOrderTransmissionMethod;
42  import org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem;
43  import org.kuali.kfs.module.purap.businessobject.PurchasingItem;
44  import org.kuali.kfs.module.purap.businessobject.PurchasingItemBase;
45  import org.kuali.kfs.module.purap.businessobject.ReceivingAddress;
46  import org.kuali.kfs.module.purap.businessobject.RecurringPaymentType;
47  import org.kuali.kfs.module.purap.businessobject.RequisitionSource;
48  import org.kuali.kfs.module.purap.document.service.PurapService;
49  import org.kuali.kfs.module.purap.document.service.PurchasingDocumentSpecificService;
50  import org.kuali.kfs.module.purap.document.service.PurchasingService;
51  import org.kuali.kfs.module.purap.document.service.ReceivingAddressService;
52  import org.kuali.kfs.module.purap.util.ItemParser;
53  import org.kuali.kfs.module.purap.util.ItemParserBase;
54  import org.kuali.kfs.sys.context.SpringContext;
55  import org.kuali.kfs.sys.service.impl.KfsParameterConstants;
56  import org.kuali.kfs.vnd.VendorPropertyConstants;
57  import org.kuali.kfs.vnd.businessobject.CampusParameter;
58  import org.kuali.kfs.vnd.businessobject.CommodityCode;
59  import org.kuali.kfs.vnd.businessobject.PurchaseOrderCostSource;
60  import org.kuali.kfs.vnd.businessobject.VendorAddress;
61  import org.kuali.kfs.vnd.businessobject.VendorContract;
62  import org.kuali.kfs.vnd.businessobject.VendorDetail;
63  import org.kuali.kfs.vnd.document.service.VendorService;
64  import org.kuali.rice.core.api.datetime.DateTimeService;
65  import org.kuali.rice.core.api.util.type.KualiDecimal;
66  import org.kuali.rice.coreservice.framework.parameter.ParameterService;
67  import org.kuali.rice.krad.rules.rule.event.ApproveDocumentEvent;
68  import org.kuali.rice.krad.rules.rule.event.KualiDocumentEvent;
69  import org.kuali.rice.krad.rules.rule.event.RouteDocumentEvent;
70  import org.kuali.rice.krad.util.GlobalVariables;
71  import org.kuali.rice.krad.util.ObjectUtils;
72  import org.kuali.rice.location.api.country.Country;
73  import org.kuali.rice.location.api.country.CountryService;
74  
75  /**
76   * Base class for Purchasing Documents.
77   */
78  public abstract class PurchasingDocumentBase extends PurchasingAccountsPayableDocumentBase implements PurchasingDocument {
79      protected static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(PurchasingDocumentBase.class);
80  
81      // SHARED FIELDS BETWEEN REQUISITION AND PURCHASE ORDER
82      protected String documentFundingSourceCode;
83      protected String requisitionSourceCode;
84      protected String purchaseOrderTransmissionMethodCode;
85      protected String purchaseOrderCostSourceCode;
86      protected String deliveryRequiredDateReasonCode;
87      protected String recurringPaymentTypeCode;
88      protected String chartOfAccountsCode;
89      protected String organizationCode;
90      protected String deliveryCampusCode;
91      protected KualiDecimal purchaseOrderTotalLimit;
92      protected Boolean vendorRestrictedIndicator;
93      protected String vendorPhoneNumber;
94      protected String vendorFaxNumber;
95      protected Integer vendorContractGeneratedIdentifier;
96      protected String vendorNoteText;
97      protected String requestorPersonName;
98      protected String requestorPersonEmailAddress;
99      protected String requestorPersonPhoneNumber;
100     protected String nonInstitutionFundOrgChartOfAccountsCode;
101     protected String nonInstitutionFundOrganizationCode;
102     protected String nonInstitutionFundChartOfAccountsCode;
103     protected String nonInstitutionFundAccountNumber;
104     protected boolean deliveryBuildingOtherIndicator;
105     protected String deliveryBuildingCode;
106     protected String deliveryBuildingName;
107     protected String deliveryBuildingRoomNumber;
108     protected String deliveryBuildingLine1Address;
109     protected String deliveryBuildingLine2Address;
110     protected String deliveryCityName;
111     protected String deliveryStateCode;
112     protected String deliveryPostalCode;
113     protected String deliveryCountryCode;
114     protected String deliveryToName;
115     protected String deliveryToEmailAddress;
116     protected String deliveryToPhoneNumber;
117     protected Date deliveryRequiredDate;
118     protected String deliveryInstructionText;
119     protected Date purchaseOrderBeginDate;
120     protected Date purchaseOrderEndDate;
121     protected String institutionContactName;
122     protected String institutionContactPhoneNumber;
123     protected String institutionContactEmailAddress;
124     protected String billingName;
125     protected String billingLine1Address;
126     protected String billingLine2Address;
127     protected String billingCityName;
128     protected String billingStateCode;
129     protected String billingPostalCode;
130     protected String billingCountryCode;
131     protected String billingPhoneNumber;
132     protected String billingEmailAddress;
133     protected String receivingName;
134     protected String receivingLine1Address;
135     protected String receivingLine2Address;
136     protected String receivingCityName;
137     protected String receivingStateCode;
138     protected String receivingPostalCode;
139     protected String receivingCountryCode;
140     protected boolean addressToVendorIndicator; // if true, use receiving address
141     protected String externalOrganizationB2bSupplierIdentifier;
142     protected boolean purchaseOrderAutomaticIndicator;
143     protected String vendorPaymentTermsCode;
144     protected String vendorShippingTitleCode;
145     protected String vendorShippingPaymentTermsCode;
146     protected String capitalAssetSystemTypeCode;
147     protected String capitalAssetSystemStateCode;
148     protected String justification;
149 
150     // NOT PERSISTED IN DB
151     protected String supplierDiversityLabel;
152     protected String vendorContactsLabel;
153 
154     // REFERENCE OBJECTS
155     protected FundingSource fundingSource;
156     protected RequisitionSource requisitionSource;
157     protected PurchaseOrderTransmissionMethod purchaseOrderTransmissionMethod;
158     protected PurchaseOrderCostSource purchaseOrderCostSource;
159     protected DeliveryRequiredDateReason deliveryRequiredDateReason;
160     protected RecurringPaymentType recurringPaymentType;
161     protected Organization organization;
162     protected Chart chartOfAccounts;
163     protected CampusParameter deliveryCampus;
164     protected Chart nonInstitutionFundOrgChartOfAccounts;
165     protected Organization nonInstitutionFundOrganization;
166     protected Account nonInstitutionFundAccount;
167     protected Chart nonInstitutionFundChartOfAccounts;
168     protected VendorContract vendorContract;
169     protected CapitalAssetSystemType capitalAssetSystemType;
170     protected CapitalAssetSystemState capitalAssetSystemState;
171     protected List<CapitalAssetSystem> purchasingCapitalAssetSystems;
172     protected List<PurchasingCapitalAssetItem> purchasingCapitalAssetItems;
173 
174     protected boolean receivingDocumentRequiredIndicator;
175     protected boolean paymentRequestPositiveApprovalIndicator;
176 
177     protected List<CommodityCode> commodityCodesForRouting;
178 
179     /**
180      * Default Constructor.
181      */
182     public PurchasingDocumentBase() {
183         super();
184 
185         purchasingCapitalAssetItems = new ArrayList();
186         purchasingCapitalAssetSystems = new ArrayList();
187     }
188 
189     @Override
190     public abstract PurchasingDocumentSpecificService getDocumentSpecificService();
191 
192     /**
193      * @see org.kuali.kfs.module.purap.document.PurchasingDocument#templateVendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail)
194      */
195     @Override
196     public void templateVendorDetail(VendorDetail vendorDetail) {
197         if (ObjectUtils.isNotNull(vendorDetail)) {
198             this.setVendorDetail(vendorDetail);
199             this.setVendorName(vendorDetail.getVendorName());
200             this.setVendorShippingTitleCode(vendorDetail.getVendorShippingTitleCode());
201             this.setVendorPaymentTermsCode(vendorDetail.getVendorPaymentTermsCode());
202             this.setVendorShippingPaymentTermsCode(vendorDetail.getVendorShippingPaymentTermsCode());
203             this.setVendorCustomerNumber("");
204         }
205     }
206     /**
207      * @see org.kuali.kfs.module.purap.document.PurchasingDocument#templateVendorContract(org.kuali.kfs.vnd.businessobject.VendorContract)
208      */
209     @Override
210     public void templateVendorContract(VendorContract vendorContract) {
211         if (ObjectUtils.isNotNull(vendorContract)) {
212             this.setVendorContract(vendorContract);
213             this.setVendorContractGeneratedIdentifier(vendorContract.getVendorContractGeneratedIdentifier());
214             this.setVendorShippingTitleCode(vendorContract.getVendorShippingTitleCode());
215             this.setVendorPaymentTermsCode(vendorContract.getVendorPaymentTermsCode());
216             this.setVendorShippingPaymentTermsCode(vendorContract.getVendorShippingPaymentTermsCode());
217             this.setPurchaseOrderCostSourceCode(vendorContract.getPurchaseOrderCostSourceCode());
218         }
219     }
220 
221     /**
222      * @see org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocumentBase#templateVendorAddress(org.kuali.kfs.vnd.businessobject.VendorAddress)
223      */
224     @Override
225     public void templateVendorAddress(VendorAddress vendorAddress) {
226         super.templateVendorAddress(vendorAddress);
227         if (vendorAddress != null) {
228             this.setVendorFaxNumber(vendorAddress.getVendorFaxNumber());
229             this.setVendorAttentionName(vendorAddress.getVendorAttentionName());
230         }
231     }
232 
233     /**
234      * @see org.kuali.kfs.module.purap.document.PurchasingDocumentBase#templateBillingAddress(org.kuali.kfs.module.purap.businessobject.BillingAddress).
235      */
236     @Override
237     public void templateBillingAddress(BillingAddress billingAddress) {
238         if (ObjectUtils.isNotNull(billingAddress)) {
239             this.setBillingName(billingAddress.getBillingName());
240             this.setBillingLine1Address(billingAddress.getBillingLine1Address());
241             this.setBillingLine2Address(billingAddress.getBillingLine2Address());
242             this.setBillingCityName(billingAddress.getBillingCityName());
243             this.setBillingStateCode(billingAddress.getBillingStateCode());
244             this.setBillingPostalCode(billingAddress.getBillingPostalCode());
245             this.setBillingCountryCode(billingAddress.getBillingCountryCode());
246             this.setBillingPhoneNumber(billingAddress.getBillingPhoneNumber());
247             this.setBillingEmailAddress(billingAddress.getBillingEmailAddress());
248         }
249     }
250 
251     /**
252      * @see org.kuali.kfs.module.purap.document.PurchasingDocumentBase#templateReceivingAddress(org.kuali.kfs.module.purap.businessobject.ReceivingAddress).
253      */
254     @Override
255     public void templateReceivingAddress(ReceivingAddress receivingAddress) {
256         if (receivingAddress != null) {
257             this.setReceivingName(receivingAddress.getReceivingName());
258             this.setReceivingLine1Address(receivingAddress.getReceivingLine1Address());
259             this.setReceivingLine2Address(receivingAddress.getReceivingLine2Address());
260             this.setReceivingCityName(receivingAddress.getReceivingCityName());
261             this.setReceivingStateCode(receivingAddress.getReceivingStateCode());
262             this.setReceivingPostalCode(receivingAddress.getReceivingPostalCode());
263             this.setReceivingCountryCode(receivingAddress.getReceivingCountryCode());
264             this.setAddressToVendorIndicator(receivingAddress.isUseReceivingIndicator());
265         }
266         else {
267             this.setReceivingName(null);
268             this.setReceivingLine1Address(null);
269             this.setReceivingLine2Address(null);
270             this.setReceivingCityName(null);
271             this.setReceivingStateCode(null);
272             this.setReceivingPostalCode(null);
273             this.setReceivingCountryCode(null);
274             this.setAddressToVendorIndicator(false);
275         }
276     }
277 
278     /**
279      * Loads the default receiving address from database corresponding to the chart/org of this document.
280      */
281     @Override
282     public void loadReceivingAddress() {
283         /*
284         Map criteria = new HashMap();
285         criteria.put(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, this.getChartOfAccountsCode());
286         criteria.put(KFSPropertyConstants.ORGANIZATION_CODE, this.getOrganizationCode());
287         criteria.put(PurapPropertyConstants.RCVNG_ADDR_DFLT_IND, true);
288         criteria.put(PurapPropertyConstants.RCVNG_ADDR_ACTIVE, true);
289         List<ReceivingAddress> addresses = (List)SpringContext.getBean(BusinessObjectService.class).findMatching(ReceivingAddress.class, criteria);
290         if (addresses != null && addresses.size()>0 )
291             this.templateReceivingAddress(addresses.get(0));
292         else // if no address is found, fill with null
293             this.templateReceivingAddress(null);
294         */
295         String chartCode = getChartOfAccountsCode();
296         String orgCode = getOrganizationCode();
297         ReceivingAddress address = SpringContext.getBean(ReceivingAddressService.class).findUniqueDefaultByChartOrg(chartCode, orgCode);
298         // if default address for chart/org not found, look for chart default
299         if (address == null && orgCode != null) {
300             address = SpringContext.getBean(ReceivingAddressService.class).findUniqueDefaultByChartOrg(chartCode, null);
301         }
302         this.templateReceivingAddress(address);
303     }
304 
305     /**
306      * Iterates through the purchasingCapitalAssetItems of the document and returns the purchasingCapitalAssetItem with the item id equal to the number given, or null if a
307      * match is not found.
308      *
309      * @param itemIdentifier item id to match on.
310      * @return the PurchasingCapitalAssetItem if a match is found, else null.
311      */
312     public PurchasingCapitalAssetItem getPurchasingCapitalAssetItemByItemIdentifier(int itemIdentifier) {
313         for (Iterator iter = purchasingCapitalAssetItems.iterator(); iter.hasNext();) {
314             PurchasingCapitalAssetItem camsItem = (PurchasingCapitalAssetItem) iter.next();
315             if (camsItem.getItemIdentifier().intValue() == itemIdentifier) {
316                 return camsItem;
317             }
318         }
319         return null;
320     }
321 
322 
323     /**
324      * @see org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocumentBase#addItem(org.kuali.kfs.module.purap.businessobject.PurApItem)
325      */
326     @Override
327     public void addItem(PurApItem item) {
328         item.refreshReferenceObject(PurapPropertyConstants.COMMODITY_CODE);
329         super.addItem(item);
330     }
331 
332     /**
333      * @see org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocument#deleteItem(int lineNum)
334      */
335     @Override
336     public void deleteItem(int lineNum) {
337         // remove associated asset items
338         PurApItem item = items.get(lineNum);
339         if (ObjectUtils.isNotNull(item) && item.getItemIdentifier() != null) {
340             PurchasingCapitalAssetItem purchasingCapitalAssetItem = getPurchasingCapitalAssetItemByItemIdentifier(item.getItemIdentifier());
341 
342             if (ObjectUtils.isNotNull(purchasingCapitalAssetItem)) {
343                 getPurchasingCapitalAssetItems().remove(purchasingCapitalAssetItem);
344             }
345             // no more capital asset items, clear cap asset fields
346             if (getPurchasingCapitalAssetItems().size() == 0) {
347                 clearCapitalAssetFields();
348             }
349         }
350         super.deleteItem(lineNum);
351     }
352 
353     /**
354      * @see org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocumentBase#populateDocumentForRouting()
355      */
356     @Override
357     public void populateDocumentForRouting() {
358         commodityCodesForRouting = new ArrayList<CommodityCode>();
359         for (PurchasingItemBase item : (List<PurchasingItemBase>)this.getItems()) {
360             if (item.getCommodityCode() != null && !commodityCodesForRouting.contains(item.getCommodityCode())) {
361                 commodityCodesForRouting.add(item.getCommodityCode());
362             }
363         }
364         super.populateDocumentForRouting();
365     }
366 
367     // GETTERS AND SETTERS
368 
369     /**
370      * @see org.kuali.kfs.module.purap.document.PurchasingDocument.getItemParser().
371      */
372     @Override
373     public ItemParser getItemParser() {
374         return new ItemParserBase();
375     }
376 
377     /**
378      * Decides whether receivingDocumentRequiredIndicator functionality shall be enabled according to the controlling parameter.
379      */
380     public boolean isEnableReceivingDocumentRequiredIndicator() {
381         return SpringContext.getBean(ParameterService.class).getParameterValueAsBoolean(KfsParameterConstants.PURCHASING_DOCUMENT.class, PurapParameterConstants.RECEIVING_DOCUMENT_REQUIRED_IND);
382     }
383 
384     /**
385      * Decides whether paymentRequestPositiveApprovalIndicator functionality shall be enabled according to the controlling parameter.
386      */
387     public boolean isEnablePaymentRequestPositiveApprovalIndicator() {
388         return SpringContext.getBean(ParameterService.class).getParameterValueAsBoolean(KfsParameterConstants.PURCHASING_DOCUMENT.class, PurapParameterConstants.PAYMENT_REQUEST_POSITIVE_APPROVAL_IND);
389     }
390 
391     @Override
392     public String getBillingCityName() {
393         return billingCityName;
394     }
395 
396     @Override
397     public void setBillingCityName(String billingCityName) {
398         this.billingCityName = billingCityName;
399     }
400 
401     @Override
402     public String getBillingCountryCode() {
403         return billingCountryCode;
404     }
405 
406     @Override
407     public void setBillingCountryCode(String billingCountryCode) {
408         this.billingCountryCode = billingCountryCode;
409     }
410 
411     @Override
412     public String getBillingCountryName() {
413         if ( StringUtils.isNotBlank(getBillingCountryCode()) ) {
414             Country country = SpringContext.getBean(CountryService.class).getCountry(getBillingCountryCode());
415             if (country != null) {
416                 return country.getName();
417             }
418         }
419         return null;
420     }
421 
422     @Override
423     public String getBillingLine1Address() {
424         return billingLine1Address;
425     }
426 
427     @Override
428     public void setBillingLine1Address(String billingLine1Address) {
429         this.billingLine1Address = billingLine1Address;
430     }
431 
432     @Override
433     public String getBillingLine2Address() {
434         return billingLine2Address;
435     }
436 
437     @Override
438     public void setBillingLine2Address(String billingLine2Address) {
439         this.billingLine2Address = billingLine2Address;
440     }
441 
442     @Override
443     public String getBillingName() {
444         return billingName;
445     }
446 
447     @Override
448     public void setBillingName(String billingName) {
449         this.billingName = billingName;
450     }
451 
452     @Override
453     public String getBillingPhoneNumber() {
454         return billingPhoneNumber;
455     }
456 
457     @Override
458     public void setBillingPhoneNumber(String billingPhoneNumber) {
459         this.billingPhoneNumber = billingPhoneNumber;
460     }
461 
462     public String getBillingEmailAddress() {
463         return billingEmailAddress;
464     }
465 
466     public void setBillingEmailAddress(String billingEmailAddress) {
467         this.billingEmailAddress = billingEmailAddress;
468     }
469 
470     @Override
471     public String getBillingPostalCode() {
472         return billingPostalCode;
473     }
474 
475     @Override
476     public void setBillingPostalCode(String billingPostalCode) {
477         this.billingPostalCode = billingPostalCode;
478     }
479 
480     @Override
481     public String getBillingStateCode() {
482         return billingStateCode;
483     }
484 
485     @Override
486     public void setBillingStateCode(String billingStateCode) {
487         this.billingStateCode = billingStateCode;
488     }
489 
490     @Override
491     public String getReceivingCityName() {
492         return receivingCityName;
493     }
494 
495     @Override
496     public void setReceivingCityName(String receivingCityName) {
497         this.receivingCityName = receivingCityName;
498     }
499 
500     @Override
501     public String getReceivingCountryCode() {
502         return receivingCountryCode;
503     }
504 
505     @Override
506     public void setReceivingCountryCode(String receivingCountryCode) {
507         this.receivingCountryCode = receivingCountryCode;
508     }
509 
510     @Override
511     public String getReceivingCountryName() {
512         if ( StringUtils.isNotBlank(getReceivingCountryCode()) ) {
513             Country country = SpringContext.getBean(CountryService.class).getCountry(getReceivingCountryCode());
514             if (country != null) {
515                 return country.getName();
516             }
517         }
518         return null;
519     }
520 
521     @Override
522     public String getReceivingLine1Address() {
523         return receivingLine1Address;
524     }
525 
526     @Override
527     public void setReceivingLine1Address(String receivingLine1Address) {
528         this.receivingLine1Address = receivingLine1Address;
529     }
530 
531     @Override
532     public String getReceivingLine2Address() {
533         return receivingLine2Address;
534     }
535 
536     @Override
537     public void setReceivingLine2Address(String receivingLine2Address) {
538         this.receivingLine2Address = receivingLine2Address;
539     }
540 
541     @Override
542     public String getReceivingName() {
543         return receivingName;
544     }
545 
546     @Override
547     public void setReceivingName(String receivingName) {
548         this.receivingName = receivingName;
549     }
550 
551     @Override
552     public String getReceivingPostalCode() {
553         return receivingPostalCode;
554     }
555 
556     @Override
557     public void setReceivingPostalCode(String receivingPostalCode) {
558         this.receivingPostalCode = receivingPostalCode;
559     }
560 
561     @Override
562     public String getReceivingStateCode() {
563         return receivingStateCode;
564     }
565 
566     @Override
567     public void setReceivingStateCode(String receivingStateCode) {
568         this.receivingStateCode = receivingStateCode;
569     }
570 
571     @Override
572     public boolean getAddressToVendorIndicator() {
573         return addressToVendorIndicator;
574     }
575 
576     @Override
577     public void setAddressToVendorIndicator(boolean addressToVendor) {
578         this.addressToVendorIndicator = addressToVendor;
579     }
580 
581     @Override
582     public String getChartOfAccountsCode() {
583         return chartOfAccountsCode;
584     }
585 
586     @Override
587     public void setChartOfAccountsCode(String chartOfAccountsCode) {
588         this.chartOfAccountsCode = chartOfAccountsCode;
589     }
590 
591     @Override
592     public String getDeliveryBuildingCode() {
593         return deliveryBuildingCode;
594     }
595 
596     @Override
597     public void setDeliveryBuildingCode(String deliveryBuildingCode) {
598         this.deliveryBuildingCode = deliveryBuildingCode;
599     }
600 
601     @Override
602     public String getDeliveryBuildingLine1Address() {
603         return deliveryBuildingLine1Address;
604     }
605 
606     @Override
607     public void setDeliveryBuildingLine1Address(String deliveryBuildingLine1Address) {
608         this.deliveryBuildingLine1Address = deliveryBuildingLine1Address;
609     }
610 
611     @Override
612     public String getDeliveryBuildingLine2Address() {
613         return deliveryBuildingLine2Address;
614     }
615 
616     @Override
617     public void setDeliveryBuildingLine2Address(String deliveryBuildingLine2Address) {
618         this.deliveryBuildingLine2Address = deliveryBuildingLine2Address;
619     }
620 
621     @Override
622     public String getDeliveryBuildingName() {
623         return deliveryBuildingName;
624     }
625 
626     @Override
627     public void setDeliveryBuildingName(String deliveryBuildingName) {
628         this.deliveryBuildingName = deliveryBuildingName;
629     }
630 
631     @Override
632     public boolean isDeliveryBuildingOtherIndicator() {
633         return deliveryBuildingOtherIndicator;
634     }
635 
636     @Override
637     public void setDeliveryBuildingOtherIndicator(boolean deliveryBuildingOtherIndicator) {
638         this.deliveryBuildingOtherIndicator = deliveryBuildingOtherIndicator;
639     }
640 
641     @Override
642     public String getDeliveryBuildingRoomNumber() {
643         return deliveryBuildingRoomNumber;
644     }
645 
646     @Override
647     public void setDeliveryBuildingRoomNumber(String deliveryBuildingRoomNumber) {
648         this.deliveryBuildingRoomNumber = deliveryBuildingRoomNumber;
649     }
650 
651     @Override
652     public String getDeliveryCampusCode() {
653         return deliveryCampusCode;
654     }
655 
656     @Override
657     public void setDeliveryCampusCode(String deliveryCampusCode) {
658         this.deliveryCampusCode = deliveryCampusCode;
659     }
660 
661     @Override
662     public String getDeliveryCityName() {
663         return deliveryCityName;
664     }
665 
666     @Override
667     public void setDeliveryCityName(String deliveryCityName) {
668         this.deliveryCityName = deliveryCityName;
669     }
670 
671     @Override
672     public String getDeliveryCountryCode() {
673         return deliveryCountryCode;
674     }
675 
676     @Override
677     public String getDeliveryCountryName() {
678         if ( StringUtils.isNotBlank(getDeliveryCountryCode()) ) {
679             Country country = SpringContext.getBean(CountryService.class).getCountry(getDeliveryCountryCode());
680             if (country != null) {
681                 return country.getName();
682             }
683         }
684         return null;
685     }
686 
687     @Override
688     public void setDeliveryCountryCode(String deliveryCountryCode) {
689         this.deliveryCountryCode = deliveryCountryCode;
690     }
691 
692 
693     @Override
694     public String getDeliveryInstructionText() {
695         return deliveryInstructionText;
696     }
697 
698     @Override
699     public void setDeliveryInstructionText(String deliveryInstructionText) {
700         this.deliveryInstructionText = deliveryInstructionText;
701     }
702 
703     @Override
704     public String getDeliveryPostalCode() {
705         return deliveryPostalCode;
706     }
707 
708     @Override
709     public void setDeliveryPostalCode(String deliveryPostalCode) {
710         this.deliveryPostalCode = deliveryPostalCode;
711     }
712 
713     @Override
714     public Date getDeliveryRequiredDate() {
715         return deliveryRequiredDate;
716     }
717 
718     @Override
719     public void setDeliveryRequiredDate(Date deliveryRequiredDate) {
720         this.deliveryRequiredDate = deliveryRequiredDate;
721     }
722 
723     @Override
724     public String getDeliveryRequiredDateReasonCode() {
725         return deliveryRequiredDateReasonCode;
726     }
727 
728     @Override
729     public void setDeliveryRequiredDateReasonCode(String deliveryRequiredDateReasonCode) {
730         this.deliveryRequiredDateReasonCode = deliveryRequiredDateReasonCode;
731     }
732 
733     @Override
734     public String getDeliveryStateCode() {
735         return deliveryStateCode;
736     }
737 
738     @Override
739     public void setDeliveryStateCode(String deliveryStateCode) {
740         this.deliveryStateCode = deliveryStateCode;
741     }
742 
743     @Override
744     public String getDeliveryToEmailAddress() {
745         return deliveryToEmailAddress;
746     }
747 
748     @Override
749     public void setDeliveryToEmailAddress(String deliveryToEmailAddress) {
750         this.deliveryToEmailAddress = deliveryToEmailAddress;
751     }
752 
753     @Override
754     public String getDeliveryToName() {
755         return deliveryToName;
756     }
757 
758     @Override
759     public void setDeliveryToName(String deliveryToName) {
760         this.deliveryToName = deliveryToName;
761     }
762 
763     @Override
764     public String getDeliveryToPhoneNumber() {
765         return deliveryToPhoneNumber;
766     }
767 
768     @Override
769     public void setDeliveryToPhoneNumber(String deliveryToPhoneNumber) {
770         this.deliveryToPhoneNumber = deliveryToPhoneNumber;
771     }
772 
773     @Override
774     public String getExternalOrganizationB2bSupplierIdentifier() {
775         return externalOrganizationB2bSupplierIdentifier;
776     }
777 
778     @Override
779     public void setExternalOrganizationB2bSupplierIdentifier(String externalOrganizationB2bSupplierIdentifier) {
780         this.externalOrganizationB2bSupplierIdentifier = externalOrganizationB2bSupplierIdentifier;
781     }
782 
783     @Override
784     public String getDocumentFundingSourceCode() {
785         return documentFundingSourceCode;
786     }
787 
788     @Override
789     public void setDocumentFundingSourceCode(String documentFundingSourceCode) {
790         this.documentFundingSourceCode = documentFundingSourceCode;
791     }
792 
793     @Override
794     public String getInstitutionContactEmailAddress() {
795         return institutionContactEmailAddress;
796     }
797 
798     @Override
799     public void setInstitutionContactEmailAddress(String institutionContactEmailAddress) {
800         this.institutionContactEmailAddress = institutionContactEmailAddress;
801     }
802 
803     @Override
804     public String getInstitutionContactName() {
805         return institutionContactName;
806     }
807 
808     @Override
809     public void setInstitutionContactName(String institutionContactName) {
810         this.institutionContactName = institutionContactName;
811     }
812 
813     @Override
814     public String getInstitutionContactPhoneNumber() {
815         return institutionContactPhoneNumber;
816     }
817 
818     @Override
819     public void setInstitutionContactPhoneNumber(String institutionContactPhoneNumber) {
820         this.institutionContactPhoneNumber = institutionContactPhoneNumber;
821     }
822 
823     @Override
824     public String getNonInstitutionFundAccountNumber() {
825         return nonInstitutionFundAccountNumber;
826     }
827 
828     @Override
829     public void setNonInstitutionFundAccountNumber(String nonInstitutionFundAccountNumber) {
830         this.nonInstitutionFundAccountNumber = nonInstitutionFundAccountNumber;
831     }
832 
833     @Override
834     public String getNonInstitutionFundChartOfAccountsCode() {
835         return nonInstitutionFundChartOfAccountsCode;
836     }
837 
838     @Override
839     public void setNonInstitutionFundChartOfAccountsCode(String nonInstitutionFundChartOfAccountsCode) {
840         this.nonInstitutionFundChartOfAccountsCode = nonInstitutionFundChartOfAccountsCode;
841     }
842 
843     @Override
844     public String getNonInstitutionFundOrganizationCode() {
845         return nonInstitutionFundOrganizationCode;
846     }
847 
848     @Override
849     public void setNonInstitutionFundOrganizationCode(String nonInstitutionFundOrganizationCode) {
850         this.nonInstitutionFundOrganizationCode = nonInstitutionFundOrganizationCode;
851     }
852 
853     @Override
854     public String getNonInstitutionFundOrgChartOfAccountsCode() {
855         return nonInstitutionFundOrgChartOfAccountsCode;
856     }
857 
858     @Override
859     public void setNonInstitutionFundOrgChartOfAccountsCode(String nonInstitutionFundOrgChartOfAccountsCode) {
860         this.nonInstitutionFundOrgChartOfAccountsCode = nonInstitutionFundOrgChartOfAccountsCode;
861     }
862 
863     @Override
864     public String getOrganizationCode() {
865         return organizationCode;
866     }
867 
868     @Override
869     public void setOrganizationCode(String organizationCode) {
870         this.organizationCode = organizationCode;
871     }
872 
873     @Override
874     public boolean getPurchaseOrderAutomaticIndicator() {
875         return purchaseOrderAutomaticIndicator;
876     }
877 
878     @Override
879     public void setPurchaseOrderAutomaticIndicator(boolean purchaseOrderAutomaticIndicator) {
880         this.purchaseOrderAutomaticIndicator = purchaseOrderAutomaticIndicator;
881     }
882 
883     @Override
884     public Date getPurchaseOrderBeginDate() {
885         return purchaseOrderBeginDate;
886     }
887 
888     @Override
889     public void setPurchaseOrderBeginDate(Date purchaseOrderBeginDate) {
890         this.purchaseOrderBeginDate = purchaseOrderBeginDate;
891     }
892 
893     @Override
894     public String getPurchaseOrderCostSourceCode() {
895         return purchaseOrderCostSourceCode;
896     }
897 
898     @Override
899     public void setPurchaseOrderCostSourceCode(String purchaseOrderCostSourceCode) {
900         this.purchaseOrderCostSourceCode = purchaseOrderCostSourceCode;
901     }
902 
903     @Override
904     public Date getPurchaseOrderEndDate() {
905         return purchaseOrderEndDate;
906     }
907 
908     @Override
909     public void setPurchaseOrderEndDate(Date purchaseOrderEndDate) {
910         this.purchaseOrderEndDate = purchaseOrderEndDate;
911     }
912 
913     @Override
914     public KualiDecimal getPurchaseOrderTotalLimit() {
915         return purchaseOrderTotalLimit;
916     }
917 
918     @Override
919     public void setPurchaseOrderTotalLimit(KualiDecimal purchaseOrderTotalLimit) {
920         this.purchaseOrderTotalLimit = purchaseOrderTotalLimit;
921     }
922 
923     @Override
924     public String getPurchaseOrderTransmissionMethodCode() {
925         return purchaseOrderTransmissionMethodCode;
926     }
927 
928     @Override
929     public void setPurchaseOrderTransmissionMethodCode(String purchaseOrderTransmissionMethodCode) {
930         this.purchaseOrderTransmissionMethodCode = purchaseOrderTransmissionMethodCode;
931     }
932 
933     @Override
934     public String getRecurringPaymentTypeCode() {
935         return recurringPaymentTypeCode;
936     }
937 
938     @Override
939     public void setRecurringPaymentTypeCode(String recurringPaymentTypeCode) {
940         this.recurringPaymentTypeCode = recurringPaymentTypeCode;
941     }
942 
943     @Override
944     public String getRequestorPersonEmailAddress() {
945         return requestorPersonEmailAddress;
946     }
947 
948     @Override
949     public void setRequestorPersonEmailAddress(String requestorPersonEmailAddress) {
950         this.requestorPersonEmailAddress = requestorPersonEmailAddress;
951     }
952 
953     @Override
954     public String getRequestorPersonName() {
955         return requestorPersonName;
956     }
957 
958     @Override
959     public void setRequestorPersonName(String requestorPersonName) {
960         this.requestorPersonName = requestorPersonName;
961     }
962 
963     @Override
964     public String getRequestorPersonPhoneNumber() {
965         return requestorPersonPhoneNumber;
966     }
967 
968     @Override
969     public void setRequestorPersonPhoneNumber(String requestorPersonPhoneNumber) {
970         this.requestorPersonPhoneNumber = requestorPersonPhoneNumber;
971     }
972 
973     @Override
974     public String getRequisitionSourceCode() {
975         return requisitionSourceCode;
976     }
977 
978     @Override
979     public void setRequisitionSourceCode(String requisitionSourceCode) {
980         this.requisitionSourceCode = requisitionSourceCode;
981     }
982 
983     public String getVendorContactsLabel() {
984         return vendorContactsLabel;
985     }
986 
987     public void setVendorContactsLabel(String vendorContactsLabel) {
988         this.vendorContactsLabel = vendorContactsLabel;
989     }
990 
991     public VendorContract getVendorContract() {
992         if (ObjectUtils.isNull(vendorContract)) {
993             refreshReferenceObject(PurapPropertyConstants.VENDOR_CONTRACT);
994         }
995         return vendorContract;
996     }
997 
998     public void setVendorContract(VendorContract vendorContract) {
999         this.vendorContract = vendorContract;
1000     }
1001 
1002     @Override
1003     public Integer getVendorContractGeneratedIdentifier() {
1004         return vendorContractGeneratedIdentifier;
1005     }
1006 
1007     @Override
1008     public void setVendorContractGeneratedIdentifier(Integer vendorContractGeneratedIdentifier) {
1009         this.vendorContractGeneratedIdentifier = vendorContractGeneratedIdentifier;
1010     }
1011 
1012     public String getVendorContractName() {
1013         getVendorContract();
1014         if (ObjectUtils.isNull(vendorContract)) {
1015             return "";
1016         }
1017         else {
1018             return vendorContract.getVendorContractName();
1019         }
1020     }
1021 
1022     @Override
1023     public String getVendorFaxNumber() {
1024         return vendorFaxNumber;
1025     }
1026 
1027     @Override
1028     public void setVendorFaxNumber(String vendorFaxNumber) {
1029         this.vendorFaxNumber = vendorFaxNumber;
1030     }
1031 
1032     @Override
1033     public String getVendorNoteText() {
1034         return vendorNoteText;
1035     }
1036 
1037     @Override
1038     public void setVendorNoteText(String vendorNoteText) {
1039         this.vendorNoteText = vendorNoteText;
1040     }
1041 
1042     @Override
1043     public String getVendorPaymentTermsCode() {
1044         return vendorPaymentTermsCode;
1045     }
1046 
1047     @Override
1048     public void setVendorPaymentTermsCode(String vendorPaymentTermsCode) {
1049         this.vendorPaymentTermsCode = vendorPaymentTermsCode;
1050     }
1051 
1052     @Override
1053     public String getVendorPhoneNumber() {
1054         return vendorPhoneNumber;
1055     }
1056 
1057     @Override
1058     public void setVendorPhoneNumber(String vendorPhoneNumber) {
1059         this.vendorPhoneNumber = vendorPhoneNumber;
1060     }
1061 
1062     @Override
1063     public Boolean getVendorRestrictedIndicator() {
1064         return vendorRestrictedIndicator;
1065     }
1066 
1067     @Override
1068     public void setVendorRestrictedIndicator(Boolean vendorRestrictedIndicator) {
1069         this.vendorRestrictedIndicator = vendorRestrictedIndicator;
1070     }
1071 
1072     @Override
1073     public String getVendorShippingPaymentTermsCode() {
1074         return vendorShippingPaymentTermsCode;
1075     }
1076 
1077     @Override
1078     public void setVendorShippingPaymentTermsCode(String vendorShippingPaymentTermsCode) {
1079         this.vendorShippingPaymentTermsCode = vendorShippingPaymentTermsCode;
1080     }
1081 
1082     @Override
1083     public String getVendorShippingTitleCode() {
1084         return vendorShippingTitleCode;
1085     }
1086 
1087     @Override
1088     public void setVendorShippingTitleCode(String vendorShippingTitleCode) {
1089         this.vendorShippingTitleCode = vendorShippingTitleCode;
1090     }
1091 
1092     @Override
1093     public Chart getChartOfAccounts() {
1094         return chartOfAccounts;
1095     }
1096 
1097     @Override
1098     public CampusParameter getDeliveryCampus() {
1099         return deliveryCampus;
1100     }
1101 
1102     @Override
1103     public DeliveryRequiredDateReason getDeliveryRequiredDateReason() {
1104         return deliveryRequiredDateReason;
1105     }
1106 
1107     @Override
1108     public FundingSource getFundingSource() {
1109         return fundingSource;
1110     }
1111 
1112     @Override
1113     public Account getNonInstitutionFundAccount() {
1114         return nonInstitutionFundAccount;
1115     }
1116 
1117     @Override
1118     public Chart getNonInstitutionFundChartOfAccounts() {
1119         return nonInstitutionFundChartOfAccounts;
1120     }
1121 
1122     @Override
1123     public Organization getNonInstitutionFundOrganization() {
1124         return nonInstitutionFundOrganization;
1125     }
1126 
1127     @Override
1128     public Chart getNonInstitutionFundOrgChartOfAccounts() {
1129         return nonInstitutionFundOrgChartOfAccounts;
1130     }
1131 
1132     @Override
1133     public Organization getOrganization() {
1134         return organization;
1135     }
1136 
1137     @Override
1138     public PurchaseOrderTransmissionMethod getPurchaseOrderTransmissionMethod() {
1139         return purchaseOrderTransmissionMethod;
1140     }
1141 
1142     @Override
1143     public RecurringPaymentType getRecurringPaymentType() {
1144         return recurringPaymentType;
1145     }
1146 
1147     @Override
1148     public RequisitionSource getRequisitionSource() {
1149         return requisitionSource;
1150     }
1151 
1152     public String getSupplierDiversityLabel() {
1153         return supplierDiversityLabel;
1154     }
1155 
1156     @Override
1157     public PurchaseOrderCostSource getPurchaseOrderCostSource() {
1158         if (ObjectUtils.isNull(purchaseOrderCostSource)) {
1159             refreshReferenceObject(PurapPropertyConstants.PURCHASE_ORDER_COST_SOURCE);
1160         }
1161         return purchaseOrderCostSource;
1162     }
1163 
1164     /**
1165      * @deprecated
1166      */
1167     @Deprecated
1168     @Override
1169     public void setChartOfAccounts(Chart chartOfAccounts) {
1170         this.chartOfAccounts = chartOfAccounts;
1171     }
1172 
1173     /**
1174      * @deprecated
1175      */
1176     @Deprecated
1177     @Override
1178     public void setDeliveryCampus(CampusParameter deliveryCampus) {
1179         this.deliveryCampus = deliveryCampus;
1180     }
1181 
1182     /**
1183      * @deprecated
1184      */
1185     @Deprecated
1186     @Override
1187     public void setDeliveryRequiredDateReason(DeliveryRequiredDateReason deliveryRequiredDateReason) {
1188         this.deliveryRequiredDateReason = deliveryRequiredDateReason;
1189     }
1190 
1191     /**
1192      * @deprecated
1193      */
1194     @Deprecated
1195     @Override
1196     public void setFundingSource(FundingSource fundingSource) {
1197         this.fundingSource = fundingSource;
1198     }
1199 
1200     /**
1201      * @deprecated
1202      */
1203     @Deprecated
1204     @Override
1205     public void setNonInstitutionFundAccount(Account nonInstitutionFundAccount) {
1206         this.nonInstitutionFundAccount = nonInstitutionFundAccount;
1207     }
1208 
1209     /**
1210      * @deprecated
1211      */
1212     @Deprecated
1213     @Override
1214     public void setNonInstitutionFundChartOfAccounts(Chart nonInstitutionFundChartOfAccounts) {
1215         this.nonInstitutionFundChartOfAccounts = nonInstitutionFundChartOfAccounts;
1216     }
1217 
1218     /**
1219      * @deprecated
1220      */
1221     @Deprecated
1222     @Override
1223     public void setNonInstitutionFundOrganization(Organization nonInstitutionFundOrganization) {
1224         this.nonInstitutionFundOrganization = nonInstitutionFundOrganization;
1225     }
1226 
1227     /**
1228      * @deprecated
1229      */
1230     @Deprecated
1231     @Override
1232     public void setNonInstitutionFundOrgChartOfAccounts(Chart nonInstitutionFundOrgChartOfAccounts) {
1233         this.nonInstitutionFundOrgChartOfAccounts = nonInstitutionFundOrgChartOfAccounts;
1234     }
1235 
1236     /**
1237      * @deprecated
1238      */
1239     @Deprecated
1240     @Override
1241     public void setOrganization(Organization organization) {
1242         this.organization = organization;
1243     }
1244 
1245     /**
1246      * @deprecated
1247      */
1248     @Deprecated
1249     @Override
1250     public void setPurchaseOrderCostSource(PurchaseOrderCostSource purchaseOrderCostSource) {
1251         this.purchaseOrderCostSource = purchaseOrderCostSource;
1252     }
1253 
1254     /**
1255      * @deprecated
1256      */
1257     @Deprecated
1258     @Override
1259     public void setPurchaseOrderTransmissionMethod(PurchaseOrderTransmissionMethod purchaseOrderTransmissionMethod) {
1260         this.purchaseOrderTransmissionMethod = purchaseOrderTransmissionMethod;
1261     }
1262 
1263     /**
1264      * @deprecated
1265      */
1266     @Deprecated
1267     @Override
1268     public void setRecurringPaymentType(RecurringPaymentType recurringPaymentType) {
1269         this.recurringPaymentType = recurringPaymentType;
1270     }
1271 
1272     /**
1273      * @deprecated
1274      */
1275     @Deprecated
1276     @Override
1277     public void setRequisitionSource(RequisitionSource requisitionSource) {
1278         this.requisitionSource = requisitionSource;
1279     }
1280 
1281     /**
1282      * Gets the receivingDocumentRequiredIndicator attribute.
1283      * @return Returns the receivingDocumentRequiredIndicator.
1284      */
1285     @Override
1286     public boolean isReceivingDocumentRequiredIndicator() {
1287         return receivingDocumentRequiredIndicator;
1288     }
1289 
1290     /**
1291      * Sets the receivingDocumentRequiredIndicator attribute value.
1292      * @param receivingDocumentRequiredIndicator The receivingDocumentRequiredIndicator to set.
1293      */
1294     @Override
1295     public void setReceivingDocumentRequiredIndicator(boolean receivingDocumentRequiredIndicator) {
1296         // if receivingDocumentRequiredIndicator functionality is disabled, always set it to false, overriding the passed-in value
1297         if (!isEnableReceivingDocumentRequiredIndicator()) {
1298             receivingDocumentRequiredIndicator = false;
1299         }
1300         else {
1301             this.receivingDocumentRequiredIndicator = receivingDocumentRequiredIndicator;
1302         }
1303     }
1304 
1305     @Override
1306     public boolean isPaymentRequestPositiveApprovalIndicator() {
1307         return paymentRequestPositiveApprovalIndicator;
1308     }
1309 
1310     @Override
1311     public void setPaymentRequestPositiveApprovalIndicator(boolean paymentRequestPositiveApprovalIndicator) {
1312         // if paymentRequestPositiveApprovalIndicator functionality is disabled, always set it to false, overriding the passed-in value
1313         if (!isEnablePaymentRequestPositiveApprovalIndicator()) {
1314             paymentRequestPositiveApprovalIndicator = false;
1315         }
1316         else {
1317             this.paymentRequestPositiveApprovalIndicator = paymentRequestPositiveApprovalIndicator;
1318         }
1319     }
1320 
1321     public List<CommodityCode> getCommodityCodesForRouting() {
1322         return commodityCodesForRouting;
1323     }
1324 
1325     public void setCommodityCodesForRouting(List<CommodityCode> commodityCodesForRouting) {
1326         this.commodityCodesForRouting = commodityCodesForRouting;
1327     }
1328 
1329     @Override
1330     public String getCapitalAssetSystemTypeCode() {
1331         return capitalAssetSystemTypeCode;
1332     }
1333 
1334     @Override
1335     public void setCapitalAssetSystemTypeCode(String capitalAssetSystemTypeCode) {
1336         this.capitalAssetSystemTypeCode = capitalAssetSystemTypeCode;
1337     }
1338 
1339     @Override
1340     public String getCapitalAssetSystemStateCode() {
1341         return capitalAssetSystemStateCode;
1342     }
1343 
1344     @Override
1345     public void setCapitalAssetSystemStateCode(String capitalAssetSystemStateCode) {
1346         this.capitalAssetSystemStateCode = capitalAssetSystemStateCode;
1347     }
1348 
1349     /**
1350      * Gets the justification attribute.
1351      * @return Returns the justification.
1352      */
1353     public String getJustification() {
1354         return justification;
1355     }
1356 
1357     /**
1358      * Sets the justification attribute value.
1359      * @param justification The justification to set.
1360      */
1361     public void setJustification(String justification) {
1362         this.justification = justification;
1363     }
1364 
1365     @Override
1366     public CapitalAssetSystemType getCapitalAssetSystemType() {
1367         if(ObjectUtils.isNull(capitalAssetSystemType)){
1368             this.refreshReferenceObject("capitalAssetSystemType");
1369         }
1370         return capitalAssetSystemType;
1371     }
1372 
1373     @Override
1374     public void setCapitalAssetSystemType(CapitalAssetSystemType capitalAssetSystemType) {
1375         this.capitalAssetSystemType = capitalAssetSystemType;
1376     }
1377 
1378     @Override
1379     public CapitalAssetSystemState getCapitalAssetSystemState() {
1380         if(ObjectUtils.isNull(capitalAssetSystemState)){
1381             this.refreshReferenceObject("capitalAssetSystemState");
1382         }
1383         return capitalAssetSystemState;
1384     }
1385 
1386     @Override
1387     public void setCapitalAssetSystemState(CapitalAssetSystemState capitalAssetSystemState) {
1388         this.capitalAssetSystemState = capitalAssetSystemState;
1389     }
1390 
1391     @Override
1392     public List<CapitalAssetSystem> getPurchasingCapitalAssetSystems() {
1393         return purchasingCapitalAssetSystems;
1394     }
1395 
1396     @Override
1397     public void setPurchasingCapitalAssetSystems(List<CapitalAssetSystem> purchasingCapitalAssetSystems) {
1398         this.purchasingCapitalAssetSystems = purchasingCapitalAssetSystems;
1399     }
1400 
1401     @Override
1402     public List<PurchasingCapitalAssetItem> getPurchasingCapitalAssetItems() {
1403         return purchasingCapitalAssetItems;
1404     }
1405 
1406     @Override
1407     public void setPurchasingCapitalAssetItems(List<PurchasingCapitalAssetItem> purchasingCapitalAssetItems) {
1408         this.purchasingCapitalAssetItems = purchasingCapitalAssetItems;
1409     }
1410 
1411     @Override
1412     public abstract Class getPurchasingCapitalAssetItemClass();
1413 
1414     @Override
1415     public abstract Class getPurchasingCapitalAssetSystemClass();
1416 
1417     @Override
1418     public PurchasingItem getPurchasingItem(Integer itemIdentifier){
1419 
1420         if(ObjectUtils.isNull(itemIdentifier)) {
1421             return null;
1422         }
1423 
1424         PurchasingItem item = null;
1425 
1426         for(PurchasingItem pi: (List<PurchasingItem>)this.getItems()){
1427             if(itemIdentifier.equals(pi.getItemIdentifier())){
1428                 item = pi;
1429                 break;
1430             }
1431         }
1432 
1433         return item;
1434     }
1435 
1436     @Override
1437     public PurchasingCapitalAssetItem getPurchasingCapitalAssetItem(Integer itemIdentifier){
1438 
1439         if(ObjectUtils.isNull(itemIdentifier)) {
1440             return null;
1441         }
1442 
1443         PurchasingCapitalAssetItem item = null;
1444 
1445         for(PurchasingCapitalAssetItem pcai: this.getPurchasingCapitalAssetItems()){
1446             if(itemIdentifier.equals(pcai.getItemIdentifier())){
1447                 item = pcai;
1448                 break;
1449             }
1450         }
1451 
1452         return item;
1453     }
1454 
1455     /**
1456      * @see org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocumentBase#buildListOfDeletionAwareLists()
1457      */
1458     @Override
1459     public List buildListOfDeletionAwareLists() {
1460         List managedLists = new ArrayList<List>();
1461         managedLists.add(getDeletionAwareAccountingLines());
1462         managedLists.add(getDeletionAwareUseTaxItems());
1463         if (allowDeleteAwareCollection) {
1464             List<ItemCapitalAsset> assetLists = new ArrayList<ItemCapitalAsset>();
1465             if (StringUtils.equals(this.getCapitalAssetSystemTypeCode(),PurapConstants.CapitalAssetSystemTypes.INDIVIDUAL)) {
1466                 for (PurchasingCapitalAssetItem capitalAssetItem : this.getPurchasingCapitalAssetItems()) {
1467                     //We only need to add the itemCapitalAssets to assetLists if the system is not null, otherwise
1468                     //just let the assetLists be empty ArrayList.
1469                     if (capitalAssetItem.getPurchasingCapitalAssetSystem() != null) {
1470                         assetLists.addAll(capitalAssetItem.getPurchasingCapitalAssetSystem().getItemCapitalAssets());
1471                     }
1472                 }
1473             }
1474             else {
1475                 for (CapitalAssetSystem system : this.getPurchasingCapitalAssetSystems()) {
1476                     assetLists.addAll(system.getItemCapitalAssets());
1477                 }
1478             }
1479             managedLists.add(assetLists);
1480             managedLists.add(this.getPurchasingCapitalAssetSystems());
1481             managedLists.add(this.getPurchasingCapitalAssetItems());
1482             managedLists.add(this.getItems());
1483         }
1484         return managedLists;
1485     }
1486 
1487     /**
1488      * Overrides the method in PurchasingAccountsPayableDocumentBase to remove the
1489      * purchasingCapitalAssetSystem when the system type is either ONE or MULT.
1490      *
1491      * @see org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocumentBase#prepareForSave(org.kuali.rice.krad.rule.event.KualiDocumentEvent)
1492      */
1493     @Override
1494     public void prepareForSave(KualiDocumentEvent event) {
1495         super.prepareForSave(event);
1496         if (StringUtils.isNotBlank(this.getCapitalAssetSystemTypeCode())) {
1497             if (this.getCapitalAssetSystemTypeCode().equals(PurapConstants.CapitalAssetSystemTypes.ONE_SYSTEM) || this.getCapitalAssetSystemTypeCode().equals(PurapConstants.CapitalAssetSystemTypes.MULTIPLE)) {
1498                 //If the system state is ONE or MULT, we have to remove all the systems on the items because it's not applicable.
1499                 for (PurchasingCapitalAssetItem camsItem : this.getPurchasingCapitalAssetItems()) {
1500                     camsItem.setPurchasingCapitalAssetSystem(null);
1501                 }
1502             }
1503         }
1504         if (event instanceof RouteDocumentEvent || event instanceof ApproveDocumentEvent) {
1505 
1506             boolean defaultUseTaxIndicatorValue = SpringContext.getBean(PurchasingService.class).getDefaultUseTaxIndicatorValue(this);
1507             SpringContext.getBean(PurapService.class).updateUseTaxIndicator(this, defaultUseTaxIndicatorValue);
1508         }
1509     }
1510 
1511     @Override
1512     public Date getTransactionTaxDate() {
1513         return SpringContext.getBean(DateTimeService.class).getCurrentSqlDate();
1514     }
1515 
1516     @Override
1517     public void clearCapitalAssetFields() {
1518         this.getPurchasingCapitalAssetItems().clear();
1519         this.getPurchasingCapitalAssetSystems().clear();
1520         this.setCapitalAssetSystemStateCode(null);
1521         this.setCapitalAssetSystemTypeCode(null);
1522         this.setCapitalAssetSystemState(null);
1523         this.setCapitalAssetSystemType(null);
1524 
1525     }
1526 
1527     /**
1528      * @return the payment request positive approval indicator
1529      */
1530     public boolean getPaymentRequestPositiveApprovalIndicatorForSearching() {
1531         return paymentRequestPositiveApprovalIndicator;
1532     }
1533 
1534     /**
1535      * @return the receiving document required indicator
1536      */
1537     public boolean getReceivingDocumentRequiredIndicatorForSearching() {
1538         return receivingDocumentRequiredIndicator;
1539     }
1540 
1541     public String getDocumentChartOfAccountsCodeForSearching(){
1542         return chartOfAccountsCode;
1543     }
1544 
1545     public String getDocumentOrganizationCodeForSearching(){
1546         return organizationCode;
1547     }
1548 
1549     @Override
1550     public boolean shouldGiveErrorForEmptyAccountsProration() {
1551         return true;
1552     }
1553 
1554     public String getChartAndOrgCodeForResult(){
1555         return getChartOfAccountsCode() + "-" + getOrganizationCode();
1556     }
1557 
1558     public String getDeliveryCampusCodeForSearch(){
1559         return getDeliveryCampusCode();
1560     }
1561 
1562     public boolean getHasB2BVendor() {
1563         if (getVendorHeaderGeneratedIdentifier() != null) {
1564             refreshReferenceObject(VendorPropertyConstants.VENDOR_DETAIL);
1565             String campusCode = GlobalVariables.getUserSession().getPerson().getCampusCode();
1566             VendorDetail vendorDetail = getVendorDetail();
1567             if (vendorDetail == null || StringUtils.isEmpty(campusCode))
1568              {
1569                 return false; // this should never happen
1570             }
1571             return SpringContext.getBean(VendorService.class).getVendorB2BContract(vendorDetail, campusCode) != null;
1572         }
1573         return false;
1574     }
1575 }