2023-10-27 17:46:34 +02:00
|
|
|
package eu.eudat.service.fielddatahelper;
|
|
|
|
|
|
|
|
import eu.eudat.commons.enums.FieldType;
|
|
|
|
import gr.cite.tools.data.builder.Builder;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.context.ApplicationContext;
|
|
|
|
|
|
|
|
public class FieldDataHelperServiceProvider {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private ApplicationContext applicationContext;
|
|
|
|
|
|
|
|
public FieldDataHelperService get(FieldType type){
|
|
|
|
FieldDataHelperService item = null;
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case BOOLEAN_DECISION: {
|
|
|
|
item = this.applicationContext.getBean(BooleanDecisionFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case RADIO_BOX: {
|
|
|
|
item = this.applicationContext.getBean(RadioBoxFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CHECK_BOX: {
|
|
|
|
item = this.applicationContext.getBean(CheckBoxFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case FREE_TEXT: {
|
|
|
|
item = this.applicationContext.getBean(FreeTextFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TEXT_AREA: {
|
|
|
|
item = this.applicationContext.getBean(TextAreaFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case RICH_TEXT_AREA: {
|
|
|
|
item = this.applicationContext.getBean(RichTextAreaDataFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case UPLOAD: {
|
|
|
|
item = this.applicationContext.getBean(UploadFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DATE_PICKER: {
|
|
|
|
item = this.applicationContext.getBean(DatePickerFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EXTERNAL_DATASETS: {
|
|
|
|
item = this.applicationContext.getBean(ExternalDatasetFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
2023-10-30 14:07:59 +01:00
|
|
|
case DATA_REPOSITORIES: {
|
2023-10-27 17:46:34 +02:00
|
|
|
item = this.applicationContext.getBean(DataRepositoryFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
2023-10-30 14:07:59 +01:00
|
|
|
case PUB_REPOSITORIES: {
|
|
|
|
item = this.applicationContext.getBean(PublicationRepositoryFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case JOURNAL_REPOSITORIES: {
|
|
|
|
item = this.applicationContext.getBean(JournalRepositoryFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
2023-10-27 17:46:34 +02:00
|
|
|
case TAXONOMIES: {
|
|
|
|
item = this.applicationContext.getBean(TaxonomyFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case LICENSES: {
|
|
|
|
item = this.applicationContext.getBean(LicenseFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case PUBLICATIONS: {
|
|
|
|
item = this.applicationContext.getBean(PublicationFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case REGISTRIES: {
|
|
|
|
item = this.applicationContext.getBean(RegistryFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SERVICES: {
|
|
|
|
item = this.applicationContext.getBean(ServiceFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TAGS: {
|
|
|
|
item = this.applicationContext.getBean(TagFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case RESEARCHERS: {
|
|
|
|
item = this.applicationContext.getBean(ResearcherFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case ORGANIZATIONS: {
|
|
|
|
item = this.applicationContext.getBean(OrganizationFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DATASET_IDENTIFIER: {
|
|
|
|
item = this.applicationContext.getBean(DatasetIdentifierFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CURRENCY: {
|
|
|
|
item = this.applicationContext.getBean(CurrencyFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case VALIDATION: {
|
|
|
|
item = this.applicationContext.getBean(ValidationFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
2023-10-30 14:07:59 +01:00
|
|
|
case WORD_LIST: {
|
|
|
|
item = this.applicationContext.getBean(ValidationFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AUTO_COMPLETE: {
|
|
|
|
item = this.applicationContext.getBean(AutoCompleteFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case INTERNAL_DMP_ENTRIES_DMPS: {
|
|
|
|
item = this.applicationContext.getBean(DmpAutoCompleteFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case INTERNAL_DMP_ENTRIES_DATASETS: {
|
|
|
|
item = this.applicationContext.getBean(DatasetAutoCompleteFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case INTERNAL_DMP_ENTRIES_RESEARCHERS: {
|
|
|
|
item = this.applicationContext.getBean(ResearcherAutoCompleteFieldDataHelperService.class);
|
|
|
|
break;
|
|
|
|
}
|
2023-10-27 17:46:34 +02:00
|
|
|
default: throw new RuntimeException("unrecognized builder " + type.getValue());
|
|
|
|
}
|
2023-10-30 14:07:59 +01:00
|
|
|
if (item != null && item instanceof FieldDataHelperService) {
|
2023-10-27 17:46:34 +02:00
|
|
|
return item;
|
|
|
|
} else {
|
|
|
|
throw new RuntimeException("unrecognized builder " + type.getValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|