001/*
002 * Copyright 2008 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 */
016package org.kuali.ole.module.purap.document;
017
018import org.apache.commons.lang.StringUtils;
019import org.kuali.ole.module.purap.businessobject.Carrier;
020import org.kuali.ole.module.purap.businessobject.DeliveryRequiredDateReason;
021import org.kuali.ole.module.purap.businessobject.PurchaseOrderView;
022import org.kuali.ole.module.purap.businessobject.SensitiveData;
023import org.kuali.ole.module.purap.document.service.PurchaseOrderService;
024import org.kuali.ole.module.purap.document.service.ReceivingService;
025import org.kuali.ole.module.purap.service.SensitiveDataService;
026import org.kuali.ole.module.purap.util.PurApRelatedViews;
027import org.kuali.ole.module.purap.util.PurapSearchUtils;
028import org.kuali.ole.select.service.OleUrlResolver;
029import org.kuali.ole.sys.context.SpringContext;
030import org.kuali.ole.sys.document.FinancialSystemTransactionalDocumentBase;
031import org.kuali.ole.vnd.businessobject.CampusParameter;
032import org.kuali.ole.vnd.businessobject.VendorDetail;
033import org.kuali.rice.core.api.config.property.ConfigContext;
034import org.kuali.rice.kew.api.KewApiServiceLocator;
035import org.kuali.rice.kew.api.WorkflowDocument;
036import org.kuali.rice.kew.api.action.ActionRequestType;
037import org.kuali.rice.kew.api.exception.WorkflowException;
038import org.kuali.rice.kew.framework.postprocessor.DocumentRouteStatusChange;
039import org.kuali.rice.krad.service.KualiModuleService;
040import org.kuali.rice.krad.service.ModuleService;
041import org.kuali.rice.krad.util.NoteType;
042import org.kuali.rice.krad.util.ObjectUtils;
043import org.kuali.rice.location.api.LocationConstants;
044import org.kuali.rice.location.api.country.Country;
045import org.kuali.rice.location.api.country.CountryService;
046import org.kuali.rice.location.framework.country.CountryEbo;
047
048import java.sql.Date;
049import java.util.HashMap;
050import java.util.List;
051import java.util.Map;
052import java.util.Set;
053
054public abstract class ReceivingDocumentBase extends FinancialSystemTransactionalDocumentBase implements ReceivingDocument {
055
056    protected String carrierCode;
057    protected String shipmentPackingSlipNumber;
058    protected String shipmentReferenceNumber;
059    protected String shipmentBillOfLadingNumber;
060    protected Date shipmentReceivedDate;
061    protected Integer vendorHeaderGeneratedIdentifier;
062    protected Integer vendorDetailAssignedIdentifier;
063    protected String vendorName;
064    protected String vendorLine1Address;
065    protected String vendorLine2Address;
066    protected String vendorCityName;
067    protected String vendorStateCode;
068    protected String vendorPostalCode;
069    protected String vendorCountryCode;
070    protected String deliveryCampusCode;
071    protected boolean deliveryBuildingOtherIndicator;
072    protected String deliveryBuildingCode;
073    protected String deliveryBuildingName;
074    protected String deliveryBuildingRoomNumber;
075    protected String deliveryBuildingLine1Address;
076    protected String deliveryBuildingLine2Address;
077    protected String deliveryCityName;
078    protected String deliveryStateCode;
079    protected String deliveryPostalCode;
080    protected String deliveryCountryCode;
081    protected String deliveryToName;
082    protected String deliveryToEmailAddress;
083    protected String deliveryToPhoneNumber;
084    protected Date deliveryRequiredDate;
085    protected String deliveryInstructionText;
086    protected String deliveryRequiredDateReasonCode;
087
088    protected Integer alternateVendorHeaderGeneratedIdentifier;
089    protected Integer alternateVendorDetailAssignedIdentifier;
090    protected String alternateVendorName;
091
092    //not persisted in db
093    protected String vendorNumber;
094    protected Integer vendorAddressGeneratedIdentifier;
095    protected String alternateVendorNumber;
096    protected boolean sensitive;
097
098    protected CampusParameter deliveryCampus;
099    protected CountryEbo vendorCountry;
100    protected Carrier carrier;
101    protected VendorDetail vendorDetail;
102    protected DeliveryRequiredDateReason deliveryRequiredDateReason;
103    protected Integer purchaseOrderIdentifier;
104    protected Integer accountsPayablePurchasingDocumentLinkIdentifier;
105    protected transient PurchaseOrderDocument purchaseOrderDocument;
106
107    protected transient PurApRelatedViews relatedViews;
108
109    //For Default Collapsing the tabs when initiating the document
110    private boolean overviewFlag;
111    private boolean deliveryFlag;
112    private boolean vendorFlag;
113    private boolean titlesFlag;
114    private boolean relatedDocumentsFlag;
115    private boolean notesAndAttachmentFlag;
116    private boolean routeLogFlag;
117
118
119
120    //license request document number
121    /*public transient String licenseRequestDocNum = null;*/
122    private transient OleUrlResolver oleUrlResolver;
123
124    public ReceivingDocumentBase() {
125        super();
126    }
127
128    public boolean isSensitive() {
129        List<SensitiveData> sensitiveData = SpringContext.getBean(SensitiveDataService.class).getSensitiveDatasAssignedByRelatedDocId(getAccountsPayablePurchasingDocumentLinkIdentifier());
130        if (ObjectUtils.isNotNull(sensitiveData) && !sensitiveData.isEmpty()) {
131            return true;
132        }
133        return false;
134    }
135
136    @Override
137    public String getCarrierCode() {
138        return carrierCode;
139    }
140
141    @Override
142    public void setCarrierCode(String carrierCode) {
143        this.carrierCode = carrierCode;
144    }
145
146    @Override
147    public String getShipmentPackingSlipNumber() {
148        return shipmentPackingSlipNumber;
149    }
150
151    @Override
152    public void setShipmentPackingSlipNumber(String shipmentPackingSlipNumber) {
153        this.shipmentPackingSlipNumber = shipmentPackingSlipNumber;
154    }
155
156    @Override
157    public String getShipmentReferenceNumber() {
158        return shipmentReferenceNumber;
159    }
160
161    @Override
162    public void setShipmentReferenceNumber(String shipmentReferenceNumber) {
163        this.shipmentReferenceNumber = shipmentReferenceNumber;
164    }
165
166    @Override
167    public String getShipmentBillOfLadingNumber() {
168        return shipmentBillOfLadingNumber;
169    }
170
171    @Override
172    public void setShipmentBillOfLadingNumber(String shipmentBillOfLadingNumber) {
173        this.shipmentBillOfLadingNumber = shipmentBillOfLadingNumber;
174    }
175
176    @Override
177    public Date getShipmentReceivedDate() {
178        return shipmentReceivedDate;
179    }
180
181    @Override
182    public void setShipmentReceivedDate(Date shipmentReceivedDate) {
183        this.shipmentReceivedDate = shipmentReceivedDate;
184    }
185
186    @Override
187    public Integer getVendorHeaderGeneratedIdentifier() {
188        return vendorHeaderGeneratedIdentifier;
189    }
190
191    @Override
192    public void setVendorHeaderGeneratedIdentifier(Integer vendorHeaderGeneratedIdentifier) {
193        this.vendorHeaderGeneratedIdentifier = vendorHeaderGeneratedIdentifier;
194    }
195
196    @Override
197    public Integer getVendorDetailAssignedIdentifier() {
198        return vendorDetailAssignedIdentifier;
199    }
200
201    @Override
202    public void setVendorDetailAssignedIdentifier(Integer vendorDetailAssignedIdentifier) {
203        this.vendorDetailAssignedIdentifier = vendorDetailAssignedIdentifier;
204    }
205
206    @Override
207    public String getVendorName() {
208        return vendorName;
209    }
210
211    @Override
212    public void setVendorName(String vendorName) {
213        this.vendorName = vendorName;
214    }
215
216    @Override
217    public String getVendorLine1Address() {
218        return vendorLine1Address;
219    }
220
221    @Override
222    public void setVendorLine1Address(String vendorLine1Address) {
223        this.vendorLine1Address = vendorLine1Address;
224    }
225
226    @Override
227    public String getVendorLine2Address() {
228        return vendorLine2Address;
229    }
230
231    @Override
232    public void setVendorLine2Address(String vendorLine2Address) {
233        this.vendorLine2Address = vendorLine2Address;
234    }
235
236    @Override
237    public String getVendorCityName() {
238        return vendorCityName;
239    }
240
241    @Override
242    public void setVendorCityName(String vendorCityName) {
243        this.vendorCityName = vendorCityName;
244    }
245
246    @Override
247    public String getVendorStateCode() {
248        return vendorStateCode;
249    }
250
251    @Override
252    public void setVendorStateCode(String vendorStateCode) {
253        this.vendorStateCode = vendorStateCode;
254    }
255
256    @Override
257    public String getVendorPostalCode() {
258        return vendorPostalCode;
259    }
260
261    @Override
262    public void setVendorPostalCode(String vendorPostalCode) {
263        this.vendorPostalCode = vendorPostalCode;
264    }
265
266    @Override
267    public String getVendorCountryCode() {
268        return vendorCountryCode;
269    }
270
271    @Override
272    public void setVendorCountryCode(String vendorCountryCode) {
273        this.vendorCountryCode = vendorCountryCode;
274    }
275
276    @Override
277    public String getDeliveryCampusCode() {
278        return deliveryCampusCode;
279    }
280
281    @Override
282    public void setDeliveryCampusCode(String deliveryCampusCode) {
283        this.deliveryCampusCode = deliveryCampusCode;
284    }
285
286    @Override
287    public String getDeliveryBuildingCode() {
288        return deliveryBuildingCode;
289    }
290
291    @Override
292    public void setDeliveryBuildingCode(String deliveryBuildingCode) {
293        this.deliveryBuildingCode = deliveryBuildingCode;
294    }
295
296    @Override
297    public String getDeliveryBuildingName() {
298        return deliveryBuildingName;
299    }
300
301    @Override
302    public void setDeliveryBuildingName(String deliveryBuildingName) {
303        this.deliveryBuildingName = deliveryBuildingName;
304    }
305
306    @Override
307    public String getDeliveryBuildingRoomNumber() {
308        return deliveryBuildingRoomNumber;
309    }
310
311    @Override
312    public void setDeliveryBuildingRoomNumber(String deliveryBuildingRoomNumber) {
313        this.deliveryBuildingRoomNumber = deliveryBuildingRoomNumber;
314    }
315
316    @Override
317    public String getDeliveryBuildingLine1Address() {
318        return deliveryBuildingLine1Address;
319    }
320
321    @Override
322    public void setDeliveryBuildingLine1Address(String deliveryBuildingLine1Address) {
323        this.deliveryBuildingLine1Address = deliveryBuildingLine1Address;
324    }
325
326    @Override
327    public String getDeliveryBuildingLine2Address() {
328        return deliveryBuildingLine2Address;
329    }
330
331    @Override
332    public void setDeliveryBuildingLine2Address(String deliveryBuildingLine2Address) {
333        this.deliveryBuildingLine2Address = deliveryBuildingLine2Address;
334    }
335
336    @Override
337    public String getDeliveryCityName() {
338        return deliveryCityName;
339    }
340
341    @Override
342    public void setDeliveryCityName(String deliveryCityName) {
343        this.deliveryCityName = deliveryCityName;
344    }
345
346    @Override
347    public String getDeliveryStateCode() {
348        return deliveryStateCode;
349    }
350
351    @Override
352    public void setDeliveryStateCode(String deliveryStateCode) {
353        this.deliveryStateCode = deliveryStateCode;
354    }
355
356    @Override
357    public String getDeliveryPostalCode() {
358        return deliveryPostalCode;
359    }
360
361    @Override
362    public void setDeliveryPostalCode(String deliveryPostalCode) {
363        this.deliveryPostalCode = deliveryPostalCode;
364    }
365
366    @Override
367    public String getDeliveryCountryCode() {
368        return deliveryCountryCode;
369    }
370
371    @Override
372    public void setDeliveryCountryCode(String deliveryCountryCode) {
373        this.deliveryCountryCode = deliveryCountryCode;
374    }
375
376    @Override
377    public String getDeliveryCountryName() {
378        if (StringUtils.isNotBlank(getDeliveryCountryCode())) {
379            Country country = SpringContext.getBean(CountryService.class).getCountry(getDeliveryCountryCode());
380            if (country != null) {
381                return country.getName();
382            }
383        }
384        return null;
385    }
386
387    @Override
388    public String getDeliveryToName() {
389        return deliveryToName;
390    }
391
392    @Override
393    public void setDeliveryToName(String deliveryToName) {
394        this.deliveryToName = deliveryToName;
395    }
396
397    @Override
398    public String getDeliveryToEmailAddress() {
399        return deliveryToEmailAddress;
400    }
401
402    @Override
403    public void setDeliveryToEmailAddress(String deliveryToEmailAddress) {
404        this.deliveryToEmailAddress = deliveryToEmailAddress;
405    }
406
407    @Override
408    public String getDeliveryToPhoneNumber() {
409        return deliveryToPhoneNumber;
410    }
411
412    @Override
413    public void setDeliveryToPhoneNumber(String deliveryToPhoneNumber) {
414        this.deliveryToPhoneNumber = deliveryToPhoneNumber;
415    }
416
417    @Override
418    public Date getDeliveryRequiredDate() {
419        return deliveryRequiredDate;
420    }
421
422    @Override
423    public void setDeliveryRequiredDate(Date deliveryRequiredDate) {
424        this.deliveryRequiredDate = deliveryRequiredDate;
425    }
426
427    @Override
428    public String getDeliveryInstructionText() {
429        return deliveryInstructionText;
430    }
431
432    @Override
433    public void setDeliveryInstructionText(String deliveryInstructionText) {
434        this.deliveryInstructionText = deliveryInstructionText;
435    }
436
437    @Override
438    public String getDeliveryRequiredDateReasonCode() {
439        return deliveryRequiredDateReasonCode;
440    }
441
442    @Override
443    public void setDeliveryRequiredDateReasonCode(String deliveryRequiredDateReasonCode) {
444        this.deliveryRequiredDateReasonCode = deliveryRequiredDateReasonCode;
445    }
446
447    @Override
448    public CampusParameter getDeliveryCampus() {
449        return deliveryCampus;
450    }
451
452    /**
453     * @deprecated
454     */
455    @Deprecated
456    public void setDeliveryCampus(CampusParameter deliveryCampus) {
457        this.deliveryCampus = deliveryCampus;
458    }
459
460    @Override
461    public Carrier getCarrier() {
462        return carrier;
463    }
464
465    /**
466     * @deprecated
467     */
468    @Deprecated
469    public void setCarrier(Carrier carrier) {
470        this.carrier = carrier;
471    }
472
473    @Override
474    public DeliveryRequiredDateReason getDeliveryRequiredDateReason() {
475        return deliveryRequiredDateReason;
476    }
477
478    /**
479     * @deprecated
480     */
481    @Deprecated
482    public void setDeliveryRequiredDateReason(DeliveryRequiredDateReason deliveryRequiredDateReason) {
483        this.deliveryRequiredDateReason = deliveryRequiredDateReason;
484    }
485
486    /**
487     * Gets the vendorCountryCode attribute.
488     *
489     * @return Returns the vendorCountryCode.
490     */
491    @Override
492    public CountryEbo getVendorCountry() {
493        if (StringUtils.isBlank(vendorCountryCode)) {
494            vendorCountry = null;
495        } else {
496            if (vendorCountry == null || !StringUtils.equals(vendorCountry.getCode(), vendorCountryCode)) {
497                ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(CountryEbo.class);
498                if (moduleService != null) {
499                    Map<String, Object> keys = new HashMap<String, Object>(1);
500                    keys.put(LocationConstants.PrimaryKeyConstants.CODE, vendorCountryCode);
501                    vendorCountry = moduleService.getExternalizableBusinessObject(CountryEbo.class, keys);
502                } else {
503                    throw new RuntimeException("CONFIGURATION ERROR: No responsible module found for EBO class.  Unable to proceed.");
504                }
505            }
506        }
507
508        return vendorCountry;
509    }
510
511    /**
512     * @deprecated
513     */
514    @Deprecated
515    public void setVendorCountry(CountryEbo vendorCountry) {
516        this.vendorCountry = vendorCountry;
517    }
518
519    @Override
520    public VendorDetail getVendorDetail() {
521        return vendorDetail;
522    }
523
524    /**
525     * @deprecated
526     */
527    @Deprecated
528    public void setVendorDetail(VendorDetail vendorDetail) {
529        this.vendorDetail = vendorDetail;
530    }
531
532    @Override
533    public String getVendorNumber() {
534        if (StringUtils.isNotEmpty(vendorNumber)) {
535            return vendorNumber;
536        } else if (ObjectUtils.isNotNull(vendorDetail)) {
537            return vendorDetail.getVendorNumber();
538        } else {
539            return "";
540        }
541    }
542
543    @Override
544    public void setVendorNumber(String vendorNumber) {
545        this.vendorNumber = vendorNumber;
546    }
547
548    @Override
549    public Integer getVendorAddressGeneratedIdentifier() {
550        return vendorAddressGeneratedIdentifier;
551    }
552
553    @Override
554    public void setVendorAddressGeneratedIdentifier(Integer vendorAddressGeneratedIdentifier) {
555        this.vendorAddressGeneratedIdentifier = vendorAddressGeneratedIdentifier;
556    }
557
558    @Override
559    public Integer getAlternateVendorDetailAssignedIdentifier() {
560        return alternateVendorDetailAssignedIdentifier;
561    }
562
563    @Override
564    public void setAlternateVendorDetailAssignedIdentifier(Integer alternateVendorDetailAssignedIdentifier) {
565        this.alternateVendorDetailAssignedIdentifier = alternateVendorDetailAssignedIdentifier;
566    }
567
568    @Override
569    public Integer getAlternateVendorHeaderGeneratedIdentifier() {
570        return alternateVendorHeaderGeneratedIdentifier;
571    }
572
573    @Override
574    public void setAlternateVendorHeaderGeneratedIdentifier(Integer alternateVendorHeaderGeneratedIdentifier) {
575        this.alternateVendorHeaderGeneratedIdentifier = alternateVendorHeaderGeneratedIdentifier;
576    }
577
578    @Override
579    public String getAlternateVendorName() {
580        return alternateVendorName;
581    }
582
583    @Override
584    public void setAlternateVendorName(String alternateVendorName) {
585        this.alternateVendorName = alternateVendorName;
586    }
587
588    @Override
589    public String getAlternateVendorNumber() {
590        return alternateVendorNumber;
591    }
592
593    @Override
594    public void setAlternateVendorNumber(String alternateVendorNumber) {
595        this.alternateVendorNumber = alternateVendorNumber;
596    }
597
598    @Override
599    public boolean isDeliveryBuildingOtherIndicator() {
600        return deliveryBuildingOtherIndicator;
601    }
602
603    @Override
604    public void setDeliveryBuildingOtherIndicator(boolean deliveryBuildingOtherIndicator) {
605        this.deliveryBuildingOtherIndicator = deliveryBuildingOtherIndicator;
606    }
607
608    @Override
609    public void doRouteStatusChange(DocumentRouteStatusChange statusChangeEvent) {
610        super.doRouteStatusChange(statusChangeEvent);
611        if (!(this instanceof BulkReceivingDocument)) {
612            if (this.getFinancialSystemDocumentHeader().getWorkflowDocument().isProcessed()) {
613                //delete unentered items and update po totals and save po
614                SpringContext.getBean(ReceivingService.class).completeReceivingDocument(this);
615            }
616        }
617    }
618
619    @Override
620    public abstract Class getItemClass();
621
622    public Integer getPurchaseOrderIdentifier() {
623        return purchaseOrderIdentifier;
624    }
625
626    public void setPurchaseOrderIdentifier(Integer purchaseOrderIdentifier) {
627        this.purchaseOrderIdentifier = purchaseOrderIdentifier;
628    }
629
630    @Override
631    public Integer getAccountsPayablePurchasingDocumentLinkIdentifier() {
632        return accountsPayablePurchasingDocumentLinkIdentifier;
633    }
634
635    @Override
636    public void setAccountsPayablePurchasingDocumentLinkIdentifier(Integer accountsPayablePurchasingDocumentLinkIdentifier) {
637        this.accountsPayablePurchasingDocumentLinkIdentifier = accountsPayablePurchasingDocumentLinkIdentifier;
638    }
639
640    @Override
641    public PurchaseOrderDocument getPurchaseOrderDocument() {
642        if ((ObjectUtils.isNull(this.purchaseOrderDocument) || ObjectUtils.isNull(this.purchaseOrderDocument.getPurapDocumentIdentifier())) && (ObjectUtils.isNotNull(getPurchaseOrderIdentifier()))) {
643            setPurchaseOrderDocument(SpringContext.getBean(PurchaseOrderService.class).getCurrentPurchaseOrder(this.getPurchaseOrderIdentifier()));
644        }
645        return this.purchaseOrderDocument;
646    }
647
648    @Override
649    public void setPurchaseOrderDocument(PurchaseOrderDocument purchaseOrderDocument) {
650        if (ObjectUtils.isNull(purchaseOrderDocument)) {
651            this.purchaseOrderDocument = null;
652        } else {
653            if (ObjectUtils.isNotNull(purchaseOrderDocument.getPurapDocumentIdentifier())) {
654                setPurchaseOrderIdentifier(purchaseOrderDocument.getPurapDocumentIdentifier());
655            }
656            this.purchaseOrderDocument = purchaseOrderDocument;
657        }
658    }
659
660    public PurApRelatedViews getRelatedViews() {
661        if (relatedViews == null) {
662            relatedViews = new PurApRelatedViews(this.documentNumber, this.accountsPayablePurchasingDocumentLinkIdentifier);
663        }
664        return relatedViews;
665    }
666
667    public void setRelatedViews(PurApRelatedViews relatedViews) {
668        this.relatedViews = relatedViews;
669    }
670
671    public void initiateDocument() {
672        //initiate code
673
674    }
675
676    /**
677     * FIXME: this is same as PurchaseOrderDoc please move somewhere appropriate
678     * Sends FYI workflow request to the given user on this document.
679     *
680     * @param workflowDocument the associated workflow document.
681     * @param userNetworkId    the network ID of the user to be sent to.
682     * @param annotation       the annotation notes contained in this document.
683     * @param responsibility   the responsibility specified in the request.
684     * @throws WorkflowException
685     */
686    @Override
687    public void appSpecificRouteDocumentToUser(WorkflowDocument workflowDocument, String routePrincipalId, String annotation, String responsibility) throws WorkflowException {
688        if (ObjectUtils.isNotNull(workflowDocument)) {
689            String annotationNote = (ObjectUtils.isNull(annotation)) ? "" : annotation;
690            String responsibilityNote = (ObjectUtils.isNull(responsibility)) ? "" : responsibility;
691            String currentNodeName = getCurrentRouteNodeName(workflowDocument);
692            workflowDocument.adHocToPrincipal(ActionRequestType.FYI, currentNodeName, annotationNote, routePrincipalId, responsibilityNote, true);
693        }
694    }
695
696    /**
697     * FIXME: this is same as PurchaseOrderDoc please move somewhere appropriate
698     * Returns the name of the current route node.
699     *
700     * @param wd the current workflow document.
701     * @return the name of the current route node.
702     * @throws WorkflowException
703     */
704    protected String getCurrentRouteNodeName(WorkflowDocument wd) throws WorkflowException {
705        Set<String> nodeNames = wd.getCurrentNodeNames();
706        if ((nodeNames == null) || (nodeNames.size() == 0)) {
707            return null;
708        } else {
709            return (String) nodeNames.toArray()[0];
710        }
711    }
712
713    public boolean isBoNotesSupport() {
714        return true;
715    }
716
717    @Override
718    public String getAppDocStatus() {
719        return this.getApplicationDocumentStatus();
720    }
721
722    @Override
723    public void setAppDocStatus(String appDocStatus) {
724        this.setApplicationDocumentStatus(appDocStatus);
725    }
726
727    /**
728     * Always returns true.
729     * This method is needed here because it's called by some tag files shared with PurAp documents.
730     */
731    @Override
732    public boolean getIsATypeOfPurAPRecDoc() {
733        return true;
734    }
735
736    /**
737     * Always returns false.
738     * This method is needed here because it's called by some tag files shared with PurAp documents.
739     */
740    @Override
741    public boolean getIsATypeOfPurDoc() {
742        return false;
743    }
744
745    /**
746     * Always returns false.
747     * This method is needed here because it's called by some tag files shared with PurAp documents.
748     */
749    @Override
750    public boolean getIsATypeOfPODoc() {
751        return false;
752    }
753
754    /**
755     * Always returns false.
756     * This method is needed here because it's called by some tag files shared with PurAp documents.
757     */
758    @Override
759    public boolean getIsPODoc() {
760        return false;
761    }
762
763    /**
764     * Always returns false.
765     * This method is needed here because it's called by some tag files shared with PurAp documents.
766     */
767    @Override
768    public boolean getIsReqsDoc() {
769        return false;
770    }
771
772    public String getWorkflowStatusForResult() {
773        return PurapSearchUtils.getWorkFlowStatusString(getDocumentHeader());
774    }
775
776    public java.util.Date getCreateDateForResult() {
777        return new java.util.Date(this.getFinancialSystemDocumentHeader().getWorkflowDocument().getDateCreated().getMillis());
778    }
779
780    public String getDocumentTitleForResult() throws WorkflowException {
781        return KewApiServiceLocator.getDocumentTypeService().getDocumentTypeByName(this.getFinancialSystemDocumentHeader().getWorkflowDocument().getDocumentTypeName()).getLabel();
782    }
783
784    /**
785     * Checks whether the related purchase order views need a warning to be displayed,
786     * i.e. if at least one of the purchase orders has never been opened.
787     *
788     * @return true if at least one related purchase order needs a warning; false otherwise
789     */
790    public boolean getNeedWarningRelatedPOs() {
791        List<PurchaseOrderView> poViews = getRelatedViews().getRelatedPurchaseOrderViews();
792        for (PurchaseOrderView poView : poViews) {
793            if (poView.getNeedWarning()) {
794                return true;
795            }
796        }
797        return false;
798    }
799
800    /**
801     * This method returns the licenserequest web service url
802     *
803     * @return url
804     */
805    public String getLicenseURL() {
806        return ConfigContext.getCurrentContextConfig().getProperty("license.web.service.url");
807
808        //      String environment = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(OLEConstants.ENVIRONMENT_KEY);
809        //    String url  = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(environment + "."+OLEConstants.LICENSE_WEB_SERVICE_URL);
810        //    return url;
811    }
812
813    /*@Override
814    public void setLicenseRequestDocNum(String licenseRequestDocNum) {
815        this.licenseRequestDocNum = licenseRequestDocNum;
816    }*/
817
818    /**
819     * This method gets the licenseRequest document number for the corresponding requisition document
820     *
821     * @return licenseRequestDocNum
822     * @see org.kuali.ole.module.purap.document.PurchasingAccountsPayableDocument#getLicenseRequestDocnum()
823     */
824   /* @Override
825    public String getLicenseRequestDocNum(){
826        String licenseRequestDocNum = "";
827        *//*OleWebServiceProvider oleWebServiceProvider = (OleWebServiceProvider) GlobalResourceLoader.getService(OLEConstants.OLE_WEB_SERVICE_PROVIDER);
828        OleLicenseRequestWebService oleLicenseRequestWebService =
829                (OleLicenseRequestWebService) oleWebServiceProvider.
830                        getService("org.kuali.ole.select.document.service.OleLicenseRequestWebService", "oleLicenseRequestWebService", getOleUrlResolver().getLicenseURL());
831        String reqDocNum = "";
832        if(this instanceof LineItemReceivingDocument) {
833            reqDocNum = this.getDocumentNumber();
834        }
835        else if (this instanceof CorrectionReceivingDocument) {
836
837        }
838        licenseRequestDocNum = oleLicenseRequestWebService.getLicenseRequestDocNumber(reqDocNum);        *//*
839        return licenseRequestDocNum;
840    }*/
841    @Override
842    public NoteType getNoteType() {
843        return NoteType.BUSINESS_OBJECT;
844    }
845
846    /**
847     * This method returns the overview Flag indicator
848     * @return boolean
849     */
850    public boolean isOverviewFlag() {
851        return overviewFlag;
852    }
853
854    /**
855     * This method sets the overviewFlag
856     * @param overviewFlag
857     */
858    public void setOverviewFlag(boolean overviewFlag) {
859        this.overviewFlag = overviewFlag;
860    }
861
862    /**
863     * This method returns the deliveryFlag
864     * @return boolean
865     */
866    public boolean isDeliveryFlag() {
867        return deliveryFlag;
868    }
869
870    /**
871     * This method sets the deliveryFlag
872     * @param deliveryFlag
873     */
874    public void setDeliveryFlag(boolean deliveryFlag) {
875        this.deliveryFlag = deliveryFlag;
876    }
877
878    /**
879     * This method returns the vendorFlag indicator
880     * @return boolean
881     */
882    public boolean isVendorFlag() {
883        return vendorFlag;
884    }
885
886    /**
887     * This method sets the vendorFlag
888     * @param vendorFlag
889     */
890    public void setVendorFlag(boolean vendorFlag) {
891        this.vendorFlag = vendorFlag;
892    }
893
894    /**
895     * This method returns the titlesFlag indicator
896     * @return booelan
897     */
898    public boolean isTitlesFlag() {
899        return titlesFlag;
900    }
901
902    /**
903     * This methos sets the titlesFlag
904     * @param titlesFlag
905     */
906    public void setTitlesFlag(boolean titlesFlag) {
907        this.titlesFlag = titlesFlag;
908    }
909
910    /**
911     * This method returns the relatedDocumentFlag indicato
912     * @return boolean
913     */
914    public boolean isRelatedDocumentsFlag() {
915        return relatedDocumentsFlag;
916    }
917
918    /**
919     * This method sets the relatedDocumentFlag
920     * @param relatedDocumentsFlag
921     */
922    public void setRelatedDocumentsFlag(boolean relatedDocumentsFlag) {
923        this.relatedDocumentsFlag = relatedDocumentsFlag;
924    }
925
926    /**
927     * This method returns the notesAndAttachmentFlag indicator
928     * @return boolean
929     */
930    public boolean isNotesAndAttachmentFlag() {
931        return notesAndAttachmentFlag;
932    }
933
934    /**
935     * This method sets the notesAndAttachmentFlag
936     * @param notesAndAttachmentFlag
937     */
938    public void setNotesAndAttachmentFlag(boolean notesAndAttachmentFlag) {
939        this.notesAndAttachmentFlag = notesAndAttachmentFlag;
940    }
941
942    /**
943     * This method returns the routeLogFlag indicator
944     * @return boolean
945     */
946    public boolean isRouteLogFlag() {
947        return routeLogFlag;
948    }
949
950    /**
951     * This method sets the routeLogFlag
952     * @param routeLogFlag
953     */
954    public void setRouteLogFlag(boolean routeLogFlag) {
955        this.routeLogFlag = routeLogFlag;
956    }
957}