#589 - ElasticSearch - refactor to DocQueryContext

This commit is contained in:
Robin Bygrave
2016-03-08 00:00:02 +13:00
parent da8766533f
commit 37b86f2191
32 changed files with 155 additions and 788 deletions
@@ -0,0 +1,93 @@
package com.avaje.ebeaninternal.server.expression;
import com.avaje.ebean.LikeType;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* Context for writing a doc store query.
*/
public interface DocQueryContext {
/**
* Start a conjunction or disjunction.
*/
void startBool(boolean conjunction) throws IOException;
/**
* Start a conjunction.
*/
void startBoolMust() throws IOException;
/**
* Start a boolean NOT.
*/
void startBoolMustNot() throws IOException;
/**
* End a bool expression/group.
*/
void endBool() throws IOException;
/**
* Write a equalTo expression.
*/
void writeEqualTo(String propertyName, Object value) throws IOException;
/**
* Write a case insensitive equalTo expression.
*/
void writeIEqualTo(String propName, String value) throws IOException;
/**
* Write a range operation with one value.
*/
void writeRange(String propertyName, String rangeType, Object value) throws IOException;
/**
* Write a range operation with a lower and upper values.
*/
void writeRange(String propertyName, Op lowOp, Object valueLow, Op highOp, Object valueHigh) throws IOException;
/**
* Write an In expression.
*/
void writeIn(String propertyName, Object[] values, boolean not) throws IOException;
/**
* Write an Id in expression.
*/
void writeIds(List<?> idList) throws IOException;
/**
* Write an Id equals expression.
*/
void writeId(Object value) throws IOException;
/**
* Write a raw expression with bind values (might not be supported).
*/
void writeRaw(String raw, Object[] values) throws IOException;
/**
* Write an exists expression.
*/
void writeExists(boolean notNull, String propertyName) throws IOException;
/**
* Write one of the base expressions.
*/
void writeSimple(Op type, String propertyName, Object value) throws IOException;
/**
* Write an all equals expression.
*/
void writeAllEquals(Map<String, Object> propMap) throws IOException;
/**
* Write a Like expression.
*/
void writeLike(String propName, String val, LikeType type, boolean caseInsensitive) throws IOException;
}