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;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
public class QueryConfig {
|
||||
|
||||
private String condition;
|
||||
private String separator;
|
||||
private String value;
|
||||
private Integer ordinal;
|
||||
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
@XmlElement(name = "condition")
|
||||
public void setCondition(String condition) {
|
||||
this.condition = condition;
|
||||
}
|
||||
|
@ -19,6 +23,7 @@ public class QueryConfig {
|
|||
return separator;
|
||||
}
|
||||
|
||||
@XmlElement(name = "separator")
|
||||
public void setSeparator(String separator) {
|
||||
this.separator = separator;
|
||||
}
|
||||
|
@ -27,7 +32,17 @@ public class QueryConfig {
|
|||
return value;
|
||||
}
|
||||
|
||||
@XmlElement(name = "value")
|
||||
public void setValue(String 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) {
|
||||
String finalQuery = "";
|
||||
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.getSeparator() != null) {
|
||||
String[] likes = externalUrlCriteria.getLike().split(queryConfig.getSeparator());
|
||||
|
@ -295,7 +295,6 @@ public class RemoteFetcher {
|
|||
} else {
|
||||
completedPath = completedPath.replace("{path}", "");
|
||||
}
|
||||
logger.info(completedPath);
|
||||
return completedPath;
|
||||
}
|
||||
|
||||
|
|
|
@ -878,15 +878,18 @@ but not
|
|||
<contenttype>application/json; charset=UTF-8</contenttype>
|
||||
<queries>
|
||||
<query>
|
||||
<ordinal>0</ordinal>
|
||||
<condition>^[A-Za-z0-9]+ [A-Za-z0-9]+$</condition>
|
||||
<separator> </separator>
|
||||
<value>((given-names:{like1}+AND+family-name:{like2})+OR+(given-names:{like2}+AND+family-name:{like1}))</value>
|
||||
</query>
|
||||
<query>
|
||||
<ordinal>1</ordinal>
|
||||
<condition>\d{4}-\d{4}-\d{4}-\d{4}</condition>
|
||||
<value>orcid:{like}</value>
|
||||
</query>
|
||||
<query>
|
||||
<ordinal>2</ordinal>
|
||||
<condition>.+</condition>
|
||||
<value>given-names:{like}+OR+family-name:{like}</value>
|
||||
</query>
|
||||
|
@ -896,7 +899,7 @@ but not
|
|||
<fields>
|
||||
<id>'orcid-id'</id>
|
||||
<firstName>'given-names'</firstName>
|
||||
<lastName>'family-name'</lastName>
|
||||
<lastName>'family-names'</lastName>
|
||||
<name>'name'</name>
|
||||
</fields>
|
||||
</data>
|
||||
|
|
Loading…
Reference in New Issue