コード例 #1
0
  /**
   * @see
   *     org.kuali.kfs.module.tem.batch.service.CreditCardDataImportService#moveCreditCardDataToHistoricalExpenseTable()
   */
  @Override
  public boolean moveCreditCardDataToHistoricalExpenseTable() {

    List<CreditCardStagingData> creditCardData = travelExpenseService.retrieveValidCreditCardData();
    if (ObjectUtils.isNotNull(creditCardData) && creditCardData.size() > 0) {
      for (CreditCardStagingData creditCard : creditCardData) {
        boolean result = processCreditCardStagingExpense(creditCard);
        LOG.info(
            "Credit Card Staging Data Id: "
                + creditCard.getId()
                + (result ? " was" : " was not")
                + " processed.");
      }
    }

    return true;
  }
コード例 #2
0
  @Transactional
  protected boolean processCreditCardStagingExpense(CreditCardStagingData creditCard) {
    LOG.info("Creating historical travel expense for credit card: " + creditCard.getId());
    HistoricalTravelExpense expense =
        travelExpenseService.createHistoricalTravelExpense(creditCard);
    businessObjectService.save(expense);

    // Mark as moved to historical
    creditCard.setErrorCode(CreditCardStagingDataErrorCodes.CREDIT_CARD_MOVED_TO_HISTORICAL);
    LOG.info(
        "Finished creating historical travel expense for credit card: "
            + creditCard.getId()
            + " Historical Travel Expense: "
            + expense.getId());
    businessObjectService.save(creditCard);

    return true;
  }