License Holder identification

This commit is contained in:
gexce
2017-09-22 15:07:36 +02:00
parent 59697c22d7
commit d04c957680
@@ -23,17 +23,21 @@ public class EntryProcessor {
private ObjectMapper jsonMapper = new ObjectMapper(); private ObjectMapper jsonMapper = new ObjectMapper();
public EntryProcessor() throws IOException { public EntryProcessor() throws IOException {
log.info("Starting up");
LineIterator iter = FileUtils.lineIterator(entriesFile, "UTF-8"); LineIterator iter = FileUtils.lineIterator(entriesFile, "UTF-8");
// skip header // skip header
iter.next(); iter.next();
HashSet<String> orgSet = new HashSet<String>(); HashSet<String> orgSet = new HashSet<String>();
int count = 0;
while (iter.hasNext()) { while (iter.hasNext()) {
String line = iter.next(); String line = iter.next();
line = line.substring(line.lastIndexOf(fieldSeparator) + fieldSeparator.length()); line = line.substring(line.lastIndexOf(fieldSeparator) + fieldSeparator.length());
Entry entry = jsonMapper.readValue(line, Entry.class); Entry entry = jsonMapper.readValue(line, Entry.class);
if (entry.copyright == null || entry.copyright.organization == null || !entry.copyright.organization.get("id").equals("3740")) { if (entry.copyright == null || entry.copyright.organization == null || !entry.copyright.organization.get("id").equals("3740")) {
String orgId = null; String orgId = null;
@@ -44,14 +48,45 @@ public class EntryProcessor {
} }
log.warn("Entry " + entry.id + ": License Holder is not set to 'Bayer Animal Health GmbH' " + orgId); log.warn("Entry " + entry.id + ": License Holder is not set to 'Bayer Animal Health GmbH' " + orgId + ", status: " + entry.stateId);
} }
// for (Download download : entry.downloadListPublicFolder) {
//
// }
// boolean originalFound = false;
// long largest = 0;
// long originalSize = 0;
// for (Download download : entry.downloadList) {
// if (largest < download.size)
// largest = download.size;
//
// if (download.entryFileVariation.equals("ORIGINAL")) {
// originalFound = true;
// originalSize = download.size;
// }
// }
//
// if (!originalFound) {
// log.info(entry.id + " - no original - " + entry.stateId);
// count++;
// }
// else if (largest > originalSize) {
// log.info(entry.id + " - original is not largest file - " + entry.stateId);
// count++;
// }
} }
for (String orgId : orgSet) { for (String orgId : orgSet) {
log.info(orgId); log.info(orgId);
} }
log.info("Count: " + count);
} }
public static void main(String[] args) { public static void main(String[] args) {