Commit 5e1ff4eb authored by Jean-Baptiste Nizet's avatar Jean-Baptiste Nizet
Browse files

feat: externalize the faidare search URL

parent abefa05c
......@@ -31,6 +31,13 @@ public class FaidareProperties {
private String securityUserGroupWsUrl;
private String securityUserGroupWsToken;
/**
* The URL used by the germplasm card to generate links to the faidare search application
* (i.e. the faidare flavor of data-discovery).
*/
@NotBlank
private String searchUrl;
private List<DataSourceImpl> dataSources = new ArrayList<>();
public String getElasticsearchIndexingTemplate() {
......@@ -118,6 +125,11 @@ public class FaidareProperties {
.replace("{documentType}", documentType.toLowerCase());
}
public String getSearchUrl() {
return searchUrl;
}
public void setSearchUrl(String searchUrl) {
this.searchUrl = searchUrl;
}
}
package fr.inra.urgi.faidare.web.thymeleaf;
import fr.inra.urgi.faidare.config.FaidareProperties;
import org.springframework.stereotype.Component;
import org.thymeleaf.dialect.AbstractDialect;
import org.thymeleaf.dialect.IExpressionObjectDialect;
......@@ -12,14 +13,15 @@ import org.thymeleaf.expression.IExpressionObjectFactory;
@Component
public class FaidareDialect extends AbstractDialect implements IExpressionObjectDialect {
private final IExpressionObjectFactory FAIDARE_EXPRESSION_OBJECTS_FACTORY = new FaidareExpressionFactory();
private final IExpressionObjectFactory faidareExpressionFactory;
protected FaidareDialect() {
public FaidareDialect(FaidareProperties faidareProperties) {
super("faidare");
faidareExpressionFactory = new FaidareExpressionFactory(faidareProperties.getSearchUrl());
}
@Override
public IExpressionObjectFactory getExpressionObjectFactory() {
return FAIDARE_EXPRESSION_OBJECTS_FACTORY;
return faidareExpressionFactory;
}
}
......@@ -16,6 +16,12 @@ public class FaidareExpressionFactory implements IExpressionObjectFactory {
private static final Set<String> ALL_EXPRESSION_OBJECT_NAMES =
Collections.singleton(FAIDARE_EVALUATION_VARIABLE_NAME);
private final String searchUrl;
public FaidareExpressionFactory(String searchUrl) {
this.searchUrl = searchUrl;
}
@Override
public Set<String> getAllExpressionObjectNames() {
return ALL_EXPRESSION_OBJECT_NAMES;
......@@ -23,7 +29,7 @@ public class FaidareExpressionFactory implements IExpressionObjectFactory {
@Override
public Object buildObject(IExpressionContext context, String expressionObjectName) {
return new FaidareExpressions(context.getLocale());
return new FaidareExpressions(context.getLocale(), searchUrl);
}
@Override
......
......@@ -57,9 +57,11 @@ public class FaidareExpressions {
}
private final Locale locale;
private final String searchUrl;
public FaidareExpressions(Locale locale) {
public FaidareExpressions(Locale locale, String searchUrl) {
this.locale = locale;
this.searchUrl = searchUrl;
}
public String toSiteParam(String siteId) {
......@@ -85,7 +87,7 @@ public class FaidareExpressions {
}
public String searchUrl() {
return "https://urgi.versailles.inrae.fr/faidare/search";
return searchUrl;
}
private String collPopTitle(CollPopVO collPopVO, Function<String, String> nameTransformer) {
......
......@@ -43,6 +43,8 @@ faidare:
security-user-group-ws-url:
security-user-group-ws-token:
search-url: https://urgi.versailles.inrae.fr/faidare/search
# TODO: Update URIs to match URL (update in generated JSON document too)
# Warning! URIs should match with FAIDARE datadiscovery 'schema:includedInDataCatalog' field value
data-sources:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment