001package org.kuali.ole.batch.marc; 002 003import org.marc4j.ErrorHandler; 004 005import java.util.HashMap; 006import java.util.LinkedList; 007import java.util.List; 008import java.util.Map; 009 010/** 011 * Created with IntelliJ IDEA. 012 * User: meenrajd 013 * Date: 9/2/13 014 * Time: 11:55 AM 015 * To change this template use File | Settings | File Templates. 016 */ 017public class OLEMarcErrorHandler extends ErrorHandler { 018 private List<Error> errors; 019 private Map<String,String> errorMap = new HashMap<String,String>(); 020 021 public void addError(String id, String field, String subfield, int severity, String message) { 022 if (errors == null) { 023 errors = new LinkedList(); 024 } 025 026 errors.add(new OLEMarcError(this, id, field, subfield, severity, message)); 027 } 028 029 public boolean hasErrors() { 030 return (errors != null && errors.size() > 0); 031 } 032 033 public List<Error> getErrors() { 034 return errors; 035 } 036 037 public Map<String,String> getErrorMap(){ 038 return errorMap; 039 } 040 041}