Revision 9165
Added by Jing Tao over 9 years ago
src/edu/ucsb/nceas/metacat/dataone/convert/LogV2toV1Converter.java | ||
---|---|---|
60 | 60 |
public org.dataone.service.types.v1.Log convert(Log logV2) |
61 | 61 |
throws InstantiationException, IllegalAccessException, InvocationTargetException, JiBXException, IOException { |
62 | 62 |
org.dataone.service.types.v1.Log logV1 = null; |
63 |
int removedLogCount =0; |
|
63 | 64 |
if(logV2 != null) { |
64 | 65 |
//System.out.println("====================== logV2 is not null and the size is "+logV2.getCount()); |
65 | 66 |
LogEntryV2toV1Converter converter = new LogEntryV2toV1Converter(); |
... | ... | |
67 | 68 |
for(int i=0; i<logV2.getCount(); i++) { |
68 | 69 |
LogEntry v2LogEntry = logV2.getLogEntry(i); |
69 | 70 |
org.dataone.service.types.v1.LogEntry v1LogEntry = converter.convert(v2LogEntry); |
70 |
logV1.addLogEntry(v1LogEntry); |
|
71 |
if(v1LogEntry.getEvent() != null) { |
|
72 |
logV1.addLogEntry(v1LogEntry); |
|
73 |
} else { |
|
74 |
removedLogCount ++; |
|
75 |
} |
|
76 |
|
|
71 | 77 |
} |
72 |
logV1.setCount(logV2.getCount()); |
|
78 |
logV1.setCount(logV2.getCount()-removedLogCount);
|
|
73 | 79 |
logV1.setStart(logV2.getStart()); |
74 |
logV1.setTotal(logV2.getTotal()); |
|
80 |
logV1.setTotal(logV2.getTotal()-removedLogCount);
|
|
75 | 81 |
} |
76 | 82 |
return logV1; |
77 | 83 |
} |
Also available in: Unified diff
If an Event object is null in the v1 log entry, we won't add it to the log.