use of org.kuali.kfs.vnd.businessobject.VendorCustomerNumber in project cu-kfs by CU-CommunityApps.
the class VendorRule method processCustomAddCollectionLineBusinessRules.
/**
* Validates business rules for VendorDetail document collection add lines. Add lines are the initial lines on a
* collections, i.e. the ones next to the "Add" button
*/
@Override
public boolean processCustomAddCollectionLineBusinessRules(MaintenanceDocument document, String collectionName, PersistableBusinessObject bo) {
boolean success = true;
// this incoming bo needs to be refreshed because it doesn't have its subobjects setup
bo.refreshNonUpdateableReferences();
if (bo instanceof VendorAddress) {
VendorAddress address = (VendorAddress) bo;
success = checkAddressCountryEmptyStateZip(address);
}
if (bo instanceof VendorContract) {
VendorContract contract = (VendorContract) bo;
success &= validateVendorContractBeginEndDates(contract);
success &= processContractB2BValidation(contract, -1);
}
if (bo instanceof VendorContractOrganization) {
VendorContractOrganization contractOrg = (VendorContractOrganization) bo;
success &= validateVendorContractOrganization(contractOrg, 0);
}
if (bo instanceof VendorCustomerNumber) {
VendorCustomerNumber customerNumber = (VendorCustomerNumber) bo;
success &= validateVendorCustomerNumber(customerNumber);
}
if (bo instanceof VendorDefaultAddress) {
VendorDefaultAddress defaultAddress = (VendorDefaultAddress) bo;
String parentName = StringUtils.substringBeforeLast(collectionName, ".");
VendorAddress parent = (VendorAddress) ObjectUtils.getPropertyValue(this.getNewBo(), parentName);
VendorDetail vendorDetail = (VendorDetail) document.getNewMaintainableObject().getBusinessObject();
success &= checkDefaultAddressCampus(vendorDetail, defaultAddress, parent);
}
if (bo instanceof VendorCommodityCode) {
VendorCommodityCode commodityCode = (VendorCommodityCode) bo;
String purchasingCommodityCode = commodityCode.getPurchasingCommodityCode();
boolean found = ObjectUtils.isNotNull(commodityCode) && StringUtils.isNotBlank(purchasingCommodityCode) && checkVendorCommodityCode(commodityCode);
if (!found) {
GlobalVariables.getMessageMap().putError(VendorPropertyConstants.PURCHASING_COMMODITY_CODE, KFSKeyConstants.ERROR_EXISTENCE, purchasingCommodityCode);
}
success &= found;
}
return success;
}
Aggregations