use of edu.harvard.iq.dataverse.api.dto.FieldDTO in project dataverse by IQSS.
the class DublinCoreExportUtil method writeAuthorsElement.
private static void writeAuthorsElement(XMLStreamWriter xmlw, DatasetVersionDTO datasetVersionDTO, String dcFlavor) 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.author.equals(fieldDTO.getTypeName())) {
String authorName = "";
for (HashSet<FieldDTO> foo : fieldDTO.getMultipleCompound()) {
for (Iterator<FieldDTO> iterator = foo.iterator(); iterator.hasNext(); ) {
FieldDTO next = iterator.next();
if (DatasetFieldConstant.authorName.equals(next.getTypeName())) {
authorName = next.getSinglePrimitive();
}
}
if (!authorName.isEmpty()) {
xmlw.writeStartElement(dcFlavor + ":" + "creator");
xmlw.writeCharacters(authorName);
// AuthEnty
xmlw.writeEndElement();
}
}
}
}
}
}
}
use of edu.harvard.iq.dataverse.api.dto.FieldDTO in project dataverse by IQSS.
the class DublinCoreExportUtil method writeAbstractElement.
private static void writeAbstractElement(XMLStreamWriter xmlw, DatasetVersionDTO datasetVersionDTO, String dcFlavor) 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 = "";
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 (!descriptionText.isEmpty()) {
xmlw.writeStartElement(dcFlavor + ":" + "description");
xmlw.writeCharacters(descriptionText);
// abstract
xmlw.writeEndElement();
}
}
}
}
}
}
}
use of edu.harvard.iq.dataverse.api.dto.FieldDTO in project dataverse by IQSS.
the class DublinCoreExportUtil method writeTimeElements.
private static void writeTimeElements(XMLStreamWriter xmlw, DatasetVersionDTO datasetVersionDTO, String dcFlavor) 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.timePeriodCovered.equals(fieldDTO.getTypeName())) {
String dateValStart = "";
String dateValEnd = "";
for (HashSet<FieldDTO> foo : fieldDTO.getMultipleCompound()) {
for (Iterator<FieldDTO> iterator = foo.iterator(); iterator.hasNext(); ) {
FieldDTO next = iterator.next();
if (DatasetFieldConstant.timePeriodCoveredStart.equals(next.getTypeName())) {
dateValStart = next.getSinglePrimitive();
}
if (DatasetFieldConstant.timePeriodCoveredEnd.equals(next.getTypeName())) {
dateValEnd = next.getSinglePrimitive();
}
}
if (!dateValStart.isEmpty()) {
writeFullElement(xmlw, dcFlavor + ":" + "temporal", dateValStart);
}
if (!dateValEnd.isEmpty()) {
writeFullElement(xmlw, dcFlavor + ":" + "temporal", dateValEnd);
}
}
}
if (DatasetFieldConstant.dateOfCollection.equals(fieldDTO.getTypeName())) {
String dateValStart = "";
String dateValEnd = "";
for (HashSet<FieldDTO> foo : fieldDTO.getMultipleCompound()) {
for (Iterator<FieldDTO> iterator = foo.iterator(); iterator.hasNext(); ) {
FieldDTO next = iterator.next();
if (DatasetFieldConstant.dateOfCollectionStart.equals(next.getTypeName())) {
dateValStart = next.getSinglePrimitive();
}
if (DatasetFieldConstant.dateOfCollectionEnd.equals(next.getTypeName())) {
dateValEnd = next.getSinglePrimitive();
}
}
if (!dateValStart.isEmpty()) {
writeFullElement(xmlw, dcFlavor + ":" + "temporal", dateValStart);
}
if (!dateValEnd.isEmpty()) {
writeFullElement(xmlw, dcFlavor + ":" + "temporal", dateValEnd);
}
}
}
}
}
}
}
use of edu.harvard.iq.dataverse.api.dto.FieldDTO in project dataverse by IQSS.
the class DublinCoreExportUtil method writeContributorElement.
private static void writeContributorElement(XMLStreamWriter xmlw, DatasetVersionDTO datasetVersionDTO, String dcFlavor) 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.contributor.equals(fieldDTO.getTypeName())) {
String contributorName = "";
for (HashSet<FieldDTO> foo : fieldDTO.getMultipleCompound()) {
for (Iterator<FieldDTO> iterator = foo.iterator(); iterator.hasNext(); ) {
FieldDTO next = iterator.next();
if (DatasetFieldConstant.contributorName.equals(next.getTypeName())) {
contributorName = next.getSinglePrimitive();
}
}
if (!contributorName.isEmpty()) {
xmlw.writeStartElement(dcFlavor + ":" + "contributor");
xmlw.writeCharacters(contributorName);
// abstract
xmlw.writeEndElement();
}
}
}
}
}
}
}
use of edu.harvard.iq.dataverse.api.dto.FieldDTO in project dataverse by IQSS.
the class DublinCoreExportUtil method writeSpatialElements.
private static void writeSpatialElements(XMLStreamWriter xmlw, DatasetVersionDTO datasetVersionDTO, String dcFlavor) throws XMLStreamException {
for (Map.Entry<String, MetadataBlockDTO> entry : datasetVersionDTO.getMetadataBlocks().entrySet()) {
String key = entry.getKey();
MetadataBlockDTO value = entry.getValue();
if ("geospatial".equals(key)) {
for (FieldDTO fieldDTO : value.getFields()) {
if (DatasetFieldConstant.geographicCoverage.equals(fieldDTO.getTypeName())) {
for (HashSet<FieldDTO> foo : fieldDTO.getMultipleCompound()) {
for (Iterator<FieldDTO> iterator = foo.iterator(); iterator.hasNext(); ) {
FieldDTO next = iterator.next();
if (DatasetFieldConstant.country.equals(next.getTypeName())) {
writeFullElement(xmlw, dcFlavor + ":" + "spatial", next.getSinglePrimitive());
}
if (DatasetFieldConstant.city.equals(next.getTypeName())) {
writeFullElement(xmlw, dcFlavor + ":" + "spatial", next.getSinglePrimitive());
}
if (DatasetFieldConstant.state.equals(next.getTypeName())) {
writeFullElement(xmlw, dcFlavor + ":" + "spatial", next.getSinglePrimitive());
}
if (DatasetFieldConstant.otherGeographicCoverage.equals(next.getTypeName())) {
writeFullElement(xmlw, dcFlavor + ":" + "spatial", next.getSinglePrimitive());
}
}
}
}
}
}
}
}
Aggregations