refactor reference type enums to prefilling source and ui code clean up
This commit is contained in:
parent
69b00a7a26
commit
57908f342b
|
@ -6,14 +6,14 @@ import jakarta.xml.bind.annotation.XmlEnumValue;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public enum ReferenceTypeExternalApiHTTPMethodType implements DatabaseEnum<Short> {
|
public enum ExternalFetcherApiHTTPMethodType implements DatabaseEnum<Short> {
|
||||||
@XmlEnumValue(value = "0")
|
@XmlEnumValue(value = "0")
|
||||||
GET((short) 0),
|
GET((short) 0),
|
||||||
@XmlEnumValue(value = "1")
|
@XmlEnumValue(value = "1")
|
||||||
POST((short) 1);
|
POST((short) 1);
|
||||||
private final Short value;
|
private final Short value;
|
||||||
|
|
||||||
ReferenceTypeExternalApiHTTPMethodType(Short value) {
|
ExternalFetcherApiHTTPMethodType(Short value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,9 +22,9 @@ public enum ReferenceTypeExternalApiHTTPMethodType implements DatabaseEnum<Short
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Map<Short, ReferenceTypeExternalApiHTTPMethodType> map = EnumUtils.getEnumValueMap(ReferenceTypeExternalApiHTTPMethodType.class);
|
private static final Map<Short, ExternalFetcherApiHTTPMethodType> map = EnumUtils.getEnumValueMap(ExternalFetcherApiHTTPMethodType.class);
|
||||||
|
|
||||||
public static ReferenceTypeExternalApiHTTPMethodType of(Short i) {
|
public static ExternalFetcherApiHTTPMethodType of(Short i) {
|
||||||
return map.get(i);
|
return map.get(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,11 +3,10 @@ package eu.eudat.commons.enums;
|
||||||
import com.fasterxml.jackson.annotation.JsonValue;
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
import eu.eudat.data.converters.enums.DatabaseEnum;
|
import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||||
import jakarta.xml.bind.annotation.XmlEnumValue;
|
import jakarta.xml.bind.annotation.XmlEnumValue;
|
||||||
import jakarta.xml.bind.annotation.XmlValue;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public enum ReferenceTypeSourceType implements DatabaseEnum<Short> {
|
public enum ExternalFetcherSourceType implements DatabaseEnum<Short> {
|
||||||
@XmlEnumValue(value = "0")
|
@XmlEnumValue(value = "0")
|
||||||
API((short) 0),
|
API((short) 0),
|
||||||
@XmlEnumValue(value = "1")
|
@XmlEnumValue(value = "1")
|
||||||
|
@ -19,7 +18,7 @@ public enum ReferenceTypeSourceType implements DatabaseEnum<Short> {
|
||||||
public static final String STATIC = "static";
|
public static final String STATIC = "static";
|
||||||
}
|
}
|
||||||
|
|
||||||
ReferenceTypeSourceType(Short value) {
|
ExternalFetcherSourceType(Short value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,9 +27,9 @@ public enum ReferenceTypeSourceType implements DatabaseEnum<Short> {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Map<Short, ReferenceTypeSourceType> map = EnumUtils.getEnumValueMap(ReferenceTypeSourceType.class);
|
private static final Map<Short, ExternalFetcherSourceType> map = EnumUtils.getEnumValueMap(ExternalFetcherSourceType.class);
|
||||||
|
|
||||||
public static ReferenceTypeSourceType of(Short i) {
|
public static ExternalFetcherSourceType of(Short i) {
|
||||||
return map.get(i);
|
return map.get(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.commons.types.externalfetcher;
|
package eu.eudat.commons.types.externalfetcher;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.ReferenceTypeExternalApiHTTPMethodType;
|
import eu.eudat.commons.enums.ExternalFetcherApiHTTPMethodType;
|
||||||
import eu.eudat.service.externalfetcher.config.entities.AuthenticationConfiguration;
|
import eu.eudat.service.externalfetcher.config.entities.AuthenticationConfiguration;
|
||||||
import jakarta.xml.bind.annotation.XmlElement;
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ public class AuthenticationConfigurationEntity implements AuthenticationConfigur
|
||||||
|
|
||||||
private Boolean enabled;
|
private Boolean enabled;
|
||||||
private String authUrl;
|
private String authUrl;
|
||||||
private ReferenceTypeExternalApiHTTPMethodType authMethod;
|
private ExternalFetcherApiHTTPMethodType authMethod;
|
||||||
private String authTokenPath;
|
private String authTokenPath;
|
||||||
private String authRequestBody;
|
private String authRequestBody;
|
||||||
private String type;
|
private String type;
|
||||||
|
@ -31,12 +31,12 @@ public class AuthenticationConfigurationEntity implements AuthenticationConfigur
|
||||||
this.authUrl = authUrl;
|
this.authUrl = authUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReferenceTypeExternalApiHTTPMethodType getAuthMethod() {
|
public ExternalFetcherApiHTTPMethodType getAuthMethod() {
|
||||||
return authMethod;
|
return authMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "authUrlMethod")
|
@XmlElement(name = "authUrlMethod")
|
||||||
public void setAuthMethod(ReferenceTypeExternalApiHTTPMethodType authMethod) {
|
public void setAuthMethod(ExternalFetcherApiHTTPMethodType authMethod) {
|
||||||
this.authMethod = authMethod;
|
this.authMethod = authMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package eu.eudat.commons.types.externalfetcher;
|
package eu.eudat.commons.types.externalfetcher;
|
||||||
|
|
||||||
|
|
||||||
import eu.eudat.commons.enums.ReferenceTypeExternalApiHTTPMethodType;
|
import eu.eudat.commons.enums.ExternalFetcherApiHTTPMethodType;
|
||||||
import eu.eudat.service.externalfetcher.config.entities.SourceExternalApiConfiguration;
|
import eu.eudat.service.externalfetcher.config.entities.SourceExternalApiConfiguration;
|
||||||
import jakarta.xml.bind.annotation.XmlElement;
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
import jakarta.xml.bind.annotation.XmlElementWrapper;
|
import jakarta.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
@ -14,7 +14,7 @@ public class ExternalFetcherApiSourceConfigurationEntity extends ExternalFetcher
|
||||||
private String paginationPath;
|
private String paginationPath;
|
||||||
private String contentType;
|
private String contentType;
|
||||||
private String firstPage;
|
private String firstPage;
|
||||||
private ReferenceTypeExternalApiHTTPMethodType httpMethod;
|
private ExternalFetcherApiHTTPMethodType httpMethod;
|
||||||
private String requestBody = "";
|
private String requestBody = "";
|
||||||
private String filterType = "remote";
|
private String filterType = "remote";
|
||||||
private AuthenticationConfigurationEntity auth;
|
private AuthenticationConfigurationEntity auth;
|
||||||
|
@ -62,12 +62,12 @@ public class ExternalFetcherApiSourceConfigurationEntity extends ExternalFetcher
|
||||||
this.firstPage = firstPage;
|
this.firstPage = firstPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReferenceTypeExternalApiHTTPMethodType getHttpMethod() {
|
public ExternalFetcherApiHTTPMethodType getHttpMethod() {
|
||||||
return httpMethod;
|
return httpMethod;
|
||||||
}
|
}
|
||||||
@XmlElement(name = "requestHttpMethod")
|
@XmlElement(name = "requestHttpMethod")
|
||||||
public void setHttpMethod(ReferenceTypeExternalApiHTTPMethodType httpMethod) {
|
public void setHttpMethod(ExternalFetcherApiHTTPMethodType httpMethod) {
|
||||||
this.httpMethod = httpMethod != null ? httpMethod : ReferenceTypeExternalApiHTTPMethodType.GET;
|
this.httpMethod = httpMethod != null ? httpMethod : ExternalFetcherApiHTTPMethodType.GET;
|
||||||
}
|
}
|
||||||
public String getRequestBody() {
|
public String getRequestBody() {
|
||||||
return requestBody;
|
return requestBody;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.commons.types.externalfetcher;
|
package eu.eudat.commons.types.externalfetcher;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.ReferenceTypeSourceType;
|
import eu.eudat.commons.enums.ExternalFetcherSourceType;
|
||||||
import eu.eudat.service.externalfetcher.config.entities.SourceBaseConfiguration;
|
import eu.eudat.service.externalfetcher.config.entities.SourceBaseConfiguration;
|
||||||
import jakarta.xml.bind.annotation.XmlElement;
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
import jakarta.xml.bind.annotation.XmlElementWrapper;
|
import jakarta.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
@ -15,10 +15,10 @@ public abstract class ExternalFetcherBaseSourceConfigurationEntity implements So
|
||||||
private String label;
|
private String label;
|
||||||
|
|
||||||
private Integer ordinal;
|
private Integer ordinal;
|
||||||
private ReferenceTypeSourceType type;
|
private ExternalFetcherSourceType type;
|
||||||
|
|
||||||
private List<UUID> referenceTypeDependencyIds;
|
private List<UUID> referenceTypeDependencyIds;
|
||||||
public ReferenceTypeSourceType getType() {
|
public ExternalFetcherSourceType getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public abstract class ExternalFetcherBaseSourceConfigurationEntity implements So
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "type")
|
@XmlElement(name = "type")
|
||||||
public void setType(ReferenceTypeSourceType type) {
|
public void setType(ExternalFetcherSourceType type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.commons.types.referencetype;
|
package eu.eudat.commons.types.referencetype;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.ReferenceTypeSourceType;
|
import eu.eudat.commons.enums.ExternalFetcherSourceType;
|
||||||
import eu.eudat.commons.types.externalfetcher.ExternalFetcherBaseSourceConfigurationEntity;
|
import eu.eudat.commons.types.externalfetcher.ExternalFetcherBaseSourceConfigurationEntity;
|
||||||
import eu.eudat.commons.types.externalfetcher.ExternalFetcherApiSourceConfigurationEntity;
|
import eu.eudat.commons.types.externalfetcher.ExternalFetcherApiSourceConfigurationEntity;
|
||||||
import eu.eudat.commons.types.externalfetcher.ExternalFetcherStaticOptionSourceConfigurationEntity;
|
import eu.eudat.commons.types.externalfetcher.ExternalFetcherStaticOptionSourceConfigurationEntity;
|
||||||
|
@ -17,8 +17,8 @@ public class ReferenceTypeDefinitionEntity {
|
||||||
|
|
||||||
@XmlElementWrapper(name = "sources")
|
@XmlElementWrapper(name = "sources")
|
||||||
@XmlElements({
|
@XmlElements({
|
||||||
@XmlElement(name = ReferenceTypeSourceType.Names.API, type = ExternalFetcherApiSourceConfigurationEntity.class),
|
@XmlElement(name = ExternalFetcherSourceType.Names.API, type = ExternalFetcherApiSourceConfigurationEntity.class),
|
||||||
@XmlElement(name = ReferenceTypeSourceType.Names.STATIC, type = ExternalFetcherStaticOptionSourceConfigurationEntity.class),
|
@XmlElement(name = ExternalFetcherSourceType.Names.STATIC, type = ExternalFetcherStaticOptionSourceConfigurationEntity.class),
|
||||||
})
|
})
|
||||||
private List<ExternalFetcherBaseSourceConfigurationEntity> sources;
|
private List<ExternalFetcherBaseSourceConfigurationEntity> sources;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,9 @@ package eu.eudat.data;
|
||||||
import eu.eudat.commons.enums.IsActive;
|
import eu.eudat.commons.enums.IsActive;
|
||||||
import eu.eudat.data.converters.enums.IsActiveConverter;
|
import eu.eudat.data.converters.enums.IsActiveConverter;
|
||||||
import eu.eudat.data.tenant.TenantScopedBaseEntity;
|
import eu.eudat.data.tenant.TenantScopedBaseEntity;
|
||||||
|
import eu.eudat.data.types.SQLXMLType;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -22,7 +24,8 @@ public class PrefillingSourceEntity extends TenantScopedBaseEntity {
|
||||||
public static final String _label = "label";
|
public static final String _label = "label";
|
||||||
public static final int _labelLength = 250;
|
public static final int _labelLength = 250;
|
||||||
|
|
||||||
@Column(name = "definition")
|
@Type(value = SQLXMLType.class)
|
||||||
|
@Column(name = "definition", nullable = false, columnDefinition = "xml")
|
||||||
private String definition;
|
private String definition;
|
||||||
public static final String _definition = "definition";
|
public static final String _definition = "definition";
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import eu.eudat.commons.types.prefillingsource.PrefillingSourceDefinitionEntity;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.model.builder.BaseBuilder;
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
import eu.eudat.model.builder.externalfetcher.ExternalFetcherApiSourceConfigurationBuilder;
|
import eu.eudat.model.builder.externalfetcher.ExternalFetcherApiSourceConfigurationBuilder;
|
||||||
|
import eu.eudat.model.externalfetcher.ExternalFetcherApiSourceConfiguration;
|
||||||
import eu.eudat.model.prefillingsourcedefinition.PrefillingSourceDefinition;
|
import eu.eudat.model.prefillingsourcedefinition.PrefillingSourceDefinition;
|
||||||
import gr.cite.tools.data.builder.BuilderFactory;
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
@ -53,6 +54,12 @@ public class PrefillingSourceDefinitionBuilder extends BaseBuilder<PrefillingSou
|
||||||
for (PrefillingSourceDefinitionEntity d : data) {
|
for (PrefillingSourceDefinitionEntity d : data) {
|
||||||
PrefillingSourceDefinition m = new PrefillingSourceDefinition();
|
PrefillingSourceDefinition m = new PrefillingSourceDefinition();
|
||||||
if (!fieldsFields.isEmpty() && d.getFields() != null) m.setFields(this.builderFactory.builder(PrefillingSourceDefinitionFieldBuilder.class).authorize(this.authorize).build(fieldsFields, d.getFields()));
|
if (!fieldsFields.isEmpty() && d.getFields() != null) m.setFields(this.builderFactory.builder(PrefillingSourceDefinitionFieldBuilder.class).authorize(this.authorize).build(fieldsFields, d.getFields()));
|
||||||
|
if (!searchConfigurationFields.isEmpty() && d.getSearchConfiguration() != null) {
|
||||||
|
m.setSearchConfiguration((ExternalFetcherApiSourceConfiguration) this.builderFactory.builder(ExternalFetcherApiSourceConfigurationBuilder.class).authorize(this.authorize).build(searchConfigurationFields, d.getSearchConfiguration()));
|
||||||
|
}
|
||||||
|
if (!getConfigurationFields.isEmpty() && d.getGetConfiguration() != null) {
|
||||||
|
m.setGetConfiguration((ExternalFetcherApiSourceConfiguration) this.builderFactory.builder(ExternalFetcherApiSourceConfigurationBuilder.class).authorize(this.authorize).build(searchConfigurationFields, d.getGetConfiguration()));
|
||||||
|
}
|
||||||
|
|
||||||
models.add(m);
|
models.add(m);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package eu.eudat.model.builder.referencetypedefinition;
|
package eu.eudat.model.builder.referencetypedefinition;
|
||||||
|
|
||||||
import eu.eudat.authorization.AuthorizationFlags;
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
import eu.eudat.commons.enums.ReferenceTypeSourceType;
|
import eu.eudat.commons.enums.ExternalFetcherSourceType;
|
||||||
import eu.eudat.commons.types.referencetype.ReferenceTypeDefinitionEntity;
|
import eu.eudat.commons.types.referencetype.ReferenceTypeDefinitionEntity;
|
||||||
import eu.eudat.commons.types.externalfetcher.ExternalFetcherApiSourceConfigurationEntity;
|
import eu.eudat.commons.types.externalfetcher.ExternalFetcherApiSourceConfigurationEntity;
|
||||||
import eu.eudat.commons.types.externalfetcher.ExternalFetcherStaticOptionSourceConfigurationEntity;
|
import eu.eudat.commons.types.externalfetcher.ExternalFetcherStaticOptionSourceConfigurationEntity;
|
||||||
|
@ -58,8 +58,8 @@ public class ReferenceTypeDefinitionBuilder extends BaseBuilder<ReferenceTypeDef
|
||||||
ReferenceTypeDefinition m = new ReferenceTypeDefinition();
|
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 (!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) {
|
if (!sourcesFields.isEmpty() && d.getSources() != null) {
|
||||||
List<ExternalFetcherApiSourceConfigurationEntity> externalApiConfigEntities = d.getSources().stream().filter(x-> ReferenceTypeSourceType.API.equals(x.getType())).map(x-> (ExternalFetcherApiSourceConfigurationEntity)x).toList();
|
List<ExternalFetcherApiSourceConfigurationEntity> externalApiConfigEntities = d.getSources().stream().filter(x-> ExternalFetcherSourceType.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();
|
List<ExternalFetcherStaticOptionSourceConfigurationEntity> staticOptionConfigEntities = d.getSources().stream().filter(x-> ExternalFetcherSourceType.STATIC.equals(x.getType())).map(x-> (ExternalFetcherStaticOptionSourceConfigurationEntity)x).toList();
|
||||||
m.setSources(new ArrayList<>());
|
m.setSources(new ArrayList<>());
|
||||||
m.getSources().addAll(this.builderFactory.builder(ExternalFetcherApiSourceConfigurationBuilder.class).authorize(this.authorize).build(sourcesFields, externalApiConfigEntities));
|
m.getSources().addAll(this.builderFactory.builder(ExternalFetcherApiSourceConfigurationBuilder.class).authorize(this.authorize).build(sourcesFields, externalApiConfigEntities));
|
||||||
m.getSources().addAll(this.builderFactory.builder(ExternalFetcherStaticOptionSourceConfigurationBuilder.class).authorize(this.authorize).build(sourcesFields, staticOptionConfigEntities));
|
m.getSources().addAll(this.builderFactory.builder(ExternalFetcherStaticOptionSourceConfigurationBuilder.class).authorize(this.authorize).build(sourcesFields, staticOptionConfigEntities));
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.model.externalfetcher;
|
package eu.eudat.model.externalfetcher;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.ReferenceTypeExternalApiHTTPMethodType;
|
import eu.eudat.commons.enums.ExternalFetcherApiHTTPMethodType;
|
||||||
|
|
||||||
public class AuthenticationConfiguration {
|
public class AuthenticationConfiguration {
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ public class AuthenticationConfiguration {
|
||||||
private String authUrl;
|
private String authUrl;
|
||||||
|
|
||||||
public final static String _authMethod = "authMethod";
|
public final static String _authMethod = "authMethod";
|
||||||
private ReferenceTypeExternalApiHTTPMethodType authMethod;
|
private ExternalFetcherApiHTTPMethodType authMethod;
|
||||||
|
|
||||||
public final static String _authTokenPath = "authTokenPath";
|
public final static String _authTokenPath = "authTokenPath";
|
||||||
private String authTokenPath;
|
private String authTokenPath;
|
||||||
|
@ -39,12 +39,12 @@ public class AuthenticationConfiguration {
|
||||||
this.authUrl = authUrl;
|
this.authUrl = authUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReferenceTypeExternalApiHTTPMethodType getAuthMethod() {
|
public ExternalFetcherApiHTTPMethodType getAuthMethod() {
|
||||||
return authMethod;
|
return authMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setAuthMethod(ReferenceTypeExternalApiHTTPMethodType authMethod) {
|
public void setAuthMethod(ExternalFetcherApiHTTPMethodType authMethod) {
|
||||||
this.authMethod = authMethod;
|
this.authMethod = authMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package eu.eudat.model.externalfetcher;
|
package eu.eudat.model.externalfetcher;
|
||||||
|
|
||||||
|
|
||||||
import eu.eudat.commons.enums.ReferenceTypeExternalApiHTTPMethodType;
|
import eu.eudat.commons.enums.ExternalFetcherApiHTTPMethodType;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ExternalFetcherApiSourceConfiguration extends ExternalFetcherBaseSourceConfiguration {
|
public class ExternalFetcherApiSourceConfiguration extends ExternalFetcherBaseSourceConfiguration {
|
||||||
|
@ -23,7 +23,7 @@ public class ExternalFetcherApiSourceConfiguration extends ExternalFetcherBaseSo
|
||||||
private String firstPage;
|
private String firstPage;
|
||||||
|
|
||||||
public final static String _httpMethod = "httpMethod";
|
public final static String _httpMethod = "httpMethod";
|
||||||
private ReferenceTypeExternalApiHTTPMethodType httpMethod;
|
private ExternalFetcherApiHTTPMethodType httpMethod;
|
||||||
|
|
||||||
public final static String _requestBody = "requestBody";
|
public final static String _requestBody = "requestBody";
|
||||||
private String requestBody = "";
|
private String requestBody = "";
|
||||||
|
@ -78,11 +78,11 @@ public class ExternalFetcherApiSourceConfiguration extends ExternalFetcherBaseSo
|
||||||
this.firstPage = firstPage;
|
this.firstPage = firstPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReferenceTypeExternalApiHTTPMethodType getHttpMethod() {
|
public ExternalFetcherApiHTTPMethodType getHttpMethod() {
|
||||||
return httpMethod;
|
return httpMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHttpMethod(ReferenceTypeExternalApiHTTPMethodType httpMethod) {
|
public void setHttpMethod(ExternalFetcherApiHTTPMethodType httpMethod) {
|
||||||
this.httpMethod = httpMethod;
|
this.httpMethod = httpMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.model.externalfetcher;
|
package eu.eudat.model.externalfetcher;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.ReferenceTypeSourceType;
|
import eu.eudat.commons.enums.ExternalFetcherSourceType;
|
||||||
import eu.eudat.model.ReferenceType;
|
import eu.eudat.model.ReferenceType;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -18,16 +18,16 @@ public abstract class ExternalFetcherBaseSourceConfiguration {
|
||||||
private Integer ordinal;
|
private Integer ordinal;
|
||||||
|
|
||||||
public final static String _type = "type";
|
public final static String _type = "type";
|
||||||
private ReferenceTypeSourceType type;
|
private ExternalFetcherSourceType type;
|
||||||
|
|
||||||
public final static String _referenceTypeDependencies = "referenceTypeDependencies";
|
public final static String _referenceTypeDependencies = "referenceTypeDependencies";
|
||||||
private List<ReferenceType> referenceTypeDependencies;
|
private List<ReferenceType> referenceTypeDependencies;
|
||||||
|
|
||||||
public ReferenceTypeSourceType getType() {
|
public ExternalFetcherSourceType getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(ReferenceTypeSourceType type) {
|
public void setType(ExternalFetcherSourceType type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.model.persist.externalfetcher;
|
package eu.eudat.model.persist.externalfetcher;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.ReferenceTypeExternalApiHTTPMethodType;
|
import eu.eudat.commons.enums.ExternalFetcherApiHTTPMethodType;
|
||||||
import eu.eudat.commons.validation.BaseValidator;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import gr.cite.tools.validation.specification.Specification;
|
import gr.cite.tools.validation.specification.Specification;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
|
@ -24,7 +24,7 @@ public class AuthenticationConfigurationPersist {
|
||||||
|
|
||||||
public static final String _authUrl = "authUrl";
|
public static final String _authUrl = "authUrl";
|
||||||
|
|
||||||
private ReferenceTypeExternalApiHTTPMethodType authMethod;
|
private ExternalFetcherApiHTTPMethodType authMethod;
|
||||||
|
|
||||||
public static final String _authMethod = "authMethod";
|
public static final String _authMethod = "authMethod";
|
||||||
|
|
||||||
|
@ -56,11 +56,11 @@ public class AuthenticationConfigurationPersist {
|
||||||
this.authUrl = authUrl;
|
this.authUrl = authUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReferenceTypeExternalApiHTTPMethodType getAuthMethod() {
|
public ExternalFetcherApiHTTPMethodType getAuthMethod() {
|
||||||
return authMethod;
|
return authMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAuthMethod(ReferenceTypeExternalApiHTTPMethodType authMethod) {
|
public void setAuthMethod(ExternalFetcherApiHTTPMethodType authMethod) {
|
||||||
this.authMethod = authMethod;
|
this.authMethod = authMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.model.persist.externalfetcher;
|
package eu.eudat.model.persist.externalfetcher;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.ReferenceTypeExternalApiHTTPMethodType;
|
import eu.eudat.commons.enums.ExternalFetcherApiHTTPMethodType;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
import gr.cite.tools.validation.ValidatorFactory;
|
import gr.cite.tools.validation.ValidatorFactory;
|
||||||
|
@ -36,13 +36,13 @@ public class ExternalFetcherApiSourceConfigurationPersist extends ExternalFetche
|
||||||
|
|
||||||
public static final String _firstPage = "firstPage";
|
public static final String _firstPage = "firstPage";
|
||||||
|
|
||||||
private ReferenceTypeExternalApiHTTPMethodType httpMethod;
|
private ExternalFetcherApiHTTPMethodType httpMethod;
|
||||||
|
|
||||||
public static final String _httpMethod = "httpMethod";
|
public static final String _httpMethod = "httpMethod";
|
||||||
|
|
||||||
private String requestBody = "";
|
private String requestBody;
|
||||||
|
|
||||||
private String filterType = "remote";
|
private String filterType;
|
||||||
|
|
||||||
private AuthenticationConfigurationPersist auth;
|
private AuthenticationConfigurationPersist auth;
|
||||||
|
|
||||||
|
@ -92,11 +92,11 @@ public class ExternalFetcherApiSourceConfigurationPersist extends ExternalFetche
|
||||||
this.firstPage = firstPage;
|
this.firstPage = firstPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReferenceTypeExternalApiHTTPMethodType getHttpMethod() {
|
public ExternalFetcherApiHTTPMethodType getHttpMethod() {
|
||||||
return httpMethod;
|
return httpMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHttpMethod(ReferenceTypeExternalApiHTTPMethodType httpMethod) {
|
public void setHttpMethod(ExternalFetcherApiHTTPMethodType httpMethod) {
|
||||||
this.httpMethod = httpMethod;
|
this.httpMethod = httpMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,13 +132,13 @@ public class ExternalFetcherApiSourceConfigurationPersist extends ExternalFetche
|
||||||
this.queries = queries;
|
this.queries = queries;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component(ReferenceTypeSourceExternalApiConfigurationPersistValidator.ValidatorName)
|
@Component(ExternalFetcherApiSourceConfigurationPersistValidator.ValidatorName)
|
||||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public static class ReferenceTypeSourceExternalApiConfigurationPersistValidator extends ReferenceTypeSourceBaseConfigurationPersistValidator<ExternalFetcherApiSourceConfigurationPersist> {
|
public static class ExternalFetcherApiSourceConfigurationPersistValidator extends ExternalFetcherBaseSourceConfigurationPersistValidator<ExternalFetcherApiSourceConfigurationPersist> {
|
||||||
|
|
||||||
public static final String ValidatorName = "ReferenceTypeSourceExternalApiConfigurationPersistValidator";
|
public static final String ValidatorName = "ExternalFetcherApiSourceConfigurationPersistValidator";
|
||||||
|
|
||||||
protected ReferenceTypeSourceExternalApiConfigurationPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
protected ExternalFetcherApiSourceConfigurationPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
super(conventionService, errors, messageSource, validatorFactory);
|
super(conventionService, errors, messageSource, validatorFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package eu.eudat.model.persist.externalfetcher;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||||
import eu.eudat.commons.enums.ReferenceTypeSourceType;
|
import eu.eudat.commons.enums.ExternalFetcherSourceType;
|
||||||
import eu.eudat.commons.validation.BaseValidator;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||||
|
@ -39,7 +39,7 @@ public abstract class ExternalFetcherBaseSourceConfigurationPersist {
|
||||||
|
|
||||||
public static final String _ordinal = "ordinal";
|
public static final String _ordinal = "ordinal";
|
||||||
|
|
||||||
private ReferenceTypeSourceType type;
|
private ExternalFetcherSourceType type;
|
||||||
|
|
||||||
public static final String _type = "type";
|
public static final String _type = "type";
|
||||||
|
|
||||||
|
@ -71,11 +71,11 @@ public abstract class ExternalFetcherBaseSourceConfigurationPersist {
|
||||||
this.ordinal = ordinal;
|
this.ordinal = ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReferenceTypeSourceType getType() {
|
public ExternalFetcherSourceType getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(ReferenceTypeSourceType type) {
|
public void setType(ExternalFetcherSourceType type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,13 +87,13 @@ public abstract class ExternalFetcherBaseSourceConfigurationPersist {
|
||||||
this.referenceTypeDependencyIds = referenceTypeDependencyIds;
|
this.referenceTypeDependencyIds = referenceTypeDependencyIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static abstract class ReferenceTypeSourceBaseConfigurationPersistValidator<T extends ExternalFetcherBaseSourceConfigurationPersist> extends BaseValidator<T> {
|
public static abstract class ExternalFetcherBaseSourceConfigurationPersistValidator<T extends ExternalFetcherBaseSourceConfigurationPersist> extends BaseValidator<T> {
|
||||||
|
|
||||||
protected final MessageSource messageSource;
|
protected final MessageSource messageSource;
|
||||||
|
|
||||||
protected final ValidatorFactory validatorFactory;
|
protected final ValidatorFactory validatorFactory;
|
||||||
|
|
||||||
protected ReferenceTypeSourceBaseConfigurationPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
protected ExternalFetcherBaseSourceConfigurationPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
super(conventionService, errors);
|
super(conventionService, errors);
|
||||||
this.messageSource = messageSource;
|
this.messageSource = messageSource;
|
||||||
this.validatorFactory = validatorFactory;
|
this.validatorFactory = validatorFactory;
|
||||||
|
|
|
@ -25,13 +25,13 @@ public class ExternalFetcherStaticOptionSourceConfigurationPersist extends Exter
|
||||||
this.options = options;
|
this.options = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component(ReferenceTypeSourceStaticOptionConfigurationPersistValidator.ValidatorName)
|
@Component(ExternalFetcherStaticOptionSourceConfigurationPersistValidator.ValidatorName)
|
||||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
public static class ReferenceTypeSourceStaticOptionConfigurationPersistValidator extends ReferenceTypeSourceBaseConfigurationPersistValidator<ExternalFetcherStaticOptionSourceConfigurationPersist> {
|
public static class ExternalFetcherStaticOptionSourceConfigurationPersistValidator extends ExternalFetcherBaseSourceConfigurationPersistValidator<ExternalFetcherStaticOptionSourceConfigurationPersist> {
|
||||||
|
|
||||||
public static final String ValidatorName = "ReferenceTypeSourceStaticOptionConfigurationPersistValidator";
|
public static final String ValidatorName = "ExternalFetcherStaticOptionSourceConfigurationPersistValidator";
|
||||||
|
|
||||||
protected ReferenceTypeSourceStaticOptionConfigurationPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
protected ExternalFetcherStaticOptionSourceConfigurationPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, ValidatorFactory validatorFactory) {
|
||||||
super(conventionService, errors, messageSource, validatorFactory);
|
super(conventionService, errors, messageSource, validatorFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,12 +81,12 @@ public class PrefillingSourceDefinitionPersist {
|
||||||
.iff(() -> !this.isNull(item.getSearchConfiguration()))
|
.iff(() -> !this.isNull(item.getSearchConfiguration()))
|
||||||
.on(PrefillingSourceDefinitionPersist._searchConfiguration)
|
.on(PrefillingSourceDefinitionPersist._searchConfiguration)
|
||||||
.over(item.getSearchConfiguration())
|
.over(item.getSearchConfiguration())
|
||||||
.using(() -> this.validatorFactory.validator(PrefillingSourceDefinitionPersist.PrefillingSourceDefinitionPersistValidator.class)),
|
.using(() -> this.validatorFactory.validator(ExternalFetcherApiSourceConfigurationPersist.ExternalFetcherApiSourceConfigurationPersistValidator.class)),
|
||||||
this.refSpec()
|
// this.refSpec() TODO
|
||||||
.iff(() -> !this.isNull(item.getGetConfiguration()))
|
// .iff(() -> !this.isNull(item.getGetConfiguration()))
|
||||||
.on(PrefillingSourceDefinitionPersist._getConfiguration)
|
// .on(PrefillingSourceDefinitionPersist._getConfiguration)
|
||||||
.over(item.getGetConfiguration())
|
// .over(item.getGetConfiguration())
|
||||||
.using(() -> this.validatorFactory.validator(PrefillingSourceDefinitionPersist.PrefillingSourceDefinitionPersistValidator.class)),
|
// .using(() -> this.validatorFactory.validator(ExternalFetcherApiSourceConfigurationPersist.ExternalFetcherApiSourceConfigurationPersistValidator.class)),
|
||||||
this.navSpec()
|
this.navSpec()
|
||||||
.iff(() -> !this.isListNullOrEmpty(item.getFields()))
|
.iff(() -> !this.isListNullOrEmpty(item.getFields()))
|
||||||
.on(PrefillingSourceDefinitionPersist._fields)
|
.on(PrefillingSourceDefinitionPersist._fields)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.model.persist.referencetypedefinition;
|
package eu.eudat.model.persist.referencetypedefinition;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.ReferenceTypeSourceType;
|
import eu.eudat.commons.enums.ExternalFetcherSourceType;
|
||||||
import eu.eudat.commons.validation.BaseValidator;
|
import eu.eudat.commons.validation.BaseValidator;
|
||||||
import eu.eudat.model.persist.externalfetcher.ExternalFetcherBaseSourceConfigurationPersist;
|
import eu.eudat.model.persist.externalfetcher.ExternalFetcherBaseSourceConfigurationPersist;
|
||||||
import eu.eudat.model.persist.externalfetcher.ExternalFetcherApiSourceConfigurationPersist;
|
import eu.eudat.model.persist.externalfetcher.ExternalFetcherApiSourceConfigurationPersist;
|
||||||
|
@ -80,7 +80,7 @@ public class ReferenceTypeDefinitionPersist {
|
||||||
.iff(() -> !this.isListNullOrEmpty(item.getSources()))
|
.iff(() -> !this.isListNullOrEmpty(item.getSources()))
|
||||||
.on(ReferenceTypeDefinitionPersist._sources)
|
.on(ReferenceTypeDefinitionPersist._sources)
|
||||||
.over(item.getSources())
|
.over(item.getSources())
|
||||||
.using((itm) -> ((ExternalFetcherBaseSourceConfigurationPersist) itm).getType() == ReferenceTypeSourceType.STATIC? this.validatorFactory.validator(ExternalFetcherStaticOptionSourceConfigurationPersist.ReferenceTypeSourceStaticOptionConfigurationPersistValidator.class): this.validatorFactory.validator(ExternalFetcherApiSourceConfigurationPersist.ReferenceTypeSourceExternalApiConfigurationPersistValidator.class))
|
.using((itm) -> ((ExternalFetcherBaseSourceConfigurationPersist) itm).getType() == ExternalFetcherSourceType.STATIC? this.validatorFactory.validator(ExternalFetcherStaticOptionSourceConfigurationPersist.ExternalFetcherStaticOptionSourceConfigurationPersistValidator.class): this.validatorFactory.validator(ExternalFetcherApiSourceConfigurationPersist.ExternalFetcherApiSourceConfigurationPersistValidator.class))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import com.jayway.jsonpath.DocumentContext;
|
||||||
import com.jayway.jsonpath.JsonPath;
|
import com.jayway.jsonpath.JsonPath;
|
||||||
import com.jayway.jsonpath.PathNotFoundException;
|
import com.jayway.jsonpath.PathNotFoundException;
|
||||||
import eu.eudat.commons.JsonHandlingService;
|
import eu.eudat.commons.JsonHandlingService;
|
||||||
import eu.eudat.commons.enums.ReferenceTypeSourceType;
|
import eu.eudat.commons.enums.ExternalFetcherSourceType;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
import eu.eudat.data.ReferenceEntity;
|
import eu.eudat.data.ReferenceEntity;
|
||||||
import eu.eudat.model.Reference;
|
import eu.eudat.model.Reference;
|
||||||
|
@ -81,7 +81,7 @@ public class ExternalFetcherServiceImpl implements ExternalFetcherService {
|
||||||
if (this.conventionService.isListNullOrEmpty(sources)) return new ExternalDataResult();
|
if (this.conventionService.isListNullOrEmpty(sources)) return new ExternalDataResult();
|
||||||
|
|
||||||
for (SourceBaseConfiguration source : sources) {
|
for (SourceBaseConfiguration source : sources) {
|
||||||
if (source.getType() == null || source.getType().equals(ReferenceTypeSourceType.API)) {
|
if (source.getType() == null || source.getType().equals(ExternalFetcherSourceType.API)) {
|
||||||
try {
|
try {
|
||||||
SourceExternalApiConfiguration<ResultsConfiguration<ResultFieldsMappingConfiguration>, AuthenticationConfiguration, QueryConfig<QueryCaseConfig>> apiSource = (SourceExternalApiConfiguration)source;
|
SourceExternalApiConfiguration<ResultsConfiguration<ResultFieldsMappingConfiguration>, AuthenticationConfiguration, QueryConfig<QueryCaseConfig>> apiSource = (SourceExternalApiConfiguration)source;
|
||||||
// this.applyFunderToQuery(apiSource, externalReferenceCriteria);
|
// this.applyFunderToQuery(apiSource, externalReferenceCriteria);
|
||||||
|
@ -94,7 +94,7 @@ public class ExternalFetcherServiceImpl implements ExternalFetcherService {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getLocalizedMessage(), e);
|
logger.error(e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
} else if (source.getType() != null && source.getType().equals(ReferenceTypeSourceType.STATIC)) {
|
} else if (source.getType() != null && source.getType().equals(ExternalFetcherSourceType.STATIC)) {
|
||||||
SourceStaticOptionConfiguration<StaticOption> staticSource = (SourceStaticOptionConfiguration)source;
|
SourceStaticOptionConfiguration<StaticOption> staticSource = (SourceStaticOptionConfiguration)source;
|
||||||
results.addAll(queryStaticData(staticSource, externalReferenceCriteria));
|
results.addAll(queryStaticData(staticSource, externalReferenceCriteria));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package eu.eudat.service.externalfetcher.config;
|
package eu.eudat.service.externalfetcher.config;
|
||||||
|
|
||||||
|
|
||||||
import eu.eudat.commons.enums.ReferenceTypeSourceType;
|
import eu.eudat.commons.enums.ExternalFetcherSourceType;
|
||||||
import eu.eudat.service.externalfetcher.config.entities.SourceBaseConfiguration;
|
import eu.eudat.service.externalfetcher.config.entities.SourceBaseConfiguration;
|
||||||
|
|
||||||
public class UrlConfiguration implements SourceBaseConfiguration {
|
public class UrlConfiguration implements SourceBaseConfiguration {
|
||||||
|
@ -9,7 +9,7 @@ public class UrlConfiguration implements SourceBaseConfiguration {
|
||||||
private String key;
|
private String key;
|
||||||
private String label;
|
private String label;
|
||||||
private Integer ordinal;
|
private Integer ordinal;
|
||||||
private ReferenceTypeSourceType type;
|
private ExternalFetcherSourceType type;
|
||||||
|
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
return key;
|
return key;
|
||||||
|
@ -35,11 +35,11 @@ public class UrlConfiguration implements SourceBaseConfiguration {
|
||||||
this.ordinal = ordinal;
|
this.ordinal = ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReferenceTypeSourceType getType() {
|
public ExternalFetcherSourceType getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(ReferenceTypeSourceType type) {
|
public void setType(ExternalFetcherSourceType type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.service.externalfetcher.config.entities;
|
package eu.eudat.service.externalfetcher.config.entities;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.ReferenceTypeExternalApiHTTPMethodType;
|
import eu.eudat.commons.enums.ExternalFetcherApiHTTPMethodType;
|
||||||
|
|
||||||
public interface AuthenticationConfiguration {
|
public interface AuthenticationConfiguration {
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ public interface AuthenticationConfiguration {
|
||||||
|
|
||||||
String getAuthUrl();
|
String getAuthUrl();
|
||||||
|
|
||||||
ReferenceTypeExternalApiHTTPMethodType getAuthMethod();
|
ExternalFetcherApiHTTPMethodType getAuthMethod();
|
||||||
|
|
||||||
String getAuthTokenPath();
|
String getAuthTokenPath();
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package eu.eudat.service.externalfetcher.config.entities;
|
package eu.eudat.service.externalfetcher.config.entities;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.ReferenceTypeSourceType;
|
import eu.eudat.commons.enums.ExternalFetcherSourceType;
|
||||||
|
|
||||||
public interface SourceBaseConfiguration {
|
public interface SourceBaseConfiguration {
|
||||||
String getKey();
|
String getKey();
|
||||||
String getLabel();
|
String getLabel();
|
||||||
Integer getOrdinal();
|
Integer getOrdinal();
|
||||||
ReferenceTypeSourceType getType();
|
ExternalFetcherSourceType getType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.service.externalfetcher.config.entities;
|
package eu.eudat.service.externalfetcher.config.entities;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.ReferenceTypeExternalApiHTTPMethodType;
|
import eu.eudat.commons.enums.ExternalFetcherApiHTTPMethodType;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ public interface SourceExternalApiConfiguration<RsConfig extends ResultsConfigur
|
||||||
|
|
||||||
String getFirstPage();
|
String getFirstPage();
|
||||||
|
|
||||||
ReferenceTypeExternalApiHTTPMethodType getHttpMethod();
|
ExternalFetcherApiHTTPMethodType getHttpMethod();
|
||||||
|
|
||||||
String getRequestBody();
|
String getRequestBody();
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,12 @@ public class PrefillingSourceServiceImpl implements PrefillingSourceService {
|
||||||
data.getFields().add(this.buildFieldEntity(fieldPersist));
|
data.getFields().add(this.buildFieldEntity(fieldPersist));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (persist.getSearchConfiguration() != null ) {
|
||||||
|
data.setSearchConfiguration(this.buildExternalFetcherApiConfigEntity(persist.getSearchConfiguration()));
|
||||||
|
}
|
||||||
|
if (persist.getGetConfiguration() != null ) {
|
||||||
|
data.setGetConfiguration(this.buildExternalFetcherApiConfigEntity(persist.getGetConfiguration()));
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -141,6 +147,11 @@ public class PrefillingSourceServiceImpl implements PrefillingSourceService {
|
||||||
if (persist.getResults() != null ) {
|
if (persist.getResults() != null ) {
|
||||||
data.setResults(this.buildResultsConfigEntity(persist.getResults()));
|
data.setResults(this.buildResultsConfigEntity(persist.getResults()));
|
||||||
}
|
}
|
||||||
|
data.setKey(persist.getKey());
|
||||||
|
data.setLabel(persist.getLabel());
|
||||||
|
data.setOrdinal(persist.getOrdinal());
|
||||||
|
data.setType(persist.getType());
|
||||||
|
data.setReferenceTypeDependencyIds(persist.getReferenceTypeDependencyIds());
|
||||||
data.setPaginationPath(persist.getPaginationPath());
|
data.setPaginationPath(persist.getPaginationPath());
|
||||||
data.setContentType(persist.getContentType());
|
data.setContentType(persist.getContentType());
|
||||||
data.setFirstPage(persist.getFirstPage());
|
data.setFirstPage(persist.getFirstPage());
|
||||||
|
|
|
@ -4,7 +4,7 @@ import eu.eudat.authorization.AuthorizationFlags;
|
||||||
import eu.eudat.authorization.Permission;
|
import eu.eudat.authorization.Permission;
|
||||||
import eu.eudat.commons.XmlHandlingService;
|
import eu.eudat.commons.XmlHandlingService;
|
||||||
import eu.eudat.commons.enums.IsActive;
|
import eu.eudat.commons.enums.IsActive;
|
||||||
import eu.eudat.commons.enums.ReferenceTypeSourceType;
|
import eu.eudat.commons.enums.ExternalFetcherSourceType;
|
||||||
import eu.eudat.commons.types.externalfetcher.*;
|
import eu.eudat.commons.types.externalfetcher.*;
|
||||||
import eu.eudat.commons.types.referencetype.*;
|
import eu.eudat.commons.types.referencetype.*;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
|
@ -141,7 +141,7 @@ public class ReferenceTypeServiceImpl implements ReferenceTypeService {
|
||||||
|
|
||||||
ExternalFetcherBaseSourceConfigurationEntity data;
|
ExternalFetcherBaseSourceConfigurationEntity data;
|
||||||
|
|
||||||
if (ReferenceTypeSourceType.API.equals(persist.getType())) {
|
if (ExternalFetcherSourceType.API.equals(persist.getType())) {
|
||||||
ExternalFetcherApiSourceConfigurationEntity apiEntity = new ExternalFetcherApiSourceConfigurationEntity();
|
ExternalFetcherApiSourceConfigurationEntity apiEntity = new ExternalFetcherApiSourceConfigurationEntity();
|
||||||
|
|
||||||
apiEntity.setUrl(((ExternalFetcherApiSourceConfigurationPersist) persist).getUrl());
|
apiEntity.setUrl(((ExternalFetcherApiSourceConfigurationPersist) persist).getUrl());
|
||||||
|
|
|
@ -161,364 +161,6 @@
|
||||||
[referenceTypes]="referenceTypes"
|
[referenceTypes]="referenceTypes"
|
||||||
[sourceKeysMap]="sourceKeysMap">
|
[sourceKeysMap]="sourceKeysMap">
|
||||||
</app-external-fetcher-source-component>
|
</app-external-fetcher-source-component>
|
||||||
<!-- <div class="row" >
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.KEY' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="key" [formControl]="source.get('key')" required>
|
|
||||||
<mat-error *ngIf="source.get('key').hasError('backendError')">{{source.get('key').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="source.get('key').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.LABEL' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="label" [formControl]="source.get('label')" required>
|
|
||||||
<mat-error *ngIf="source.get('label').hasError('backendError')">{{source.get('label').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="source.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.ORDINAL' | translate}}</mat-label>
|
|
||||||
<input matInput type="number" name="ordinal" [formControl]="source.get('ordinal')" required>
|
|
||||||
<mat-error *ngIf="source.get('ordinal').hasError('backendError')">{{source.get('ordinal').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="source.get('ordinal').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.DEPENDENCIES' | translate}}</mat-label>
|
|
||||||
<mat-select multiple (selectionChange)="setReferenceTypeDependenciesMap($event.value, sourceIndex)" [formControl]="source.get('referenceTypeDependencyIds')">
|
|
||||||
<mat-option *ngFor="let referenceType of referenceTypes" [value]="referenceType.id">{{referenceType.name}}</mat-option>
|
|
||||||
</mat-select> -->
|
|
||||||
<!-- <app-multiple-auto-complete [formControl]="source.get('referenceTypeDependencyIds')" [configuration]="referenceTypeService.multipleAutocompleteConfiguration"></app-multiple-auto-complete> -->
|
|
||||||
<!-- <mat-error *ngIf="source.get('referenceTypeDependencyIds').hasError('backendError')">{{source.get('referenceTypeDependencyIds').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="source.get('referenceTypeDependencyIds').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.SOURCE-TYPE' | translate}}</mat-label>
|
|
||||||
<mat-select name="type" [formControl]="source.get('type')" required>
|
|
||||||
<mat-option *ngFor="let sourceType of referenceTypeSourceTypeEnum" [value]="sourceType">
|
|
||||||
{{enumUtils.toReferenceTypeSourceTypeString(sourceType)}}
|
|
||||||
</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
<mat-error *ngIf="source.get('type').hasError('backendError')">{{source.get('type').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="source.get('type').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row" *ngIf="source.get('type').value == referenceTypeSourceType.API">
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.URL' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="ordinal" [formControl]="source.get('url')">
|
|
||||||
<mat-error *ngIf="source.get('url').hasError('backendError')">{{source.get('url').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="source.get('url').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.PAGINATION-PATH' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="paginationPath" [formControl]="source.get('paginationPath')">
|
|
||||||
<mat-error *ngIf="source.get('paginationPath').hasError('backendError')">{{source.get('paginationPath').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="source.get('paginationPath').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.CONTENT-TYPE' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="contentType" [formControl]="source.get('contentType')">
|
|
||||||
<mat-error *ngIf="source.get('contentType').hasError('backendError')">{{source.get('contentType').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="source.get('contentType').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.FIRST-PAGE' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="firstPage" [formControl]="source.get('firstPage')">
|
|
||||||
<mat-error *ngIf="source.get('firstPage').hasError('backendError')">{{source.get('firstPage').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="source.get('firstPage').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.HTTP-METHOD' | translate}}</mat-label>
|
|
||||||
<mat-select name="httpMethod" [formControl]="source.get('httpMethod')">
|
|
||||||
<mat-option *ngFor="let httpMethod of referenceTypeExternalApiHTTPMethodTypeEnum" [value]="httpMethod">
|
|
||||||
{{enumUtils.toReferenceTypeExternalApiHTTPMethodTypeString(httpMethod)}}
|
|
||||||
</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
<mat-error *ngIf="source.get('httpMethod').hasError('backendError')">{{source.get('httpMethod').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="source.get('httpMethod').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6" *ngIf="source.get('httpMethod').value == referenceTypeExternalApiHTTPMethodType.POST" >
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.REQUEST-BODY' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="requestBody" [formControl]="source.get('requestBody')">
|
|
||||||
<mat-error *ngIf="source.get('requestBody').hasError('backendError')">{{source.get('requestBody').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="source.get('requestBody').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.FILTER-TYPE' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="filterType" [formControl]="source.get('filterType')">
|
|
||||||
<mat-error *ngIf="source.get('filterType').hasError('backendError')">{{source.get('filterType').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="source.get('filterType').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
Results info
|
|
||||||
<h3 class="col-12">{{'REFERENCE-TYPE-EDITOR.FIELDS.RESULTS' | translate}}</h3>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.RESULTS-PATH' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="resultsArrayPath" [formControl]="source.get('results').get('resultsArrayPath')">
|
|
||||||
<mat-error *ngIf="source.get('results').get('resultsArrayPath').hasError('backendError')">{{source.get('results').get('resultsArrayPath').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="source.get('results').get('resultsArrayPath').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
fields mapping
|
|
||||||
<div class="col-12">
|
|
||||||
<div *ngFor="let field of source.get('results').get('fieldsMapping').controls; let fieldMappingIndex=index;" class="row mb-3">
|
|
||||||
<div class="col-12">
|
|
||||||
<mat-card-header>
|
|
||||||
<div class="row mb-3 d-flex align-items-center">
|
|
||||||
<div class="col-auto d-flex">
|
|
||||||
<h4 class="col-12">{{'REFERENCE-TYPE-EDITOR.FIELDS.FIELD-MAPPING' | translate}} {{fieldMappingIndex + 1}}</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</mat-card-header>
|
|
||||||
<mat-card-content>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.CODE' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" [readonly]="field.get('code').disabled" name="code" [formControl]="field.get('code')">
|
|
||||||
<mat-error *ngIf="field.get('code').hasError('backendError')">{{field.get('code').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="field.get('code').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.RESPONSE-PATH' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="responsePath" [formControl]="field.get('responsePath')">
|
|
||||||
<mat-error *ngIf="field.get('responsePath').hasError('backendError')">{{field.get('responsePath').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="field.get('responsePath').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</mat-card-content>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
Auth info
|
|
||||||
<h3 class="col-12">{{'REFERENCE-TYPE-EDITOR.FIELDS.AUTHENTICATION' | translate}}
|
|
||||||
<mat-checkbox [formControl]="source.get('auth').get('enabled')"></mat-checkbox>
|
|
||||||
</h3>
|
|
||||||
<div class="row" *ngIf="source.get('auth').get('enabled').value == true">
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.URL' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="authUrl" [formControl]="source.get('auth').get('authUrl')">
|
|
||||||
<mat-error *ngIf="source.get('auth').get('authUrl').hasError('backendError')">{{source.get('auth').get('authUrl').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="source.get('auth').get('authUrl').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.HTTP-METHOD' | translate}}</mat-label>
|
|
||||||
<mat-select name="httpMethod" [formControl]="source.get('auth').get('authMethod')">
|
|
||||||
<mat-option *ngFor="let httpMethod of referenceTypeExternalApiHTTPMethodTypeEnum" [value]="httpMethod">
|
|
||||||
{{enumUtils.toReferenceTypeExternalApiHTTPMethodTypeString(httpMethod)}}
|
|
||||||
</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
<mat-error *ngIf="source.get('auth').get('authMethod').hasError('backendError')">{{source.get('auth').get('authMethod').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="source.get('auth').get('authMethod').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.TOKEN-PATH' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="authTokenPath" [formControl]="source.get('auth').get('authTokenPath')">
|
|
||||||
<mat-error *ngIf="source.get('auth').get('authTokenPath').hasError('backendError')">{{source.get('auth').get('authTokenPath').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="source.get('auth').get('authTokenPath').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.REQUEST-BODY' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="authRequestBody" [formControl]="source.get('auth').get('authRequestBody')">
|
|
||||||
<mat-error *ngIf="source.get('auth').get('authRequestBody').hasError('backendError')">{{source.get('auth').get('authRequestBody').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="source.get('auth').get('authRequestBody').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.TYPE' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="type" [formControl]="source.get('auth').get('type')">
|
|
||||||
<mat-error *ngIf="source.get('auth').get('type').hasError('backendError')">{{source.get('auth').get('type').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="source.get('auth').get('type').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
Queries info
|
|
||||||
<h3 class="col-12">{{'REFERENCE-TYPE-EDITOR.FIELDS.QUERIES' | translate}}
|
|
||||||
<button mat-button type="button" class="action-btn" (click)="addQuery(sourceIndex)" [disabled]="formGroup.disabled">{{'REFERENCE-TYPE-EDITOR.ACTIONS.ADD-QUERY' | translate}}</button>
|
|
||||||
</h3>
|
|
||||||
<div class="col-12">
|
|
||||||
<div *ngFor="let query of source.get('queries').controls; let queryIndex=index;" class="row mb-3">
|
|
||||||
<div class="col-12">
|
|
||||||
<mat-card-header>
|
|
||||||
<div class="row mb-3 d-flex align-items-center">
|
|
||||||
<div class="col-auto d-flex">
|
|
||||||
<h4 class="col-12">{{'REFERENCE-TYPE-EDITOR.FIELDS.QUERY' | translate}} {{queryIndex + 1}}</h4>
|
|
||||||
</div>
|
|
||||||
<div class="col-auto d-flex">
|
|
||||||
<button mat-icon-button class="action-list-icon" matTooltip="{{'REFERENCE-TYPE-EDITOR.ACTIONS.REMOVE-QUERY' | translate}}" (click)="removeQuery(sourceIndex, queryIndex)" [disabled]="formGroup.disabled">
|
|
||||||
<mat-icon>delete</mat-icon>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="col-auto">
|
|
||||||
<button mat-button class="action-btn" type="button" (click)="addCase(sourceIndex, queryIndex)" [disabled]="formGroup.disabled">{{'REFERENCE-TYPE-EDITOR.ACTIONS.ADD-CASE' | translate}}</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</mat-card-header>
|
|
||||||
<mat-card-content>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.NAME' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="name" [formControl]="query.get('name')" required>
|
|
||||||
<mat-error *ngIf="query.get('name').hasError('backendError')">{{query.get('name').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="query.get('name').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.DEFAULT-VALUE' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="defaultValue" [formControl]="query.get('defaultValue')">
|
|
||||||
<mat-error *ngIf="query.get('defaultValue').hasError('backendError')">{{query.get('defaultValue').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="query.get('defaultValue').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</mat-card-content>
|
|
||||||
</div>
|
|
||||||
Query Cases
|
|
||||||
<div *ngFor="let case of query.get('cases').controls; let caseIndex=index;" class="row mb-3">
|
|
||||||
<div class="col-12">
|
|
||||||
<mat-card-header>
|
|
||||||
<div class="row mb-3 d-flex align-items-center">
|
|
||||||
<div class="col-auto d-flex">
|
|
||||||
<h4 class="col-12">{{'REFERENCE-TYPE-EDITOR.FIELDS.CASE' | translate}} {{caseIndex + 1}}</h4>
|
|
||||||
</div>
|
|
||||||
<div class="col-auto d-flex">
|
|
||||||
<button mat-icon-button class="action-list-icon" matTooltip="{{'REFERENCE-TYPE-EDITOR.ACTIONS.REMOVE-CASE' | translate}}" (click)="removeCase(sourceIndex, queryIndex, caseIndex)" [disabled]="formGroup.disabled">
|
|
||||||
<mat-icon>delete</mat-icon>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</mat-card-header>
|
|
||||||
<mat-card-content>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.LIKE-PATTERN' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="likePattern" [formControl]="case.get('likePattern')">
|
|
||||||
<mat-error *ngIf="case.get('likePattern').hasError('backendError')">{{case.get('likePattern').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="case.get('likePattern').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.SEPARATOR' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="separator" [formControl]="case.get('separator')">
|
|
||||||
<mat-error *ngIf="case.get('separator').hasError('backendError')">{{case.get('separator').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="case.get('separator').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.VALUE' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="value" [formControl]="case.get('value')">
|
|
||||||
<mat-error *ngIf="case.get('value').hasError('backendError')">{{case.get('value').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="case.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6" *ngIf="source.get('referenceTypeDependencyIds').value">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.REFERENCE-TYPE' | translate}}</mat-label>
|
|
||||||
<mat-select name="referenceTypeId" [formControl]="case.get('referenceTypeId')">
|
|
||||||
<mat-option *ngFor="let referenceType of referenceTypeDependenciesMap.get(sourceIndex)" [value]="referenceType.id">
|
|
||||||
{{referenceType.code}}
|
|
||||||
</mat-option>
|
|
||||||
</mat-select> -->
|
|
||||||
<!-- <app-single-auto-complete [formControl]="case.get('referenceTypeId')" [configuration]="selectedDepedencies(sourceIndex)"></app-single-auto-complete> -->
|
|
||||||
<!-- <mat-error *ngIf="case.get('referenceTypeId').hasError('backendError')">{{case.get('referenceTypeId').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="case.get('referenceTypeId').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6" *ngIf="case.get('referenceTypeId').value">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.SOURCE-KEY' | translate}}</mat-label>
|
|
||||||
<mat-select name = 'referenceTypeSourceKey' [formControl]="case.get('referenceTypeSourceKey')">
|
|
||||||
<mat-option *ngFor="let sourceKey of sourceKeysMap.get(case.get('referenceTypeId').value)" [value]="sourceKey">
|
|
||||||
{{sourceKey}}
|
|
||||||
</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
<mat-error *ngIf="case.get('referenceTypeSourceKey').hasError('backendError')">{{case.get('referenceTypeSourceKey').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="case.get('referenceTypeSourceKey').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</mat-card-content>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
Options
|
|
||||||
<div class="row" *ngIf="source.get('type').value == referenceTypeSourceType.STATIC">
|
|
||||||
<div class="col-12">
|
|
||||||
<h3 class="col-12">{{'REFERENCE-TYPE-EDITOR.FIELDS.OPTIONS' | translate}}</h3>
|
|
||||||
<div *ngFor="let option of source.get('options').controls; let optionsIndex=index;" class="row mb-3">
|
|
||||||
<div class="col-12">
|
|
||||||
<mat-card-header>
|
|
||||||
<div class="row mb-3 d-flex align-items-center">
|
|
||||||
<div class="col-auto d-flex">
|
|
||||||
<h4 class="col-12">{{'REFERENCE-TYPE-EDITOR.FIELDS.OPTION' | translate}} {{optionsIndex + 1}}</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</mat-card-header>
|
|
||||||
<mat-card-content>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.CODE' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" [readonly]="option.get('code').disabled" name="code" [formControl]="option.get('code')">
|
|
||||||
<mat-error *ngIf="option.get('code').hasError('backendError')">{{option.get('code').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="option.get('code').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<mat-form-field class="w-100">
|
|
||||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.VALUE' | translate}}</mat-label>
|
|
||||||
<input matInput type="text" name="value" [formControl]="option.get('value')">
|
|
||||||
<mat-error *ngIf="option.get('value').hasError('backendError')">{{option.get('value').getError('backendError').message}}</mat-error>
|
|
||||||
<mat-error *ngIf="option.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</mat-card-content>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue