diff --git a/src/main/java/com/integratedgraphics/extractor/DOICrawler.java b/src/main/java/com/integratedgraphics/extractor/DOICrawler.java index 96a210b..11cfea0 100644 --- a/src/main/java/com/integratedgraphics/extractor/DOICrawler.java +++ b/src/main/java/com/integratedgraphics/extractor/DOICrawler.java @@ -93,7 +93,7 @@ public class DOICrawler extends FindingAidCreator { public interface DOICustomizer { boolean customizeText(String key, String val); - String customizeGet(String key); + String customizeKey(String key); boolean ignoreURL(String url); } @@ -361,14 +361,13 @@ protected void processEndElement(String localName) { Map attrs; switch (localName) { case "description": - if (s.length() > 0 && !hackText("description", s)) { + if (s.length() > 0 && !customizeText("description", s)) { crawler.addAttr(IFDConst.IFD_PROPERTY_DESCRIPTION, s); } break; case "title": - System.out.println(localName + "=" + s); if (s.length() > 0) { - if (!hackText("title", s)) { + if (!customizeText("title", s)) { crawler.addAttr(IFDConst.IFD_PROPERTY_LABEL, s); } } @@ -411,7 +410,7 @@ private void addSubjects(Map attrs, String s) { } break; default: - key = hackGet(key); + key = customizeKey(key); break; } if (key.startsWith(FAIRSPEC_DATAOBJECT_FLAG)) { @@ -423,12 +422,12 @@ private void addSubjects(Map attrs, String s) { } } - private String hackGet(String key) { - return (customizer == null ? key : customizer.customizeGet(key)); + private String customizeKey(String key) { + return (customizer == null ? key : customizer.customizeKey(key)); } - private boolean hackText(String key, String val) { - return (customizer == null || customizer.customizeText(key, val)); + private boolean customizeText(String key, String val) { + return (customizer != null && customizer.customizeText(key, val)); } } @@ -918,6 +917,8 @@ protected void processRecords(String dataObjectType, List doiList) th break; case DOI_DATA: o = thisDataObject = faHelper.createDataObject("" + ++ids, rec.dataObjectType); + o.setDOI(rec.ifdRef.getDOI()); + o.setURL(rec.ifdRef.getURL()); thisDataObjectType = rec.dataObjectType; break; case DOI_REP: @@ -1056,11 +1057,10 @@ public void addPropertyOrRepresentation(String key, Object val, } public static void main(String[] args) { - if (args.length == 0) { - args = new String[] { TEST_PID, DEFAULT_OUTDIR, "-dodownload" }; -// args = new String[] { "10.14469/hpc/14443" , DEFAULT_OUTDIR, "-dodownload -bycompound" }; - } - new DOICrawler(args).crawl(); + if (args.length == 0) + ICLDOICrawler.main(args); + else + new DOICrawler(args).crawl(); } diff --git a/src/main/java/com/integratedgraphics/extractor/ICLDOICrawler.java b/src/main/java/com/integratedgraphics/extractor/ICLDOICrawler.java index ac8d976..121e7a0 100644 --- a/src/main/java/com/integratedgraphics/extractor/ICLDOICrawler.java +++ b/src/main/java/com/integratedgraphics/extractor/ICLDOICrawler.java @@ -61,7 +61,7 @@ public boolean ignoreURL(String url) { * return mapped key or key */ @Override - public String customizeGet(String key) { + public String customizeKey(String key) { String mappedKey = hackMap.get(key); return (mappedKey == null ? key : mappedKey); }