/** * Determines if any imported expenses on the document have a card type of CORP * * @return true if there are CORP imported expenses on the document, false otherwise */ public boolean isCorporateCardPayable() { if (getImportedExpenses() != null && !getImportedExpenses().isEmpty()) { for (ImportedExpense expense : getImportedExpenses()) { if (StringUtils.equals(expense.getCardType(), TemConstants.TRAVEL_TYPE_CORP)) { return true; } } } return false; }
/** * Looks through the imported expenses on the document to find a corporate card record which has a * credit card agency - returns that * * @param document a document to find a corporate card vendor for * @return the id of the found vendor or null if nothing was found */ protected CreditCardAgency getCorporateCreditCardAgency(TEMReimbursementDocument document) { for (ImportedExpense importedExpense : document.getImportedExpenses()) { if (StringUtils.equals(importedExpense.getCardType(), TemConstants.TRAVEL_TYPE_CORP) && !ObjectUtils.isNull(importedExpense.getHistoricalTravelExpense())) { importedExpense .getHistoricalTravelExpense() .refreshReferenceObject(TemPropertyConstants.CREDIT_CARD_AGENCY); if (!ObjectUtils.isNull(importedExpense.getHistoricalTravelExpense().getCreditCardAgency()) && !StringUtils.isBlank( importedExpense .getHistoricalTravelExpense() .getCreditCardAgency() .getVendorNumber())) { return importedExpense.getHistoricalTravelExpense().getCreditCardAgency(); } } } return null; }