org.kuali.kfs.vnd.document.service.impl
Class VendorServiceImpl

java.lang.Object
  extended by org.kuali.kfs.vnd.document.service.impl.VendorServiceImpl
All Implemented Interfaces:
VendorService

@Transactional
public class VendorServiceImpl
extends Object
implements VendorService


Constructor Summary
VendorServiceImpl()
           
 
Method Summary
 boolean equalMemberLists(List<? extends VendorRoutingComparable> list_a, List<? extends VendorRoutingComparable> list_b)
          Compares lists which have an isEqualForRouting method by using that method.
 org.kuali.rice.kns.util.KualiDecimal getApoLimitFromContract(Integer contractId, String chart, String org)
          Gets the apo limit for the given parameters using the following logic:

First it checks to see if an existing VendorContractOrganization object exists for the associated parameters.
 VendorDetail getByVendorNumber(String vendorNumber)
          get the vendor detail with the given vendor number
 VendorDetail getParentVendor(Integer vendorHeaderGeneratedIdentifier)
          Retrieves the VendorDetail which is the parent vendor with the given headerId.
 VendorContract getVendorB2BContract(VendorDetail vendorDetail, String campus)
          This method retrieves the B2B Contract for the given Vendor (see method in VendorDao for criteria).
 VendorDetail getVendorByDunsNumber(String vendorDunsNumber)
          Retrieves the VendorDetail using its vendorDunsNumber.
 VendorAddress getVendorDefaultAddress(Integer vendorHeaderId, Integer vendorDetailId, String addressType, String campus)
          Finds the addresses for the given vendor and then calls the method to determine the default address from this list.
 VendorAddress getVendorDefaultAddress(List<VendorAddress> addresses, String addressType, String campus)
          Finds the default address for the given addressType and campus from the address list passed in based on the following logic: 1) The allDefaultAddress is defined by defaultAddressIndicator on VendorAddress.
 VendorDetail getVendorDetail(Integer headerId, Integer detailId)
           
 VendorDetail getVendorDetail(String vendorNumber)
           
 boolean isRevolvingFundCodeVendor(Integer vendorHeaderGeneratedIdentifier)
          Indicates whether the vendor identified by the given vendorHeaderGeneratedIdentifier is a revolving fund code vendor by checking the value of VendorHeader.getVendorTypeCode() to see if it equals "RF".
 boolean isSubjectPaymentVendor(Integer vendorHeaderGeneratedIdentifier)
          Indicates whether the vendor identified by the given vendorHeaderGeneratedIdentifier is a subject payment vendor by checking the value of VendorHeader.getVendorTypeCode() to see if it equals "SP".
 boolean isVendorForeign(Integer vendorHeaderGeneratedIdentifier)
          Indicates whether the vendor identified by the given vendorHeaderGeneratedIdentifier is a non-resident alien by checking the value of VendorHeader.getVendorForeignIndicator().
 boolean isVendorInstitutionEmployee(Integer vendorHeaderGeneratedIdentifier)
          Indicates whether the vendor identified by the given vendorHeaderGeneratedIdentifier is an employee of the institution.
 boolean noRouteSignificantChangeOccurred(VendorDetail newVDtl, VendorHeader newVHdr, VendorDetail oldVDtl, VendorHeader oldVHdr)
          This method is the place to put the calls to equality checks that are needed when deciding whether to route a vendor for approval or directly to final status on the basis of what has changed.
 void saveVendorHeader(VendorDetail vendorDetail)
           
 void setBusinessObjectService(org.kuali.rice.kns.service.BusinessObjectService boService)
           
 void setDocumentService(org.kuali.rice.kns.service.DocumentService documentService)
           
 void setPersistenceService(org.kuali.rice.kns.service.PersistenceService persistenceService)
           
 void setVendorDao(VendorDao vendorDao)
           
 boolean shouldVendorRouteForApproval(String documentId)
          Checks to see if a the Vendor Document associated with the given document ID should route to the route path branch in workflow where the document will stop for approvals.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VendorServiceImpl

public VendorServiceImpl()
Method Detail

saveVendorHeader

public void saveVendorHeader(VendorDetail vendorDetail)
Specified by:
saveVendorHeader in interface VendorService
See Also:
VendorService.saveVendorHeader(org.kuali.kfs.vnd.businessobject.VendorDetail)

getByVendorNumber

public VendorDetail getByVendorNumber(String vendorNumber)
Description copied from interface: VendorService
get the vendor detail with the given vendor number

Specified by:
getByVendorNumber in interface VendorService
Parameters:
vendorNumber - the given vendor number
Returns:
the vendor detail with the given vendor number if the vendor exists, otherwise, return null
See Also:
org.kuali.kfs.vnd.document.service.getByVendorNumber(String)

getVendorDetail

public VendorDetail getVendorDetail(String vendorNumber)
Specified by:
getVendorDetail in interface VendorService
See Also:
VendorService.getVendorDetail(String)

getVendorDetail

public VendorDetail getVendorDetail(Integer headerId,
                                    Integer detailId)
Specified by:
getVendorDetail in interface VendorService
See Also:
VendorService.getVendorDetail(java.lang.Integer, java.lang.Integer)

getApoLimitFromContract

public org.kuali.rice.kns.util.KualiDecimal getApoLimitFromContract(Integer contractId,
                                                                    String chart,
                                                                    String org)
Description copied from interface: VendorService
Gets the apo limit for the given parameters using the following logic:

First it checks to see if an existing VendorContractOrganization object exists for the associated parameters. If one exists and it is not excluded (see VendorContractOrganization.isVendorContractExcludeIndicator()) this will return the value of VendorContractOrganization.getVendorContractPurchaseOrderLimitAmount().

If an associated VendorContractOrganization object cannot be found then a valid VendorContract object will be sought. If one is found this method will return the value of VendorContract.getOrganizationAutomaticPurchaseOrderLimit().

If no valid VendorContractOrganization or VendorContract objects can be found for the given parameters this method will return null.

Specified by:
getApoLimitFromContract in interface VendorService
Parameters:
contractId - id used to find VendorContractOrganization object and VendorContract object
chart - chart code for use in finding VendorContractOrganization object
org - org code for use in finding VendorContractOrganization object
Returns:
the automatic purchase order limit amount from the contract found using the parameters. If parameters do not find valid vendor contract objects then null is returned.
See Also:
VendorService.getApoLimitFromContract(Integer, String, String)

getParentVendor

public VendorDetail getParentVendor(Integer vendorHeaderGeneratedIdentifier)
Description copied from interface: VendorService
Retrieves the VendorDetail which is the parent vendor with the given headerId. This is the method to use when working backward from a division vendor to its parent vendor. This method throws RuntimeExceptions if there are found to be no parent vendor or more than one parent vendor for the associated corporate structure.

Specified by:
getParentVendor in interface VendorService
Parameters:
vendorHeaderGeneratedIdentifier - The Header Id in Integer form
Returns:
The VendorDetail of the parent vendor associated with the corporate structure indicated by the given Header Id, or null if there are no vendors associated with it.
See Also:
VendorService.getParentVendor(java.lang.Integer)

getVendorByDunsNumber

public VendorDetail getVendorByDunsNumber(String vendorDunsNumber)
Description copied from interface: VendorService
Retrieves the VendorDetail using its vendorDunsNumber.

Specified by:
getVendorByDunsNumber in interface VendorService
Parameters:
vendorDunsNumber - the vendor's DUN number.
Returns:
See Also:
VendorService.getVendorByDunsNumber(String)

getVendorDefaultAddress

public VendorAddress getVendorDefaultAddress(Integer vendorHeaderId,
                                             Integer vendorDetailId,
                                             String addressType,
                                             String campus)
Description copied from interface: VendorService
Finds the addresses for the given vendor and then calls the method to determine the default address from this list.

Specified by:
getVendorDefaultAddress in interface VendorService
Parameters:
vendorHeaderId - Integer - Header ID of vendor.
vendorDetailId - Integer - Detail ID of vendor.
addressType - String - Address type of desired default.
campus - String - Campus of desired default.
Returns:
VendorAddress Desired default address; return null is possible if no defaults set.
See Also:
VendorService.getVendorDefaultAddress(Integer, Integer, String, String)

getVendorDefaultAddress

public VendorAddress getVendorDefaultAddress(List<VendorAddress> addresses,
                                             String addressType,
                                             String campus)
Description copied from interface: VendorService
Finds the default address for the given addressType and campus from the address list passed in based on the following logic: 1) The allDefaultAddress is defined by defaultAddressIndicator on VendorAddress. 2) If campus passed in is null, return allDefaultAddress if found. 3) If campus passed in is not null, look in campus lists of addresses to see if given campus is found for the given address type. If match found, return address. If no match found, return allDefaultAddress.

Specified by:
getVendorDefaultAddress in interface VendorService
Parameters:
addresses - List of addresses for a vendor.
addressType - String - Address type of the desired default sought.
campus - String - Campus of the desired default sought.
Returns:
VendorAddress Desired default address; return null is possible if no defaults set.
See Also:
VendorService.getVendorDefaultAddress(List, String, String)

shouldVendorRouteForApproval

public boolean shouldVendorRouteForApproval(String documentId)
Description copied from interface: VendorService
Checks to see if a the Vendor Document associated with the given document ID should route to the route path branch in workflow where the document will stop for approvals.

Specified by:
shouldVendorRouteForApproval in interface VendorService
Returns:
true if the vendor should be take the approval patch... false if the vendor can be 'auto approved'
See Also:
VendorService.shouldVendorRouteForApproval(java.lang.String)

noRouteSignificantChangeOccurred

public boolean noRouteSignificantChangeOccurred(VendorDetail newVDtl,
                                                VendorHeader newVHdr,
                                                VendorDetail oldVDtl,
                                                VendorHeader oldVHdr)
Description copied from interface: VendorService
This method is the place to put the calls to equality checks that are needed when deciding whether to route a vendor for approval or directly to final status on the basis of what has changed. This method has been split out from shouldVendorRouteForApproval for the convenience of unit testing, but might be useful for other purposes.

Specified by:
noRouteSignificantChangeOccurred in interface VendorService
Parameters:
newVDtl - A VendorDetail object representing the state of the proposed change
newVHdr - A VendorHeader object representing the state of the proposed change
oldVDtl - A VendorDetail object from before the change
oldVHdr - A VendorHeader object from before the change
Returns:
True if no route-significant change occurred
See Also:
VendorService.noRouteSignificantChangeOccurred(org.kuali.kfs.vnd.businessobject.VendorDetail, org.kuali.kfs.vnd.businessobject.VendorHeader, org.kuali.kfs.vnd.businessobject.VendorDetail, org.kuali.kfs.vnd.businessobject.VendorHeader)

equalMemberLists

public boolean equalMemberLists(List<? extends VendorRoutingComparable> list_a,
                                List<? extends VendorRoutingComparable> list_b)
Description copied from interface: VendorService
Compares lists which have an isEqualForRouting method by using that method. An Equals() method would be wrong for the purpose of comparing these because we want to compare only using certain specified attributes, which is what our isEqualForRouting methods will do.

Specified by:
equalMemberLists in interface VendorService
Parameters:
list_a - A List which implements VendorRoutingComparable (specifies isEqualForRouting)
list_b - Another such list
Returns:
True if all the member objects in the given lists are equal (as far as routing is concerned) at the same locations in the lists.
See Also:
VendorService.equalMemberLists(java.util.List, java.util.List)

isVendorInstitutionEmployee

public boolean isVendorInstitutionEmployee(Integer vendorHeaderGeneratedIdentifier)
Description copied from interface: VendorService
Indicates whether the vendor identified by the given vendorHeaderGeneratedIdentifier is an employee of the institution. The vendor must have a valid tax id and it must be of type SSN (see VendorConstants.TAX_TYPE_SSN).

Specified by:
isVendorInstitutionEmployee in interface VendorService
Parameters:
vendorHeaderGeneratedIdentifier - The Header Id in Integer form
Returns:
true if the vendor identified by the vendorHeaderGeneratedIdentifier given is an employee of the institution
See Also:
VendorService.isVendorInstitutionEmployee(java.lang.Integer)

isVendorForeign

public boolean isVendorForeign(Integer vendorHeaderGeneratedIdentifier)
Description copied from interface: VendorService
Indicates whether the vendor identified by the given vendorHeaderGeneratedIdentifier is a non-resident alien by checking the value of VendorHeader.getVendorForeignIndicator().

Specified by:
isVendorForeign in interface VendorService
Parameters:
vendorHeaderGeneratedIdentifier - The Header Id in Integer form
Returns:
true if the vendor identified by the vendorHeaderGeneratedIdentifier given is valid and is marked as a foreign vendor
See Also:
org.kuali.kfs.vnd.document.service.VendorService#isVendorNonResidentAlien(java.lang.Integer)

isSubjectPaymentVendor

public boolean isSubjectPaymentVendor(Integer vendorHeaderGeneratedIdentifier)
Description copied from interface: VendorService
Indicates whether the vendor identified by the given vendorHeaderGeneratedIdentifier is a subject payment vendor by checking the value of VendorHeader.getVendorTypeCode() to see if it equals "SP".

Specified by:
isSubjectPaymentVendor in interface VendorService
Parameters:
vendorHeaderGeneratedIdentifier - The Header Id in Integer form
Returns:
true if the vendor identified by the vendorHeaderGeneratedIdentifier given is valid and has a vendor type code of "SP"
See Also:
VendorService.isSubjectPaymentVendor(java.lang.Integer)

isRevolvingFundCodeVendor

public boolean isRevolvingFundCodeVendor(Integer vendorHeaderGeneratedIdentifier)
Description copied from interface: VendorService
Indicates whether the vendor identified by the given vendorHeaderGeneratedIdentifier is a revolving fund code vendor by checking the value of VendorHeader.getVendorTypeCode() to see if it equals "RF".

Specified by:
isRevolvingFundCodeVendor in interface VendorService
Parameters:
vendorHeaderGeneratedIdentifier - The Header Id in Integer form
Returns:
true if the vendor identified by the vendorHeaderGeneratedIdentifier given is valid and has a vendor type code of "RF"
See Also:
VendorService.isRevolvingFundCodeVendor(java.lang.Integer)

getVendorB2BContract

public VendorContract getVendorB2BContract(VendorDetail vendorDetail,
                                           String campus)
Description copied from interface: VendorService
This method retrieves the B2B Contract for the given Vendor (see method in VendorDao for criteria).

Specified by:
getVendorB2BContract in interface VendorService
Parameters:
vendorDetail - Vendor info
campus - Campus
Returns:
VendorContract B2B Contract for given vendor
See Also:
VendorService.getVendorB2BContract(org.kuali.kfs.vnd.businessobject.VendorDetail, java.lang.String)

setBusinessObjectService

public void setBusinessObjectService(org.kuali.rice.kns.service.BusinessObjectService boService)

setDocumentService

public void setDocumentService(org.kuali.rice.kns.service.DocumentService documentService)

setPersistenceService

public void setPersistenceService(org.kuali.rice.kns.service.PersistenceService persistenceService)

setVendorDao

public void setVendorDao(VendorDao vendorDao)


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.