mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Merge pull request #9671 from atmire/w2p-115693_DataCite-DOI-fix
DataCite DOI error fixes
This commit is contained in:
@@ -7,6 +7,10 @@
|
||||
*/
|
||||
package org.dspace.identifier.doi;
|
||||
|
||||
import static org.dspace.identifier.DOIIdentifierProvider.DOI_ELEMENT;
|
||||
import static org.dspace.identifier.DOIIdentifierProvider.DOI_QUALIFIER;
|
||||
import static org.dspace.identifier.DOIIdentifierProvider.MD_SCHEMA;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
@@ -15,6 +19,7 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.StatusLine;
|
||||
@@ -383,6 +388,10 @@ public class DataCiteConnector
|
||||
parameters.put("hostinginstitution",
|
||||
configurationService.getProperty(CFG_HOSTINGINSTITUTION));
|
||||
}
|
||||
parameters.put("mdSchema", MD_SCHEMA);
|
||||
parameters.put("mdElement", DOI_ELEMENT);
|
||||
// Pass an empty string for qualifier if the metadata field doesn't have any
|
||||
parameters.put("mdQualifier", DOI_QUALIFIER);
|
||||
|
||||
Element root = null;
|
||||
try {
|
||||
@@ -410,7 +419,7 @@ public class DataCiteConnector
|
||||
}
|
||||
|
||||
String metadataDOI = extractDOI(root);
|
||||
if (null == metadataDOI) {
|
||||
if (StringUtils.isBlank(metadataDOI)) {
|
||||
// The DOI will be saved as metadata of dso after successful
|
||||
// registration. To register a doi it has to be part of the metadata
|
||||
// sent to DataCite. So we add it to the XML we'll send to DataCite
|
||||
|
@@ -36,6 +36,10 @@
|
||||
<xsl:param name="hostinginstitution"><xsl:value-of select="$publisher" /></xsl:param>
|
||||
<!-- Please take a look into the DataCite schema documentation if you want to know how to use these elements.
|
||||
http://schema.datacite.org -->
|
||||
<!-- Metadata-field to retrieve DOI from items -->
|
||||
<xsl:param name="mdSchema">dc</xsl:param>
|
||||
<xsl:param name="mdElement">identifier</xsl:param>
|
||||
<xsl:param name="mdQualifier">uri</xsl:param>
|
||||
|
||||
<xsl:output method="xml" indent="yes" encoding="utf-8" />
|
||||
|
||||
@@ -333,15 +337,17 @@
|
||||
company as well. We have to ensure to use URIs of our prefix
|
||||
as primary identifiers only.
|
||||
-->
|
||||
<xsl:template match="dspace:field[@mdschema='dc' and @element='identifier' and @qualifier and (contains(., $prefix))]">
|
||||
<identifier identifierType="DOI">
|
||||
<xsl:if test="starts-with(string(text()), 'https://doi.org/')">
|
||||
<xsl:value-of select="substring(., 17)"/>
|
||||
</xsl:if>
|
||||
<xsl:if test="starts-with(string(text()), 'http://dx.doi.org/')">
|
||||
<xsl:value-of select="substring(., 19)"/>
|
||||
</xsl:if>
|
||||
</identifier>
|
||||
<xsl:template match="dspace:field[@mdschema=$mdSchema and @element=$mdElement and (contains(., $prefix))]">
|
||||
<xsl:if test="(($mdQualifier and $mdQualifier != '') and @qualifier=$mdQualifier) or ((not($mdQualifier) or $mdQualifier = '') and not(@qualifier))">
|
||||
<identifier identifierType="DOI">
|
||||
<xsl:if test="starts-with(string(text()), 'https://doi.org/')">
|
||||
<xsl:value-of select="substring(., 17)"/>
|
||||
</xsl:if>
|
||||
<xsl:if test="starts-with(string(text()), 'http://dx.doi.org/')">
|
||||
<xsl:value-of select="substring(., 19)"/>
|
||||
</xsl:if>
|
||||
</identifier>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- DataCite (2) :: Creator -->
|
||||
|
Reference in New Issue
Block a user