argos/dmp-backend/core/src/main/java/eu/eudat/commons/types/descriptiontemplate/fielddata/FieldDataHelper.java

70 lines
3.1 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 DmpAutoCompleteDataEntity();
}
case Datasets: {
return new DatasetAutoCompleteDataEntity();
}
case Researchers : {
return new ResearcherAutoCompleteDataEntity();
}
}
}
break;
}
case BOOLEAN_DECISION: return new BooleanDecisionDataEntity();
case RADIO_BOX: return new RadioBoxDataEntity();
case CHECK_BOX: return new CheckBoxDataEntity();
case FREE_TEXT: return new FreeTextDataEntity();
case TEXT_AREA: return new TextAreaDataEntity();
case RICH_TEXT_AREA: return new RichTextAreaDataEntity();
case UPLOAD: return new UploadDataEntity();
case DATE_PICKER: return new DatePickerDataEntity();
case EXTERNAL_DATASETS: return new ExternalDatasetDataEntity();
case DATA_REPOSITORIES: return new DataRepositoryDataEntity();
case PUB_REPOSITORIES: return new PublicationRepositoryDataEntity();
case JOURNAL_REPOSITORIES: return new JournalRepositoryDataEntity();
case TAXONOMIES: return new TaxonomyDataEntity();
case LICENSES: return new LicenseDataEntity();
case PUBLICATIONS: return new PublicationDataEntity();
case REGISTRIES: return new RegistryDataEntity();
case SERVICES: return new ServiceDataEntity();
case TAGS: return new TagDataEntity();
case RESEARCHERS: return new ResearcherDataEntity();
case ORGANIZATIONS: return new OrganizationDataEntity();
case DATASET_IDENTIFIER: return new DatasetIdentifierDataEntity();
case CURRENCY: return new CurrencyDataEntity();
case VALIDATION: return new ValidationDataEntity();
default: return null;
}
return null;
}
}