Further stability improvement over external urls query
This commit is contained in:
parent
0f4b209427
commit
66511d2ed6
|
@ -1,16 +1,20 @@
|
||||||
package eu.eudat.logic.proxy.config;
|
package eu.eudat.logic.proxy.config;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
public class QueryConfig {
|
public class QueryConfig {
|
||||||
|
|
||||||
private String condition;
|
private String condition;
|
||||||
private String separator;
|
private String separator;
|
||||||
private String value;
|
private String value;
|
||||||
|
private Integer ordinal;
|
||||||
|
|
||||||
|
|
||||||
public String getCondition() {
|
public String getCondition() {
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "condition")
|
||||||
public void setCondition(String condition) {
|
public void setCondition(String condition) {
|
||||||
this.condition = condition;
|
this.condition = condition;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +23,7 @@ public class QueryConfig {
|
||||||
return separator;
|
return separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "separator")
|
||||||
public void setSeparator(String separator) {
|
public void setSeparator(String separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +32,17 @@ public class QueryConfig {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "value")
|
||||||
public void setValue(String value) {
|
public void setValue(String value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getOrdinal() {
|
||||||
|
return ordinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "ordinal")
|
||||||
|
public void setOrdinal(Integer ordinal) {
|
||||||
|
this.ordinal = ordinal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,7 +227,7 @@ public class RemoteFetcher {
|
||||||
private String calculateQuery(ExternalUrlCriteria externalUrlCriteria, List<QueryConfig> queryConfigs) {
|
private String calculateQuery(ExternalUrlCriteria externalUrlCriteria, List<QueryConfig> queryConfigs) {
|
||||||
String finalQuery = "";
|
String finalQuery = "";
|
||||||
QueryConfig queryConfig = queryConfigs.stream().filter(queryConfigl -> externalUrlCriteria.getLike().matches(queryConfigl.getCondition()))
|
QueryConfig queryConfig = queryConfigs.stream().filter(queryConfigl -> externalUrlCriteria.getLike().matches(queryConfigl.getCondition()))
|
||||||
.findFirst().orElse(null);
|
.min((Comparator.comparing(QueryConfig::getOrdinal))).orElse(null);
|
||||||
if (queryConfig != null) {
|
if (queryConfig != null) {
|
||||||
if (queryConfig.getSeparator() != null) {
|
if (queryConfig.getSeparator() != null) {
|
||||||
String[] likes = externalUrlCriteria.getLike().split(queryConfig.getSeparator());
|
String[] likes = externalUrlCriteria.getLike().split(queryConfig.getSeparator());
|
||||||
|
@ -295,7 +295,6 @@ public class RemoteFetcher {
|
||||||
} else {
|
} else {
|
||||||
completedPath = completedPath.replace("{path}", "");
|
completedPath = completedPath.replace("{path}", "");
|
||||||
}
|
}
|
||||||
logger.info(completedPath);
|
|
||||||
return completedPath;
|
return completedPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -878,15 +878,18 @@ but not
|
||||||
<contenttype>application/json; charset=UTF-8</contenttype>
|
<contenttype>application/json; charset=UTF-8</contenttype>
|
||||||
<queries>
|
<queries>
|
||||||
<query>
|
<query>
|
||||||
|
<ordinal>0</ordinal>
|
||||||
<condition>^[A-Za-z0-9]+ [A-Za-z0-9]+$</condition>
|
<condition>^[A-Za-z0-9]+ [A-Za-z0-9]+$</condition>
|
||||||
<separator> </separator>
|
<separator> </separator>
|
||||||
<value>((given-names:{like1}+AND+family-name:{like2})+OR+(given-names:{like2}+AND+family-name:{like1}))</value>
|
<value>((given-names:{like1}+AND+family-name:{like2})+OR+(given-names:{like2}+AND+family-name:{like1}))</value>
|
||||||
</query>
|
</query>
|
||||||
<query>
|
<query>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
<condition>\d{4}-\d{4}-\d{4}-\d{4}</condition>
|
<condition>\d{4}-\d{4}-\d{4}-\d{4}</condition>
|
||||||
<value>orcid:{like}</value>
|
<value>orcid:{like}</value>
|
||||||
</query>
|
</query>
|
||||||
<query>
|
<query>
|
||||||
|
<ordinal>2</ordinal>
|
||||||
<condition>.+</condition>
|
<condition>.+</condition>
|
||||||
<value>given-names:{like}+OR+family-name:{like}</value>
|
<value>given-names:{like}+OR+family-name:{like}</value>
|
||||||
</query>
|
</query>
|
||||||
|
@ -896,7 +899,7 @@ but not
|
||||||
<fields>
|
<fields>
|
||||||
<id>'orcid-id'</id>
|
<id>'orcid-id'</id>
|
||||||
<firstName>'given-names'</firstName>
|
<firstName>'given-names'</firstName>
|
||||||
<lastName>'family-name'</lastName>
|
<lastName>'family-names'</lastName>
|
||||||
<name>'name'</name>
|
<name>'name'</name>
|
||||||
</fields>
|
</fields>
|
||||||
</data>
|
</data>
|
||||||
|
|
Loading…
Reference in New Issue