use of edu.harvard.iq.dataverse.api.dto.FieldDTO in project dataverse by IQSS.
the class DdiExportUtil method writeSeriesElement.
private static void writeSeriesElement(XMLStreamWriter xmlw, DatasetVersionDTO datasetVersionDTO) throws XMLStreamException {
for (Map.Entry<String, MetadataBlockDTO> entry : datasetVersionDTO.getMetadataBlocks().entrySet()) {
String key = entry.getKey();
MetadataBlockDTO value = entry.getValue();
if ("citation".equals(key)) {
for (FieldDTO fieldDTO : value.getFields()) {
if (DatasetFieldConstant.series.equals(fieldDTO.getTypeName())) {
xmlw.writeStartElement("serStmt");
String seriesName = "";
String seriesInformation = "";
Set<FieldDTO> foo = fieldDTO.getSingleCompound();
for (Iterator<FieldDTO> iterator = foo.iterator(); iterator.hasNext(); ) {
FieldDTO next = iterator.next();
if (DatasetFieldConstant.seriesName.equals(next.getTypeName())) {
seriesName = next.getSinglePrimitive();
}
if (DatasetFieldConstant.seriesInformation.equals(next.getTypeName())) {
seriesInformation = next.getSinglePrimitive();
}
}
if (!seriesName.isEmpty()) {
xmlw.writeStartElement("serName");
xmlw.writeCharacters(seriesName);
// grantno
xmlw.writeEndElement();
}
if (!seriesInformation.isEmpty()) {
xmlw.writeStartElement("serInfo");
xmlw.writeCharacters(seriesInformation);
// grantno
xmlw.writeEndElement();
}
// serStmt
xmlw.writeEndElement();
}
}
}
}
}
use of edu.harvard.iq.dataverse.api.dto.FieldDTO in project dataverse by IQSS.
the class DdiExportUtil method writeContactsElement.
private static void writeContactsElement(XMLStreamWriter xmlw, DatasetVersionDTO datasetVersionDTO) throws XMLStreamException {
for (Map.Entry<String, MetadataBlockDTO> entry : datasetVersionDTO.getMetadataBlocks().entrySet()) {
String key = entry.getKey();
MetadataBlockDTO value = entry.getValue();
if ("citation".equals(key)) {
for (FieldDTO fieldDTO : value.getFields()) {
if (DatasetFieldConstant.datasetContact.equals(fieldDTO.getTypeName())) {
String datasetContactName = "";
String datasetContactAffiliation = "";
String datasetContactEmail = "";
for (HashSet<FieldDTO> foo : fieldDTO.getMultipleCompound()) {
for (Iterator<FieldDTO> iterator = foo.iterator(); iterator.hasNext(); ) {
FieldDTO next = iterator.next();
if (DatasetFieldConstant.datasetContactName.equals(next.getTypeName())) {
datasetContactName = next.getSinglePrimitive();
}
if (DatasetFieldConstant.datasetContactAffiliation.equals(next.getTypeName())) {
datasetContactAffiliation = next.getSinglePrimitive();
}
if (DatasetFieldConstant.datasetContactEmail.equals(next.getTypeName())) {
datasetContactEmail = next.getSinglePrimitive();
}
}
// TODO: Since datasetContactEmail is a required field but datasetContactName is not consider not checking if datasetContactName is empty so we can write out datasetContactEmail.
if (!datasetContactName.isEmpty()) {
xmlw.writeStartElement("contact");
if (!datasetContactAffiliation.isEmpty()) {
writeAttribute(xmlw, "affiliation", datasetContactAffiliation);
}
if (!datasetContactEmail.isEmpty()) {
writeAttribute(xmlw, "email", datasetContactEmail);
}
xmlw.writeCharacters(datasetContactName);
// AuthEnty
xmlw.writeEndElement();
}
}
}
}
}
}
}
use of edu.harvard.iq.dataverse.api.dto.FieldDTO in project dataverse by IQSS.
the class DdiExportUtil method writeAbstractElement.
private static void writeAbstractElement(XMLStreamWriter xmlw, DatasetVersionDTO datasetVersionDTO) throws XMLStreamException {
for (Map.Entry<String, MetadataBlockDTO> entry : datasetVersionDTO.getMetadataBlocks().entrySet()) {
String key = entry.getKey();
MetadataBlockDTO value = entry.getValue();
if ("citation".equals(key)) {
for (FieldDTO fieldDTO : value.getFields()) {
if (DatasetFieldConstant.description.equals(fieldDTO.getTypeName())) {
String descriptionText = "";
String descriptionDate = "";
for (HashSet<FieldDTO> foo : fieldDTO.getMultipleCompound()) {
for (Iterator<FieldDTO> iterator = foo.iterator(); iterator.hasNext(); ) {
FieldDTO next = iterator.next();
if (DatasetFieldConstant.descriptionText.equals(next.getTypeName())) {
descriptionText = next.getSinglePrimitive();
}
if (DatasetFieldConstant.descriptionDate.equals(next.getTypeName())) {
descriptionDate = next.getSinglePrimitive();
}
}
if (!descriptionText.isEmpty()) {
xmlw.writeStartElement("abstract");
if (!descriptionDate.isEmpty()) {
writeAttribute(xmlw, "date", descriptionDate);
}
xmlw.writeCharacters(descriptionText);
// abstract
xmlw.writeEndElement();
}
}
}
}
}
}
}
use of edu.harvard.iq.dataverse.api.dto.FieldDTO in project dataverse by IQSS.
the class DdiExportUtil method writeRelPublElement.
private static void writeRelPublElement(XMLStreamWriter xmlw, DatasetVersionDTO datasetVersionDTO) throws XMLStreamException {
for (Map.Entry<String, MetadataBlockDTO> entry : datasetVersionDTO.getMetadataBlocks().entrySet()) {
String key = entry.getKey();
MetadataBlockDTO value = entry.getValue();
if ("citation".equals(key)) {
for (FieldDTO fieldDTO : value.getFields()) {
if (DatasetFieldConstant.publication.equals(fieldDTO.getTypeName())) {
for (HashSet<FieldDTO> foo : fieldDTO.getMultipleCompound()) {
String pubString = "";
String citation = "";
String IDType = "";
String IDNo = "";
String url = "";
for (Iterator<FieldDTO> iterator = foo.iterator(); iterator.hasNext(); ) {
FieldDTO next = iterator.next();
if (DatasetFieldConstant.publicationCitation.equals(next.getTypeName())) {
citation = next.getSinglePrimitive();
}
if (DatasetFieldConstant.publicationIDType.equals(next.getTypeName())) {
IDType = next.getSinglePrimitive();
}
if (DatasetFieldConstant.publicationIDNumber.equals(next.getTypeName())) {
IDNo = next.getSinglePrimitive();
}
if (DatasetFieldConstant.publicationURL.equals(next.getTypeName())) {
url = next.getSinglePrimitive();
}
}
pubString = appendCommaSeparatedValue(citation, IDType);
pubString = appendCommaSeparatedValue(pubString, IDNo);
pubString = appendCommaSeparatedValue(pubString, url);
if (!pubString.isEmpty()) {
xmlw.writeStartElement("relPubl");
xmlw.writeCharacters(pubString);
// relPubl
xmlw.writeEndElement();
}
}
}
}
}
}
}
use of edu.harvard.iq.dataverse.api.dto.FieldDTO in project dataverse by IQSS.
the class DdiExportUtil method writeSoftwareElement.
private static void writeSoftwareElement(XMLStreamWriter xmlw, DatasetVersionDTO datasetVersionDTO) throws XMLStreamException {
for (Map.Entry<String, MetadataBlockDTO> entry : datasetVersionDTO.getMetadataBlocks().entrySet()) {
String key = entry.getKey();
MetadataBlockDTO value = entry.getValue();
if ("citation".equals(key)) {
for (FieldDTO fieldDTO : value.getFields()) {
if (DatasetFieldConstant.software.equals(fieldDTO.getTypeName())) {
String softwareName = "";
String softwareVersion = "";
for (HashSet<FieldDTO> foo : fieldDTO.getMultipleCompound()) {
for (Iterator<FieldDTO> iterator = foo.iterator(); iterator.hasNext(); ) {
FieldDTO next = iterator.next();
if (DatasetFieldConstant.softwareName.equals(next.getTypeName())) {
softwareName = next.getSinglePrimitive();
}
if (DatasetFieldConstant.softwareVersion.equals(next.getTypeName())) {
softwareVersion = next.getSinglePrimitive();
}
}
if (!softwareName.isEmpty()) {
xmlw.writeStartElement("software");
if (!softwareVersion.isEmpty()) {
writeAttribute(xmlw, "version", softwareVersion);
}
xmlw.writeCharacters(softwareName);
// software
xmlw.writeEndElement();
}
}
}
}
}
}
}
Aggregations