1 package org.kuali.ole.batch.marc;
2
3 import org.marc4j.ErrorHandler;
4
5 import java.util.HashMap;
6 import java.util.LinkedList;
7 import java.util.List;
8 import java.util.Map;
9
10
11
12
13
14
15
16
17 public class OLEMarcErrorHandler extends ErrorHandler {
18 private List<Error> errors;
19 private Map<String,String> errorMap = new HashMap<String,String>();
20
21 public void addError(String id, String field, String subfield, int severity, String message) {
22 if (errors == null) {
23 errors = new LinkedList();
24 }
25
26 errors.add(new OLEMarcError(this, id, field, subfield, severity, message));
27 }
28
29 public boolean hasErrors() {
30 return (errors != null && errors.size() > 0);
31 }
32
33 public List<Error> getErrors() {
34 return errors;
35 }
36
37 public Map<String,String> getErrorMap(){
38 return errorMap;
39 }
40
41 }