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 int noOfEHoldingsCreatedWithOutPlatfom =0;
29      private int noOfEHoldingsCreatedWithOutEResource =0;
30      private StringBuffer misMatchMarcRecords = new StringBuffer("");
31      private List<BibMarcRecord> mismatchRecordList = new ArrayList<BibMarcRecord>();
32      private List<BibMarcRecord> recordsCreatedWithOutLink = new ArrayList<BibMarcRecord>();
33      private List<BibMarcRecord> recordsCreatedWithMoreThanOneLink = new ArrayList<BibMarcRecord>();
34      private List<Holdings> totalRecordsCreated = new ArrayList<Holdings>();
35      private List<Holdings> totalRecordsDeleted = new ArrayList<Holdings>();
36      private List<String> invalidLeaderField = new ArrayList<>();
37      private List<BibMarcRecord> bibMarcRecordList = new ArrayList<BibMarcRecord>();
38      private List bibImportChunkRecordsList = new ArrayList(0);
39      private StringBuilder errorBuilder = new StringBuilder();
40      private List<BibMarcRecord> matchedBibMarc = new ArrayList<>();
41      private List<BibMarcRecord> nonMatchedBibMarc = new ArrayList<>();
42      private List<String> matchedBibIds = new ArrayList<>();
43      private List<String> noMatchFoundBibs = new ArrayList<>();
44      private List<BibMarcRecord> matchedHoldingsMarc = new ArrayList<>();
45      private List<BibMarcRecord> nonMatchedHoldingsMarc = new ArrayList<>();
46      private List<String> matchedHoldingsIds = new ArrayList<>();
47      private List<String> noMatchFoundHoldings = new ArrayList<>();
48      private List<BibMarcRecord> matchedItemMarc = new ArrayList<>();
49      private List<BibMarcRecord> nonMatchedItemMarc = new ArrayList<>();
50      private List<String> matchedItemIds = new ArrayList<>();
51      private List<String> noMatchFoundItem = new ArrayList<>();
52  
53      private List<BibMarcRecord> moreThanOneHoldingsMatched = new ArrayList<BibMarcRecord>();
54      private List<BibMarcRecord> moreThanOneItemMatched = new ArrayList<BibMarcRecord>();
55  
56      public int getChunkCount() {
57          return chunkCount;
58      }
59  
60      public void setChunkCount(int chunkCount) {
61          this.chunkCount = chunkCount;
62      }
63  
64      public int getTotalCount() {
65          return totalCount;
66      }
67  
68      public void setTotalCount(int totalCount) {
69          this.totalCount = totalCount;
70      }
71  
72      public int getSuccessRecord() {
73          return successRecord;
74      }
75  
76      public void setSuccessRecord(int successRecord) {
77          this.successRecord = successRecord;
78      }
79  
80      public int getNoOfEinstanceAdded() {
81          return noOfEinstanceAdded;
82      }
83  
84      public void setNoOfEinstanceAdded(int noOfEinstanceAdded) {
85          this.noOfEinstanceAdded = noOfEinstanceAdded;
86      }
87  
88      public int getNoOfEinstanceDeleted() {
89          return noOfEinstanceDeleted;
90      }
91  
92      public void setNoOfEinstanceDeleted(int noOfEinstanceDeleted) {
93          this.noOfEinstanceDeleted = noOfEinstanceDeleted;
94      }
95  
96      public int getNoOfEinstanceCreatedWithOutLink() {
97          return noOfEinstanceCreatedWithOutLink;
98      }
99  
100     public void setNoOfEinstanceCreatedWithOutLink(int noOfEinstanceCreatedWithOutLink) {
101         this.noOfEinstanceCreatedWithOutLink = noOfEinstanceCreatedWithOutLink;
102     }
103 
104     public int getNoOfbibsHaveMoreThanOneEinstance() {
105         return noOfbibsHaveMoreThanOneEinstance;
106     }
107 
108     public void setNoOfbibsHaveMoreThanOneEinstance(int noOfbibsHaveMoreThanOneEinstance) {
109         this.noOfbibsHaveMoreThanOneEinstance = noOfbibsHaveMoreThanOneEinstance;
110     }
111 
112     public void addChunkCount(int chunkCount) {
113         this.chunkCount = this.chunkCount + chunkCount;
114     }
115 
116     public void addTotalCount(int totalCount) {
117         this.totalCount = this.totalCount + totalCount;
118     }
119 
120     public void addSuccessRecord(int successRecord) {
121         this.successRecord = this.successRecord + successRecord;
122     }
123 
124     public void addNoOfEinstanceAdded(int noOfEinstanceAdded) {
125         this.noOfEinstanceAdded = this.noOfEinstanceAdded + noOfEinstanceAdded;
126     }
127 
128     public void addNoOfEinstanceDeleted(int noOfEinstanceDeleted) {
129         this.noOfEinstanceDeleted = this.noOfEinstanceDeleted + noOfEinstanceDeleted;
130     }
131 
132     public void addNoOfEinstanceCreatedWithOutLink(int noOfEinstanceCreatedWithOutLink) {
133         this.noOfEinstanceCreatedWithOutLink = this.noOfEinstanceCreatedWithOutLink + noOfEinstanceCreatedWithOutLink;
134     }
135 
136     public void addNoOfbibsHaveMoreThanOneEinstance(int noOfbibsHaveMoreThanOneEinstance) {
137         this.noOfbibsHaveMoreThanOneEinstance = this.noOfbibsHaveMoreThanOneEinstance + noOfbibsHaveMoreThanOneEinstance;
138     }
139 
140     public StringBuffer getMisMatchMarcRecords() {
141         return misMatchMarcRecords;
142     }
143 
144     public void setMisMatchMarcRecords(StringBuffer misMatchMarcRecords) {
145         this.misMatchMarcRecords = misMatchMarcRecords;
146     }
147 
148     public void appendMisMatchMarcRecords(String misMatchMarcRecords) {
149         this.misMatchMarcRecords.append(misMatchMarcRecords);
150     }
151 
152     public List<BibMarcRecord> getMismatchRecordList() {
153         return mismatchRecordList;
154     }
155 
156     public void setMismatchRecordList(List<BibMarcRecord> mismatchRecordList) {
157         this.mismatchRecordList = mismatchRecordList;
158     }
159 
160     public List<BibMarcRecord> getRecordsCreatedWithOutLink() {
161         return recordsCreatedWithOutLink;
162     }
163 
164     public void setRecordsCreatedWithOutLink(List<BibMarcRecord> recordsCreatedWithOutLink) {
165         this.recordsCreatedWithOutLink = recordsCreatedWithOutLink;
166     }
167 
168     public List<BibMarcRecord> getRecordsCreatedWithMoreThanOneLink() {
169         return recordsCreatedWithMoreThanOneLink;
170     }
171 
172     public void setRecordsCreatedWithMoreThanOneLink(List<BibMarcRecord> recordsCreatedWithMoreThanOneLink) {
173         this.recordsCreatedWithMoreThanOneLink = recordsCreatedWithMoreThanOneLink;
174     }
175 
176     public List<Holdings> getTotalRecordsCreated() {
177         return totalRecordsCreated;
178     }
179 
180     public void setTotalRecordsCreated(List<Holdings> totalRecordsCreated) {
181         this.totalRecordsCreated = totalRecordsCreated;
182     }
183 
184     public List<Holdings> getTotalRecordsDeleted() {
185         return totalRecordsDeleted;
186     }
187 
188     public void setTotalRecordsDeleted(List<Holdings> totalRecordsDeleted) {
189         this.totalRecordsDeleted = totalRecordsDeleted;
190     }
191 
192     public List<String> getInvalidLeaderField() {
193         return invalidLeaderField;
194     }
195 
196     public void setInvalidLeaderField(List<String> invalidLeaderField) {
197         this.invalidLeaderField = invalidLeaderField;
198     }
199 
200     public List<BibMarcRecord> getBibMarcRecordList() {
201         return bibMarcRecordList;
202     }
203 
204     public void setBibMarcRecordList(List<BibMarcRecord> bibMarcRecordList) {
205         this.bibMarcRecordList = bibMarcRecordList;
206     }
207 
208     public List getBibImportChunkRecordsList() {
209         return bibImportChunkRecordsList;
210     }
211 
212     public void setBibImportChunkRecordsList(List bibImportChunkRecordsList) {
213         this.bibImportChunkRecordsList = bibImportChunkRecordsList;
214     }
215 
216     public List<BibMarcRecord> getMoreThanOneHoldingsMatched() {
217         return moreThanOneHoldingsMatched;
218     }
219 
220     public void setMoreThanOneHoldingsMatched(List<BibMarcRecord> moreThanOneHoldingsMatched) {
221         this.moreThanOneHoldingsMatched = moreThanOneHoldingsMatched;
222     }
223 
224     public List<BibMarcRecord> getMoreThanOneItemMatched() {
225         return moreThanOneItemMatched;
226     }
227 
228     public void setMoreThanOneItemMatched(List<BibMarcRecord> moreThanOneItemMatched) {
229         this.moreThanOneItemMatched = moreThanOneItemMatched;
230     }
231 
232     public StringBuilder getErrorBuilder() {
233         return errorBuilder;
234     }
235 
236     public void setErrorBuilder(StringBuilder errorBuilder) {
237         this.errorBuilder = errorBuilder;
238     }
239 
240     public int getNoOfEHoldingsCreatedWithOutPlatfom() {
241         return noOfEHoldingsCreatedWithOutPlatfom;
242     }
243 
244     public void setNoOfEHoldingsCreatedWithOutPlatfom(int noOfEHoldingsCreatedWithOutPlatfom) {
245         this.noOfEHoldingsCreatedWithOutPlatfom = noOfEHoldingsCreatedWithOutPlatfom;
246     }
247 
248     public int getNoOfEHoldingsCreatedWithOutEResource() {
249         return noOfEHoldingsCreatedWithOutEResource;
250     }
251 
252     public void setNoOfEHoldingsCreatedWithOutEResource(int noOfEHoldingsCreatedWithOutEResource) {
253         this.noOfEHoldingsCreatedWithOutEResource = noOfEHoldingsCreatedWithOutEResource;
254     }
255 
256     public List<BibMarcRecord> getMatchedBibMarc() {
257         return matchedBibMarc;
258     }
259 
260     public void setMatchedBibMarc(List<BibMarcRecord> matchedBibMarc) {
261         this.matchedBibMarc = matchedBibMarc;
262     }
263 
264     public List<BibMarcRecord> getNonMatchedBibMarc() {
265         return nonMatchedBibMarc;
266     }
267 
268     public void setNonMatchedBibMarc(List<BibMarcRecord> nonMatchedBibMarc) {
269         this.nonMatchedBibMarc = nonMatchedBibMarc;
270     }
271 
272 
273     public List<String> getMatchedBibIds() {
274         return matchedBibIds;
275     }
276 
277     public void setMatchedBibIds(List<String> matchedBibIds) {
278         this.matchedBibIds = matchedBibIds;
279     }
280 
281     public List<String> getNoMatchFoundBibs() {
282         return noMatchFoundBibs;
283     }
284 
285     public void setNoMatchFoundBibs(List<String> noMatchFoundBibs) {
286         this.noMatchFoundBibs = noMatchFoundBibs;
287     }
288 
289     public List<BibMarcRecord> getMatchedHoldingsMarc() {
290         return matchedHoldingsMarc;
291     }
292 
293     public void setMatchedHoldingsMarc(List<BibMarcRecord> matchedHoldingsMarc) {
294         this.matchedHoldingsMarc = matchedHoldingsMarc;
295     }
296 
297     public List<BibMarcRecord> getNonMatchedHoldingsMarc() {
298         return nonMatchedHoldingsMarc;
299     }
300 
301     public void setNonMatchedHoldingsMarc(List<BibMarcRecord> nonMatchedHoldingsMarc) {
302         this.nonMatchedHoldingsMarc = nonMatchedHoldingsMarc;
303     }
304 
305     public List<String> getMatchedHoldingsIds() {
306         return matchedHoldingsIds;
307     }
308 
309     public void setMatchedHoldingsIds(List<String> matchedHoldingsIds) {
310         this.matchedHoldingsIds = matchedHoldingsIds;
311     }
312 
313     public List<String> getNoMatchFoundHoldings() {
314         return noMatchFoundHoldings;
315     }
316 
317     public void setNoMatchFoundHoldings(List<String> noMatchFoundHoldings) {
318         this.noMatchFoundHoldings = noMatchFoundHoldings;
319     }
320 
321     public List<BibMarcRecord> getMatchedItemMarc() {
322         return matchedItemMarc;
323     }
324 
325     public void setMatchedItemMarc(List<BibMarcRecord> matchedItemMarc) {
326         this.matchedItemMarc = matchedItemMarc;
327     }
328 
329     public List<BibMarcRecord> getNonMatchedItemMarc() {
330         return nonMatchedItemMarc;
331     }
332 
333     public void setNonMatchedItemMarc(List<BibMarcRecord> nonMatchedItemMarc) {
334         this.nonMatchedItemMarc = nonMatchedItemMarc;
335     }
336 
337     public List<String> getMatchedItemIds() {
338         return matchedItemIds;
339     }
340 
341     public void setMatchedItemIds(List<String> matchedItemIds) {
342         this.matchedItemIds = matchedItemIds;
343     }
344 
345     public List<String> getNoMatchFoundItem() {
346         return noMatchFoundItem;
347     }
348 
349     public void setNoMatchFoundItem(List<String> noMatchFoundItem) {
350         this.noMatchFoundItem = noMatchFoundItem;
351     }
352 
353     @Override
354     public String toString() {
355         return "OLEBatchBibImportStatistics {" + "chunkCount" + chunkCount
356                 + "totalCount" + totalCount
357                 + "successRecord" + successRecord
358                 + "noOfEinstanceAdded" + noOfEinstanceAdded
359                 + "noOfEinstanceDeleted" + noOfEinstanceDeleted
360                 + "noOfEinstanceCreatedWithOutLink" + noOfEinstanceCreatedWithOutLink
361                 + "noOfbibsHaveMoreThanOneEinstance" + noOfbibsHaveMoreThanOneEinstance
362                 + "}";
363     }
364 
365     public void setInstanceStatistics(List<BibMarcRecord> mismatchRecordList) {
366         setMismatchRecordList(mismatchRecordList);
367         setNoOfEinstanceCreatedWithOutLink(getRecordsCreatedWithOutLink().size());
368         setNoOfbibsHaveMoreThanOneEinstance(getRecordsCreatedWithMoreThanOneLink().size());
369         setNoOfEinstanceAdded(getTotalRecordsCreated().size());
370         setNoOfEinstanceDeleted(getTotalRecordsDeleted().size());
371 
372     }
373 }