use of com.yahoo.elide.core.filter.dialect.jsonapi.DefaultFilterDialect in project elide by yahoo.
the class VerboseErrorResponsesTestBinder method configure.
@Override
protected void configure() {
EntityDictionary dictionary = EntityDictionary.builder().injector(injector::inject).checks(TestCheckMappings.MAPPINGS).build();
bind(dictionary).to(EntityDictionary.class);
// Elide instance
bindFactory(new Factory<Elide>() {
@Override
public Elide provide() {
DefaultFilterDialect defaultFilterStrategy = new DefaultFilterDialect(dictionary);
RSQLFilterDialect rsqlFilterStrategy = RSQLFilterDialect.builder().dictionary(dictionary).build();
MultipleFilterDialect multipleFilterStrategy = new MultipleFilterDialect(Arrays.asList(rsqlFilterStrategy, defaultFilterStrategy), Arrays.asList(rsqlFilterStrategy, defaultFilterStrategy));
Elide elide = new Elide(new ElideSettingsBuilder(getDataStore()).withAuditLogger(auditLogger).withJoinFilterDialect(multipleFilterStrategy).withSubqueryFilterDialect(multipleFilterStrategy).withEntityDictionary(dictionary).withVerboseErrors().build());
elide.doScans();
return elide;
}
@Override
public void dispose(Elide elide) {
// do nothing
}
}).to(Elide.class).named("elide");
bind(new BillingService() {
@Override
public long purchase(Invoice invoice) {
return 0;
}
}).to(BillingService.class);
}
use of com.yahoo.elide.core.filter.dialect.jsonapi.DefaultFilterDialect in project elide by yahoo.
the class ElideSettingsBuilder method build.
public ElideSettings build() {
if (joinFilterDialects.isEmpty()) {
joinFilterDialects.add(new DefaultFilterDialect(entityDictionary));
joinFilterDialects.add(RSQLFilterDialect.builder().dictionary(entityDictionary).build());
}
if (subqueryFilterDialects.isEmpty()) {
subqueryFilterDialects.add(new DefaultFilterDialect(entityDictionary));
subqueryFilterDialects.add(RSQLFilterDialect.builder().dictionary(entityDictionary).build());
}
if (graphqlFilterDialect == null) {
graphqlFilterDialect = RSQLFilterDialect.builder().dictionary(entityDictionary).build();
}
if (entityDictionary == null) {
throw new IllegalStateException("EntityDictionary must be set in ElideSettings.");
}
return new ElideSettings(auditLogger, dataStore, entityDictionary, jsonApiMapper, errorMapper, permissionExecutorFunction, joinFilterDialects, subqueryFilterDialects, graphqlFilterDialect, jsonApiLinks, defaultMaxPageSize, defaultPageSize, updateStatusCode, serdes, enableJsonLinks, strictQueryParams, baseUrl, jsonApiPath, graphQLApiPath, exportApiPath);
}
use of com.yahoo.elide.core.filter.dialect.jsonapi.DefaultFilterDialect in project elide by yahoo.
the class FilterPredicateTest method setup.
@BeforeAll
static void setup() {
EntityDictionary entityDictionary = EntityDictionary.builder().build();
entityDictionary.bindEntity(Book.class);
entityDictionary.bindEntity(Author.class);
strategy = new DefaultFilterDialect(entityDictionary);
}
use of com.yahoo.elide.core.filter.dialect.jsonapi.DefaultFilterDialect in project elide by yahoo.
the class DefaultFilterDialectTest method init.
@BeforeAll
public static void init() {
EntityDictionary dictionary = EntityDictionary.builder().build();
dictionary.bindEntity(Author.class);
dictionary.bindEntity(Book.class);
dialect = new DefaultFilterDialect(dictionary);
}
use of com.yahoo.elide.core.filter.dialect.jsonapi.DefaultFilterDialect in project elide by yahoo.
the class StandardTestBinder method configure.
@Override
protected void configure() {
EntityDictionary dictionary = EntityDictionary.builder().injector(injector::inject).checks(TestCheckMappings.MAPPINGS).build();
bind(dictionary).to(EntityDictionary.class);
// Elide instance
bindFactory(new Factory<Elide>() {
@Override
public Elide provide() {
DefaultFilterDialect defaultFilterStrategy = new DefaultFilterDialect(dictionary);
RSQLFilterDialect rsqlFilterStrategy = RSQLFilterDialect.builder().dictionary(dictionary).build();
MultipleFilterDialect multipleFilterStrategy = new MultipleFilterDialect(Arrays.asList(rsqlFilterStrategy, defaultFilterStrategy), Arrays.asList(rsqlFilterStrategy, defaultFilterStrategy));
Elide elide = new Elide(new ElideSettingsBuilder(IntegrationTest.getDataStore()).withAuditLogger(auditLogger).withJoinFilterDialect(multipleFilterStrategy).withSubqueryFilterDialect(multipleFilterStrategy).withEntityDictionary(dictionary).withISO8601Dates("yyyy-MM-dd'T'HH:mm'Z'", Calendar.getInstance().getTimeZone()).build());
elide.doScans();
return elide;
}
@Override
public void dispose(Elide elide) {
}
}).to(Elide.class).named("elide");
bind(BILLING_SERVICE).to(BillingService.class);
}
Aggregations