1 package org.kuali.ole.pojo.bib;
2
3 import org.kuali.ole.docstore.model.xmlpojo.work.bib.marc.ControlField;
4 import org.kuali.ole.docstore.model.xmlpojo.work.bib.marc.DataField;
5 import org.kuali.ole.docstore.model.xmlpojo.work.bib.marc.LeaderTag;
6
7 import java.util.ArrayList;
8 import java.util.List;
9
10
11
12
13
14
15
16
17 public class BibliographicRecord {
18 private LeaderTag leader = new LeaderTag();
19 private List<ControlField> controlfields = new ArrayList<ControlField>();
20 private List<DataField> datafields = new ArrayList<DataField>();
21
22 public String getLeader() {
23 return leader.getValue();
24 }
25
26 public void setLeader(String leader) {
27 this.leader.setValue(leader);
28 }
29
30 public List<ControlField> getControlfields() {
31 return controlfields;
32 }
33
34 public List<DataField> getDatafields() {
35 return datafields;
36 }
37
38 public void setDatafields(List<DataField> datafields) {
39 this.datafields = datafields;
40 }
41
42 public void addDataField(DataField dataField) {
43 if (null != datafields && !this.datafields.contains(dataField)) {
44 this.datafields.add(dataField);
45 }
46 }
47
48 public void setControlfields(List<ControlField> controlfields) {
49 this.controlfields = controlfields;
50 }
51
52 public String getRecordId() {
53 for (ControlField cf : controlfields) {
54 if (cf.getTag().equals("001")) {
55 return cf.getValue();
56 }
57 }
58 return "";
59 }
60
61 @Override
62 public boolean equals(Object object) {
63 if (this == object) return true;
64 if (object == null || getClass() != object.getClass()) return false;
65
66 BibliographicRecord that = (BibliographicRecord) object;
67
68 if (leader != null ? !leader.equals(that.leader) : that.leader != null) return false;
69 if (controlfields != null ? !controlfields.equals(that.controlfields) : that.controlfields != null)
70 return false;
71 if (datafields != null ? !datafields.equals(that.datafields) : that.datafields != null) return false;
72
73 return true;
74 }
75
76 @Override
77 public int hashCode() {
78 int result = leader != null ? leader.hashCode() : 0;
79 result = 31 * result + (controlfields != null ? controlfields.hashCode() : 0);
80 result = 31 * result + (datafields != null ? datafields.hashCode() : 0);
81 return result;
82 }
83 }