View Javadoc
1   package org.kuali.ole.batch.marc;
2   
3   import org.marc4j.ErrorHandler;
4   
5   import java.util.Date;
6   import java.util.Map;
7   
8   /**
9    * Created with IntelliJ IDEA.
10   * User: meenrajd
11   * Date: 9/2/13
12   * Time: 11:54 AM
13   * To change this template use File | Settings | File Templates.
14   */
15  public class OLEMarcError extends ErrorHandler.Error {
16      private static final String COMMA =",";
17      private OLEMarcErrorHandler errorHandler;
18  
19      protected OLEMarcError(ErrorHandler errorHandler, String recordID,
20                             String field, String subfield, int severity, String message) {
21          errorHandler.super(recordID, field, subfield, severity, message);
22          this.errorHandler = (OLEMarcErrorHandler)errorHandler;
23      }
24  
25      public String toString() {
26          StringBuilder str = new StringBuilder();
27          str.append("Record").append(COMMA).append(curRecordID).append(COMMA).append("Time Stamp").append(COMMA).append(new Date().toString()).append(COMMA);
28  
29          for(Map.Entry<String,String>entry : errorHandler.getErrorMap().entrySet()){
30              str.append(entry.getKey()).append(COMMA).append(entry.getValue()).append(COMMA);
31          }
32          return (str.toString());
33      }
34  
35  
36  }