Skip to content

Commit

Permalink
Got rid of the dubious "role=logo" attribute export. #3648
Browse files Browse the repository at this point in the history
  • Loading branch information
landreev committed Apr 19, 2023
1 parent 14603c2 commit 74497e5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public class DdiExportUtil {
public static final String CITATION_BLOCK_NAME = "citation";

public static String datasetDtoAsJson2ddi(String datasetDtoAsJson) {
logger.fine(JsonUtil.prettyPrint(datasetDtoAsJson));
Gson gson = new Gson();
DatasetDTO datasetDto = gson.fromJson(datasetDtoAsJson, DatasetDTO.class);
try {
Expand Down Expand Up @@ -963,7 +962,6 @@ private static void writeProducersElement(XMLStreamWriter xmlw, DatasetVersionDT
String producerAffiliation = "";
String producerAbbreviation = "";
String producerLogo = "";
String producerURL = "";
for (Iterator<FieldDTO> iterator = foo.iterator(); iterator.hasNext();) {
FieldDTO next = iterator.next();
if (DatasetFieldConstant.producerName.equals(next.getTypeName())) {
Expand All @@ -978,10 +976,6 @@ private static void writeProducersElement(XMLStreamWriter xmlw, DatasetVersionDT
if (DatasetFieldConstant.producerLogo.equals(next.getTypeName())) {
producerLogo = next.getSinglePrimitive();
}
if (DatasetFieldConstant.producerURL.equals(next.getTypeName())) {
producerURL = next.getSinglePrimitive();

}
}
if (!producerName.isEmpty()) {
xmlw.writeStartElement("producer");
Expand All @@ -991,11 +985,8 @@ private static void writeProducersElement(XMLStreamWriter xmlw, DatasetVersionDT
if (!producerAbbreviation.isEmpty()) {
writeAttribute(xmlw, "abbr", producerAbbreviation);
}
if (!producerLogo.isEmpty()) {
/*if (!producerLogo.isEmpty()) {
writeAttribute(xmlw, "role", producerLogo);
}
/* NOT IN THE SCHEMA! -L.A. if (!producerURL.isEmpty()) {
writeAttribute(xmlw, "URI", producerURL);
}*/
xmlw.writeCharacters(producerName);
xmlw.writeEndElement(); //AuthEnty
Expand All @@ -1010,9 +1001,7 @@ private static void writeProducersElement(XMLStreamWriter xmlw, DatasetVersionDT
// productionPlace was made multiple as of 5.14:
// (a quick backward compatibility check was added to dto2PrimitiveList(),
// see the method for details)
for (String productionPlace : dto2PrimitiveList(version, DatasetFieldConstant.productionPlace)) {
writeFullElement(xmlw, "prodPlac", productionPlace);
}
writeFullElementList(xmlw, "prodPlac", dto2PrimitiveList(version, DatasetFieldConstant.productionPlace));
writeSoftwareElement(xmlw, version);

writeGrantElement(xmlw, version);
Expand All @@ -1032,7 +1021,6 @@ private static void writeDistributorsElement(XMLStreamWriter xmlw, DatasetVersio
String distributorAffiliation = "";
String distributorAbbreviation = "";
String distributorURL = "";
String distributorLogoURL = "";
for (Iterator<FieldDTO> iterator = foo.iterator(); iterator.hasNext();) {
FieldDTO next = iterator.next();
if (DatasetFieldConstant.distributorName.equals(next.getTypeName())) {
Expand All @@ -1047,9 +1035,6 @@ private static void writeDistributorsElement(XMLStreamWriter xmlw, DatasetVersio
if (DatasetFieldConstant.distributorURL.equals(next.getTypeName())) {
distributorURL = next.getSinglePrimitive();
}
if (DatasetFieldConstant.distributorLogo.equals(next.getTypeName())) {
distributorLogoURL = next.getSinglePrimitive();
}
}
if (!distributorName.isEmpty()) {
xmlw.writeStartElement("distrbtr");
Expand All @@ -1065,10 +1050,6 @@ private static void writeDistributorsElement(XMLStreamWriter xmlw, DatasetVersio
if (!distributorURL.isEmpty()) {
writeAttribute(xmlw, "URI", distributorURL);
}
/* NOT IN THE SCHEMA! -L.A.if (!distributorLogoURL.isEmpty()) {
(and why were we putting this logo into the "role" field anyway?? - same with producerLogo above!)
writeAttribute(xmlw, "role", distributorLogoURL);
}*/
xmlw.writeCharacters(distributorName);
xmlw.writeEndElement(); //AuthEnty
}
Expand Down Expand Up @@ -1566,7 +1547,7 @@ private static List<String> dto2PrimitiveList(DatasetVersionDTO datasetVersionDT
// up on an instance that upgraded to a Dataverse version
// where a certain primitive has been made multiple, but has
// not yet update the block.
if (fieldDTO.getMultiple()) {
if (fieldDTO.getMultiple() != null && fieldDTO.getMultiple()) {
return fieldDTO.getMultiplePrimitive();
} else {
return Arrays.asList(fieldDTO.getSinglePrimitive());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<AuthEnty affiliation="Birds Inc.">Finch, Fiona</AuthEnty>
</rspStmt>
<prodStmt>
<producer affiliation="Hawk Institute" abbr="ProdAbb" role="http://www.hawk.edu/logo">Johnny Hawk</producer>
<producer affiliation="Hawk Institute" abbr="ProdAbb">Johnny Hawk</producer>
</prodStmt>
<distStmt>
<distrbtr xml:lang="en" affiliation="Valhalla Polytechnic" abbr="Dist-Abb" URI="http://www.valhalla.edu/url">Odin Raven</distrbtr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<othId role="Data Curator">LastContributor2, FirstContributor2</othId>
</rspStmt>
<prodStmt>
<producer affiliation="ProducerAffiliation1" abbr="ProducerAbbreviation1" role="http://ProducerLogoURL1.org">LastProducer1, FirstProducer1</producer>
<producer affiliation="ProducerAffiliation2" abbr="ProducerAbbreviation2" role="http://ProducerLogoURL2.org">LastProducer2, FirstProducer2</producer>
<producer affiliation="ProducerAffiliation1" abbr="ProducerAbbreviation1">LastProducer1, FirstProducer1</producer>
<producer affiliation="ProducerAffiliation2" abbr="ProducerAbbreviation2">LastProducer2, FirstProducer2</producer>
<prodDate>1003-01-01</prodDate>
<prodPlac>ProductionPlace</prodPlac>
<software version="SoftwareVersion1">SoftwareName1</software>
Expand Down

0 comments on commit 74497e5

Please sign in to comment.