/**
  * Adds a summary message and a list processed records for a processd status type.
  *
  * @param context the processing context
  * @param msgBroker the message broker
  * @param resourceKey the resource key associated with the status type
  * @param statusType the sstatus type
  * @param count the count associated with the status type
  */
 private void addSummaryMessage(
     ProcessingContext context,
     MessageBroker msgBroker,
     String resourceKey,
     ProcessedRecord.StatusType statusType,
     int count) {
   Object[] parameters = new Integer[] {count};
   String msg = msgBroker.retrieveMessage(resourceKey);
   msg = MessageFormat.format(msg, parameters);
   StringBuilder sb = new StringBuilder(msg);
   for (ProcessedRecord processedRecord : context.getProcessedRecords()) {
     if (processedRecord.getStatusType().equals(statusType)) {
       sb.append("<br />").append(processedRecord.getSourceUri());
     }
   }
   if (sb.length() > 0) {
     FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_INFO, sb.toString(), null);
     msgBroker.addMessage(fm);
   }
 }
  /**
   * Adds a summary message and a list of errors for each processed record that failed.
   *
   * @param context the processing context
   * @param msgBroker the message broker
   * @param resourceKey the resource key associated with the status type
   * @param statusType the sstatus type
   * @param count the count associated with the status type
   */
  private void addErrorMessages(
      ProcessingContext context,
      MessageBroker msgBroker,
      String resourceKey,
      ProcessedRecord.StatusType statusType,
      int count) {

    Object[] parameters = new Integer[] {count};
    String msg = msgBroker.retrieveMessage(resourceKey);
    msg = MessageFormat.format(msg, parameters);
    FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, null);
    msgBroker.addMessage(fm);
    for (ProcessedRecord processedRecord : context.getProcessedRecords()) {
      if (processedRecord.getStatusType().equals(statusType)
          && (processedRecord.getExceptions() != null)) {
        StringBuilder sb = new StringBuilder();
        sb.append(processedRecord.getSourceUri());
        if (processedRecord.getExceptions() != null) {
          for (String error : processedRecord.getExceptions()) {
            sb.append("<br />").append(error);
          }
        }
        fm = new FacesMessage(FacesMessage.SEVERITY_ERROR, sb.toString(), null);
        msgBroker.addMessage(fm);
      }
    }
  }