Merge pull request #621 from umd-lib/ezid-metadata-mapping

DS-2119. EZID IdentifierProvider Metadata Mapping.
In the interest of time, merging this despite a problem with the transform, for which I already have a solution.  A separate PR will provide that solution.
This commit is contained in:
Mark H. Wood
2014-11-06 11:08:45 -05:00
4 changed files with 160 additions and 12 deletions

View File

@@ -53,16 +53,25 @@ import org.springframework.beans.factory.annotation.Required;
*
* <p>Then there are properties injected using Spring:</p>
* <ul>
* <li>There is a Map (with the property name "crosswalk") from EZID
* metadata field names into DSpace field names, injected by Spring. Specify
* the fully-qualified names of all metadata fields to be looked up on a DSpace
* object and their values set on mapped fully-qualified names in the object's
* DataCite metadata.</li>
*
* <li>A second map ("crosswalkTransform") provides Transform instances
* mapped from EZID metadata field names. This allows the crosswalk to rewrite
* field values where the form maintained by DSpace is not directly usable in
* EZID metadata.</li>
* <li>There is a Map (with the property name "crosswalk") from EZID metadata
* field names into DSpace field names, injected by Spring. Specify the
* fully-qualified names of all metadata fields to be looked up on a DSpace
* object and their values set on mapped fully-qualified names in the object's
* DataCite metadata.</li>
*
* <li>A second map ("crosswalkTransform") provides Transform instances mapped
* from EZID metadata field names. This allows the crosswalk to rewrite field
* values where the form maintained by DSpace is not directly usable in EZID
* metadata.</li>
*
* <li>Optional: A boolean property ("generateDataciteXML") that controls the
* creation and inclusion of DataCite xml schema during the metadata
* crosswalking. The default "DataCite" dissemination plugin uses
* DIM2DataCite.xsl for crosswalking. Default value: false.</li>
*
* <li>Optional: A string property ("disseminationCrosswalkName") that can be
* used to set the name of the dissemination crosswalk plugin for metadata
* crosswalking. Default value: "DataCite".</li>
* </ul>
*
* @author mwood
@@ -90,6 +99,10 @@ public class EZIDIdentifierProvider
private static final String DOI_SCHEME = "doi:";
protected boolean GENERATE_DATACITE_XML = false;
protected String DATACITE_XML_CROSSWALK = "DataCite";
/** Map DataCite metadata into local metadata. */
private static Map<String, String> crosswalk = new HashMap<>();
@@ -592,8 +605,17 @@ public class EZIDIdentifierProvider
}
}
if (GENERATE_DATACITE_XML == true)
{
DataCiteXMLCreator xmlGen = new DataCiteXMLCreator();
xmlGen.setDisseminationCrosswalkName(DATACITE_XML_CROSSWALK);
String xmlString = xmlGen.getXMLString(dso);
mapped.put("datacite", xmlString);
}
// Supply a default publisher, if the Item has none.
if (!mapped.containsKey(DATACITE_PUBLISHER))
if (!mapped.containsKey(DATACITE_PUBLISHER)
&& !mapped.containsKey("datacite"))
{
String publisher = configurationService.getPropertyAsType(CFG_PUBLISHER, "unknown");
log.info("Supplying default publisher: {}", publisher);
@@ -601,7 +623,8 @@ public class EZIDIdentifierProvider
}
// Supply current year as year of publication, if the Item has none.
if (!mapped.containsKey(DATACITE_PUBLICATION_YEAR))
if (!mapped.containsKey(DATACITE_PUBLICATION_YEAR)
&& !mapped.containsKey("datacite"))
{
String year = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
log.info("Supplying default publication year: {}", year);
@@ -625,6 +648,16 @@ public class EZIDIdentifierProvider
transforms = transformMap;
}
public void setGenerateDataciteXML(boolean GENERATE_DATACITE_XML)
{
this.GENERATE_DATACITE_XML = GENERATE_DATACITE_XML;
}
public void setDisseminationCrosswalkName(String DATACITE_XML_CROSSWALK)
{
this.DATACITE_XML_CROSSWALK = DATACITE_XML_CROSSWALK;
}
@Required
public static void setRequestFactory(EZIDRequestFactory aRequestFactory)
{