/**
   * post the given entry into the labor ledger tables if the entry is qualified; otherwise report
   * error
   *
   * @param originEntry the given origin entry, a transaction
   * @param reportSummary the report summary object that need to be update when a transaction is
   *     posted
   * @param runDate the data when the process is running
   * @return true if the given transaction is posted into ledger tables; otherwise, return false
   */
  protected boolean postSingleEntryIntoLaborLedger(
      LaborOriginEntry originEntry, Map<String, Integer> reportSummary, Date runDate, String line) {
    // reject the invalid entry so that it can be available for error correction
    List<Message> errors = new ArrayList<Message>();
    try {
      errors = this.validateEntry(originEntry);
    } catch (Exception e) {
      errors.add(new Message(e.toString() + " occurred for this record.", Message.TYPE_FATAL));
    }

    if (errors != null && !errors.isEmpty()) {
      reportWriterService.writeError(originEntry, errors);
      numberOfErrorOriginEntry += errors.size();
      writeErrorEntry(line);
      return false;
    }

    String operationOnLedgerEntry = postAsLedgerEntry(originEntry, runDate);
    updateReportSummary(
        reportSummary, laborLedgerEntryPoster.getDestinationName(), operationOnLedgerEntry);

    String operationOnLedgerBalance = updateLedgerBalance(originEntry, runDate);
    updateReportSummary(
        reportSummary, laborLedgerBalancePoster.getDestinationName(), operationOnLedgerBalance);

    return true;
  }
 // fill the gl entry report writer with the collected data
 protected void fillGlEntryReportWriter(Map<String, Integer> glEntryReportSummary) {
   laborGlEntryStatisticsReportWriterService.writeStatisticLine(
       "NUMBER OF RECORDS READ              %,9d",
       glEntryReportSummary.get(ORIGN_ENTRY + "," + KFSConstants.OperationType.READ));
   laborGlEntryStatisticsReportWriterService.writeStatisticLine(
       "NUMBER OF RECORDS BYPASSED          %,9d",
       glEntryReportSummary.get(ORIGN_ENTRY + "," + KFSConstants.OperationType.BYPASS));
   laborGlEntryStatisticsReportWriterService.writeStatisticLine(
       "NUMBER OF RECORDS SELECTED          %,9d",
       glEntryReportSummary.get(ORIGN_ENTRY + "," + KFSConstants.OperationType.SELECT));
   laborGlEntryStatisticsReportWriterService.writeStatisticLine(
       "NUMBER OF RECORDS IN ERROR          %,9d",
       glEntryReportSummary.get(ORIGN_ENTRY + "," + KFSConstants.OperationType.REPORT_ERROR));
   laborGlEntryStatisticsReportWriterService.writeStatisticLine(
       "NUMBER OF RECORDS INSERTED          %,9d",
       glEntryReportSummary.get(
           laborGLLedgerEntryPoster.getDestinationName()
               + ","
               + KFSConstants.OperationType.INSERT));
 }
 // construct a poster report summary object
 protected void fillPosterReportWriter(
     int lineNumber,
     Map<String, Integer> reportSummary,
     Map<String, Integer> glEntryReportSummary) {
   reportWriterService.writeStatisticLine(
       "SEQUENTIAL RECORDS READ                    %,9d", lineNumber);
   reportWriterService.writeStatisticLine(
       "LLEN RECORDS INSERTED (LD_LDGR_ENTR_T)     %,9d",
       reportSummary.get(
           laborLedgerEntryPoster.getDestinationName() + "," + KFSConstants.OperationType.INSERT));
   reportWriterService.writeStatisticLine(
       "LLBL RECORDS INSERTED (LD_LDGR_BAL_T)      %,9d",
       reportSummary.get(
           laborLedgerBalancePoster.getDestinationName()
               + ","
               + KFSConstants.OperationType.INSERT));
   reportWriterService.writeStatisticLine(
       "LLBL RECORDS UPDATED  (LD_LDGR_BAL_T)      %,9d",
       reportSummary.get(
           laborLedgerBalancePoster.getDestinationName()
               + ","
               + KFSConstants.OperationType.UPDATE));
   reportWriterService.writeStatisticLine(
       "LLGL RECORDS INSERTED (LD_LBR_GL_ENTRY_T)  %,9d",
       glEntryReportSummary.get(
           laborGLLedgerEntryPoster.getDestinationName()
               + ","
               + KFSConstants.OperationType.INSERT));
   reportWriterService.writeStatisticLine(
       "WARNING RECORDS WRITTEN                    %,9d", numberOfErrorOriginEntry);
 }