diff --git a/pom.xml b/pom.xml index 4f43693f52..0318c08f8a 100644 --- a/pom.xml +++ b/pom.xml @@ -48,9 +48,9 @@ 1.17 1.31 2.3.26-incubating - 0.56 + 0.61 0.41 - 0.36 + 0.38 1.5 1.1.1 0.31 @@ -102,7 +102,7 @@ ipt@lists.gbif.org ipt-subscribe@lists.gbif.org ipt-unsubscribe@lists.gbif.org - http://lists.gbif.org/pipermail/ipt/ + https://lists.gbif.org/pipermail/ipt/ @@ -522,7 +522,7 @@ javax.validation validation-api ${validation-api.version} - + diff --git a/src/main/java/org/gbif/ipt/model/Resource.java b/src/main/java/org/gbif/ipt/model/Resource.java index b9b578c9c2..d84ba8e2b8 100644 --- a/src/main/java/org/gbif/ipt/model/Resource.java +++ b/src/main/java/org/gbif/ipt/model/Resource.java @@ -1215,8 +1215,8 @@ public synchronized void updateAlternateIdentifierForDOI() { if (doi != null) { // retrieve a list of the resource's alternate identifiers List ids = eml.getAlternateIdentifiers(); - if (identifierStatus.equals(IdentifierStatus.PUBLIC_PENDING_PUBLICATION) || identifierStatus - .equals(IdentifierStatus.PUBLIC)) { + if (identifierStatus.equals(IdentifierStatus.PUBLIC_PENDING_PUBLICATION) || + identifierStatus.equals(IdentifierStatus.PUBLIC)) { // make sure the DOI always appears first List reorderedList = Lists.newArrayList(); reorderedList.add(doi.toString()); @@ -1232,8 +1232,8 @@ public synchronized void updateAlternateIdentifierForDOI() { } ids.addAll(reorderedList); log.debug("DOI=" + doi.toString() + " added to resource's list of alt ids as first element"); - } else if (identifierStatus.equals(IdentifierStatus.UNAVAILABLE) || identifierStatus - .equals(IdentifierStatus.UNRESERVED)) { + } else if (identifierStatus.equals(IdentifierStatus.UNAVAILABLE) || + identifierStatus.equals(IdentifierStatus.UNRESERVED)) { for (Iterator iterator = ids.iterator(); iterator.hasNext(); ) { String id = iterator.next(); // make sure a DOI that has been made unavailable, or that has been deleted, no longer appears in the list diff --git a/src/main/java/org/gbif/ipt/service/manage/impl/SourceManagerImpl.java b/src/main/java/org/gbif/ipt/service/manage/impl/SourceManagerImpl.java index c51992930b..176310ac72 100644 --- a/src/main/java/org/gbif/ipt/service/manage/impl/SourceManagerImpl.java +++ b/src/main/java/org/gbif/ipt/service/manage/impl/SourceManagerImpl.java @@ -32,7 +32,7 @@ import org.gbif.ipt.service.manage.SourceManager; import org.gbif.utils.file.ClosableIterator; import org.gbif.utils.file.ClosableReportingIterator; -import org.gbif.utils.file.csv.UnkownDelimitersException; +import org.gbif.utils.file.csv.UnknownDelimitersException; import java.io.BufferedWriter; import java.io.File; @@ -96,7 +96,7 @@ public SqlColumnIterator(SqlSource source, int column, int limit) throws SQLExce /** * SqlColumnIterator constructor - * + * * @param source of the sql data * @param column to inspect, zero based numbering as used in the dwc archives * @param sql statement to query in the sql source @@ -306,16 +306,16 @@ private TextFileSource addTextFile(File file) throws ImportException { // anaylze individual files using the dwca reader Archive arch = ArchiveFactory.openArchive(file); copyArchiveFileProperties(arch.getCore(), src); + } catch (UnknownDelimitersException e) { + // this file is invalid + log.warn(e.getMessage()); + throw new ImportException(e); } catch (IOException e) { log.warn(e.getMessage()); throw new ImportException(e); } catch (UnsupportedArchiveException e) { // fine, cant read it with dwca library, but might still be a valid file for manual setup log.warn(e.getMessage()); - } catch (UnkownDelimitersException e) { - // this file is invalid - log.warn(e.getMessage()); - throw new ImportException(e); } return src; } diff --git a/src/main/java/org/gbif/ipt/task/GenerateDwca.java b/src/main/java/org/gbif/ipt/task/GenerateDwca.java index ddf46d9286..d6cfcf10cd 100644 --- a/src/main/java/org/gbif/ipt/task/GenerateDwca.java +++ b/src/main/java/org/gbif/ipt/task/GenerateDwca.java @@ -1346,7 +1346,7 @@ private void applyTranslations(PropertyMapping[] inCols, String[] in, String[] r // use DOI for datasetID property? if (pm.getTerm().qualifiedName().equalsIgnoreCase(Constants.DWC_DATASET_ID) && doiUsedForDatasetId && doi != null) { - val = doi.toString(); + val = "doi:" + doi.getDoiName(); } } // add value to data file record diff --git a/src/test/java/org/gbif/ipt/model/ResourceTest.java b/src/test/java/org/gbif/ipt/model/ResourceTest.java index 952d3313ee..99ea1cd983 100644 --- a/src/test/java/org/gbif/ipt/model/ResourceTest.java +++ b/src/test/java/org/gbif/ipt/model/ResourceTest.java @@ -685,7 +685,7 @@ public void testUpdateAlternateIdentifierForDOICase1() { r.updateAlternateIdentifierForDOI(); assertEquals(1, r.getEml().getAlternateIdentifiers().size()); - assertEquals("doi:10.5072/case1", r.getEml().getAlternateIdentifiers().get(0)); + assertEquals("10.5072/case1", r.getEml().getAlternateIdentifiers().get(0)); } /** @@ -707,7 +707,7 @@ public void testUpdateAlternateIdentifierForDOICase2() { r.updateAlternateIdentifierForDOI(); assertEquals(3, r.getEml().getAlternateIdentifiers().size()); - assertEquals("doi:10.5072/case2", r.getEml().getAlternateIdentifiers().get(0)); + assertEquals("10.5072/case2", r.getEml().getAlternateIdentifiers().get(0)); assertEquals("alt-id-1", r.getEml().getAlternateIdentifiers().get(1)); assertEquals("alt-id-2", r.getEml().getAlternateIdentifiers().get(2)); } @@ -732,7 +732,7 @@ public void testUpdateAlternateIdentifierForDOICase3() { r.updateAlternateIdentifierForDOI(); assertEquals(3, r.getEml().getAlternateIdentifiers().size()); - assertEquals("doi:10.5072/case3", r.getEml().getAlternateIdentifiers().get(0)); + assertEquals("10.5072/case3", r.getEml().getAlternateIdentifiers().get(0)); assertEquals("alt-id-1", r.getEml().getAlternateIdentifiers().get(1)); assertEquals("doi:10.5077/other", r.getEml().getAlternateIdentifiers().get(2)); } @@ -747,16 +747,18 @@ public void testUpdateAlternateIdentifierForDOICase4() { r.setDoi(new DOI("10.5072/case4")); r.setIdentifierStatus(IdentifierStatus.UNAVAILABLE); - r.getEml().getAlternateIdentifiers().add("doi:10.5072/case4"); - r.getEml().getAlternateIdentifiers().add("doi:10.5077/other"); + r.getEml().getAlternateIdentifiers().add("10.5072/case4"); + r.getEml().getAlternateIdentifiers().add("10.5077/other"); assertEquals(2, r.getEml().getAlternateIdentifiers().size()); - assertEquals("doi:10.5072/case4", r.getEml().getAlternateIdentifiers().get(0)); - assertEquals("doi:10.5077/other", r.getEml().getAlternateIdentifiers().get(1)); + assertEquals("10.5072/case4", r.getEml().getAlternateIdentifiers().get(0)); + assertEquals("10.5077/other", r.getEml().getAlternateIdentifiers().get(1)); r.updateAlternateIdentifierForDOI(); + System.out.println(r.getEml().getAlternateIdentifiers()); + assertEquals(1, r.getEml().getAlternateIdentifiers().size()); - assertEquals("doi:10.5077/other", r.getEml().getAlternateIdentifiers().get(0)); + assertEquals("10.5077/other", r.getEml().getAlternateIdentifiers().get(0)); } /**