コード例 #1
0
  /** This method is for validation of PayrollEndFiscalPeriodCode */
  protected Message validatePayrollEndFiscalPeriodCode(
      LaborOriginEntry laborOriginEntry,
      LaborOriginEntry laborWorkingEntry,
      UniversityDate universityRunDate,
      LaborAccountingCycleCachingService laborAccountingCycleCachingService) {
    LOG.debug("validateUniversityFiscalPeriodCode() started");

    AccountingPeriod accountingPeriod = null;
    Integer tempPayrollFiscalYear = 0;
    if (laborOriginEntry.getPayrollEndDateFiscalYear() == null) {
      tempPayrollFiscalYear = universityRunDate.getUniversityFiscalYear();
    } else {
      tempPayrollFiscalYear = laborOriginEntry.getPayrollEndDateFiscalYear();
    }

    if (!laborOriginEntry.getPayrollEndDateFiscalPeriodCode().equals("")) {
      accountingPeriod =
          laborAccountingCycleCachingService.getAccountingPeriod(
              tempPayrollFiscalYear, laborOriginEntry.getPayrollEndDateFiscalPeriodCode());
      if (accountingPeriod == null) {
        return MessageBuilder.buildMessage(
            KFSKeyConstants.ERROR_PAYROLL_END_DATE_FISCAL_PERIOD,
            laborOriginEntry.getPayrollEndDateFiscalPeriodCode(),
            Message.TYPE_FATAL);
      }
    }

    return null;
  }
コード例 #2
0
  /** This method changes account to suspenseAccount */
  protected Message useSuspenseAccount(LaborOriginEntry workingEntry) {
    String suspenseAccountNumber =
        parameterService.getParameterValueAsString(
            LaborScrubberStep.class, LaborConstants.Scrubber.SUSPENSE_ACCOUNT);
    String suspenseCOAcode =
        parameterService.getParameterValueAsString(
            LaborScrubberStep.class, LaborConstants.Scrubber.SUSPENSE_CHART);
    String suspenseSubAccountNumber =
        parameterService.getParameterValueAsString(
            LaborScrubberStep.class, LaborConstants.Scrubber.SUSPENSE_SUB_ACCOUNT);

    Account account = accountService.getByPrimaryId(suspenseCOAcode, suspenseAccountNumber);

    if (ObjectUtils.isNull(account)) {
      return MessageBuilder.buildMessage(
          LaborKeyConstants.ERROR_INVALID_SUSPENSE_ACCOUNT, Message.TYPE_FATAL);
    }

    workingEntry.setAccount(account);
    workingEntry.setAccountNumber(suspenseAccountNumber);
    workingEntry.setChartOfAccountsCode(suspenseCOAcode);
    workingEntry.setSubAccountNumber(suspenseSubAccountNumber);

    return MessageBuilder.buildMessageWithPlaceHolder(
        LaborKeyConstants.MESSAGE_SUSPENSE_ACCOUNT_APPLIED,
        Message.TYPE_WARNING,
        new Object[] {suspenseCOAcode, suspenseAccountNumber, suspenseSubAccountNumber});
  }
コード例 #3
0
  /**
   * Checks the continuation account system indicator. If on checks whether the account is expired
   * or closed, and if so calls the contination logic.
   */
  protected Message handleExpiredClosedAccount(
      Account account,
      LaborOriginEntry laborOriginEntry,
      LaborOriginEntry laborWorkingEntry,
      UniversityDate universityRunDate) {
    List<String> continuationAccountBypassBalanceTypeCodes =
        balanceTypService.getContinuationAccountBypassBalanceTypeCodes(
            universityRunDate.getUniversityFiscalYear());
    List<String> continuationAccountBypassOriginationCodes =
        new ArrayList<String>(
            parameterService.getParameterValuesAsString(
                LaborScrubberStep.class,
                LaborConstants.Scrubber.CONTINUATION_ACCOUNT_BYPASS_ORIGINATION_CODES));
    List<String> continuationAccountBypassDocumentTypeCodes =
        new ArrayList<String>(
            parameterService.getParameterValuesAsString(
                LaborScrubberStep.class,
                LaborConstants.Scrubber.CONTINUATION_ACCOUNT_BYPASS_DOCUMENT_TYPE_CODES));

    Calendar today = Calendar.getInstance();
    today.setTime(universityRunDate.getUniversityDate());

    long offsetAccountExpirationTime = getAdjustedAccountExpirationDate(account);
    boolean isAccountExpiredOrClosed =
        (account.getAccountExpirationDate() != null && isAccountExpired(account, universityRunDate))
            || !account.isActive();
    boolean continuationAccountLogicInd =
        parameterService.getParameterValueAsBoolean(
            LaborScrubberStep.class, LaborConstants.Scrubber.CONTINUATION_ACCOUNT_LOGIC_PARAMETER);

    if (continuationAccountLogicInd && isAccountExpiredOrClosed) {
      // special checks for origination codes that have override ability
      boolean isOverrideOriginCode =
          continuationAccountBypassOriginationCodes.contains(
              laborOriginEntry.getFinancialSystemOriginationCode());
      if (isOverrideOriginCode && !account.isActive()) {
        return MessageBuilder.buildMessage(
            KFSKeyConstants.ERROR_ORIGIN_CODE_CANNOT_HAVE_CLOSED_ACCOUNT,
            laborOriginEntry.getChartOfAccountsCode() + "-" + laborOriginEntry.getAccountNumber(),
            Message.TYPE_FATAL);
      }

      boolean canBypass =
          isOverrideOriginCode
              || continuationAccountBypassBalanceTypeCodes.contains(
                  laborOriginEntry.getFinancialBalanceTypeCode())
              || continuationAccountBypassDocumentTypeCodes.contains(
                  laborOriginEntry.getFinancialDocumentTypeCode().trim());
      if (account.isActive() && canBypass) {
        return null;
      }

      return continuationAccountLogic(
          account, laborOriginEntry, laborWorkingEntry, universityRunDate);
    }

    return null;
  }
コード例 #4
0
ファイル: TestDataLoader.java プロジェクト: hawking81/kfs
  public int loadTransactionIntoOriginEntryTable(OriginEntryGroup group) {
    int numberOfInputData = Integer.valueOf(properties.getProperty("numOfData"));
    businessObjectService.save(group);

    int[] fieldLength = this.getFieldLength(fieldLengthList);
    List<LaborOriginEntry> originEntries =
        this.loadInputData(
            LaborOriginEntry.class, "data", numberOfInputData, keyFieldList, fieldLength);
    for (LaborOriginEntry entry : originEntries) {
      entry.setEntryGroupId(group.getId());
    }

    businessObjectService.save(originEntries);
    return originEntries.size();
  }
コード例 #5
0
  /**
   * summary the valid origin entries for the General Ledger
   *
   * @param laborOriginEntry the current entry to check for summarization
   * @param laborLedgerUnitOfWork the current (in process) summarized entry for the GL
   * @param runDate the data when the process is running
   * @param lineNumber the line in the input file (used for error message only)
   */
  protected LaborOriginEntry summarizeLaborGLEntries(
      LaborOriginEntry laborOriginEntry,
      LaborLedgerUnitOfWork laborLedgerUnitOfWork,
      Date runDate,
      int lineNumber,
      Map<String, Integer> glEntryReportSummary) {
    // KFSMI-5308: Description update moved here due to requirement for this to happen before
    // consolidation
    if (ObjectUtils.isNotNull(laborOriginEntry)) {
      String description =
          laborTransactionDescriptionService.getTransactionDescription(laborOriginEntry);
      if (StringUtils.isNotEmpty(description)) {
        laborOriginEntry.setTransactionLedgerEntryDescription(description);
      }
    }

    LaborOriginEntry summarizedEntry = null;
    if (laborLedgerUnitOfWork.canContain(laborOriginEntry)) {
      laborLedgerUnitOfWork.addEntryIntoUnit(laborOriginEntry);
      updateReportSummary(glEntryReportSummary, ORIGN_ENTRY, KFSConstants.OperationType.SELECT);
    } else {
      summarizedEntry = laborLedgerUnitOfWork.getWorkingEntry();
      laborLedgerUnitOfWork.resetLaborLedgerUnitOfWork(laborOriginEntry);
    }

    return summarizedEntry;
  }
コード例 #6
0
  /**
   * For fringe transaction types checks if the account accepts fringe benefits. If not, retrieves
   * the alternative account, then calls expiration checking on either the alternative account or
   * the account passed in.
   */
  protected Message checkAccountFringeIndicator(
      LaborOriginEntry laborOriginEntry,
      LaborOriginEntry laborWorkingEntry,
      Account account,
      UniversityDate universityRunDate,
      LaborAccountingCycleCachingService laborAccountingCycleCachingService) {
    // check for fringe tranaction type
    // LaborObject laborObject = (LaborObject)
    // businessObjectService.findByPrimaryKey(LaborObject.class, fieldValues);
    LaborObject laborObject =
        laborAccountingCycleCachingService.getLaborObject(
            laborOriginEntry.getUniversityFiscalYear(),
            laborOriginEntry.getChartOfAccountsCode(),
            laborOriginEntry.getFinancialObjectCode());
    boolean isFringeTransaction =
        laborObject != null
            && org.apache.commons.lang.StringUtils.equals(
                LaborConstants.BenefitExpenseTransfer.LABOR_LEDGER_BENEFIT_CODE,
                laborObject.getFinancialObjectFringeOrSalaryCode());

    // alternative account handling for non fringe accounts
    if (isFringeTransaction && !account.isAccountsFringesBnftIndicator()) {
      Account altAccount =
          accountService.getByPrimaryId(
              laborOriginEntry.getAccount().getReportsToChartOfAccountsCode(),
              laborOriginEntry.getAccount().getReportsToAccountNumber());
      if (ObjectUtils.isNotNull(altAccount)) {
        laborWorkingEntry.setAccount(altAccount);
        laborWorkingEntry.setAccountNumber(altAccount.getAccountNumber());
        laborWorkingEntry.setChartOfAccountsCode(altAccount.getChartOfAccountsCode());
        Message err =
            handleExpiredClosedAccount(
                altAccount, laborOriginEntry, laborWorkingEntry, universityRunDate);
        if (err == null) {
          err =
              MessageBuilder.buildMessageWithPlaceHolder(
                  LaborKeyConstants.MESSAGE_FRINGES_MOVED_TO,
                  Message.TYPE_WARNING,
                  new Object[] {altAccount.getAccountNumber()});
        }
        return err;
      }

      // no alt acct, use suspense acct if active
      boolean suspenseAccountLogicInd =
          parameterService.getParameterValueAsBoolean(
              LaborScrubberStep.class, LaborConstants.Scrubber.SUSPENSE_ACCOUNT_LOGIC_PARAMETER);
      if (suspenseAccountLogicInd) {
        return useSuspenseAccount(laborWorkingEntry);
      }

      return MessageBuilder.buildMessage(
          LaborKeyConstants.ERROR_NON_FRINGE_ACCOUNT_ALTERNATIVE_NOT_FOUND, Message.TYPE_FATAL);
    }

    return handleExpiredClosedAccount(
        account, laborOriginEntry, laborWorkingEntry, universityRunDate);
  }
コード例 #7
0
  /** This method is for validation of payrollEndFiscalYear */
  protected Message validatePayrollEndFiscalYear(
      LaborOriginEntry laborOriginEntry,
      LaborOriginEntry laborWorkingEntry,
      UniversityDate universityRunDate,
      LaborAccountingCycleCachingService laborAccountingCycleCachingService) {
    LOG.debug("validatePayrollEndFiscalYear() started");
    SystemOptions scrubbedEntryOption = null;
    if (laborOriginEntry.getPayrollEndDateFiscalYear() != null) {
      scrubbedEntryOption =
          laborAccountingCycleCachingService.getSystemOptions(
              laborOriginEntry.getPayrollEndDateFiscalYear());

      if (scrubbedEntryOption == null) {
        return MessageBuilder.buildMessage(
            KFSKeyConstants.ERROR_PAYROLL_END_DATE_FISCAL_YEAR,
            "" + laborOriginEntry.getPayrollEndDateFiscalYear(),
            Message.TYPE_FATAL);
      }
    }

    return null;
  }
コード例 #8
0
  /**
   * @see
   *     org.kuali.module.labor.service.LaborScrubberValidator#validateTransaction(owrg.kuali.module.labor.bo.LaborOriginEntry,
   *     org.kuali.kfs.module.ld.businessobject.LaborOriginEntry,
   *     org.kuali.kfs.gl.businessobject.UniversityDate)
   */
  public List<Message> validateTransaction(
      OriginEntryInformation originEntry,
      OriginEntryInformation scrubbedEntry,
      UniversityDate universityRunDate,
      boolean laborIndicator,
      AccountingCycleCachingService laborAccountingCycleCachingService) {
    LOG.debug("validateTransaction() started");
    List<Message> errors = new ArrayList<Message>();
    continuationAccountIndicator = false;

    LaborOriginEntry laborOriginEntry = (LaborOriginEntry) originEntry;
    LaborOriginEntry laborScrubbedEntry = (LaborOriginEntry) scrubbedEntry;

    // gl scrubber validation
    errors =
        scrubberValidator.validateTransaction(
            laborOriginEntry,
            laborScrubbedEntry,
            universityRunDate,
            laborIndicator,
            laborAccountingCycleCachingService);

    refreshOriginEntryReferences(laborOriginEntry);
    refreshOriginEntryReferences(laborScrubbedEntry);

    if (StringUtils.isBlank(laborOriginEntry.getEmplid())) {
      laborScrubbedEntry.setEmplid(LaborConstants.getDashEmplId());
    }

    if (StringUtils.isBlank(laborOriginEntry.getPositionNumber())) {
      laborScrubbedEntry.setPositionNumber(LaborConstants.getDashPositionNumber());
    }

    Message err = null;

    // this validation is duplicated.  This is in ScrubberValidatorImpl under GL
    //        err = this.validateClosedPeriodCode(laborOriginEntry, laborScrubbedEntry);
    //        if (err != null) {
    //            errors.add(err);
    //        }

    err =
        validatePayrollEndFiscalYear(
            laborOriginEntry,
            laborScrubbedEntry,
            universityRunDate,
            (LaborAccountingCycleCachingService) laborAccountingCycleCachingService);
    if (err != null) {
      errors.add(err);
    }

    err =
        validatePayrollEndFiscalPeriodCode(
            laborOriginEntry,
            laborScrubbedEntry,
            universityRunDate,
            (LaborAccountingCycleCachingService) laborAccountingCycleCachingService);
    if (err != null) {
      errors.add(err);
    }

    err =
        validateAccount(
            laborOriginEntry,
            laborScrubbedEntry,
            universityRunDate,
            (LaborAccountingCycleCachingService) laborAccountingCycleCachingService);
    if (err != null) {
      errors.add(err);
    }

    err =
        validateSubAccount(
            laborOriginEntry,
            laborScrubbedEntry,
            (LaborAccountingCycleCachingService) laborAccountingCycleCachingService);
    if (err != null) {
      errors.add(err);
    }

    return errors;
  }
コード例 #9
0
  /**
   * Validates the sub account of the origin entry
   *
   * @param originEntry the origin entry being scrubbed
   * @param workingEntry the scrubbed version of the origin entry
   * @return a Message if an error was encountered, otherwise null
   */
  protected Message validateSubAccount(
      LaborOriginEntry originEntry,
      LaborOriginEntry workingEntry,
      LaborAccountingCycleCachingService laborAccountingCycleCachingService) {
    LOG.debug("validateSubAccount() started");

    // when continuationAccount used, the subAccountNumber should be changed to dashes and skip
    // validation subAccount process
    if (continuationAccountIndicator) {
      workingEntry.setSubAccountNumber(KFSConstants.getDashSubAccountNumber());
      return null;
    }

    // If the sub account number is empty, set it to dashes.
    // Otherwise set the workingEntry sub account number to the
    // sub account number of the input origin entry.
    if (org.springframework.util.StringUtils.hasText(originEntry.getSubAccountNumber())) {
      // sub account IS specified
      if (!KFSConstants.getDashSubAccountNumber().equals(originEntry.getSubAccountNumber())) {
        SubAccount originEntrySubAccount =
            laborAccountingCycleCachingService.getSubAccount(
                originEntry.getChartOfAccountsCode(),
                originEntry.getAccountNumber(),
                originEntry.getSubAccountNumber());
        // SubAccount originEntrySubAccount = getSubAccount(originEntry);
        if (originEntrySubAccount == null) {
          // sub account is not valid
          return MessageBuilder.buildMessage(
              KFSKeyConstants.ERROR_SUB_ACCOUNT_NOT_FOUND,
              originEntry.getChartOfAccountsCode()
                  + "-"
                  + originEntry.getAccountNumber()
                  + "-"
                  + originEntry.getSubAccountNumber(),
              Message.TYPE_FATAL);
        } else {
          // sub account IS valid
          if (originEntrySubAccount.isActive()) {
            // sub account IS active
            workingEntry.setSubAccountNumber(originEntry.getSubAccountNumber());
          } else {
            // sub account IS NOT active
            if (parameterService
                .getParameterValueAsString(
                    KfsParameterConstants.GENERAL_LEDGER_BATCH.class,
                    KFSConstants.SystemGroupParameterNames.GL_ANNUAL_CLOSING_DOC_TYPE)
                .equals(originEntry.getFinancialDocumentTypeCode())) {
              // document IS annual closing
              workingEntry.setSubAccountNumber(originEntry.getSubAccountNumber());
            } else {
              // document is NOT annual closing
              return MessageBuilder.buildMessage(
                  KFSKeyConstants.ERROR_SUB_ACCOUNT_NOT_ACTIVE,
                  originEntry.getChartOfAccountsCode()
                      + "-"
                      + originEntry.getAccountNumber()
                      + "-"
                      + originEntry.getSubAccountNumber(),
                  Message.TYPE_FATAL);
            }
          }
        }
      } else {
        // the sub account is dashes
        workingEntry.setSubAccountNumber(KFSConstants.getDashSubAccountNumber());
      }
    } else {
      // No sub account is specified.
      workingEntry.setSubAccountNumber(KFSConstants.getDashSubAccountNumber());
    }

    return null;
  }
コード例 #10
0
  /**
   * Loops through continuation accounts for 10 tries or until it finds an account that is not
   * expired.
   */
  protected Message continuationAccountLogic(
      Account expiredClosedAccount,
      LaborOriginEntry laborOriginEntry,
      LaborOriginEntry laborWorkingEntry,
      UniversityDate universityRunDate) {
    String chartCode = expiredClosedAccount.getContinuationFinChrtOfAcctCd();
    String accountNumber = expiredClosedAccount.getContinuationAccountNumber();

    List<String> checkedAccountNumbers = new ArrayList<String>();
    for (int i = 0; i < 10; ++i) {
      if (checkedAccountNumbers.contains(chartCode + accountNumber)) {
        // Something is really wrong with the data because this account has already been evaluated.
        return MessageBuilder.buildMessage(
            KFSKeyConstants.ERROR_CIRCULAR_DEPENDENCY_IN_CONTINUATION_ACCOUNT_LOGIC,
            Message.TYPE_FATAL);
      }

      checkedAccountNumbers.add(chartCode + accountNumber);

      if (chartCode == null || accountNumber == null) {
        return MessageBuilder.buildMessage(
            KFSKeyConstants.ERROR_CONTINUATION_ACCOUNT_NOT_FOUND, Message.TYPE_FATAL);
      }

      // Lookup the account
      Account account = accountService.getByPrimaryId(chartCode, accountNumber);
      if (ObjectUtils.isNull(account)) {
        return MessageBuilder.buildMessage(
            KFSKeyConstants.ERROR_CONTINUATION_ACCOUNT_NOT_FOUND, Message.TYPE_FATAL);
      }

      // check account expiration
      long offsetAccountExpirationTime = getAdjustedAccountExpirationDate(account);
      if (ObjectUtils.isNotNull(account.getAccountExpirationDate())
          && isAccountExpired(account, universityRunDate)) {
        chartCode = account.getContinuationFinChrtOfAcctCd();
        accountNumber = account.getContinuationAccountNumber();
      } else {

        // set continuationAccountLogicIndi
        continuationAccountIndicator = true;

        laborWorkingEntry.setAccount(account);
        laborWorkingEntry.setAccountNumber(accountNumber);
        laborWorkingEntry.setChartOfAccountsCode(chartCode);
        laborWorkingEntry.setSubAccountNumber(KFSConstants.getDashSubAccountNumber());
        laborWorkingEntry.setTransactionLedgerEntryDescription(
            kualiConfigurationService.getPropertyValueAsString(KFSKeyConstants.MSG_AUTO_FORWARD)
                + " "
                + expiredClosedAccount.getChartOfAccountsCode()
                + expiredClosedAccount.getAccountNumber()
                + laborOriginEntry.getTransactionLedgerEntryDescription());

        return MessageBuilder.buildMessage(
            KFSKeyConstants.MSG_ACCOUNT_CLOSED_TO,
            laborWorkingEntry.getChartOfAccountsCode() + "-" + laborWorkingEntry.getAccountNumber(),
            Message.TYPE_WARNING);
      }
    }

    // We failed to find a valid continuation account.
    boolean suspenseAccountLogicInd =
        parameterService.getParameterValueAsBoolean(
            LaborScrubberStep.class, LaborConstants.Scrubber.SUSPENSE_ACCOUNT_LOGIC_PARAMETER);
    if (suspenseAccountLogicInd) {
      return useSuspenseAccount(laborWorkingEntry);
    } else {
      return MessageBuilder.buildMessage(
          KFSKeyConstants.ERROR_CONTINUATION_ACCOUNT_LIMIT_REACHED, Message.TYPE_FATAL);
    }
  }
コード例 #11
0
  /** Performs Account Validation. */
  protected Message validateAccount(
      LaborOriginEntry laborOriginEntry,
      LaborOriginEntry laborWorkingEntry,
      UniversityDate universityRunDate,
      LaborAccountingCycleCachingService laborAccountingCycleCachingService) {
    LOG.debug("validateAccount() started");

    Account account = laborOriginEntry.getAccount();
    boolean suspenseAccountLogicInd =
        parameterService.getParameterValueAsBoolean(
            LaborScrubberStep.class, LaborConstants.Scrubber.SUSPENSE_ACCOUNT_LOGIC_PARAMETER);
    if (ObjectUtils.isNull(account)) {
      if (suspenseAccountLogicInd) {
        return useSuspenseAccount(laborWorkingEntry);
      }
      return MessageBuilder.buildMessage(
          KFSKeyConstants.ERROR_ACCOUNT_NOT_FOUND,
          laborOriginEntry.getChartOfAccountsCode() + "-" + laborOriginEntry.getAccountNumber(),
          Message.TYPE_FATAL);
    }

    // default
    laborWorkingEntry.setAccount(account);
    laborWorkingEntry.setChartOfAccountsCode(account.getChartOfAccountsCode());
    laborWorkingEntry.setAccountNumber(account.getAccountNumber());

    // no further validation for gl annual doc type
    String glAnnualClosingType =
        parameterService.getParameterValueAsString(
            KfsParameterConstants.GENERAL_LEDGER_BATCH.class,
            KFSConstants.SystemGroupParameterNames.GL_ANNUAL_CLOSING_DOC_TYPE);
    if (glAnnualClosingType.equals(laborOriginEntry.getFinancialDocumentTypeCode())) {
      return null;
    }

    // Sub-Fund Wage Exclusion
    String orginationCode = laborOriginEntry.getFinancialSystemOriginationCode();
    List<String> nonWageSubfundBypassOriginationCodes =
        new ArrayList<String>(
            parameterService.getParameterValuesAsString(
                LaborScrubberStep.class,
                LaborConstants.Scrubber.NON_WAGE_SUB_FUND_BYPASS_ORIGINATIONS));
    boolean subfundWageExclusionInd =
        parameterService.getParameterValueAsBoolean(
            LaborScrubberStep.class, LaborConstants.Scrubber.SUBFUND_WAGE_EXCLUSION_PARAMETER);

    if (subfundWageExclusionInd
        && !account.getSubFundGroup().isSubFundGroupWagesIndicator()
        && !nonWageSubfundBypassOriginationCodes.contains(orginationCode)) {
      if (suspenseAccountLogicInd) {
        return useSuspenseAccount(laborWorkingEntry);
      }

      return MessageBuilder.buildMessage(
          LaborKeyConstants.ERROR_SUN_FUND_NOT_ACCEPT_WAGES, Message.TYPE_FATAL);
    }

    // Account Fringe Validation
    List<String> nonFringeAccountBypassOriginationCodes =
        new ArrayList<String>(
            parameterService.getParameterValuesAsString(
                LaborScrubberStep.class,
                LaborConstants.Scrubber.NON_FRINGE_ACCOUNT_BYPASS_ORIGINATIONS));
    boolean accountFringeExclusionInd =
        parameterService.getParameterValueAsBoolean(
            LaborScrubberStep.class, LaborConstants.Scrubber.ACCOUNT_FRINGE_EXCLUSION_PARAMETER);

    if (accountFringeExclusionInd
        && !nonFringeAccountBypassOriginationCodes.contains(orginationCode)) {
      return checkAccountFringeIndicator(
          laborOriginEntry,
          laborWorkingEntry,
          account,
          universityRunDate,
          laborAccountingCycleCachingService);
    }

    // Expired/Closed Validation
    return handleExpiredClosedAccount(
        laborOriginEntry.getAccount(), laborOriginEntry, laborWorkingEntry, universityRunDate);
  }
コード例 #12
0
  /**
   * post the qualified origin entries into Labor Ledger tables
   *
   * @param validGroup the origin entry group that holds the valid transactions
   * @param invalidGroup the origin entry group that holds the invalid transactions
   * @param runDate the data when the process is running
   */
  protected void postLaborLedgerEntries(Date runDate) {
    LOG.debug("postLaborLedgerEntries() started..........................");
    numberOfErrorOriginEntry = 0;
    // change file name to FIS

    String postInputFileName =
        batchFileDirectoryName
            + File.separator
            + LaborConstants.BatchFileSystem.POSTER_INPUT_FILE
            + GeneralLedgerConstants.BatchFileSystem.EXTENSION;
    String postErrFileName =
        batchFileDirectoryName
            + File.separator
            + LaborConstants.BatchFileSystem.POSTER_ERROR_OUTPUT_FILE
            + GeneralLedgerConstants.BatchFileSystem.EXTENSION;

    FileReader INPUT_GLE_FILE = null;
    try {
      INPUT_GLE_FILE = new FileReader(postInputFileName);
    } catch (FileNotFoundException e) {
      throw new RuntimeException(e);
    }

    try {
      POSTER_OUTPUT_ERR_FILE_ps = new PrintStream(postErrFileName);
    } catch (IOException e) {
      LOG.error("postLaborLedgerEntries cannot open file: " + e.getMessage(), e);
      throw new RuntimeException(e);
    }

    int lineNumber = 0;
    int loadedCount = 0;

    int numberOfSelectedOriginEntry = 0;
    LaborLedgerUnitOfWork laborLedgerUnitOfWork = new LaborLedgerUnitOfWork();

    LedgerSummaryReport ledgerSummaryReport = new LedgerSummaryReport();

    Map<String, Integer> reportSummary = this.constructPosterReportSummary();
    Map<String, Integer> glEntryReportSummary = this.constructGlEntryReportSummary();

    try {
      BufferedReader INPUT_GLE_FILE_br = new BufferedReader(INPUT_GLE_FILE);
      String currentLine = INPUT_GLE_FILE_br.readLine();

      while (currentLine != null) {
        LaborOriginEntry laborOriginEntry = null;

        try {
          lineNumber++;
          if (!StringUtils.isEmpty(currentLine) && !StringUtils.isBlank(currentLine.trim())) {
            laborOriginEntry = new LaborOriginEntry();

            // checking parsing process and stop poster when it has errors.
            List<Message> parsingError = new ArrayList<Message>();
            parsingError = laborOriginEntry.setFromTextFileForBatch(currentLine, lineNumber);
            if (parsingError.size() > 0) {
              throw new RuntimeException("Exception happened from parsing process");
            }

            loadedCount++;
            if (loadedCount % 1000 == 0) {
              LOG.info(loadedCount + " " + laborOriginEntry.toString());
            }

            boolean isPostable =
                this.postSingleEntryIntoLaborLedger(
                    laborOriginEntry, reportSummary, runDate, currentLine);
            if (isPostable) {
              this.updateReportSummary(
                  glEntryReportSummary, ORIGN_ENTRY, KFSConstants.OperationType.READ);
              this.writeLaborGLEntry(
                  laborOriginEntry,
                  laborLedgerUnitOfWork,
                  runDate,
                  lineNumber,
                  glEntryReportSummary);

              ledgerSummaryReport.summarizeEntry(laborOriginEntry);

              numberOfSelectedOriginEntry++;
              laborOriginEntry = null;
            }
          }

          currentLine = INPUT_GLE_FILE_br.readLine();
        } catch (RuntimeException re) {
          // catch here again, it should be from postSingleEntryIntoLaborLedger
          LOG.error(
              "postLaborLedgerEntries stopped due to: "
                  + re.getMessage()
                  + " on line number : "
                  + loadedCount,
              re);
          LOG.error(
              "laborOriginEntry failure occured on: " + laborOriginEntry == null
                  ? null
                  : laborOriginEntry.toString());
          throw new RuntimeException(
              "Unable to execute: " + re.getMessage() + " on line number : " + loadedCount, re);
        }
      }

      this.writeLaborGLEntry(
          null, laborLedgerUnitOfWork, runDate, lineNumber, glEntryReportSummary);

      INPUT_GLE_FILE_br.close();
      INPUT_GLE_FILE.close();
      POSTER_OUTPUT_ERR_FILE_ps.close();

      this.fillPosterReportWriter(lineNumber, reportSummary, glEntryReportSummary);
      this.fillGlEntryReportWriter(glEntryReportSummary);

      // Generate Error Listing Report
      ledgerSummaryReport.writeReport(ledgerSummaryReportWriterService);
      new TransactionListingReport()
          .generateReport(
              errorListingReportWriterService,
              new LaborOriginEntryFileIterator(new File(postErrFileName)));
    } catch (IOException ioe) {
      LOG.error("postLaborLedgerEntries stopped due to: " + ioe.getMessage(), ioe);
      throw new RuntimeException(
          "Unable to execute: " + ioe.getMessage() + " on line number : " + loadedCount, ioe);
    }
  }