use of org.graylog.plugins.views.search.rest.ExecutionState in project graylog2-server by Graylog2.
the class Search method applyExecutionState.
public Search applyExecutionState(ObjectMapper objectMapper, ExecutionState executionState) {
final Builder builder = toBuilder();
if (!executionState.parameterBindings().isEmpty()) {
final ImmutableSet<Parameter> parameters = parameters().stream().map(param -> param.applyBindings(executionState.parameterBindings())).collect(toImmutableSet());
builder.parameters(parameters);
}
if (executionState.queries() != null || executionState.globalOverride() != null) {
final ImmutableSet<Query> queries = queries().stream().map(query -> applyStateToQuery(executionState, query)).collect(toImmutableSet());
builder.queries(queries);
}
return builder.build();
}
use of org.graylog.plugins.views.search.rest.ExecutionState in project graylog2-server by Graylog2.
the class SearchTest method keepsMultipleSearchTypesWhenOverridden.
@Test
public void keepsMultipleSearchTypesWhenOverridden() {
Search before = Search.builder().queries(queriesWithSearchTypes("oans,zwoa", "gsuffa")).build();
ExecutionState executionState = partialResultsMapWithSearchTypes("oans", "gsuffa");
Search after = before.applyExecutionState(objectMapperProvider.get(), executionState);
assertThat(searchTypeIdsFrom(after)).containsExactlyInAnyOrder("oans", "gsuffa");
}
use of org.graylog.plugins.views.search.rest.ExecutionState in project graylog2-server by Graylog2.
the class SearchTest method keepsSingleSearchTypeWhenOverridden.
@Test
public void keepsSingleSearchTypeWhenOverridden() {
Search before = Search.builder().queries(queriesWithSearchTypes("oans,zwoa")).build();
ExecutionState executionState = partialResultsMapWithSearchTypes("oans");
Search after = before.applyExecutionState(objectMapperProvider.get(), executionState);
assertThat(searchTypeIdsFrom(after)).containsOnly("oans");
}
Aggregations