use of org.jnosql.diana.api.column.ColumnCondition in project jnosql-artemis by eclipse.
the class ColumnQueryParserUtil method or.
static ConditionResult or(Object[] args, int index, String token, String methodName, ClassRepresentation representation, ColumnCondition queryCondition, Converters converters) {
String field = token.replace(ColumnQueryParserUtil.OR, ColumnQueryParserUtil.EMPTY);
ColumnCondition conditionResult = toCondition(field, index, args, methodName, representation, converters);
ColumnCondition condition = null;
if (queryCondition == null) {
condition = conditionResult;
} else {
condition = queryCondition.or(conditionResult);
}
if (Condition.BETWEEN.equals(condition.getCondition())) {
return new ConditionResult(index + 2, condition);
} else {
return new ConditionResult(++index, condition);
}
}
use of org.jnosql.diana.api.column.ColumnCondition in project jnosql-artemis by eclipse.
the class AbstractMapperQuery method gtImpl.
protected void gtImpl(Number value) {
requireNonNull(value, "value is required");
ColumnCondition newCondition = ColumnCondition.gt(Column.of(representation.getColumnField(name), getValue(value)));
appendCondition(newCondition);
}
use of org.jnosql.diana.api.column.ColumnCondition in project jnosql-artemis by eclipse.
the class AbstractMapperQuery method likeImpl.
protected void likeImpl(String value) {
requireNonNull(value, "value is required");
ColumnCondition newCondition = ColumnCondition.like(Column.of(representation.getColumnField(name), getValue(value)));
appendCondition(newCondition);
}
use of org.jnosql.diana.api.column.ColumnCondition in project jnosql-artemis by eclipse.
the class AbstractMapperQuery method lteImpl.
protected void lteImpl(Number value) {
requireNonNull(value, "value is required");
ColumnCondition newCondition = ColumnCondition.lte(Column.of(representation.getColumnField(name), getValue(value)));
appendCondition(newCondition);
}
use of org.jnosql.diana.api.column.ColumnCondition in project jnosql-artemis by eclipse.
the class ColumnRepositoryProxyTest method shouldFindByGreaterThan.
@Test
public void shouldFindByGreaterThan() {
Person ada = Person.builder().withAge(20).withName("Ada").build();
when(template.select(any(ColumnQuery.class))).thenReturn(singletonList(ada));
personRepository.findByAgeGreaterThan(33);
ArgumentCaptor<ColumnQuery> captor = ArgumentCaptor.forClass(ColumnQuery.class);
verify(template).select(captor.capture());
ColumnQuery query = captor.getValue();
ColumnCondition condition = query.getCondition().get();
assertEquals("Person", query.getColumnFamily());
assertEquals(GREATER_THAN, condition.getCondition());
assertEquals(Column.of("age", 33), condition.getColumn());
}
Aggregations