72 lines
2.7 KiB
Java
72 lines
2.7 KiB
Java
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
|
|
|
import eu.eudat.commons.enums.FieldDataComboBoxType;
|
|
import eu.eudat.commons.enums.FieldDataInternalDmpEntryType;
|
|
import eu.eudat.commons.enums.FieldType;
|
|
import org.w3c.dom.Element;
|
|
import java.util.Map;
|
|
|
|
public class FieldDataHelper {
|
|
public BaseFieldDataEntity<?> create(FieldType type, String subType) {
|
|
switch (type) {
|
|
case COMBO_BOX: {
|
|
if (subType != null && !subType.isBlank()) {
|
|
switch (FieldDataComboBoxType.of(subType)) {
|
|
case Wordlist: {
|
|
return new WordListDataEntity();
|
|
}
|
|
case Autocomplete: {
|
|
return new AutoCompleteDataEntity();
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
case INTERNAL_DMP_ENTRIES: {
|
|
if (subType != null && !subType.isBlank()) {
|
|
switch (FieldDataInternalDmpEntryType.of(subType)){
|
|
case Dmps: {
|
|
return new InternalDmpBaseDataEntity(FieldType.INTERNAL_DMP_ENTRIES_DMPS, FieldDataInternalDmpEntryType.Dmps);
|
|
}
|
|
case Datasets: {
|
|
return new InternalDmpBaseDataEntity(FieldType.INTERNAL_DMP_ENTRIES_DATASETS, FieldDataInternalDmpEntryType.Datasets);
|
|
}
|
|
case Researchers : {
|
|
return new InternalDmpBaseDataEntity(FieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS, FieldDataInternalDmpEntryType.Researchers);
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
case LICENSES:
|
|
case ORGANIZATIONS:
|
|
case PUBLICATIONS:
|
|
case REGISTRIES:
|
|
case RESEARCHERS:
|
|
case SERVICES:
|
|
case TAXONOMIES:
|
|
case DATA_REPOSITORIES:
|
|
case JOURNAL_REPOSITORIES:
|
|
case PUB_REPOSITORIES:
|
|
case BOOLEAN_DECISION: return new LabelAndMultiplicityDataEntity(type);
|
|
|
|
case FREE_TEXT:
|
|
case DATE_PICKER:
|
|
case RICH_TEXT_AREA:
|
|
case TAGS:
|
|
case TEXT_AREA:
|
|
case VALIDATION:
|
|
case DATASET_IDENTIFIER:
|
|
case CURRENCY:
|
|
case CHECK_BOX: return new LabelDataEntity(type);
|
|
|
|
case RADIO_BOX: return new RadioBoxDataEntity();
|
|
case UPLOAD: return new UploadDataEntity();
|
|
case EXTERNAL_DATASETS: return new ExternalDatasetDataEntity();
|
|
default: return null;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|