use of edu.cornell.kfs.vnd.businessobject.CuVendorCreditCardMerchant in project cu-kfs by CU-CommunityApps.
the class CuVendorRule method validateCreditCardMerchantAddition.
protected boolean validateCreditCardMerchantAddition(VendorDetail vendorDetail, CuVendorCreditCardMerchant vendorCreditCardMerchant) {
boolean success = true;
List<CuVendorCreditCardMerchant> vendorCreditCardMerchants = ((VendorDetailExtension) vendorDetail.getExtension()).getVendorCreditCardMerchants();
for (CuVendorCreditCardMerchant existingMerchant : vendorCreditCardMerchants) {
if (existingMerchant.getCreditMerchantName().equals(vendorCreditCardMerchant.getCreditMerchantName())) {
putFieldError("add.vendorCreditCardMerchants.creditMerchantName", CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_CREDIT_MERCHANT_NAME_DUPLICATE);
// can't have duplicate merchant names, part of the primary key for the table in the db
success = false;
}
}
return success;
}
use of edu.cornell.kfs.vnd.businessobject.CuVendorCreditCardMerchant in project cu-kfs by CU-CommunityApps.
the class CuVendorRule method processCustomAddCollectionLineBusinessRules.
public boolean processCustomAddCollectionLineBusinessRules(MaintenanceDocument document, String collectionName, PersistableBusinessObject bo) {
boolean success = super.processCustomAddCollectionLineBusinessRules(document, collectionName, bo);
if (bo instanceof VendorAddress) {
VendorAddress address = (VendorAddress) bo;
VendorDetail vendorDetail = (VendorDetail) document.getNewMaintainableObject().getBusinessObject();
VendorHeader vendorHeader = vendorDetail.getVendorHeader();
// String propertyConstant = KFSConstants.ADD_PREFIX + "." + VendorPropertyConstants.VENDOR_ADDRESS + ".";
String propertyConstant = "add.vendorAddresses.";
if (StringUtils.isBlank(vendorHeader.getVendorTypeCode())) {
success = false;
putFieldError(VendorPropertyConstants.VENDOR_TYPE_CODE, CUVendorKeyConstants.ERROR_DOCUMENT_VENDOR_TYPE_IS_REQUIRED_FOR_ADD_VENDORADRESS);
} else {
vendorHeader.refreshReferenceObject(KFSPropertyConstants.VENDOR_TYPE_CODE);
success &= this.checkAddressMethodOfPOTransmissionAndData(vendorHeader.getVendorTypeCode(), vendorHeader.getVendorType().getVendorAddressTypeRequiredCode(), address, propertyConstant);
}
}
if (bo instanceof CuVendorCreditCardMerchant) {
CuVendorCreditCardMerchant vendorMerchant = (CuVendorCreditCardMerchant) bo;
VendorDetail vendorDetail = (VendorDetail) document.getNewMaintainableObject().getBusinessObject();
success &= validateCreditCardMerchantAddition(vendorDetail, vendorMerchant);
}
if (bo instanceof VendorSupplierDiversity) {
VendorSupplierDiversity vendorSupplierDiversity = (VendorSupplierDiversity) bo;
success &= validateSupplierDiversityAddition(vendorSupplierDiversity);
}
return success;
}
use of edu.cornell.kfs.vnd.businessobject.CuVendorCreditCardMerchant in project cu-kfs by CU-CommunityApps.
the class CuVendorRule method checkMerchantNameUniqueness.
protected boolean checkMerchantNameUniqueness(MaintenanceDocument document) {
boolean success = true;
VendorDetail vendorDetail = (VendorDetail) document.getNewMaintainableObject().getBusinessObject();
List<CuVendorCreditCardMerchant> vendorCreditCardMerchants = ((VendorDetailExtension) vendorDetail.getExtension()).getVendorCreditCardMerchants();
ArrayList<String> merchantNames = new ArrayList<String>();
int i = 0;
for (CuVendorCreditCardMerchant vendorCreditCardMerchant : vendorCreditCardMerchants) {
if (merchantNames.contains(vendorCreditCardMerchant.getCreditMerchantName())) {
putFieldError("vendorCreditCardMerchants[" + i + "].creditMerchantName", CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_CREDIT_MERCHANT_NAME_DUPLICATE);
// can't have duplicate merchant names, part of the primary key for the table in the db
success = false;
}
if (vendorCreditCardMerchant.getCreditMerchantName() == null || vendorCreditCardMerchant.getCreditMerchantName().equals("")) {
// can't have a null or blank name, it's part of the primary key for this table in the db
putFieldError("vendorCreditCardMerchants[" + i + "].creditMerchantName", CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_CREDIT_MERCHANT_NAME_BLANK);
success = false;
}
merchantNames.add(vendorCreditCardMerchant.getCreditMerchantName());
i++;
}
return success;
}
Aggregations