remove external dataset field
This commit is contained in:
parent
3f8716ab0a
commit
dabbbf3fa4
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -18,7 +18,6 @@ public enum FieldType implements DatabaseEnum<String> {
|
|||
UPLOAD(Names.Upload),
|
||||
DATE_PICKER(Names.DatePicker),
|
||||
TAGS(Names.Tags),
|
||||
EXTERNAL_DATASETS(Names.ExternalDatasets),
|
||||
REFERENCE_TYPES(Names.ReferenceTypes),
|
||||
DATASET_IDENTIFIER(Names.DatasetIdentifier),
|
||||
CURRENCY(Names.Currency),
|
||||
|
@ -42,7 +41,6 @@ public enum FieldType implements DatabaseEnum<String> {
|
|||
public static final String Currency = "currency";
|
||||
public static final String Validation = "validation";
|
||||
public static final String ReferenceTypes = "referenceTypes";
|
||||
public static final String ExternalDatasets = "externalDatasets";
|
||||
}
|
||||
|
||||
FieldType(String value) {
|
||||
|
|
|
@ -26,7 +26,6 @@ public class FieldEntity {
|
|||
@XmlElements({
|
||||
@XmlElement(name = LabelDataEntity.XmlElementName, type = LabelDataEntity.class),
|
||||
@XmlElement(name = LabelAndMultiplicityDataEntity.XmlElementName, type = LabelAndMultiplicityDataEntity.class),
|
||||
@XmlElement(name = ExternalDatasetDataEntity.XmlElementName, type = ExternalDatasetDataEntity.class),
|
||||
@XmlElement(name = UploadDataEntity.XmlElementName, type = UploadDataEntity.class),
|
||||
@XmlElement(name = RadioBoxDataEntity.XmlElementName, type = RadioBoxDataEntity.class),
|
||||
@XmlElement(name = SelectDataEntity.XmlElementName, type = SelectDataEntity.class),
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -36,7 +36,6 @@ public class FieldImportExport {
|
|||
@XmlElements({
|
||||
@XmlElement(name = LabelDataImportExport.XmlElementName, type = LabelDataImportExport.class),
|
||||
@XmlElement(name = LabelAndMultiplicityDataImportExport.XmlElementName, type = LabelAndMultiplicityDataImportExport.class),
|
||||
@XmlElement(name = ExternalDatasetDataImportExport.XmlElementName, type = ExternalDatasetDataImportExport.class),
|
||||
@XmlElement(name = UploadDataImportExport.XmlElementName, type = UploadDataImportExport.class),
|
||||
@XmlElement(name = RadioBoxDataImportExport.XmlElementName, type = RadioBoxDataImportExport.class),
|
||||
@XmlElement(name = SelectDataImportExport.XmlElementName, type = SelectDataImportExport.class),
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -91,7 +91,6 @@ public class DescriptionFieldDepositBuilder extends BaseDepositBuilder<Descripti
|
|||
case RICH_TEXT_AREA -> m.setFieldType(FieldType.RICH_TEXT_AREA);
|
||||
case UPLOAD -> m.setFieldType(FieldType.UPLOAD);
|
||||
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 TAGS -> m.setFieldType(FieldType.TAGS);
|
||||
case DATASET_IDENTIFIER -> m.setFieldType(FieldType.DATASET_IDENTIFIER);
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
|
@ -169,12 +169,12 @@ public class DescriptionTemplateDefinitionFileTransformerBuilder extends BaseFil
|
|||
// ((ExternalSelectDataFileTransformerModel)m).setMultipleSelect(d.getMultipleSelect());
|
||||
// ((ExternalSelectDataFileTransformerModel) m).setSources(convertAutoCompleteSingleData(d.getSources()));
|
||||
// }
|
||||
case ExternalDatasetDataEntity d -> {
|
||||
m = new ExternalDatasetDataFileTransformerModel();
|
||||
m.setLabel(d.getLabel());
|
||||
m.setFieldType(FieldType.of(d.getFieldType().getValue()));
|
||||
((ExternalDatasetDataFileTransformerModel)m).setType(FieldDataExternalDatasetType.of(d.getType().getValue()));
|
||||
}
|
||||
// case ExternalDatasetDataEntity d -> {
|
||||
// m = new ExternalDatasetDataFileTransformerModel();
|
||||
// m.setLabel(d.getLabel());
|
||||
// m.setFieldType(FieldType.of(d.getFieldType().getValue()));
|
||||
// ((ExternalDatasetDataFileTransformerModel)m).setType(FieldDataExternalDatasetType.of(d.getType().getValue()));
|
||||
// }
|
||||
case RadioBoxDataEntity d -> {
|
||||
m = new RadioBoxDataFileTransformerModel();
|
||||
m.setLabel(d.getLabel());
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -26,7 +26,6 @@ import java.util.List;
|
|||
@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.DatePicker),
|
||||
@JsonSubTypes.Type(value = ExternalDatasetDataPersist.class, name = FieldType.Names.ExternalDatasets),
|
||||
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.FreeText),
|
||||
@JsonSubTypes.Type(value = ReferenceTypeDataPersist.class, name = FieldType.Names.ReferenceTypes),
|
||||
@JsonSubTypes.Type(value = RadioBoxDataPersist.class, name = FieldType.Names.RadioBox),
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -41,10 +41,6 @@ public class FieldDataHelperServiceProvider {
|
|||
item = this.applicationContext.getBean(UploadFieldDataHelperService.class);
|
||||
break;
|
||||
}
|
||||
case EXTERNAL_DATASETS: {
|
||||
item = this.applicationContext.getBean(ExternalDatasetFieldDataHelperService.class);
|
||||
break;
|
||||
}
|
||||
case SELECT: {
|
||||
item = this.applicationContext.getBean(SelectFieldDataHelperService.class);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue