use of com.yahoo.elide.RefreshableElide in project elide by yahoo.
the class ElideAutoConfiguration method getRefreshableElide.
/**
* Creates the Elide instance with standard settings.
* @param dictionary Stores the static metadata about Elide models.
* @param dataStore The persistence store.
* @param transactionRegistry Global transaction registry.
* @param settings Elide settings.
* @return A new elide instance.
*/
@Bean
@RefreshScope
@ConditionalOnMissingBean
public RefreshableElide getRefreshableElide(EntityDictionary dictionary, DataStore dataStore, TransactionRegistry transactionRegistry, ElideConfigProperties settings, JsonApiMapper mapper, ErrorMapper errorMapper) {
ElideSettingsBuilder builder = new ElideSettingsBuilder(dataStore).withEntityDictionary(dictionary).withErrorMapper(errorMapper).withJsonApiMapper(mapper).withDefaultMaxPageSize(settings.getMaxPageSize()).withDefaultPageSize(settings.getPageSize()).withJoinFilterDialect(RSQLFilterDialect.builder().dictionary(dictionary).build()).withSubqueryFilterDialect(RSQLFilterDialect.builder().dictionary(dictionary).build()).withAuditLogger(new Slf4jLogger()).withBaseUrl(settings.getBaseUrl()).withISO8601Dates("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC")).withJsonApiPath(settings.getJsonApi().getPath()).withGraphQLApiPath(settings.getGraphql().getPath());
if (settings.isVerboseErrors()) {
builder.withVerboseErrors();
}
if (settings.getAsync() != null && settings.getAsync().getExport() != null && settings.getAsync().getExport().isEnabled()) {
builder.withExportApiPath(settings.getAsync().getExport().getPath());
}
if (settings.getJsonApi() != null && settings.getJsonApi().isEnabled() && settings.getJsonApi().isEnableLinks()) {
String baseUrl = settings.getBaseUrl();
if (StringUtils.isEmpty(baseUrl)) {
builder.withJSONApiLinks(new DefaultJSONApiLinks());
} else {
String jsonApiBaseUrl = baseUrl + settings.getJsonApi().getPath() + "/";
builder.withJSONApiLinks(new DefaultJSONApiLinks(jsonApiBaseUrl));
}
}
Elide elide = new Elide(builder.build(), transactionRegistry, dictionary.getScanner(), true);
return new RefreshableElide(elide);
}
use of com.yahoo.elide.RefreshableElide in project elide by yahoo.
the class IntegrationTestSetup method initializeElide.
// Initialize beans here if needed.
// We recreate the Elide bean here without @RefreshScope so that it can be used With @SpyBean.
@Bean
public RefreshableElide initializeElide(EntityDictionary dictionary, DataStore dataStore, ElideConfigProperties settings, JsonApiMapper mapper, ErrorMapper errorMapper) {
ElideSettingsBuilder builder = new ElideSettingsBuilder(dataStore).withEntityDictionary(dictionary).withErrorMapper(errorMapper).withJsonApiMapper(mapper).withDefaultMaxPageSize(settings.getMaxPageSize()).withDefaultPageSize(settings.getPageSize()).withJoinFilterDialect(RSQLFilterDialect.builder().dictionary(dictionary).build()).withSubqueryFilterDialect(RSQLFilterDialect.builder().dictionary(dictionary).build()).withAuditLogger(new Slf4jLogger()).withBaseUrl(settings.getBaseUrl()).withISO8601Dates("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC")).withJsonApiPath(settings.getJsonApi().getPath()).withGraphQLApiPath(settings.getGraphql().getPath());
if (settings.isVerboseErrors()) {
builder.withVerboseErrors();
}
if (settings.getAsync() != null && settings.getAsync().getExport() != null && settings.getAsync().getExport().isEnabled()) {
builder.withExportApiPath(settings.getAsync().getExport().getPath());
}
if (settings.getJsonApi() != null && settings.getJsonApi().isEnabled() && settings.getJsonApi().isEnableLinks()) {
String baseUrl = settings.getBaseUrl();
if (StringUtils.isEmpty(baseUrl)) {
builder.withJSONApiLinks(new DefaultJSONApiLinks());
} else {
String jsonApiBaseUrl = baseUrl + settings.getJsonApi().getPath() + "/";
builder.withJSONApiLinks(new DefaultJSONApiLinks(jsonApiBaseUrl));
}
}
Elide elide = new Elide(builder.build(), new TransactionRegistry(), dictionary.getScanner(), true);
return new RefreshableElide(spy(elide));
}
Aggregations