use of edu.harvard.iq.dataverse.api.dto.FieldDTO 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.FieldDTO 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.FieldDTO 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();
}
}
}
}
}
}
}
use of edu.harvard.iq.dataverse.api.dto.FieldDTO in project dataverse by IQSS.
the class DdiExportUtil method writeDistributorsElement.
private static void writeDistributorsElement(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.distributor.equals(fieldDTO.getTypeName())) {
xmlw.writeStartElement("distrbtr");
for (HashSet<FieldDTO> foo : fieldDTO.getMultipleCompound()) {
String distributorName = "";
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())) {
distributorName = next.getSinglePrimitive();
}
if (DatasetFieldConstant.distributorAffiliation.equals(next.getTypeName())) {
distributorAffiliation = next.getSinglePrimitive();
}
if (DatasetFieldConstant.distributorAbbreviation.equals(next.getTypeName())) {
distributorAbbreviation = next.getSinglePrimitive();
}
if (DatasetFieldConstant.distributorURL.equals(next.getTypeName())) {
distributorURL = next.getSinglePrimitive();
}
if (DatasetFieldConstant.distributorLogo.equals(next.getTypeName())) {
distributorLogoURL = next.getSinglePrimitive();
}
}
if (!distributorName.isEmpty()) {
xmlw.writeStartElement("distrbtr");
if (!distributorAffiliation.isEmpty()) {
writeAttribute(xmlw, "affiliation", distributorAffiliation);
}
if (!distributorAbbreviation.isEmpty()) {
writeAttribute(xmlw, "abbr", distributorAbbreviation);
}
if (!distributorURL.isEmpty()) {
writeAttribute(xmlw, "URI", distributorURL);
}
if (!distributorLogoURL.isEmpty()) {
writeAttribute(xmlw, "role", distributorLogoURL);
}
xmlw.writeCharacters(distributorName);
// AuthEnty
xmlw.writeEndElement();
}
}
// rspStmt
xmlw.writeEndElement();
}
}
}
}
}
use of edu.harvard.iq.dataverse.api.dto.FieldDTO in project dataverse by IQSS.
the class DdiExportUtil method writeNotesElement.
private static void writeNotesElement(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.socialScienceNotes.equals(fieldDTO.getTypeName())) {
String notesText = "";
String notesType = "";
String notesSubject = "";
Set<FieldDTO> foo = fieldDTO.getSingleCompound();
for (Iterator<FieldDTO> iterator = foo.iterator(); iterator.hasNext(); ) {
FieldDTO next = iterator.next();
if (DatasetFieldConstant.socialScienceNotesText.equals(next.getTypeName())) {
notesText = next.getSinglePrimitive();
}
if (DatasetFieldConstant.socialScienceNotesType.equals(next.getTypeName())) {
notesType = next.getSinglePrimitive();
}
if (DatasetFieldConstant.socialScienceNotesSubject.equals(next.getTypeName())) {
notesSubject = next.getSinglePrimitive();
}
}
if (!notesText.isEmpty()) {
xmlw.writeStartElement("notes");
if (!notesType.isEmpty()) {
writeAttribute(xmlw, "type", notesType);
}
if (!notesSubject.isEmpty()) {
writeAttribute(xmlw, "subject", notesSubject);
}
xmlw.writeCharacters(notesText);
xmlw.writeEndElement();
}
}
}
}
}
}
Aggregations