remove external dataset field

This commit is contained in:
Efstratios Giannopoulos 2024-02-23 11:40:40 +02:00
parent 3f8716ab0a
commit dabbbf3fa4
14 changed files with 6 additions and 310 deletions

View File

@ -1,28 +0,0 @@
package eu.eudat.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import eu.eudat.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum FieldDataExternalDatasetType implements DatabaseEnum<String> {
ReusedDataset("reused_dataset"),
ProducedDataset("produced_dataset"),
Other("other");
private final String value;
FieldDataExternalDatasetType(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
private static final Map<String, FieldDataExternalDatasetType> map = EnumUtils.getEnumValueMap(FieldDataExternalDatasetType.class);
public static FieldDataExternalDatasetType of(String i) {
return map.get(i);
}
}

View File

@ -18,7 +18,6 @@ public enum FieldType implements DatabaseEnum<String> {
UPLOAD(Names.Upload), UPLOAD(Names.Upload),
DATE_PICKER(Names.DatePicker), DATE_PICKER(Names.DatePicker),
TAGS(Names.Tags), TAGS(Names.Tags),
EXTERNAL_DATASETS(Names.ExternalDatasets),
REFERENCE_TYPES(Names.ReferenceTypes), REFERENCE_TYPES(Names.ReferenceTypes),
DATASET_IDENTIFIER(Names.DatasetIdentifier), DATASET_IDENTIFIER(Names.DatasetIdentifier),
CURRENCY(Names.Currency), CURRENCY(Names.Currency),
@ -42,7 +41,6 @@ public enum FieldType implements DatabaseEnum<String> {
public static final String Currency = "currency"; public static final String Currency = "currency";
public static final String Validation = "validation"; public static final String Validation = "validation";
public static final String ReferenceTypes = "referenceTypes"; public static final String ReferenceTypes = "referenceTypes";
public static final String ExternalDatasets = "externalDatasets";
} }
FieldType(String value) { FieldType(String value) {

View File

@ -26,7 +26,6 @@ public class FieldEntity {
@XmlElements({ @XmlElements({
@XmlElement(name = LabelDataEntity.XmlElementName, type = LabelDataEntity.class), @XmlElement(name = LabelDataEntity.XmlElementName, type = LabelDataEntity.class),
@XmlElement(name = LabelAndMultiplicityDataEntity.XmlElementName, type = LabelAndMultiplicityDataEntity.class), @XmlElement(name = LabelAndMultiplicityDataEntity.XmlElementName, type = LabelAndMultiplicityDataEntity.class),
@XmlElement(name = ExternalDatasetDataEntity.XmlElementName, type = ExternalDatasetDataEntity.class),
@XmlElement(name = UploadDataEntity.XmlElementName, type = UploadDataEntity.class), @XmlElement(name = UploadDataEntity.XmlElementName, type = UploadDataEntity.class),
@XmlElement(name = RadioBoxDataEntity.XmlElementName, type = RadioBoxDataEntity.class), @XmlElement(name = RadioBoxDataEntity.XmlElementName, type = RadioBoxDataEntity.class),
@XmlElement(name = SelectDataEntity.XmlElementName, type = SelectDataEntity.class), @XmlElement(name = SelectDataEntity.XmlElementName, type = SelectDataEntity.class),

View File

@ -1,27 +0,0 @@
package eu.eudat.commons.types.descriptiontemplate.fielddata;
import eu.eudat.commons.enums.FieldDataExternalDatasetType;
import eu.eudat.commons.enums.FieldType;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.HashMap;
import java.util.Map;
@XmlAccessorType(XmlAccessType.FIELD)
public class ExternalDatasetDataEntity extends LabelAndMultiplicityDataEntity {
public static final String XmlElementName = "externalDatasetsData";
@XmlAttribute(name="type")
private FieldDataExternalDatasetType type;
public FieldDataExternalDatasetType getType() {
return type;
}
public void setType(FieldDataExternalDatasetType type) {
this.type = type;
}
}

View File

@ -36,7 +36,6 @@ public class FieldImportExport {
@XmlElements({ @XmlElements({
@XmlElement(name = LabelDataImportExport.XmlElementName, type = LabelDataImportExport.class), @XmlElement(name = LabelDataImportExport.XmlElementName, type = LabelDataImportExport.class),
@XmlElement(name = LabelAndMultiplicityDataImportExport.XmlElementName, type = LabelAndMultiplicityDataImportExport.class), @XmlElement(name = LabelAndMultiplicityDataImportExport.XmlElementName, type = LabelAndMultiplicityDataImportExport.class),
@XmlElement(name = ExternalDatasetDataImportExport.XmlElementName, type = ExternalDatasetDataImportExport.class),
@XmlElement(name = UploadDataImportExport.XmlElementName, type = UploadDataImportExport.class), @XmlElement(name = UploadDataImportExport.XmlElementName, type = UploadDataImportExport.class),
@XmlElement(name = RadioBoxDataImportExport.XmlElementName, type = RadioBoxDataImportExport.class), @XmlElement(name = RadioBoxDataImportExport.XmlElementName, type = RadioBoxDataImportExport.class),
@XmlElement(name = SelectDataImportExport.XmlElementName, type = SelectDataImportExport.class), @XmlElement(name = SelectDataImportExport.XmlElementName, type = SelectDataImportExport.class),

View File

@ -1,21 +0,0 @@
package eu.eudat.commons.types.descriptiontemplate.importexport.fielddata;
import eu.eudat.commons.enums.FieldDataExternalDatasetType;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
@XmlAccessorType(XmlAccessType.FIELD)
public class ExternalDatasetDataImportExport extends LabelAndMultiplicityDataImportExport {
public static final String XmlElementName = "externalDatasetsData";
@XmlAttribute(name = "type")
private FieldDataExternalDatasetType type;
public FieldDataExternalDatasetType getType() {
return type;
}
public void setType(FieldDataExternalDatasetType type) {
this.type = type;
}
}

View File

@ -91,7 +91,6 @@ public class DescriptionFieldDepositBuilder extends BaseDepositBuilder<Descripti
case RICH_TEXT_AREA -> m.setFieldType(FieldType.RICH_TEXT_AREA); case RICH_TEXT_AREA -> m.setFieldType(FieldType.RICH_TEXT_AREA);
case UPLOAD -> m.setFieldType(FieldType.UPLOAD); case UPLOAD -> m.setFieldType(FieldType.UPLOAD);
case DATE_PICKER -> m.setFieldType(FieldType.DATE_PICKER); case DATE_PICKER -> m.setFieldType(FieldType.DATE_PICKER);
case EXTERNAL_DATASETS -> m.setFieldType(FieldType.EXTERNAL_DATASETS);
// case REFERENCE_TYPES -> m.setFieldType(FieldType.REFERENCE_TYPES); //TODO new reference logic // case REFERENCE_TYPES -> m.setFieldType(FieldType.REFERENCE_TYPES); //TODO new reference logic
case TAGS -> m.setFieldType(FieldType.TAGS); case TAGS -> m.setFieldType(FieldType.TAGS);
case DATASET_IDENTIFIER -> m.setFieldType(FieldType.DATASET_IDENTIFIER); case DATASET_IDENTIFIER -> m.setFieldType(FieldType.DATASET_IDENTIFIER);

View File

@ -1,31 +0,0 @@
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalDatasetDataEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ExternalDatasetData;
import gr.cite.tools.fieldset.FieldSet;
import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ExternalDatasetDataBuilder extends BaseFieldDataBuilder<ExternalDatasetData, ExternalDatasetDataEntity> {
@Autowired
public ExternalDatasetDataBuilder(ConventionService conventionService) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(ExternalDatasetDataBuilder.class)));
}
protected ExternalDatasetData getInstance() {
return new ExternalDatasetData();
}
@Override
protected void buildChild(FieldSet fields, ExternalDatasetDataEntity d, ExternalDatasetData m) {
if (fields.hasField(this.asIndexer(ExternalDatasetData._multipleSelect))) m.setMultipleSelect(d.getMultipleSelect());
if (fields.hasField(this.asIndexer(ExternalDatasetData._type))) m.setType(d.getType());
}
}

View File

@ -169,12 +169,12 @@ public class DescriptionTemplateDefinitionFileTransformerBuilder extends BaseFil
// ((ExternalSelectDataFileTransformerModel)m).setMultipleSelect(d.getMultipleSelect()); // ((ExternalSelectDataFileTransformerModel)m).setMultipleSelect(d.getMultipleSelect());
// ((ExternalSelectDataFileTransformerModel) m).setSources(convertAutoCompleteSingleData(d.getSources())); // ((ExternalSelectDataFileTransformerModel) m).setSources(convertAutoCompleteSingleData(d.getSources()));
// } // }
case ExternalDatasetDataEntity d -> { // case ExternalDatasetDataEntity d -> {
m = new ExternalDatasetDataFileTransformerModel(); // m = new ExternalDatasetDataFileTransformerModel();
m.setLabel(d.getLabel()); // m.setLabel(d.getLabel());
m.setFieldType(FieldType.of(d.getFieldType().getValue())); // m.setFieldType(FieldType.of(d.getFieldType().getValue()));
((ExternalDatasetDataFileTransformerModel)m).setType(FieldDataExternalDatasetType.of(d.getType().getValue())); // ((ExternalDatasetDataFileTransformerModel)m).setType(FieldDataExternalDatasetType.of(d.getType().getValue()));
} // }
case RadioBoxDataEntity d -> { case RadioBoxDataEntity d -> {
m = new RadioBoxDataFileTransformerModel(); m = new RadioBoxDataFileTransformerModel();
m.setLabel(d.getLabel()); m.setLabel(d.getLabel());

View File

@ -1,17 +0,0 @@
package eu.eudat.model.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.enums.FieldDataExternalDatasetType;
public class ExternalDatasetData extends LabelAndMultiplicityData {
public final static String _type = "type";
private FieldDataExternalDatasetType type;
public FieldDataExternalDatasetType getType() {
return type;
}
public void setType(FieldDataExternalDatasetType type) {
this.type = type;
}
}

View File

@ -26,7 +26,6 @@ import java.util.List;
@JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.InternalEntitiesDmps), @JsonSubTypes.Type(value = LabelAndMultiplicityDataPersist.class, name = FieldType.Names.InternalEntitiesDmps),
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.CheckBox), @JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.CheckBox),
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.DatePicker), @JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.DatePicker),
@JsonSubTypes.Type(value = ExternalDatasetDataPersist.class, name = FieldType.Names.ExternalDatasets),
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.FreeText), @JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.FreeText),
@JsonSubTypes.Type(value = ReferenceTypeDataPersist.class, name = FieldType.Names.ReferenceTypes), @JsonSubTypes.Type(value = ReferenceTypeDataPersist.class, name = FieldType.Names.ReferenceTypes),
@JsonSubTypes.Type(value = RadioBoxDataPersist.class, name = FieldType.Names.RadioBox), @JsonSubTypes.Type(value = RadioBoxDataPersist.class, name = FieldType.Names.RadioBox),

View File

@ -1,69 +0,0 @@
package eu.eudat.model.persist.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.enums.FieldDataExternalDatasetType;
import gr.cite.tools.validation.specification.Specification;
import eu.eudat.convention.ConventionService;
import eu.eudat.errorcode.ErrorThesaurusProperties;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Scope;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
public class ExternalDatasetDataPersist extends BaseFieldDataPersist {
private Boolean multipleSelect = null;
public static final String _multipleSelect = "multipleSelect";
private FieldDataExternalDatasetType type;
public static final String _type = "type";
public Boolean getMultipleSelect() {
return multipleSelect;
}
public void setMultipleSelect(Boolean multipleSelect) {
this.multipleSelect = multipleSelect;
}
public FieldDataExternalDatasetType getType() {
return type;
}
public void setType(FieldDataExternalDatasetType type) {
this.type = type;
}
@Component(ExternalDatasetDataPersist.ExternalDatasetDataPersistValidator.ValidatorName)
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public static class ExternalDatasetDataPersistValidator extends BaseFieldDataPersistValidator<ExternalDatasetDataPersist> {
public static final String ValidatorName = "DescriptionTemplate.ExternalDatasetDataPersistValidator";
protected ExternalDatasetDataPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource) {
super(conventionService, errors, messageSource);
}
@Override
protected Class<ExternalDatasetDataPersist> modelClass() {
return ExternalDatasetDataPersist.class;
}
@Override
protected List<Specification> specifications(ExternalDatasetDataPersist item) {
List<Specification> specifications = getBaseSpecifications(item);
specifications.addAll(Arrays.asList(
this.spec()
.must(() -> !this.isNull(item.getMultipleSelect()))
.failOn(ExternalDatasetDataPersist._multipleSelect).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalDatasetDataPersist._multipleSelect}, LocaleContextHolder.getLocale()))
));
return specifications;
}
}
}

View File

@ -1,101 +0,0 @@
package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalDatasetDataEntity;
import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.ExternalDatasetDataImportExport;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.ExternalDatasetDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ExternalDatasetData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.ExternalDatasetDataPersist;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet;
import gr.cite.tools.validation.Validator;
import gr.cite.tools.validation.ValidatorFactory;
import org.springframework.stereotype.Component;
import java.util.EnumSet;
import java.util.List;
@Component
public class ExternalDatasetFieldDataHelperService extends BaseFieldDataHelperService<ExternalDatasetData, ExternalDatasetDataPersist, ExternalDatasetDataEntity, ExternalDatasetDataImportExport> {
private final BuilderFactory builderFactory;
private final ValidatorFactory validatorFactory;
public ExternalDatasetFieldDataHelperService(BuilderFactory builderFactory, ValidatorFactory validatorFactory) {
this.builderFactory = builderFactory;
this.validatorFactory = validatorFactory;
}
@Override
public ExternalDatasetDataEntity newDataInstanceInternal() {
return new ExternalDatasetDataEntity();
}
@Override
public ExternalDatasetData newModelInstanceInternal() {
return new ExternalDatasetData();
}
@Override
public ExternalDatasetDataPersist newPersistModelInstanceInternal() {
return new ExternalDatasetDataPersist();
}
@Override
protected ExternalDatasetDataImportExport newImportExportInstanceInternal() {
return new ExternalDatasetDataImportExport();
}
@Override
public Class<?> getDataClass() {
return ExternalDatasetDataEntity.class;
}
@Override
public Class<?> getModelClass() {
return ExternalDatasetData.class;
}
@Override
public Class<?> getPersistModelClass() {
return ExternalDatasetDataPersist.class;
}
@Override
public Class<?> getImportExportClass() {
return ExternalDatasetDataImportExport.class;
}
@Override
public Validator getPersistModelValidator() {
return this.validatorFactory.validator(ExternalDatasetDataPersist.ExternalDatasetDataPersistValidator.class);
}
@Override
public List<ExternalDatasetData> buildInternal(FieldSet fieldSet, List<ExternalDatasetDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(ExternalDatasetDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override
protected ExternalDatasetDataEntity applyPersistInternal(ExternalDatasetDataPersist persist, ExternalDatasetDataEntity data) {
data.setMultipleSelect(persist.getMultipleSelect());
data.setType(persist.getType());
return data;
}
@Override
protected ExternalDatasetDataPersist importExportMapDataToPersistInternal(ExternalDatasetDataImportExport data, ExternalDatasetDataPersist persist) {
persist.setMultipleSelect(data.getMultipleSelect());
persist.setType(data.getType());
return persist;
}
@Override
protected ExternalDatasetDataImportExport dataToImportExportXmlInternal(ExternalDatasetDataEntity data, ExternalDatasetDataImportExport xml) {
xml.setMultipleSelect(data.getMultipleSelect());
xml.setType(data.getType());
return xml;
}
@Override
protected boolean isMultiValueInternal(ExternalDatasetDataEntity data) {
return data.getMultipleSelect();
}
}

View File

@ -41,10 +41,6 @@ public class FieldDataHelperServiceProvider {
item = this.applicationContext.getBean(UploadFieldDataHelperService.class); item = this.applicationContext.getBean(UploadFieldDataHelperService.class);
break; break;
} }
case EXTERNAL_DATASETS: {
item = this.applicationContext.getBean(ExternalDatasetFieldDataHelperService.class);
break;
}
case SELECT: { case SELECT: {
item = this.applicationContext.getBean(SelectFieldDataHelperService.class); item = this.applicationContext.getBean(SelectFieldDataHelperService.class);
break; break;