use of edu.harvard.iq.dataverse.api.dto.MetadataBlockDTO in project dataverse by IQSS.
the class DdiExportUtil method writeProducersElement.
private static void writeProducersElement(XMLStreamWriter xmlw, DatasetVersionDTO version) throws XMLStreamException {
xmlw.writeStartElement("prodStmt");
for (Map.Entry<String, MetadataBlockDTO> entry : version.getMetadataBlocks().entrySet()) {
String key = entry.getKey();
MetadataBlockDTO value = entry.getValue();
if ("citation".equals(key)) {
for (FieldDTO fieldDTO : value.getFields()) {
if (DatasetFieldConstant.producer.equals(fieldDTO.getTypeName())) {
for (HashSet<FieldDTO> foo : fieldDTO.getMultipleCompound()) {
String producerName = "";
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())) {
producerName = next.getSinglePrimitive();
}
if (DatasetFieldConstant.producerAffiliation.equals(next.getTypeName())) {
producerAffiliation = next.getSinglePrimitive();
}
if (DatasetFieldConstant.producerAbbreviation.equals(next.getTypeName())) {
producerAbbreviation = next.getSinglePrimitive();
}
if (DatasetFieldConstant.producerLogo.equals(next.getTypeName())) {
producerLogo = next.getSinglePrimitive();
}
if (DatasetFieldConstant.producerURL.equals(next.getTypeName())) {
producerURL = next.getSinglePrimitive();
}
}
if (!producerName.isEmpty()) {
xmlw.writeStartElement("producer");
if (!producerAffiliation.isEmpty()) {
writeAttribute(xmlw, "affiliation", producerAffiliation);
}
if (!producerAbbreviation.isEmpty()) {
writeAttribute(xmlw, "abbr", producerAbbreviation);
}
if (!producerLogo.isEmpty()) {
writeAttribute(xmlw, "role", producerLogo);
}
if (!producerURL.isEmpty()) {
writeAttribute(xmlw, "URI", producerURL);
}
xmlw.writeCharacters(producerName);
// AuthEnty
xmlw.writeEndElement();
}
}
}
}
}
}
writeFullElement(xmlw, "prodDate", dto2Primitive(version, DatasetFieldConstant.productionDate));
writeFullElement(xmlw, "prodPlac", dto2Primitive(version, DatasetFieldConstant.productionPlace));
writeGrantElement(xmlw, version);
// prodStmt
xmlw.writeEndElement();
}
use of edu.harvard.iq.dataverse.api.dto.MetadataBlockDTO in project dataverse by IQSS.
the class DdiExportUtil method writeGrantElement.
private static void writeGrantElement(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.grantNumber.equals(fieldDTO.getTypeName())) {
String grantNumber = "";
String grantAgency = "";
for (HashSet<FieldDTO> foo : fieldDTO.getMultipleCompound()) {
for (Iterator<FieldDTO> iterator = foo.iterator(); iterator.hasNext(); ) {
FieldDTO next = iterator.next();
if (DatasetFieldConstant.grantNumberValue.equals(next.getTypeName())) {
grantNumber = next.getSinglePrimitive();
}
if (DatasetFieldConstant.grantNumberAgency.equals(next.getTypeName())) {
grantAgency = next.getSinglePrimitive();
}
}
if (!grantNumber.isEmpty()) {
xmlw.writeStartElement("grantNo");
if (!grantAgency.isEmpty()) {
writeAttribute(xmlw, "agency", grantAgency);
}
xmlw.writeCharacters(grantNumber);
// grantno
xmlw.writeEndElement();
}
}
}
}
}
}
}
use of edu.harvard.iq.dataverse.api.dto.MetadataBlockDTO in project dataverse by IQSS.
the class DdiExportUtil method writeTargetSampleElement.
private static void writeTargetSampleElement(XMLStreamWriter xmlw, DatasetVersionDTO datasetVersionDTO) throws XMLStreamException {
for (Map.Entry<String, MetadataBlockDTO> entry : datasetVersionDTO.getMetadataBlocks().entrySet()) {
String key = entry.getKey();
MetadataBlockDTO value = entry.getValue();
if ("socialscience".equals(key)) {
for (FieldDTO fieldDTO : value.getFields()) {
if (DatasetFieldConstant.targetSampleSize.equals(fieldDTO.getTypeName())) {
String sizeFormula = "";
String actualSize = "";
Set<FieldDTO> foo = fieldDTO.getSingleCompound();
for (Iterator<FieldDTO> iterator = foo.iterator(); iterator.hasNext(); ) {
FieldDTO next = iterator.next();
if (DatasetFieldConstant.targetSampleSizeFormula.equals(next.getTypeName())) {
sizeFormula = next.getSinglePrimitive();
}
if (DatasetFieldConstant.targetSampleActualSize.equals(next.getTypeName())) {
actualSize = next.getSinglePrimitive();
}
}
if (!sizeFormula.isEmpty()) {
xmlw.writeStartElement("sampleSizeFormula");
xmlw.writeCharacters(sizeFormula);
// sampleSizeFormula
xmlw.writeEndElement();
}
if (!actualSize.isEmpty()) {
xmlw.writeStartElement("sampleSize");
xmlw.writeCharacters(actualSize);
// sampleSize
xmlw.writeEndElement();
}
}
}
}
}
}
use of edu.harvard.iq.dataverse.api.dto.MetadataBlockDTO in project dataverse by IQSS.
the class DdiExportUtil method writeAuthorsElement.
private static void writeAuthorsElement(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.author.equals(fieldDTO.getTypeName())) {
xmlw.writeStartElement("rspStmt");
String authorName = "";
String authorAffiliation = "";
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 (DatasetFieldConstant.authorAffiliation.equals(next.getTypeName())) {
authorAffiliation = next.getSinglePrimitive();
}
}
if (!authorName.isEmpty()) {
xmlw.writeStartElement("AuthEnty");
if (!authorAffiliation.isEmpty()) {
writeAttribute(xmlw, "affiliation", authorAffiliation);
}
xmlw.writeCharacters(authorName);
// AuthEnty
xmlw.writeEndElement();
}
}
// rspStmt
xmlw.writeEndElement();
}
}
}
}
}
use of edu.harvard.iq.dataverse.api.dto.MetadataBlockDTO in project dataverse by IQSS.
the class DdiExportUtil method writeOtherIdElement.
private static void writeOtherIdElement(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.otherId.equals(fieldDTO.getTypeName())) {
String otherId = "";
String otherIdAgency = "";
for (HashSet<FieldDTO> foo : fieldDTO.getMultipleCompound()) {
for (Iterator<FieldDTO> iterator = foo.iterator(); iterator.hasNext(); ) {
FieldDTO next = iterator.next();
if (DatasetFieldConstant.otherIdValue.equals(next.getTypeName())) {
otherId = next.getSinglePrimitive();
}
if (DatasetFieldConstant.otherIdAgency.equals(next.getTypeName())) {
otherIdAgency = next.getSinglePrimitive();
}
}
if (!otherId.isEmpty()) {
xmlw.writeStartElement("IDNo");
if (!otherIdAgency.isEmpty()) {
writeAttribute(xmlw, "agency", otherIdAgency);
}
xmlw.writeCharacters(otherId);
// IDNo
xmlw.writeEndElement();
}
}
}
}
}
}
}
Aggregations