View Javadoc
1   package org.kuali.ole.batch.bo;
2   
3   import org.kuali.ole.docstore.common.document.Holdings;
4   import org.kuali.ole.docstore.common.document.content.bib.marc.BibMarcRecord;
5   import org.slf4j.Logger;
6   import org.slf4j.LoggerFactory;
7   
8   import java.util.ArrayList;
9   import java.util.List;
10  
11  /**
12   * Created with IntelliJ IDEA.
13   * User: rajeshbabuk
14   * Date: 7/2/14
15   * Time: 10:49 AM
16   * To change this template use File | Settings | File Templates.
17   */
18  public class OLEBatchBibImportStatistics {
19      private static final Logger LOG = LoggerFactory.getLogger(OLEBatchBibImportStatistics.class);
20  
21      private int chunkCount = 0;
22      private int totalCount = 0;
23      private int successRecord = 0;
24      private int noOfEinstanceAdded = 0;
25      private int noOfEinstanceDeleted = 0;
26      private int noOfEinstanceCreatedWithOutLink = 0;
27      private int noOfbibsHaveMoreThanOneEinstance = 0;
28      private StringBuffer misMatchMarcRecords = new StringBuffer("");
29      private List<BibMarcRecord> mismatchRecordList = new ArrayList<BibMarcRecord>();
30      private List<BibMarcRecord> recordsCreatedWithOutLink = new ArrayList<BibMarcRecord>();
31      private List<BibMarcRecord> recordsCreatedWithMoreThanOneLink = new ArrayList<BibMarcRecord>();
32      private List<Holdings> totalRecordsCreated = new ArrayList<Holdings>();
33      private List<Holdings> totalRecordsDeleted = new ArrayList<Holdings>();
34      private List<String> invalidLeaderField = new ArrayList<>();
35      private List<BibMarcRecord> bibMarcRecordList = new ArrayList<BibMarcRecord>();
36      private List bibImportChunkRecordsList = new ArrayList(0);
37      private StringBuilder errorBuilder = new StringBuilder();
38  
39      private List<BibMarcRecord> moreThanOneHoldingsMatched = new ArrayList<BibMarcRecord>();
40      private List<BibMarcRecord> moreThanOneItemMatched = new ArrayList<BibMarcRecord>();
41  
42      public int getChunkCount() {
43          return chunkCount;
44      }
45  
46      public void setChunkCount(int chunkCount) {
47          this.chunkCount = chunkCount;
48      }
49  
50      public int getTotalCount() {
51          return totalCount;
52      }
53  
54      public void setTotalCount(int totalCount) {
55          this.totalCount = totalCount;
56      }
57  
58      public int getSuccessRecord() {
59          return successRecord;
60      }
61  
62      public void setSuccessRecord(int successRecord) {
63          this.successRecord = successRecord;
64      }
65  
66      public int getNoOfEinstanceAdded() {
67          return noOfEinstanceAdded;
68      }
69  
70      public void setNoOfEinstanceAdded(int noOfEinstanceAdded) {
71          this.noOfEinstanceAdded = noOfEinstanceAdded;
72      }
73  
74      public int getNoOfEinstanceDeleted() {
75          return noOfEinstanceDeleted;
76      }
77  
78      public void setNoOfEinstanceDeleted(int noOfEinstanceDeleted) {
79          this.noOfEinstanceDeleted = noOfEinstanceDeleted;
80      }
81  
82      public int getNoOfEinstanceCreatedWithOutLink() {
83          return noOfEinstanceCreatedWithOutLink;
84      }
85  
86      public void setNoOfEinstanceCreatedWithOutLink(int noOfEinstanceCreatedWithOutLink) {
87          this.noOfEinstanceCreatedWithOutLink = noOfEinstanceCreatedWithOutLink;
88      }
89  
90      public int getNoOfbibsHaveMoreThanOneEinstance() {
91          return noOfbibsHaveMoreThanOneEinstance;
92      }
93  
94      public void setNoOfbibsHaveMoreThanOneEinstance(int noOfbibsHaveMoreThanOneEinstance) {
95          this.noOfbibsHaveMoreThanOneEinstance = noOfbibsHaveMoreThanOneEinstance;
96      }
97  
98      public void addChunkCount(int chunkCount) {
99          this.chunkCount = this.chunkCount + chunkCount;
100     }
101 
102     public void addTotalCount(int totalCount) {
103         this.totalCount = this.totalCount + totalCount;
104     }
105 
106     public void addSuccessRecord(int successRecord) {
107         this.successRecord = this.successRecord + successRecord;
108     }
109 
110     public void addNoOfEinstanceAdded(int noOfEinstanceAdded) {
111         this.noOfEinstanceAdded = this.noOfEinstanceAdded + noOfEinstanceAdded;
112     }
113 
114     public void addNoOfEinstanceDeleted(int noOfEinstanceDeleted) {
115         this.noOfEinstanceDeleted = this.noOfEinstanceDeleted + noOfEinstanceDeleted;
116     }
117 
118     public void addNoOfEinstanceCreatedWithOutLink(int noOfEinstanceCreatedWithOutLink) {
119         this.noOfEinstanceCreatedWithOutLink = this.noOfEinstanceCreatedWithOutLink + noOfEinstanceCreatedWithOutLink;
120     }
121 
122     public void addNoOfbibsHaveMoreThanOneEinstance(int noOfbibsHaveMoreThanOneEinstance) {
123         this.noOfbibsHaveMoreThanOneEinstance = this.noOfbibsHaveMoreThanOneEinstance + noOfbibsHaveMoreThanOneEinstance;
124     }
125 
126     public StringBuffer getMisMatchMarcRecords() {
127         return misMatchMarcRecords;
128     }
129 
130     public void setMisMatchMarcRecords(StringBuffer misMatchMarcRecords) {
131         this.misMatchMarcRecords = misMatchMarcRecords;
132     }
133 
134     public void appendMisMatchMarcRecords(String misMatchMarcRecords) {
135         this.misMatchMarcRecords.append(misMatchMarcRecords);
136     }
137 
138     public List<BibMarcRecord> getMismatchRecordList() {
139         return mismatchRecordList;
140     }
141 
142     public void setMismatchRecordList(List<BibMarcRecord> mismatchRecordList) {
143         this.mismatchRecordList = mismatchRecordList;
144     }
145 
146     public List<BibMarcRecord> getRecordsCreatedWithOutLink() {
147         return recordsCreatedWithOutLink;
148     }
149 
150     public void setRecordsCreatedWithOutLink(List<BibMarcRecord> recordsCreatedWithOutLink) {
151         this.recordsCreatedWithOutLink = recordsCreatedWithOutLink;
152     }
153 
154     public List<BibMarcRecord> getRecordsCreatedWithMoreThanOneLink() {
155         return recordsCreatedWithMoreThanOneLink;
156     }
157 
158     public void setRecordsCreatedWithMoreThanOneLink(List<BibMarcRecord> recordsCreatedWithMoreThanOneLink) {
159         this.recordsCreatedWithMoreThanOneLink = recordsCreatedWithMoreThanOneLink;
160     }
161 
162     public List<Holdings> getTotalRecordsCreated() {
163         return totalRecordsCreated;
164     }
165 
166     public void setTotalRecordsCreated(List<Holdings> totalRecordsCreated) {
167         this.totalRecordsCreated = totalRecordsCreated;
168     }
169 
170     public List<Holdings> getTotalRecordsDeleted() {
171         return totalRecordsDeleted;
172     }
173 
174     public void setTotalRecordsDeleted(List<Holdings> totalRecordsDeleted) {
175         this.totalRecordsDeleted = totalRecordsDeleted;
176     }
177 
178     public List<String> getInvalidLeaderField() {
179         return invalidLeaderField;
180     }
181 
182     public void setInvalidLeaderField(List<String> invalidLeaderField) {
183         this.invalidLeaderField = invalidLeaderField;
184     }
185 
186     public List<BibMarcRecord> getBibMarcRecordList() {
187         return bibMarcRecordList;
188     }
189 
190     public void setBibMarcRecordList(List<BibMarcRecord> bibMarcRecordList) {
191         this.bibMarcRecordList = bibMarcRecordList;
192     }
193 
194     public List getBibImportChunkRecordsList() {
195         return bibImportChunkRecordsList;
196     }
197 
198     public void setBibImportChunkRecordsList(List bibImportChunkRecordsList) {
199         this.bibImportChunkRecordsList = bibImportChunkRecordsList;
200     }
201 
202     public List<BibMarcRecord> getMoreThanOneHoldingsMatched() {
203         return moreThanOneHoldingsMatched;
204     }
205 
206     public void setMoreThanOneHoldingsMatched(List<BibMarcRecord> moreThanOneHoldingsMatched) {
207         this.moreThanOneHoldingsMatched = moreThanOneHoldingsMatched;
208     }
209 
210     public List<BibMarcRecord> getMoreThanOneItemMatched() {
211         return moreThanOneItemMatched;
212     }
213 
214     public void setMoreThanOneItemMatched(List<BibMarcRecord> moreThanOneItemMatched) {
215         this.moreThanOneItemMatched = moreThanOneItemMatched;
216     }
217 
218     public StringBuilder getErrorBuilder() {
219         return errorBuilder;
220     }
221 
222     public void setErrorBuilder(StringBuilder errorBuilder) {
223         this.errorBuilder = errorBuilder;
224     }
225 
226     @Override
227     public String toString() {
228         return "OLEBatchBibImportStatistics {" + "chunkCount" + chunkCount
229                 + "totalCount" + totalCount
230                 + "successRecord" + successRecord
231                 + "noOfEinstanceAdded" + noOfEinstanceAdded
232                 + "noOfEinstanceDeleted" + noOfEinstanceDeleted
233                 + "noOfEinstanceCreatedWithOutLink" + noOfEinstanceCreatedWithOutLink
234                 + "noOfbibsHaveMoreThanOneEinstance" + noOfbibsHaveMoreThanOneEinstance
235                 + "}";
236     }
237 
238     public void setInstanceStatistics(List<BibMarcRecord> mismatchRecordList) {
239         setMismatchRecordList(mismatchRecordList);
240         setNoOfEinstanceCreatedWithOutLink(getRecordsCreatedWithOutLink().size());
241         setNoOfbibsHaveMoreThanOneEinstance(getRecordsCreatedWithMoreThanOneLink().size());
242         setNoOfEinstanceAdded(getTotalRecordsCreated().size());
243         setNoOfEinstanceDeleted(getTotalRecordsDeleted().size());
244 
245     }
246 }