Search in sources :

Example 16 with ControlledVocabularyValue

use of edu.harvard.iq.dataverse.ControlledVocabularyValue in project dataverse by IQSS.

the class DatasetFieldWalker method walk.

public void walk(DatasetField fld, SettingsServiceBean settingsService) {
    l.startField(fld);
    DatasetFieldType datasetFieldType = fld.getDatasetFieldType();
    if (datasetFieldType.isControlledVocabulary()) {
        for (ControlledVocabularyValue cvv : sort(fld.getControlledVocabularyValues(), ControlledVocabularyValue.DisplayOrder)) {
            l.controledVocabularyValue(cvv);
        }
    } else if (datasetFieldType.isPrimitive()) {
        for (DatasetFieldValue pv : sort(fld.getDatasetFieldValues(), DatasetFieldValue.DisplayOrder)) {
            if (settingsService != null && settingsService.isTrueForKey(SettingsServiceBean.Key.ExcludeEmailFromExport, false) && DatasetFieldType.FieldType.EMAIL.equals(pv.getDatasetField().getDatasetFieldType().getFieldType())) {
                continue;
            }
            l.primitiveValue(pv);
        }
    } else if (datasetFieldType.isCompound()) {
        for (DatasetFieldCompoundValue dsfcv : sort(fld.getDatasetFieldCompoundValues(), DatasetFieldCompoundValue.DisplayOrder)) {
            l.startCompoundValue(dsfcv);
            for (DatasetField dsf : sort(dsfcv.getChildDatasetFields(), DatasetField.DisplayOrder)) {
                walk(dsf, settingsService);
            }
            l.endCompoundValue(dsfcv);
        }
    }
    l.endField(fld);
}
Also used : DatasetField(edu.harvard.iq.dataverse.DatasetField) DatasetFieldValue(edu.harvard.iq.dataverse.DatasetFieldValue) DatasetFieldType(edu.harvard.iq.dataverse.DatasetFieldType) DatasetFieldCompoundValue(edu.harvard.iq.dataverse.DatasetFieldCompoundValue) ControlledVocabularyValue(edu.harvard.iq.dataverse.ControlledVocabularyValue)

Aggregations

ControlledVocabularyValue (edu.harvard.iq.dataverse.ControlledVocabularyValue)16 DatasetFieldType (edu.harvard.iq.dataverse.DatasetFieldType)12 DatasetField (edu.harvard.iq.dataverse.DatasetField)7 DatasetFieldCompoundValue (edu.harvard.iq.dataverse.DatasetFieldCompoundValue)5 DatasetFieldValue (edu.harvard.iq.dataverse.DatasetFieldValue)4 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 Before (org.junit.Before)4 LinkedList (java.util.LinkedList)3 Dataverse (edu.harvard.iq.dataverse.Dataverse)2 IOException (java.io.IOException)2 List (java.util.List)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 SolrServerException (org.apache.solr.client.solrj.SolrServerException)2 SolrInputDocument (org.apache.solr.common.SolrInputDocument)2 ControlledVocabAlternate (edu.harvard.iq.dataverse.ControlledVocabAlternate)1 DataFile (edu.harvard.iq.dataverse.DataFile)1 DataFileTag (edu.harvard.iq.dataverse.DataFileTag)1 Dataset (edu.harvard.iq.dataverse.Dataset)1