-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding terms of use in DDI #11071
base: develop
Are you sure you want to change the base?
Adding terms of use in DDI #11071
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,13 @@ | |
import edu.harvard.iq.dataverse.ControlledVocabularyValue; | ||
import edu.harvard.iq.dataverse.DatasetFieldConstant; | ||
import edu.harvard.iq.dataverse.DvObjectContainer; | ||
import edu.harvard.iq.dataverse.api.dto.MetadataBlockDTO; | ||
import edu.harvard.iq.dataverse.api.dto.DatasetDTO; | ||
import edu.harvard.iq.dataverse.api.dto.DatasetVersionDTO; | ||
import edu.harvard.iq.dataverse.api.dto.FieldDTO; | ||
import edu.harvard.iq.dataverse.api.dto.FileDTO; | ||
import edu.harvard.iq.dataverse.api.dto.MetadataBlockDTO; | ||
import edu.harvard.iq.dataverse.api.dto.FieldDTO; | ||
import edu.harvard.iq.dataverse.api.dto.LicenseDTO; | ||
|
||
|
||
import static edu.harvard.iq.dataverse.export.DDIExportServiceBean.LEVEL_FILE; | ||
import static edu.harvard.iq.dataverse.export.DDIExportServiceBean.NOTE_SUBJECT_TAG; | ||
|
@@ -313,15 +315,36 @@ private static void writeDataAccess(XMLStreamWriter xmlw , DatasetVersionDTO ver | |
XmlWriterUtil.writeFullElement(xmlw, "conditions", version.getConditions()); | ||
XmlWriterUtil.writeFullElement(xmlw, "disclaimer", version.getDisclaimer()); | ||
xmlw.writeEndElement(); //useStmt | ||
|
||
/* any <note>s: */ | ||
if (version.getTermsOfUse() != null && !version.getTermsOfUse().trim().equals("")) { | ||
xmlw.writeStartElement("notes"); | ||
xmlw.writeAttribute("type", NOTE_TYPE_TERMS_OF_USE); | ||
xmlw.writeAttribute("level", LEVEL_DV); | ||
xmlw.writeCharacters(version.getTermsOfUse()); | ||
xmlw.writeEndElement(); //notes | ||
} | ||
|
||
if (version.getTermsOfAccess() != null && !version.getTermsOfAccess().trim().equals("")) { | ||
xmlw.writeStartElement("notes"); | ||
xmlw.writeAttribute("type", NOTE_TYPE_TERMS_OF_ACCESS); | ||
xmlw.writeAttribute("level", LEVEL_DV); | ||
xmlw.writeCharacters(version.getTermsOfAccess()); | ||
xmlw.writeEndElement(); //notes | ||
} | ||
|
||
LicenseDTO license = version.getLicense(); | ||
if (license != null) { | ||
String name = license.getName(); | ||
String uri = license.getUri(); | ||
if ((name != null && !name.trim().equals("")) && (uri != null && !uri.trim().equals(""))) { | ||
xmlw.writeStartElement("notes"); | ||
xmlw.writeAttribute("type", NOTE_TYPE_TERMS_OF_USE); | ||
xmlw.writeAttribute("level", LEVEL_DV); | ||
xmlw.writeCharacters("<a href=" + '"' + uri + '"' + ">" + name + "</a>"); | ||
xmlw.writeEndElement(); //notes | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, please add a test to DdiExportUtilTest.java There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The standard license was already in dataset-finch1.json and dataset-finch1.xml was updated to add the standard license. |
||
xmlw.writeEndElement(); //dataAccs | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add to DdiExportUtilTest.java to exercise this code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added dataset-finch-terms-of-use.json and dataset-finch-terms-of-use.xml which is used in testJson2DdiNoFilesTermsOfUse() for custom terms of use