prefilling source defintion classes

This commit is contained in:
Diamantis Tziotzios 2024-02-23 10:32:18 +02:00
parent fdf8e13af9
commit 3f8716ab0a
29 changed files with 160 additions and 95 deletions

View File

@ -1,4 +1,4 @@
package eu.eudat.commons.types.referencetype;
package eu.eudat.commons.types.externalfetcher;
import eu.eudat.commons.enums.ReferenceTypeExternalApiHTTPMethodType;
import eu.eudat.service.remotefetcher.config.entities.AuthenticationConfiguration;

View File

@ -1,4 +1,4 @@
package eu.eudat.commons.types.referencetype;
package eu.eudat.commons.types.externalfetcher;
import eu.eudat.commons.enums.ReferenceTypeExternalApiHTTPMethodType;
@ -7,7 +7,7 @@ import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
public class ReferenceTypeSourceExternalApiConfigurationEntity extends ReferenceTypeSourceBaseConfigurationEntity implements SourceExternalApiConfiguration<ResultsConfigurationEntity, AuthenticationConfigurationEntity, QueryConfigEntity> {
public class ExternalFetcherApiSourceConfigurationEntity extends ExternalFetcherBaseSourceConfigurationEntity implements SourceExternalApiConfiguration<ResultsConfigurationEntity, AuthenticationConfigurationEntity, QueryConfigEntity> {
private String url;
private ResultsConfigurationEntity results;

View File

@ -1,4 +1,4 @@
package eu.eudat.commons.types.referencetype;
package eu.eudat.commons.types.externalfetcher;
import eu.eudat.commons.enums.ReferenceTypeSourceType;
import eu.eudat.service.remotefetcher.config.entities.SourceBaseConfiguration;
@ -8,7 +8,7 @@ import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
import java.util.UUID;
public abstract class ReferenceTypeSourceBaseConfigurationEntity implements SourceBaseConfiguration {
public abstract class ExternalFetcherBaseSourceConfigurationEntity implements SourceBaseConfiguration {
private String key;

View File

@ -0,0 +1,22 @@
package eu.eudat.commons.types.externalfetcher;
import eu.eudat.service.remotefetcher.config.entities.SourceStaticOptionConfiguration;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
public class ExternalFetcherStaticOptionSourceConfigurationEntity extends ExternalFetcherBaseSourceConfigurationEntity implements SourceStaticOptionConfiguration<StaticOptionEntity> {
List<StaticOptionEntity> options;
public List<StaticOptionEntity> getOptions() {
return options;
}
@XmlElementWrapper
@XmlElement(name = "option")
public void setOptions(List<StaticOptionEntity> options) {
this.options = options;
}
}

View File

@ -1,4 +1,4 @@
package eu.eudat.commons.types.referencetype;
package eu.eudat.commons.types.externalfetcher;
import eu.eudat.service.remotefetcher.config.entities.QueryCaseConfig;
import jakarta.xml.bind.annotation.XmlElement;

View File

@ -1,12 +1,10 @@
package eu.eudat.commons.types.referencetype;
package eu.eudat.commons.types.externalfetcher;
import eu.eudat.service.remotefetcher.config.entities.QueryCaseConfig;
import eu.eudat.service.remotefetcher.config.entities.QueryConfig;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
import java.util.UUID;
public class QueryConfigEntity implements QueryConfig<QueryCaseConfigEntity> {

View File

@ -1,4 +1,4 @@
package eu.eudat.commons.types.referencetype;
package eu.eudat.commons.types.externalfetcher;
import eu.eudat.service.remotefetcher.config.entities.ResultFieldsMappingConfiguration;
import jakarta.xml.bind.annotation.XmlElement;

View File

@ -1,5 +1,6 @@
package eu.eudat.commons.types.referencetype;
package eu.eudat.commons.types.externalfetcher;
import eu.eudat.commons.types.externalfetcher.ResultFieldsMappingConfigurationEntity;
import eu.eudat.service.remotefetcher.config.entities.ResultsConfiguration;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;

View File

@ -1,9 +1,9 @@
package eu.eudat.commons.types.referencetype;
package eu.eudat.commons.types.externalfetcher;
import eu.eudat.service.remotefetcher.config.entities.StaticOption;
import jakarta.xml.bind.annotation.XmlElement;
public class ReferenceTypeStaticOptionEntity implements StaticOption {
public class StaticOptionEntity implements StaticOption {
private String code;

View File

@ -1,4 +1,4 @@
package eu.eudat.commons.types.prefilling;
package eu.eudat.commons.types.prefillingsource;
import eu.eudat.commons.JsonHandlingService;

View File

@ -0,0 +1,35 @@
package eu.eudat.commons.types.prefillingsource;
import eu.eudat.model.referencetypedefinition.ReferenceTypeSourceExternalApiConfiguration;
import java.util.List;
public class PrefillingSourceDefinition {
private ReferenceTypeSourceExternalApiConfiguration searchConfiguration;
private ReferenceTypeSourceExternalApiConfiguration getConfiguration;
private List<PrefillingSourceDefinitionField> fields;
public ReferenceTypeSourceExternalApiConfiguration getSearchConfiguration() {
return searchConfiguration;
}
public void setSearchConfiguration(ReferenceTypeSourceExternalApiConfiguration searchConfiguration) {
this.searchConfiguration = searchConfiguration;
}
public ReferenceTypeSourceExternalApiConfiguration getGetConfiguration() {
return getConfiguration;
}
public void setGetConfiguration(ReferenceTypeSourceExternalApiConfiguration getConfiguration) {
this.getConfiguration = getConfiguration;
}
public List<PrefillingSourceDefinitionField> getFields() {
return fields;
}
public void setFields(List<PrefillingSourceDefinitionField> fields) {
this.fields = fields;
}
}

View File

@ -0,0 +1,49 @@
package eu.eudat.commons.types.prefillingsource;
public class PrefillingSourceDefinitionField {
private String code;
private String systemFieldTarget;
private String semanticTarget;
private String trimRegex;
private String fixedValue;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getSystemFieldTarget() {
return systemFieldTarget;
}
public void setSystemFieldTarget(String systemFieldTarget) {
this.systemFieldTarget = systemFieldTarget;
}
public String getSemanticTarget() {
return semanticTarget;
}
public void setSemanticTarget(String semanticTarget) {
this.semanticTarget = semanticTarget;
}
public String getTrimRegex() {
return trimRegex;
}
public void setTrimRegex(String trimRegex) {
this.trimRegex = trimRegex;
}
public String getFixedValue() {
return fixedValue;
}
public void setFixedValue(String fixedValue) {
this.fixedValue = fixedValue;
}
}

View File

@ -1,8 +1,9 @@
package eu.eudat.commons.types.referencetype;
import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.enums.ReferenceTypeSourceType;
import eu.eudat.commons.types.descriptiontemplate.importexport.fielddata.*;
import eu.eudat.commons.types.externalfetcher.ExternalFetcherBaseSourceConfigurationEntity;
import eu.eudat.commons.types.externalfetcher.ExternalFetcherApiSourceConfigurationEntity;
import eu.eudat.commons.types.externalfetcher.ExternalFetcherStaticOptionSourceConfigurationEntity;
import jakarta.xml.bind.annotation.*;
import java.util.List;
@ -16,10 +17,10 @@ public class ReferenceTypeDefinitionEntity {
@XmlElementWrapper(name = "sources")
@XmlElements({
@XmlElement(name = ReferenceTypeSourceType.Names.API, type = ReferenceTypeSourceExternalApiConfigurationEntity.class),
@XmlElement(name = ReferenceTypeSourceType.Names.STATIC, type = ReferenceTypeSourceStaticOptionConfigurationEntity.class),
@XmlElement(name = ReferenceTypeSourceType.Names.API, type = ExternalFetcherApiSourceConfigurationEntity.class),
@XmlElement(name = ReferenceTypeSourceType.Names.STATIC, type = ExternalFetcherStaticOptionSourceConfigurationEntity.class),
})
private List<ReferenceTypeSourceBaseConfigurationEntity> sources;
private List<ExternalFetcherBaseSourceConfigurationEntity> sources;
public List<ReferenceTypeFieldEntity> getFields() {
return fields;
@ -29,11 +30,11 @@ public class ReferenceTypeDefinitionEntity {
this.fields = fields;
}
public List<ReferenceTypeSourceBaseConfigurationEntity> getSources() {
public List<ExternalFetcherBaseSourceConfigurationEntity> getSources() {
return sources;
}
public void setSources(List<ReferenceTypeSourceBaseConfigurationEntity> sources) {
public void setSources(List<ExternalFetcherBaseSourceConfigurationEntity> sources) {
this.sources = sources;
}
}

View File

@ -1,22 +0,0 @@
package eu.eudat.commons.types.referencetype;
import eu.eudat.service.remotefetcher.config.entities.SourceStaticOptionConfiguration;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElementWrapper;
import java.util.List;
public class ReferenceTypeSourceStaticOptionConfigurationEntity extends ReferenceTypeSourceBaseConfigurationEntity implements SourceStaticOptionConfiguration<ReferenceTypeStaticOptionEntity> {
List<ReferenceTypeStaticOptionEntity> options;
public List<ReferenceTypeStaticOptionEntity> getOptions() {
return options;
}
@XmlElementWrapper
@XmlElement(name = "option")
public void setOptions(List<ReferenceTypeStaticOptionEntity> options) {
this.options = options;
}
}

View File

@ -1,11 +1,9 @@
package eu.eudat.model.builder;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.ContactInfoType;
import eu.eudat.commons.types.prefilling.PrefillingEntity;
import eu.eudat.commons.types.prefillingsource.PrefillingEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.UserEntity;
import eu.eudat.model.DmpAssociatedUser;
import eu.eudat.model.Prefilling;
import eu.eudat.model.User;
import eu.eudat.model.UserContactInfo;

View File

@ -1,15 +1,10 @@
package eu.eudat.model.builder.referencetypedefinition;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.authorization.Permission;
import eu.eudat.commons.types.referencetype.AuthenticationConfigurationEntity;
import eu.eudat.commons.types.referencetype.QueryConfigEntity;
import eu.eudat.commons.types.externalfetcher.AuthenticationConfigurationEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.builder.BaseBuilder;
import eu.eudat.model.referencetypedefinition.AuthenticationConfiguration;
import eu.eudat.model.referencetypedefinition.QueryConfig;
import gr.cite.commons.web.authz.service.AuthorizationService;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.fieldset.FieldSet;
import gr.cite.tools.logging.DataLogEntry;

View File

@ -1,7 +1,7 @@
package eu.eudat.model.builder.referencetypedefinition;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.types.referencetype.QueryCaseConfigEntity;
import eu.eudat.commons.types.externalfetcher.QueryCaseConfigEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.ReferenceType;
import eu.eudat.model.builder.BaseBuilder;

View File

@ -1,7 +1,7 @@
package eu.eudat.model.builder.referencetypedefinition;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.types.referencetype.QueryConfigEntity;
import eu.eudat.commons.types.externalfetcher.QueryConfigEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.builder.BaseBuilder;
import eu.eudat.model.referencetypedefinition.QueryConfig;

View File

@ -3,8 +3,8 @@ package eu.eudat.model.builder.referencetypedefinition;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.ReferenceTypeSourceType;
import eu.eudat.commons.types.referencetype.ReferenceTypeDefinitionEntity;
import eu.eudat.commons.types.referencetype.ReferenceTypeSourceExternalApiConfigurationEntity;
import eu.eudat.commons.types.referencetype.ReferenceTypeSourceStaticOptionConfigurationEntity;
import eu.eudat.commons.types.externalfetcher.ExternalFetcherApiSourceConfigurationEntity;
import eu.eudat.commons.types.externalfetcher.ExternalFetcherStaticOptionSourceConfigurationEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.builder.BaseBuilder;
import eu.eudat.model.referencetypedefinition.ReferenceTypeDefinition;
@ -56,8 +56,8 @@ public class ReferenceTypeDefinitionBuilder extends BaseBuilder<ReferenceTypeDef
ReferenceTypeDefinition m = new ReferenceTypeDefinition();
if (!fieldsFields.isEmpty() && d.getFields() != null) m.setFields(this.builderFactory.builder(ReferenceTypeFieldBuilder.class).authorize(this.authorize).build(fieldsFields, d.getFields()));
if (!sourcesFields.isEmpty() && d.getSources() != null) {
List<ReferenceTypeSourceExternalApiConfigurationEntity> externalApiConfigEntities = d.getSources().stream().filter(x-> ReferenceTypeSourceType.API.equals(x.getType())).map(x-> (ReferenceTypeSourceExternalApiConfigurationEntity)x).toList();
List<ReferenceTypeSourceStaticOptionConfigurationEntity> staticOptionConfigEntities = d.getSources().stream().filter(x-> ReferenceTypeSourceType.STATIC.equals(x.getType())).map(x-> (ReferenceTypeSourceStaticOptionConfigurationEntity)x).toList();
List<ExternalFetcherApiSourceConfigurationEntity> externalApiConfigEntities = d.getSources().stream().filter(x-> ReferenceTypeSourceType.API.equals(x.getType())).map(x-> (ExternalFetcherApiSourceConfigurationEntity)x).toList();
List<ExternalFetcherStaticOptionSourceConfigurationEntity> staticOptionConfigEntities = d.getSources().stream().filter(x-> ReferenceTypeSourceType.STATIC.equals(x.getType())).map(x-> (ExternalFetcherStaticOptionSourceConfigurationEntity)x).toList();
m.setSources(new ArrayList<>());
m.getSources().addAll(this.builderFactory.builder(ReferenceTypeSourceExternalApiConfigurationBuilder.class).authorize(this.authorize).build(sourcesFields, externalApiConfigEntities));
m.getSources().addAll(this.builderFactory.builder(ReferenceTypeSourceStaticOptionConfigurationBuilder.class).authorize(this.authorize).build(sourcesFields, staticOptionConfigEntities));

View File

@ -1,10 +1,8 @@
package eu.eudat.model.builder.referencetypedefinition;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.types.referencetype.ReferenceTypeSourceBaseConfigurationEntity;
import eu.eudat.commons.types.externalfetcher.ExternalFetcherBaseSourceConfigurationEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.ReferenceEntity;
import eu.eudat.model.Reference;
import eu.eudat.model.ReferenceType;
import eu.eudat.model.builder.BaseBuilder;
import eu.eudat.model.builder.ReferenceTypeBuilder;
@ -27,7 +25,7 @@ import java.util.stream.Collectors;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public abstract class ReferenceTypeSourceBaseConfigurationBuilder<Model extends ReferenceTypeSourceBaseConfiguration, Entity extends ReferenceTypeSourceBaseConfigurationEntity> extends BaseBuilder<Model, Entity> {
public abstract class ReferenceTypeSourceBaseConfigurationBuilder<Model extends ReferenceTypeSourceBaseConfiguration, Entity extends ExternalFetcherBaseSourceConfigurationEntity> extends BaseBuilder<Model, Entity> {
protected EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
protected final BuilderFactory builderFactory;
@ -90,7 +88,7 @@ public abstract class ReferenceTypeSourceBaseConfigurationBuilder<Model extends
Map<UUID, ReferenceType> itemMap;
if (!fields.hasOtherField(this.asIndexer(ReferenceType._id))) {
itemMap = this.asEmpty(
data.stream().filter(x-> x.getReferenceTypeDependencyIds() != null).map(ReferenceTypeSourceBaseConfigurationEntity::getReferenceTypeDependencyIds).flatMap(List::stream).distinct().collect(Collectors.toList()),
data.stream().filter(x-> x.getReferenceTypeDependencyIds() != null).map(ExternalFetcherBaseSourceConfigurationEntity::getReferenceTypeDependencyIds).flatMap(List::stream).distinct().collect(Collectors.toList()),
x -> {
ReferenceType item = new ReferenceType();
item.setId(x);
@ -99,7 +97,7 @@ public abstract class ReferenceTypeSourceBaseConfigurationBuilder<Model extends
ReferenceType::getId);
} else {
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(ReferenceType._id);
ReferenceTypeQuery q = this.queryFactory.query(ReferenceTypeQuery.class).authorize(this.authorize).ids(data.stream().filter(x-> x.getReferenceTypeDependencyIds() != null).map(ReferenceTypeSourceBaseConfigurationEntity::getReferenceTypeDependencyIds).flatMap(List::stream).distinct().collect(Collectors.toList()));
ReferenceTypeQuery q = this.queryFactory.query(ReferenceTypeQuery.class).authorize(this.authorize).ids(data.stream().filter(x-> x.getReferenceTypeDependencyIds() != null).map(ExternalFetcherBaseSourceConfigurationEntity::getReferenceTypeDependencyIds).flatMap(List::stream).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(ReferenceTypeBuilder.class).authorize(this.authorize).asForeignKey(q, clone, ReferenceType::getId);
}
if (!fields.hasField(ReferenceType._id)) {

View File

@ -2,7 +2,7 @@ package eu.eudat.model.builder.referencetypedefinition;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.authorization.Permission;
import eu.eudat.commons.types.referencetype.ReferenceTypeSourceExternalApiConfigurationEntity;
import eu.eudat.commons.types.externalfetcher.ExternalFetcherApiSourceConfigurationEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.referencetypedefinition.ReferenceTypeSourceExternalApiConfiguration;
import gr.cite.commons.web.authz.service.AuthorizationService;
@ -20,7 +20,7 @@ import java.util.*;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ReferenceTypeSourceExternalApiConfigurationBuilder extends ReferenceTypeSourceBaseConfigurationBuilder<ReferenceTypeSourceExternalApiConfiguration, ReferenceTypeSourceExternalApiConfigurationEntity> {
public class ReferenceTypeSourceExternalApiConfigurationBuilder extends ReferenceTypeSourceBaseConfigurationBuilder<ReferenceTypeSourceExternalApiConfiguration, ExternalFetcherApiSourceConfigurationEntity> {
private final BuilderFactory builderFactory;
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
@ -41,7 +41,7 @@ public class ReferenceTypeSourceExternalApiConfigurationBuilder extends Referenc
}
@Override
protected ReferenceTypeSourceExternalApiConfiguration buildChild(FieldSet fields, ReferenceTypeSourceExternalApiConfigurationEntity d, ReferenceTypeSourceExternalApiConfiguration m) {
protected ReferenceTypeSourceExternalApiConfiguration buildChild(FieldSet fields, ExternalFetcherApiSourceConfigurationEntity d, ReferenceTypeSourceExternalApiConfiguration m) {
FieldSet resultsFields = fields.extractPrefixed(this.asPrefix(ReferenceTypeSourceExternalApiConfiguration._results));
FieldSet authFields = fields.extractPrefixed(this.asPrefix(ReferenceTypeSourceExternalApiConfiguration._auth));
FieldSet queriesFields = fields.extractPrefixed(this.asPrefix(ReferenceTypeSourceExternalApiConfiguration._queries));

View File

@ -2,7 +2,7 @@ package eu.eudat.model.builder.referencetypedefinition;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.authorization.Permission;
import eu.eudat.commons.types.referencetype.ReferenceTypeSourceStaticOptionConfigurationEntity;
import eu.eudat.commons.types.externalfetcher.ExternalFetcherStaticOptionSourceConfigurationEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.referencetypedefinition.ReferenceTypeSourceStaticOptionConfiguration;
import gr.cite.commons.web.authz.service.AuthorizationService;
@ -20,7 +20,7 @@ import java.util.EnumSet;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ReferenceTypeSourceStaticOptionConfigurationBuilder extends ReferenceTypeSourceBaseConfigurationBuilder<ReferenceTypeSourceStaticOptionConfiguration, ReferenceTypeSourceStaticOptionConfigurationEntity> {
public class ReferenceTypeSourceStaticOptionConfigurationBuilder extends ReferenceTypeSourceBaseConfigurationBuilder<ReferenceTypeSourceStaticOptionConfiguration, ExternalFetcherStaticOptionSourceConfigurationEntity> {
private final BuilderFactory builderFactory;
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
@ -41,7 +41,7 @@ public class ReferenceTypeSourceStaticOptionConfigurationBuilder extends Referen
}
@Override
protected ReferenceTypeSourceStaticOptionConfiguration buildChild(FieldSet fields, ReferenceTypeSourceStaticOptionConfigurationEntity d, ReferenceTypeSourceStaticOptionConfiguration m) {
protected ReferenceTypeSourceStaticOptionConfiguration buildChild(FieldSet fields, ExternalFetcherStaticOptionSourceConfigurationEntity d, ReferenceTypeSourceStaticOptionConfiguration m) {
FieldSet optionsFields = fields.extractPrefixed(this.asPrefix(ReferenceTypeSourceStaticOptionConfiguration._options));
if(!authorizationService.authorize(Permission.EditReferenceType)) return m;

View File

@ -1,7 +1,7 @@
package eu.eudat.model.builder.referencetypedefinition;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.types.referencetype.ReferenceTypeStaticOptionEntity;
import eu.eudat.commons.types.externalfetcher.StaticOptionEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.builder.BaseBuilder;
import eu.eudat.model.referencetypedefinition.ReferenceTypeStaticOption;
@ -19,7 +19,7 @@ import java.util.*;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ReferenceTypeStaticOptionBuilder extends BaseBuilder<ReferenceTypeStaticOption, ReferenceTypeStaticOptionEntity> {
public class ReferenceTypeStaticOptionBuilder extends BaseBuilder<ReferenceTypeStaticOption, StaticOptionEntity> {
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
@ -34,14 +34,14 @@ public class ReferenceTypeStaticOptionBuilder extends BaseBuilder<ReferenceTypeS
}
@Override
public List<ReferenceTypeStaticOption> build(FieldSet fields, List<ReferenceTypeStaticOptionEntity> data) throws MyApplicationException {
public List<ReferenceTypeStaticOption> build(FieldSet fields, List<StaticOptionEntity> data) throws MyApplicationException {
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
this.logger.trace(new DataLogEntry("requested fields", fields));
if (fields == null || data == null || fields.isEmpty())
return new ArrayList<>();
List<ReferenceTypeStaticOption> models = new ArrayList<>();
for (ReferenceTypeStaticOptionEntity d : data) {
for (StaticOptionEntity d : data) {
ReferenceTypeStaticOption m = new ReferenceTypeStaticOption();
if (fields.hasField(this.asIndexer(ReferenceTypeStaticOption._code))) m.setCode(d.getCode());
if (fields.hasField(this.asIndexer(ReferenceTypeStaticOption._value))) m.setValue(d.getValue());

View File

@ -1,7 +1,7 @@
package eu.eudat.model.builder.referencetypedefinition;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.types.referencetype.ResultFieldsMappingConfigurationEntity;
import eu.eudat.commons.types.externalfetcher.ResultFieldsMappingConfigurationEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.builder.BaseBuilder;
import eu.eudat.model.referencetypedefinition.ResultFieldsMappingConfiguration;

View File

@ -1,7 +1,7 @@
package eu.eudat.model.builder.referencetypedefinition;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.types.referencetype.ResultsConfigurationEntity;
import eu.eudat.commons.types.externalfetcher.ResultsConfigurationEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.builder.BaseBuilder;
import eu.eudat.model.referencetypedefinition.ResultsConfiguration;

View File

@ -1,11 +1,6 @@
package eu.eudat.model.persist.referencetypedefinition;
import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.referencetype.QueryCaseConfigEntity;
import eu.eudat.commons.validation.BaseValidator;
import eu.eudat.model.persist.ReferencePersist;
import eu.eudat.model.persist.descriptionproperties.FieldPersist;
import gr.cite.tools.validation.ValidatorFactory;
import gr.cite.tools.validation.specification.Specification;
import eu.eudat.convention.ConventionService;
import eu.eudat.errorcode.ErrorThesaurusProperties;

View File

@ -1,11 +1,8 @@
package eu.eudat.model.referencetypedefinition;
import eu.eudat.commons.types.referencetype.QueryCaseConfigEntity;
import eu.eudat.model.ReferenceType;
import java.util.List;
public class QueryCaseConfig {
public final static String _likePattern = "likePattern";

View File

@ -3,11 +3,10 @@ package eu.eudat.service.prefilling;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.JsonHandlingService;
import eu.eudat.commons.XmlHandlingService;
import eu.eudat.commons.types.descriptiontemplate.FieldEntity;
import eu.eudat.commons.types.descriptiontemplate.FieldSetEntity;
import eu.eudat.commons.types.prefilling.PrefillingEntity;
import eu.eudat.commons.types.prefillingsource.PrefillingEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.DescriptionTemplateEntity;
import eu.eudat.model.*;
@ -20,11 +19,9 @@ import eu.eudat.model.descriptionproperties.PropertyDefinitionFieldSetItem;
import eu.eudat.model.persist.DescriptionProfilingRequest;
import eu.eudat.model.persist.DescriptionProfilingWithDataRequest;
import eu.eudat.service.remotefetcher.ExternalUrlConfigProvider;
import eu.eudat.service.remotefetcher.RemoteFetcherService;
import eu.eudat.service.remotefetcher.config.entities.*;
import eu.eudat.service.remotefetcher.criteria.ExternalReferenceCriteria;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.exception.MyNotFoundException;
import gr.cite.tools.fieldset.BaseFieldSet;

View File

@ -5,6 +5,7 @@ import eu.eudat.authorization.Permission;
import eu.eudat.commons.XmlHandlingService;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.commons.enums.ReferenceTypeSourceType;
import eu.eudat.commons.types.externalfetcher.*;
import eu.eudat.commons.types.referencetype.*;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.ReferenceTypeEntity;
@ -134,13 +135,13 @@ public class ReferenceTypeServiceImpl implements ReferenceTypeService {
return data;
}
private @NotNull ReferenceTypeSourceBaseConfigurationEntity buildSourceBaseConfigEntity(ReferenceTypeSourceBaseConfigurationPersist persist){
if (persist == null) return new ReferenceTypeSourceExternalApiConfigurationEntity();
private @NotNull ExternalFetcherBaseSourceConfigurationEntity buildSourceBaseConfigEntity(ReferenceTypeSourceBaseConfigurationPersist persist){
if (persist == null) return new ExternalFetcherApiSourceConfigurationEntity();
ReferenceTypeSourceBaseConfigurationEntity data;
ExternalFetcherBaseSourceConfigurationEntity data;
if (ReferenceTypeSourceType.API.equals(persist.getType())) {
ReferenceTypeSourceExternalApiConfigurationEntity apiEntity = new ReferenceTypeSourceExternalApiConfigurationEntity();
ExternalFetcherApiSourceConfigurationEntity apiEntity = new ExternalFetcherApiSourceConfigurationEntity();
apiEntity.setUrl(((ReferenceTypeSourceExternalApiConfigurationPersist) persist).getUrl());
if (((ReferenceTypeSourceExternalApiConfigurationPersist) persist).getResults() != null ) {
@ -164,7 +165,7 @@ public class ReferenceTypeServiceImpl implements ReferenceTypeService {
data = apiEntity;
}else {
ReferenceTypeSourceStaticOptionConfigurationEntity staticEntity = new ReferenceTypeSourceStaticOptionConfigurationEntity();
ExternalFetcherStaticOptionSourceConfigurationEntity staticEntity = new ExternalFetcherStaticOptionSourceConfigurationEntity();
if (!this.conventionService.isListNullOrEmpty(((ReferenceTypeSourceStaticOptionConfigurationPersist) persist).getOptions())){
staticEntity.setOptions(new ArrayList<>());
@ -254,8 +255,8 @@ public class ReferenceTypeServiceImpl implements ReferenceTypeService {
return data;
}
private @NotNull ReferenceTypeStaticOptionEntity buildStaticOptionEntity(ReferenceTypeStaticOptionPersist persist){
ReferenceTypeStaticOptionEntity data = new ReferenceTypeStaticOptionEntity();
private @NotNull StaticOptionEntity buildStaticOptionEntity(ReferenceTypeStaticOptionPersist persist){
StaticOptionEntity data = new StaticOptionEntity();
if (persist == null) return data;
data.setCode(persist.getCode());