You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metamodel.apache.org by ka...@apache.org on 2013/07/22 10:10:46 UTC
[33/64] [partial] Hard rename of all 'org/eobjects' folders to
'org/apache'.
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/query/MaxAggregateBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/query/MaxAggregateBuilder.java b/core/src/main/java/org/eobjects/metamodel/query/MaxAggregateBuilder.java
deleted file mode 100644
index 93591f1..0000000
--- a/core/src/main/java/org/eobjects/metamodel/query/MaxAggregateBuilder.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.eobjects.metamodel.query;
-
-import org.eobjects.metamodel.util.AggregateBuilder;
-import org.eobjects.metamodel.util.ObjectComparator;
-
-final class MaxAggregateBuilder implements AggregateBuilder<Object> {
-
- private Object max;
-
- @Override
- public void add(Object o) {
- if (o == null) {
- return;
- }
- if (max == null) {
- max = o;
- } else {
- Comparable<Object> comparable = ObjectComparator.getComparable(max);
- if (comparable.compareTo(o) < 0) {
- max = o;
- }
- }
- }
-
- @Override
- public Object getAggregate() {
- return max;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/query/MinAggregateBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/query/MinAggregateBuilder.java b/core/src/main/java/org/eobjects/metamodel/query/MinAggregateBuilder.java
deleted file mode 100644
index 5321b22..0000000
--- a/core/src/main/java/org/eobjects/metamodel/query/MinAggregateBuilder.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.eobjects.metamodel.query;
-
-import org.eobjects.metamodel.util.AggregateBuilder;
-import org.eobjects.metamodel.util.ObjectComparator;
-
-final class MinAggregateBuilder implements AggregateBuilder<Object> {
-
- private Object min;
-
- @Override
- public void add(Object o) {
- if (o == null) {
- return;
- }
- if (min == null) {
- min = o;
- } else {
- Comparable<Object> comparable = ObjectComparator.getComparable(min);
- if (comparable.compareTo(o) > 0) {
- min = o;
- }
- }
- }
-
- @Override
- public Object getAggregate() {
- return min;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/query/OperatorType.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/query/OperatorType.java b/core/src/main/java/org/eobjects/metamodel/query/OperatorType.java
deleted file mode 100644
index 3f4782e..0000000
--- a/core/src/main/java/org/eobjects/metamodel/query/OperatorType.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.eobjects.metamodel.query;
-
-/**
- * Defines the types of operators that can be used in filters.
- *
- * @see FilterItem
- */
-public enum OperatorType {
-
- EQUALS_TO("="), DIFFERENT_FROM("<>"), LIKE("LIKE"), GREATER_THAN(">"), LESS_THAN("<"), IN("IN"),
-
- /**
- * @deprecated use {@link #LESS_THAN} instead.
- */
- @Deprecated
- LOWER_THAN("<"),
-
- /**
- * @deprecated use {@link #GREATER_THAN} instead.
- */
- @Deprecated
- HIGHER_THAN(">");
-
- private final String _sql;
-
- private OperatorType(String sql) {
- _sql = sql;
- }
-
- public String toSql() {
- return _sql;
- }
-
- /**
- * Converts from SQL string literals to an OperatorType. Valid SQL values
- * are "=", "<>", "LIKE", ">" and "<".
- *
- * @param sqlType
- * @return a OperatorType object representing the specified SQL type
- */
- public static OperatorType convertOperatorType(String sqlType) {
- if (sqlType != null) {
- for (OperatorType operator : values()) {
- if (sqlType.equals(operator.toSql())) {
- return operator;
- }
- }
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/query/OrderByClause.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/query/OrderByClause.java b/core/src/main/java/org/eobjects/metamodel/query/OrderByClause.java
deleted file mode 100644
index 8ce04ec..0000000
--- a/core/src/main/java/org/eobjects/metamodel/query/OrderByClause.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.eobjects.metamodel.query;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Represents the ORDER BY clause of a query containing OrderByItem's. The order
- * and direction of the OrderItems define the way that the result of a query
- * will be sorted.
- *
- * @see OrderByItem
- */
-public class OrderByClause extends AbstractQueryClause<OrderByItem> {
-
- private static final long serialVersionUID = 2441926135870143715L;
-
- public OrderByClause(Query query) {
- super(query, AbstractQueryClause.PREFIX_ORDER_BY,
- AbstractQueryClause.DELIM_COMMA);
- }
-
- public List<SelectItem> getEvaluatedSelectItems() {
- final List<SelectItem> result = new ArrayList<SelectItem>();
- final List<OrderByItem> items = getItems();
- for (OrderByItem item : items) {
- result.add(item.getSelectItem());
- }
- return result;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/query/OrderByItem.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/query/OrderByItem.java b/core/src/main/java/org/eobjects/metamodel/query/OrderByItem.java
deleted file mode 100644
index a52aa1d..0000000
--- a/core/src/main/java/org/eobjects/metamodel/query/OrderByItem.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.eobjects.metamodel.query;
-
-import java.util.List;
-
-import org.eobjects.metamodel.util.BaseObject;
-
-/**
- * Represents an ORDER BY item. An OrderByItem sorts the resulting DataSet
- * according to a SelectItem that may or may not be a part of the query already.
- *
- * @see OrderByClause
- * @see SelectItem
- */
-public class OrderByItem extends BaseObject implements QueryItem, Cloneable {
-
- public enum Direction {
- ASC, DESC
- }
-
- private static final long serialVersionUID = -8397473619828484774L;
- private final SelectItem _selectItem;
- private Direction _direction;
- private Query _query;
-
- /**
- * Creates an OrderByItem
- *
- * @param selectItem
- * the select item to order
- * @param direction
- * the direction to order the select item
- */
- public OrderByItem(SelectItem selectItem, Direction direction) {
- if (selectItem == null) {
- throw new IllegalArgumentException("SelectItem cannot be null");
- }
- _selectItem = selectItem;
- _direction = direction;
- }
-
- /**
- * Creates an OrderByItem
- *
- * @param selectItem
- * @param ascending
- * @deprecated user OrderByItem(SelectItem, Direction) instead
- */
- @Deprecated
- public OrderByItem(SelectItem selectItem, boolean ascending) {
- if (selectItem == null) {
- throw new IllegalArgumentException("SelectItem cannot be null");
- }
- _selectItem = selectItem;
- if (ascending) {
- _direction = Direction.ASC;
- } else {
- _direction = Direction.DESC;
- }
- }
-
- /**
- * Creates an ascending OrderByItem
- *
- * @param selectItem
- */
- public OrderByItem(SelectItem selectItem) {
- this(selectItem, Direction.ASC);
- }
-
-
- @Override
- public String toSql(boolean includeSchemaInColumnPaths) {
- StringBuilder sb = new StringBuilder();
- sb.append(_selectItem.getSameQueryAlias(includeSchemaInColumnPaths) + ' ');
- sb.append(_direction);
- return sb.toString();
- }
-
- @Override
- public String toSql() {
- return toSql(false);
- }
-
- public boolean isAscending() {
- return (_direction == Direction.ASC);
- }
-
- public boolean isDescending() {
- return (_direction == Direction.DESC);
- }
-
- public Direction getDirection() {
- return _direction;
- }
-
- public OrderByItem setDirection(Direction direction) {
- _direction = direction;
- return this;
- }
-
- public SelectItem getSelectItem() {
- return _selectItem;
- }
-
- public Query getQuery() {
- return _query;
- }
-
- public OrderByItem setQuery(Query query) {
- _query = query;
- if (_selectItem != null) {
- _selectItem.setQuery(query);
- }
- return this;
- }
-
- @Override
- protected OrderByItem clone() {
- OrderByItem o = new OrderByItem(_selectItem.clone());
- o._direction = _direction;
- return o;
- }
-
- @Override
- protected void decorateIdentity(List<Object> identifiers) {
- identifiers.add(_direction);
- identifiers.add(_selectItem);
- }
-
- @Override
- public String toString() {
- return toSql();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/query/Query.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/query/Query.java b/core/src/main/java/org/eobjects/metamodel/query/Query.java
deleted file mode 100644
index 0986b6b..0000000
--- a/core/src/main/java/org/eobjects/metamodel/query/Query.java
+++ /dev/null
@@ -1,603 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.eobjects.metamodel.query;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eobjects.metamodel.DataContext;
-import org.eobjects.metamodel.MetaModelException;
-import org.eobjects.metamodel.query.OrderByItem.Direction;
-import org.eobjects.metamodel.query.parser.QueryParserException;
-import org.eobjects.metamodel.query.parser.QueryPartCollectionProcessor;
-import org.eobjects.metamodel.query.parser.QueryPartParser;
-import org.eobjects.metamodel.query.parser.QueryPartProcessor;
-import org.eobjects.metamodel.query.parser.SelectItemParser;
-import org.eobjects.metamodel.schema.Column;
-import org.eobjects.metamodel.schema.ColumnType;
-import org.eobjects.metamodel.schema.Table;
-import org.eobjects.metamodel.util.BaseObject;
-import org.eobjects.metamodel.util.BooleanComparator;
-import org.eobjects.metamodel.util.FormatHelper;
-import org.eobjects.metamodel.util.NumberComparator;
-
-/**
- * Represents a query to retrieve data by. A query is made up of six clauses,
- * equivalent to the SQL standard:
- * <ul>
- * <li>the SELECT clause, which define the wanted columns of the resulting
- * DataSet</li>
- * <li>the FROM clause, which define where to retrieve the data from</li>
- * <li>the WHERE clause, which define filters on the retrieved data</li>
- * <li>the GROUP BY clause, which define if the result should be grouped and
- * aggregated according to some columns acting as categories</li>
- * <li>the HAVING clause, which define filters on the grouped data</li>
- * <li>the ORDER BY clause, which define sorting of the resulting dataset</li>
- * </ul>
- *
- * In addition two properties are applied to queries to limit the resulting
- * dataset:
- * <ul>
- * <li>First row: The first row (aka. offset) of the result of the query.</li>
- * <li>Max rows: The maximum amount of rows to return when executing the query.</li>
- * </ul>
- *
- * Queries are executed using the DataContext.executeQuery method or can
- * alternatively be used directly in JDBC by using the toString() method.
- *
- * @see DataContext
- */
-public final class Query extends BaseObject implements Cloneable, Serializable {
-
- private static final long serialVersionUID = -5976325207498574216L;
-
- private final SelectClause _selectClause;
- private final FromClause _fromClause;
- private final FilterClause _whereClause;
- private final GroupByClause _groupByClause;
- private final FilterClause _havingClause;
- private final OrderByClause _orderByClause;
-
- private Integer _maxRows;
- private Integer _firstRow;
-
- public Query() {
- _selectClause = new SelectClause(this);
- _fromClause = new FromClause(this);
- _whereClause = new FilterClause(this, AbstractQueryClause.PREFIX_WHERE);
- _groupByClause = new GroupByClause(this);
- _havingClause = new FilterClause(this, AbstractQueryClause.PREFIX_HAVING);
- _orderByClause = new OrderByClause(this);
- }
-
- public Query select(Column column, FromItem fromItem) {
- SelectItem selectItem = new SelectItem(column, fromItem);
- return select(selectItem);
- }
-
- public Query select(Column... columns) {
- for (Column column : columns) {
- SelectItem selectItem = new SelectItem(column);
- selectItem.setQuery(this);
- _selectClause.addItem(selectItem);
- }
- return this;
- }
-
- public Query select(SelectItem... items) {
- _selectClause.addItems(items);
- return this;
- }
-
- public Query select(FunctionType functionType, Column column) {
- _selectClause.addItem(new SelectItem(functionType, column));
- return this;
- }
-
- public Query select(String expression, String alias) {
- return select(new SelectItem(expression, alias));
- }
-
- /**
- * Adds a selection to this query.
- *
- * @param expression
- * @return
- */
- public Query select(String expression) {
- if ("*".equals(expression)) {
- return selectAll();
- }
-
- SelectItem selectItem = findSelectItem(expression, true);
- return select(selectItem);
- }
-
- private SelectItem findSelectItem(String expression, boolean allowExpressionBasedSelectItem) {
- SelectItemParser parser = new SelectItemParser(this, allowExpressionBasedSelectItem);
- return parser.findSelectItem(expression);
- }
-
- /**
- * Select all available select items from all currently available FROM
- * items. Equivalent of the expression "SELECT * FROM ..." in SQL.
- *
- * @return
- */
- public Query selectAll() {
- List<FromItem> items = getFromClause().getItems();
- for (FromItem fromItem : items) {
- selectAll(fromItem);
- }
- return this;
- }
-
- public Query selectAll(final FromItem fromItem) {
- if (fromItem.getTable() != null) {
- final Column[] columns = fromItem.getTable().getColumns();
- for (final Column column : columns) {
- select(column, fromItem);
- }
- } else if (fromItem.getJoin() != null) {
- selectAll(fromItem.getLeftSide());
- selectAll(fromItem.getRightSide());
- } else if (fromItem.getSubQuery() != null) {
- final List<SelectItem> items = fromItem.getSubQuery().getSelectClause().getItems();
- for (final SelectItem subQuerySelectItem : items) {
- select(new SelectItem(subQuerySelectItem, fromItem));
- }
- } else {
- throw new MetaModelException("All select items ('*') not determinable with from item: " + fromItem);
- }
- return this;
- }
-
- public Query selectDistinct() {
- _selectClause.setDistinct(true);
- return this;
- }
-
- public Query selectCount() {
- return select(SelectItem.getCountAllItem());
- }
-
- public Query from(FromItem... items) {
- _fromClause.addItems(items);
- return this;
- }
-
- public Query from(Table table) {
- return from(new FromItem(table));
- }
-
- public Query from(String expression) {
- return from(new FromItem(expression));
- }
-
- public Query from(Table table, String alias) {
- return from(new FromItem(table).setAlias(alias));
- }
-
- public Query from(Table leftTable, Table rightTable, JoinType joinType, Column leftOnColumn, Column rightOnColumn) {
- SelectItem[] leftOn = new SelectItem[] { new SelectItem(leftOnColumn) };
- SelectItem[] rightOn = new SelectItem[] { new SelectItem(rightOnColumn) };
- FromItem fromItem = new FromItem(joinType, new FromItem(leftTable), new FromItem(rightTable), leftOn, rightOn);
- return from(fromItem);
- }
-
- public Query groupBy(String... groupByTokens) {
- for (String groupByToken : groupByTokens) {
- SelectItem selectItem = findSelectItem(groupByToken, true);
- groupBy(new GroupByItem(selectItem));
- }
- return this;
- }
-
- public Query groupBy(GroupByItem... items) {
- for (GroupByItem item : items) {
- SelectItem selectItem = item.getSelectItem();
- if (selectItem != null && selectItem.getQuery() == null) {
- selectItem.setQuery(this);
- }
- }
- _groupByClause.addItems(items);
- return this;
- }
-
- public Query groupBy(Column... columns) {
- for (Column column : columns) {
- SelectItem selectItem = new SelectItem(column).setQuery(this);
- _groupByClause.addItem(new GroupByItem(selectItem));
- }
- return this;
- }
-
- public Query orderBy(OrderByItem... items) {
- _orderByClause.addItems(items);
- return this;
- }
-
- public Query orderBy(String... orderByTokens) {
- for (String orderByToken : orderByTokens) {
- orderByToken = orderByToken.trim();
- final Direction direction;
- if (orderByToken.toUpperCase().endsWith("DESC")) {
- direction = Direction.DESC;
- orderByToken = orderByToken.substring(0, orderByToken.length() - 4).trim();
- } else if (orderByToken.toUpperCase().endsWith("ASC")) {
- direction = Direction.ASC;
- orderByToken = orderByToken.substring(0, orderByToken.length() - 3).trim();
- } else {
- direction = Direction.ASC;
- }
-
- OrderByItem orderByItem = new OrderByItem(findSelectItem(orderByToken, true), direction);
- orderBy(orderByItem);
- }
- return this;
- }
-
- public Query orderBy(Column column) {
- return orderBy(column, Direction.ASC);
- }
-
- /**
- * @deprecated use orderBy(Column, Direction) instead
- */
- @Deprecated
- public Query orderBy(Column column, boolean ascending) {
- if (ascending) {
- return orderBy(column, Direction.ASC);
- } else {
- return orderBy(column, Direction.DESC);
- }
- }
-
- public Query orderBy(Column column, Direction direction) {
- SelectItem selectItem = _selectClause.getSelectItem(column);
- if (selectItem == null) {
- selectItem = new SelectItem(column);
- }
- return orderBy(new OrderByItem(selectItem, direction));
- }
-
- public Query where(FilterItem... items) {
- _whereClause.addItems(items);
- return this;
- }
-
- public Query where(Iterable<FilterItem> items) {
- _whereClause.addItems(items);
- return this;
- }
-
- public Query where(String... whereItemTokens) {
- for (String whereItemToken : whereItemTokens) {
- FilterItem filterItem = findFilterItem(whereItemToken);
- where(filterItem);
- }
- return this;
- }
-
- private FilterItem findFilterItem(String expression) {
- final QueryPartCollectionProcessor collectionProcessor = new QueryPartCollectionProcessor();
- new QueryPartParser(collectionProcessor, expression, " AND ", " OR ").parse();
-
- final List<String> tokens = collectionProcessor.getTokens();
- final List<String> delims = collectionProcessor.getDelims();
- if (tokens.size() == 1) {
- expression = tokens.get(0);
- } else {
- final LogicalOperator logicalOperator = LogicalOperator.valueOf(delims.get(1).trim());
-
- final List<FilterItem> filterItems = new ArrayList<FilterItem>();
- for (int i = 0; i < tokens.size(); i++) {
- String token = tokens.get(i);
- FilterItem filterItem = findFilterItem(token);
- filterItems.add(filterItem);
- }
- return new FilterItem(logicalOperator, filterItems);
- }
-
- OperatorType operator = null;
- String leftSide = null;
- final String rightSide;
- {
- String rightSideCandidate = null;
- final OperatorType[] operators = OperatorType.values();
- for (OperatorType operatorCandidate : operators) {
- final int operatorIndex = expression.indexOf(' ' + operatorCandidate.toSql() + ' ');
- if (operatorIndex > 0) {
- operator = operatorCandidate;
- leftSide = expression.substring(0, operatorIndex).trim();
- rightSideCandidate = expression.substring(operatorIndex + operator.toSql().length() + 2).trim();
- break;
- }
- }
-
- if (operator == null) {
- // check special cases for IS NULL and IS NOT NULL
- if (expression.endsWith(" IS NOT NULL")) {
- operator = OperatorType.DIFFERENT_FROM;
- leftSide = expression.substring(0, expression.lastIndexOf(" IS NOT NULL")).trim();
- rightSideCandidate = "NULL";
- } else if (expression.endsWith(" IS NULL")) {
- operator = OperatorType.EQUALS_TO;
- leftSide = expression.substring(0, expression.lastIndexOf(" IS NULL")).trim();
- rightSideCandidate = "NULL";
- }
- }
-
- rightSide = rightSideCandidate;
- }
-
- if (operator == null) {
- return new FilterItem(expression);
- }
-
- final SelectItem selectItem = findSelectItem(leftSide, false);
- if (selectItem == null) {
- return new FilterItem(expression);
- }
-
- final Object operand;
- if (operator == OperatorType.IN) {
- final List<Object> list = new ArrayList<Object>();
- new QueryPartParser(new QueryPartProcessor() {
- @Override
- public void parse(String delim, String itemToken) {
- Object operand = createOperand(itemToken, selectItem, false);
- list.add(operand);
- }
- }, rightSide, ",").parse();
- operand = list;
- } else {
- operand = createOperand(rightSide, selectItem, true);
- }
-
- return new FilterItem(selectItem, operator, operand);
- }
-
- private Object createOperand(final String token, final SelectItem leftSelectItem, final boolean searchSelectItems) {
- if (token.equalsIgnoreCase("NULL")) {
- return null;
- }
-
- if (token.startsWith("'") && token.endsWith("'") && token.length() > 2) {
- String stringOperand = token.substring(1, token.length() - 1);
- stringOperand = stringOperand.replaceAll("\\\\'", "'");
- return stringOperand;
- }
-
- if (searchSelectItems) {
- final SelectItem selectItem = findSelectItem(token, false);
- if (selectItem != null) {
- return selectItem;
- }
- }
-
- final ColumnType expectedColumnType = leftSelectItem.getExpectedColumnType();
- final Object result;
- if (expectedColumnType == null) {
- // We're assuming number here, but it could also be boolean or a
- // time based type. But anyways, this should not happen since
- // expected column type should be available.
- result = NumberComparator.toNumber(token);
- } else if (expectedColumnType.isBoolean()) {
- result = BooleanComparator.toBoolean(token);
- } else if (expectedColumnType.isTimeBased()) {
- result = FormatHelper.parseSqlTime(expectedColumnType, token);
- } else {
- result = NumberComparator.toNumber(token);
- }
-
- if (result == null) {
- // shouldn't happen since only "NULL" is parsed as null.
- throw new QueryParserException("Could not parse operand: " + token);
- }
-
- return result;
- }
-
- public Query where(SelectItem selectItem, OperatorType operatorType, Object operand) {
- return where(new FilterItem(selectItem, operatorType, operand));
- }
-
- public Query where(Column column, OperatorType operatorType, Object operand) {
- SelectItem selectItem = _selectClause.getSelectItem(column);
- if (selectItem == null) {
- selectItem = new SelectItem(column);
- }
- return where(selectItem, operatorType, operand);
- }
-
- public Query having(FilterItem... items) {
- _havingClause.addItems(items);
- return this;
- }
-
- public Query having(FunctionType function, Column column, OperatorType operatorType, Object operand) {
- SelectItem selectItem = new SelectItem(function, column);
- return having(new FilterItem(selectItem, operatorType, operand));
- }
-
- public Query having(Column column, OperatorType operatorType, Object operand) {
- SelectItem selectItem = _selectClause.getSelectItem(column);
- if (selectItem == null) {
- selectItem = new SelectItem(column);
- }
- return having(new FilterItem(selectItem, operatorType, operand));
- }
-
- public Query having(String... havingItemTokens) {
- for (String havingItemToken : havingItemTokens) {
- FilterItem filterItem = findFilterItem(havingItemToken);
- having(filterItem);
- }
- return this;
- }
-
- @Override
- public String toString() {
- return toSql();
- }
-
- /*
- * A string representation of this query. This representation will be SQL 99
- * compatible and can thus be used for database queries on databases that
- * meet SQL standards.
- */
- public String toSql() {
- return toSql(false);
- }
-
- protected String toSql(boolean includeSchemaInColumnPaths) {
- final StringBuilder sb = new StringBuilder();
- sb.append(_selectClause.toSql(includeSchemaInColumnPaths));
- sb.append(_fromClause.toSql(includeSchemaInColumnPaths));
- sb.append(_whereClause.toSql(includeSchemaInColumnPaths));
- sb.append(_groupByClause.toSql(includeSchemaInColumnPaths));
- sb.append(_havingClause.toSql(includeSchemaInColumnPaths));
- sb.append(_orderByClause.toSql(includeSchemaInColumnPaths));
- return sb.toString();
- }
-
- public SelectClause getSelectClause() {
- return _selectClause;
- }
-
- public FromClause getFromClause() {
- return _fromClause;
- }
-
- public FilterClause getWhereClause() {
- return _whereClause;
- }
-
- public GroupByClause getGroupByClause() {
- return _groupByClause;
- }
-
- public FilterClause getHavingClause() {
- return _havingClause;
- }
-
- public OrderByClause getOrderByClause() {
- return _orderByClause;
- }
-
- /**
- * Sets the maximum number of rows to be queried. If the result of the query
- * yields more rows they should be discarded.
- *
- * @param maxRows
- * the number of desired maximum rows. Can be null (default) for
- * no limits
- * @return this query
- */
- public Query setMaxRows(Integer maxRows) {
- if (maxRows != null) {
- final int maxRowsValue = maxRows.intValue();
- if (maxRowsValue == 0) {
- throw new IllegalArgumentException("Max rows cannot be zero");
- }
- if (maxRowsValue < 0) {
- throw new IllegalArgumentException("Max rows cannot be negative");
- }
- }
- _maxRows = maxRows;
- return this;
- }
-
- /**
- * @return the number of maximum rows to yield from executing this query or
- * null if no maximum/limit is set.
- */
- public Integer getMaxRows() {
- return _maxRows;
- }
-
- /**
- * Sets the first row (aka offset) of the query's result. The row number is
- * 1-based, so setting a first row value of 1 is equivalent to not setting
- * it at all..
- *
- * @param firstRow
- * the first row, where 1 is the first row.
- * @return this query
- */
- public Query setFirstRow(Integer firstRow) {
- if (firstRow != null && firstRow.intValue() < 1) {
- throw new IllegalArgumentException("First row cannot be negative or zero");
- }
- _firstRow = firstRow;
- return this;
- }
-
- /**
- * Gets the first row (aka offset) of the query's result, or null if none is
- * specified. The row number is 1-based, so setting a first row value of 1
- * is equivalent to not setting it at all..
- *
- * @return the first row (aka offset) of the query's result, or null if no
- * offset is specified.
- */
- public Integer getFirstRow() {
- return _firstRow;
- }
-
- @Override
- protected void decorateIdentity(List<Object> identifiers) {
- identifiers.add(_maxRows);
- identifiers.add(_selectClause);
- identifiers.add(_fromClause);
- identifiers.add(_whereClause);
- identifiers.add(_groupByClause);
- identifiers.add(_havingClause);
- identifiers.add(_orderByClause);
- }
-
- @Override
- public Query clone() {
- Query q = new Query();
- q.setMaxRows(_maxRows);
- q.setFirstRow(_firstRow);
- q.getSelectClause().setDistinct(_selectClause.isDistinct());
- for (FromItem item : _fromClause.getItems()) {
- q.from(item.clone());
- }
- for (SelectItem item : _selectClause.getItems()) {
- q.select(item.clone());
- }
- for (FilterItem item : _whereClause.getItems()) {
- q.where(item.clone());
- }
- for (GroupByItem item : _groupByClause.getItems()) {
- q.groupBy(item.clone());
- }
- for (FilterItem item : _havingClause.getItems()) {
- q.having(item.clone());
- }
- for (OrderByItem item : _orderByClause.getItems()) {
- q.orderBy(item.clone());
- }
- return q;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/query/QueryClause.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/query/QueryClause.java b/core/src/main/java/org/eobjects/metamodel/query/QueryClause.java
deleted file mode 100644
index e3dddc8..0000000
--- a/core/src/main/java/org/eobjects/metamodel/query/QueryClause.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.eobjects.metamodel.query;
-
-import java.io.Serializable;
-import java.util.List;
-
-public interface QueryClause<E> extends Serializable {
-
- public QueryClause<E> setItems(E... items);
-
- public QueryClause<E> addItems(E... items);
-
- public QueryClause<E> addItems(Iterable<E> items);
-
- public QueryClause<E> addItem(int index, E item);
-
- public QueryClause<E> addItem(E item);
-
- public boolean isEmpty();
-
- public int getItemCount();
-
- public E getItem(int index);
-
- public List<E> getItems();
-
- public QueryClause<E> removeItem(int index);
-
- public QueryClause<E> removeItem(E item);
-
- public QueryClause<E> removeItems();
-
- public String toSql(boolean includeSchemaInColumnPaths);
-
- public String toSql();
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/query/QueryItem.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/query/QueryItem.java b/core/src/main/java/org/eobjects/metamodel/query/QueryItem.java
deleted file mode 100644
index ab79959..0000000
--- a/core/src/main/java/org/eobjects/metamodel/query/QueryItem.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.eobjects.metamodel.query;
-
-import java.io.Serializable;
-
-/**
- * Interface for items in a query. All QueryItems reside within a QueryClause.
- *
- * @see AbstractQueryClause
- */
-public interface QueryItem extends Serializable {
-
- public QueryItem setQuery(Query query);
-
- public Query getQuery();
-
- public String toSql();
-
- public String toSql(boolean includeSchemaInColumnPaths);
-
- public String toString();
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/query/QueryParameter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/query/QueryParameter.java b/core/src/main/java/org/eobjects/metamodel/query/QueryParameter.java
deleted file mode 100644
index cbbc64e..0000000
--- a/core/src/main/java/org/eobjects/metamodel/query/QueryParameter.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.eobjects.metamodel.query;
-
-import org.eobjects.metamodel.DataContext;
-
-/**
- * Represents a query parameter, in SQL represented with a '?' symbol.
- * Parameters are values in the query that will be defined at execution time,
- * not parsing/preparation time.
- *
- * @see CompiledQuery
- * @see DataContext#compileQuery(Query)
- */
-public class QueryParameter {
-
- @Override
- public String toString() {
- return "?";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/query/SelectClause.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/query/SelectClause.java b/core/src/main/java/org/eobjects/metamodel/query/SelectClause.java
deleted file mode 100644
index 82688a5..0000000
--- a/core/src/main/java/org/eobjects/metamodel/query/SelectClause.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.eobjects.metamodel.query;
-
-import java.util.List;
-
-import org.eobjects.metamodel.schema.Column;
-
-/**
- * Represents the SELECT clause of a query containing SelectItems.
- *
- * @see SelectItem
- */
-public class SelectClause extends AbstractQueryClause<SelectItem> {
-
- private static final long serialVersionUID = -2458447191169901181L;
- private boolean _distinct = false;
-
- public SelectClause(Query query) {
- super(query, AbstractQueryClause.PREFIX_SELECT, AbstractQueryClause.DELIM_COMMA);
- }
-
- public SelectItem getSelectItem(Column column) {
- if (column != null) {
- for (SelectItem item : getItems()) {
- if (column.equals(item.getColumn())) {
- return item;
- }
- }
- }
- return null;
- }
-
- @Override
- public String toSql(boolean includeSchemaInColumnPaths) {
- if (getItems().size() == 0) {
- return "";
- }
-
- final String sql = super.toSql(includeSchemaInColumnPaths);
- StringBuilder sb = new StringBuilder(sql);
- if (_distinct) {
- sb.insert(AbstractQueryClause.PREFIX_SELECT.length(), "DISTINCT ");
- }
- return sb.toString();
- }
-
- public boolean isDistinct() {
- return _distinct;
- }
-
- public void setDistinct(boolean distinct) {
- _distinct = distinct;
- }
-
- @Override
- protected void decorateIdentity(List<Object> identifiers) {
- super.decorateIdentity(identifiers);
- identifiers.add(_distinct);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/query/SelectItem.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/query/SelectItem.java b/core/src/main/java/org/eobjects/metamodel/query/SelectItem.java
deleted file mode 100644
index a9b1707..0000000
--- a/core/src/main/java/org/eobjects/metamodel/query/SelectItem.java
+++ /dev/null
@@ -1,517 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.eobjects.metamodel.query;
-
-import java.util.List;
-
-import org.eobjects.metamodel.schema.Column;
-import org.eobjects.metamodel.schema.ColumnType;
-import org.eobjects.metamodel.schema.Schema;
-import org.eobjects.metamodel.schema.Table;
-import org.eobjects.metamodel.util.BaseObject;
-import org.eobjects.metamodel.util.EqualsBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Represents a SELECT item. SelectItems can take different forms:
- * <ul>
- * <li>column SELECTs (selects a column from a table)</li>
- * <li>column function SELECTs (aggregates the values of a column)</li>
- * <li>expression SELECTs (retrieves data based on an expression (only supported
- * for JDBC datastores)</li>
- * <li>expression function SELECTs (retrieves databased on a function and an
- * expression, only COUNT(*) is supported for non-JDBC datastores))</li>
- * <li>SELECTs from subqueries (works just like column selects, but in stead of
- * pointing to a column, it retrieves data from the select item of a subquery)</li>
- * </ul>
- *
- * @see SelectClause
- */
-public class SelectItem extends BaseObject implements QueryItem, Cloneable {
-
- private static final long serialVersionUID = 317475105509663973L;
- private static final Logger logger = LoggerFactory.getLogger(SelectItem.class);
-
- // immutable fields (essense)
- private final Column _column;
- private final FunctionType _function;
- private final String _expression;
- private final SelectItem _subQuerySelectItem;
- private final FromItem _fromItem;
-
- // mutable fields (tweaking)
- private boolean _functionApproximationAllowed;
- private Query _query;
- private String _alias;
-
- /**
- * All-arguments constructor
- *
- * @param column
- * @param fromItem
- * @param function
- * @param expression
- * @param subQuerySelectItem
- * @param alias
- * @param functionApproximationAllowed
- */
- private SelectItem(Column column, FromItem fromItem, FunctionType function, String expression,
- SelectItem subQuerySelectItem, String alias, boolean functionApproximationAllowed) {
- super();
- _column = column;
- _fromItem = fromItem;
- _function = function;
- _expression = expression;
- _subQuerySelectItem = subQuerySelectItem;
- _alias = alias;
- _functionApproximationAllowed = functionApproximationAllowed;
- }
-
- /**
- * Generates a COUNT(*) select item
- */
- public static SelectItem getCountAllItem() {
- return new SelectItem(FunctionType.COUNT, "*", null);
- }
-
- public static boolean isCountAllItem(SelectItem item) {
- if (item != null && item.getFunction() == FunctionType.COUNT && item.getExpression() == "*") {
- return true;
- }
- return false;
- }
-
- /**
- * Creates a simple SelectItem that selects from a column
- *
- * @param column
- */
- public SelectItem(Column column) {
- this(null, column);
- }
-
- /**
- * Creates a SelectItem that uses a function on a column, for example
- * SUM(price) or MAX(age)
- *
- * @param function
- * @param column
- */
- public SelectItem(FunctionType function, Column column) {
- this(function, column, null);
- }
-
- /**
- * Creates a SelectItem that references a column from a particular
- * {@link FromItem}, for example a.price or p.age
- *
- * @param column
- * @param fromItem
- */
- public SelectItem(Column column, FromItem fromItem) {
- this(null, column, fromItem);
- if (fromItem != null) {
- Table fromItemTable = fromItem.getTable();
- if (fromItemTable != null) {
- Table columnTable = column.getTable();
- if (columnTable != null && !columnTable.equals(fromItemTable)) {
- throw new IllegalArgumentException("Column's table '" + columnTable.getName()
- + "' is not equal to referenced table: " + fromItemTable);
- }
- }
- }
- }
-
- /**
- * Creates a SelectItem that uses a function on a column from a particular
- * {@link FromItem}, for example SUM(a.price) or MAX(p.age)
- *
- * @param function
- * @param column
- * @param fromItem
- */
- public SelectItem(FunctionType function, Column column, FromItem fromItem) {
- this(column, fromItem, function, null, null, null, false);
- if (column == null) {
- throw new IllegalArgumentException("column=null");
- }
- }
-
- /**
- * Creates a SelectItem based on an expression. All expression-based
- * SelectItems must have aliases.
- *
- * @param expression
- * @param alias
- */
- public SelectItem(String expression, String alias) {
- this(null, expression, alias);
- }
-
- /**
- * Creates a SelectItem based on a function and an expression. All
- * expression-based SelectItems must have aliases.
- *
- * @param function
- * @param expression
- * @param alias
- */
- public SelectItem(FunctionType function, String expression, String alias) {
- this(null, null, function, expression, null, alias, false);
- if (expression == null) {
- throw new IllegalArgumentException("expression=null");
- }
- }
-
- /**
- * Creates a SelectItem that references another select item in a subquery
- *
- * @param subQuerySelectItem
- * @param subQueryFromItem
- * the FromItem that holds the sub-query
- */
- public SelectItem(SelectItem subQuerySelectItem, FromItem subQueryFromItem) {
- this(null, subQueryFromItem, null, null, subQuerySelectItem, null, false);
- if (subQueryFromItem.getSubQuery() == null) {
- throw new IllegalArgumentException("Only sub-query based FromItems allowed.");
- }
- if (subQuerySelectItem.getQuery() != null
- && !subQuerySelectItem.getQuery().equals(subQueryFromItem.getSubQuery())) {
- throw new IllegalArgumentException("The SelectItem must exist in the sub-query");
- }
- }
-
- public String getAlias() {
- return _alias;
- }
-
- public SelectItem setAlias(String alias) {
- _alias = alias;
- return this;
- }
-
- public FunctionType getFunction() {
- return _function;
- }
-
- /**
- * @return if this is a function based SelectItem where function calculation
- * is allowed to be approximated (if the datastore type has an
- * approximate calculation method). Approximated function results
- * are as the name implies not exact, but might be valuable as an
- * optimization in some cases.
- */
- public boolean isFunctionApproximationAllowed() {
- return _functionApproximationAllowed;
- }
-
- public void setFunctionApproximationAllowed(boolean functionApproximationAllowed) {
- _functionApproximationAllowed = functionApproximationAllowed;
- }
-
- public Column getColumn() {
- return _column;
- }
-
- /**
- * Tries to infer the {@link ColumnType} of this {@link SelectItem}. For
- * expression based select items, this is not possible, and the method will
- * return null.
- *
- * @return
- */
- public ColumnType getExpectedColumnType() {
- if (_subQuerySelectItem != null) {
- return _subQuerySelectItem.getExpectedColumnType();
- }
- if (_function != null) {
- if (_column != null) {
- return _function.getExpectedColumnType(_column.getType());
- } else {
- return _function.getExpectedColumnType(null);
- }
- }
- if (_column != null) {
- return _column.getType();
- }
- return null;
- }
-
- public String getExpression() {
- return _expression;
- }
-
- public SelectItem setQuery(Query query) {
- _query = query;
- return this;
- }
-
- public Query getQuery() {
- return _query;
- }
-
- public SelectItem getSubQuerySelectItem() {
- return _subQuerySelectItem;
- }
-
- /**
- * @deprecated use {@link #getFromItem()} instead
- */
- @Deprecated
- public FromItem getSubQueryFromItem() {
- return _fromItem;
- }
-
- public FromItem getFromItem() {
- return _fromItem;
- }
-
- /**
- * @return the name that this SelectItem can be referenced with, if
- * referenced from a super-query. This will usually be the alias,
- * but if there is no alias, then the column name will be used.
- */
- public String getSuperQueryAlias() {
- return getSuperQueryAlias(true);
- }
-
- /**
- * @return the name that this SelectItem can be referenced with, if
- * referenced from a super-query. This will usually be the alias,
- * but if there is no alias, then the column name will be used.
- *
- * @param includeQuotes
- * indicates whether or not the output should include quotes, if
- * the select item's column has quotes associated (typically
- * true, but false if used for presentation)
- */
- public String getSuperQueryAlias(boolean includeQuotes) {
- if (_alias != null) {
- return _alias;
- } else if (_column != null) {
- final StringBuilder sb = new StringBuilder();
- if (_function != null) {
- sb.append(_function.toString());
- sb.append('(');
- }
- if (includeQuotes) {
- sb.append(_column.getQuotedName());
- } else {
- sb.append(_column.getName());
- }
- if (_function != null) {
- sb.append(')');
- }
- return sb.toString();
- } else {
- logger.debug("Could not resolve a reasonable super-query alias for SelectItem: {}", toSql());
- return toStringNoAlias().toString();
- }
- }
-
- public String getSameQueryAlias() {
- return getSameQueryAlias(false);
- }
-
- /**
- * @return an alias that can be used in WHERE, GROUP BY and ORDER BY clauses
- * in the same query
- */
- public String getSameQueryAlias(boolean includeSchemaInColumnPath) {
- if (_column != null) {
- StringBuilder sb = new StringBuilder();
- String columnPrefix = getToStringColumnPrefix(includeSchemaInColumnPath);
- sb.append(columnPrefix);
- sb.append(_column.getQuotedName());
- if (_function != null) {
- sb.insert(0, _function + "(");
- sb.append(")");
- }
- return sb.toString();
- }
- String alias = getAlias();
- if (alias == null) {
- alias = toStringNoAlias(includeSchemaInColumnPath).toString();
- logger.debug("Could not resolve a reasonable same-query alias for SelectItem: {}", toSql());
- }
- return alias;
- }
-
- @Override
- public String toSql() {
- return toSql(false);
- }
-
- @Override
- public String toSql(boolean includeSchemaInColumnPath) {
- StringBuilder sb = toStringNoAlias(includeSchemaInColumnPath);
- if (_alias != null) {
- sb.append(" AS ");
- sb.append(_alias);
- }
- return sb.toString();
- }
-
- public StringBuilder toStringNoAlias() {
- return toStringNoAlias(false);
- }
-
- public StringBuilder toStringNoAlias(boolean includeSchemaInColumnPath) {
- StringBuilder sb = new StringBuilder();
- if (_column != null) {
- sb.append(getToStringColumnPrefix(includeSchemaInColumnPath));
- sb.append(_column.getQuotedName());
- }
- if (_expression != null) {
- sb.append(_expression);
- }
- if (_fromItem != null && _subQuerySelectItem != null) {
- if (_fromItem.getAlias() != null) {
- sb.append(_fromItem.getAlias() + '.');
- }
- sb.append(_subQuerySelectItem.getSuperQueryAlias());
- }
- if (_function != null) {
- sb.insert(0, _function + "(");
- sb.append(")");
- }
- return sb;
- }
-
- private String getToStringColumnPrefix(boolean includeSchemaInColumnPath) {
- StringBuilder sb = new StringBuilder();
- if (_fromItem != null && _fromItem.getAlias() != null) {
- sb.append(_fromItem.getAlias());
- sb.append('.');
- } else {
- final Table table = _column.getTable();
- String tableLabel;
- if (_query == null) {
- tableLabel = null;
- } else {
- tableLabel = _query.getFromClause().getAlias(table);
- }
- if (table != null) {
- if (tableLabel == null) {
- tableLabel = table.getQuotedName();
- if (includeSchemaInColumnPath) {
- Schema schema = table.getSchema();
- if (schema != null) {
- tableLabel = schema.getQuotedName() + "." + tableLabel;
- }
- }
- }
- sb.append(tableLabel);
- sb.append('.');
- }
- }
- return sb.toString();
- }
-
- public boolean equalsIgnoreAlias(SelectItem that) {
- return equalsIgnoreAlias(that, false);
- }
-
- public boolean equalsIgnoreAlias(SelectItem that, boolean exactColumnCompare) {
- if (that == null) {
- return false;
- }
- if (that == this) {
- return true;
- }
-
- EqualsBuilder eb = new EqualsBuilder();
- if (exactColumnCompare) {
- eb.append(this._column == that._column);
- eb.append(this._fromItem, that._fromItem);
- } else {
- eb.append(this._column, that._column);
- }
- eb.append(this._function, that._function);
- eb.append(this._functionApproximationAllowed, that._functionApproximationAllowed);
- eb.append(this._expression, that._expression);
- if (_subQuerySelectItem != null) {
- eb.append(_subQuerySelectItem.equalsIgnoreAlias(that._subQuerySelectItem));
- } else {
- if (that._subQuerySelectItem != null) {
- eb.append(false);
- }
- }
- return eb.isEquals();
- }
-
- @Override
- protected void decorateIdentity(List<Object> identifiers) {
- identifiers.add(_expression);
- identifiers.add(_alias);
- identifiers.add(_column);
- identifiers.add(_function);
- identifiers.add(_functionApproximationAllowed);
- identifiers.add(_fromItem);
- identifiers.add(_subQuerySelectItem);
- }
-
- @Override
- protected SelectItem clone() {
- final SelectItem subQuerySelectItem = (_subQuerySelectItem == null ? null : _subQuerySelectItem.clone());
- final FromItem fromItem = (_fromItem == null ? null : _fromItem.clone());
- final SelectItem s = new SelectItem(_column, fromItem, _function, _expression, subQuerySelectItem, _alias,
- _functionApproximationAllowed);
- return s;
- }
-
- /**
- * Creates a copy of the {@link SelectItem}, with a different
- * {@link FunctionType}.
- *
- * @param function
- * @return
- */
- public SelectItem replaceFunction(FunctionType function) {
- return new SelectItem(_column, _fromItem, function, _expression, _subQuerySelectItem, _alias,
- _functionApproximationAllowed);
- }
-
- /**
- * Investigates whether or not this SelectItem references a particular
- * column. This will search for direct references and indirect references
- * via subqueries.
- *
- * @param column
- * @return a boolean that is true if the specified column is referenced by
- * this SelectItem and false otherwise.
- */
- public boolean isReferenced(Column column) {
- if (column != null) {
- if (column.equals(_column)) {
- return true;
- }
- if (_subQuerySelectItem != null) {
- return _subQuerySelectItem.isReferenced(column);
- }
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toSql();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/query/SumAggregateBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/query/SumAggregateBuilder.java b/core/src/main/java/org/eobjects/metamodel/query/SumAggregateBuilder.java
deleted file mode 100644
index 2cf8811..0000000
--- a/core/src/main/java/org/eobjects/metamodel/query/SumAggregateBuilder.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.eobjects.metamodel.query;
-
-import org.eobjects.metamodel.util.AggregateBuilder;
-import org.eobjects.metamodel.util.NumberComparator;
-
-final class SumAggregateBuilder implements AggregateBuilder<Double> {
-
- private double sum;
-
- @Override
- public void add(Object o) {
- if (o == null) {
- return;
- }
- Number number = NumberComparator.toNumber(o);
- if (number == null) {
- throw new IllegalArgumentException("Could not convert to number: " + o);
- }
- sum += number.doubleValue();
- }
-
- @Override
- public Double getAggregate() {
- return sum;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/query/builder/AbstractFilterBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/query/builder/AbstractFilterBuilder.java b/core/src/main/java/org/eobjects/metamodel/query/builder/AbstractFilterBuilder.java
deleted file mode 100644
index 2d3bd25..0000000
--- a/core/src/main/java/org/eobjects/metamodel/query/builder/AbstractFilterBuilder.java
+++ /dev/null
@@ -1,459 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.eobjects.metamodel.query.builder;
-
-import java.util.Collection;
-import java.util.Date;
-
-import org.eobjects.metamodel.query.FilterItem;
-import org.eobjects.metamodel.query.OperatorType;
-import org.eobjects.metamodel.query.SelectItem;
-import org.eobjects.metamodel.schema.Column;
-
-/**
- * Abstract implementation of {@link FilterBuilder} interface. All built filters
- * are channeled to the {@link #applyFilter(FilterItem)} method which needs to
- * be implemented by concrete implementations.
- */
-public abstract class AbstractFilterBuilder<B> implements FilterBuilder<B> {
-
- private final SelectItem _selectItem;
-
- public AbstractFilterBuilder(SelectItem selectItem) {
- this._selectItem = selectItem;
- }
-
- protected abstract B applyFilter(FilterItem filter);
-
- /**
- * Provides a way to
- *
- * @param queryParameter
- * @return
- */
- public B applyFilter(OperatorType operator, Object operand) {
- return applyFilter(new FilterItem(_selectItem, operator, operand));
- }
-
- @Override
- public B in(Collection<?> values) {
- return applyFilter(new FilterItem(_selectItem, OperatorType.IN, values));
- }
-
- @Override
- public B in(Number... numbers) {
- return applyFilter(new FilterItem(_selectItem, OperatorType.IN, numbers));
- }
-
- @Override
- public B in(String... strings) {
- return applyFilter(new FilterItem(_selectItem, OperatorType.IN, strings));
- }
-
- @Override
- public B isNull() {
- return applyFilter(new FilterItem(_selectItem, OperatorType.EQUALS_TO, null));
- }
-
- @Override
- public B isNotNull() {
- return applyFilter(new FilterItem(_selectItem, OperatorType.DIFFERENT_FROM, null));
- }
-
- @Override
- public B isEquals(Column column) {
- if (column == null) {
- throw new IllegalArgumentException("column cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.EQUALS_TO, new SelectItem(column)));
- }
-
- @Override
- public B isEquals(Date date) {
- if (date == null) {
- throw new IllegalArgumentException("date cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.EQUALS_TO, date));
- }
-
- @Override
- public B isEquals(Number number) {
- if (number == null) {
- throw new IllegalArgumentException("number cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.EQUALS_TO, number));
- }
-
- @Override
- public B isEquals(String string) {
- if (string == null) {
- throw new IllegalArgumentException("string cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.EQUALS_TO, string));
- }
-
- @Override
- public B isEquals(Boolean bool) {
- if (bool == null) {
- throw new IllegalArgumentException("bool cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.EQUALS_TO, bool));
- }
-
- @Override
- public B isEquals(Object obj) {
- if (obj == null) {
- return isNull();
- }
- if (obj instanceof Boolean) {
- return isEquals((Boolean) obj);
- }
- if (obj instanceof Number) {
- return isEquals((Number) obj);
- }
- if (obj instanceof Date) {
- return isEquals((Date) obj);
- }
- if (obj instanceof String) {
- return isEquals((String) obj);
- }
- throw new UnsupportedOperationException("Argument must be a Boolean, Number, Date or String. Found: " + obj);
- }
-
- @Override
- public B differentFrom(Column column) {
- if (column == null) {
- throw new IllegalArgumentException("column cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.DIFFERENT_FROM, new SelectItem(column)));
- }
-
- @Override
- public B differentFrom(Date date) {
- if (date == null) {
- throw new IllegalArgumentException("date cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.DIFFERENT_FROM, date));
- }
-
- @Override
- public B differentFrom(Number number) {
- if (number == null) {
- throw new IllegalArgumentException("number cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.DIFFERENT_FROM, number));
- }
-
- @Override
- public B differentFrom(String string) {
- if (string == null) {
- throw new IllegalArgumentException("string cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.DIFFERENT_FROM, string));
- }
-
- @Override
- public B differentFrom(Boolean bool) {
- if (bool == null) {
- throw new IllegalArgumentException("bool cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.DIFFERENT_FROM, bool));
- }
-
- @Override
- public B differentFrom(Object obj) {
- if (obj == null) {
- return isNotNull();
- }
- if (obj instanceof Boolean) {
- return differentFrom((Boolean) obj);
- }
- if (obj instanceof Number) {
- return differentFrom((Number) obj);
- }
- if (obj instanceof Date) {
- return differentFrom((Date) obj);
- }
- if (obj instanceof String) {
- return differentFrom((String) obj);
- }
- throw new UnsupportedOperationException("Argument must be a Boolean, Number, Date or String. Found: " + obj);
- }
-
- @Deprecated
- @Override
- public B higherThan(Column arg) {
- return greaterThan(arg);
- }
-
- @Override
- public B greaterThan(Column column) {
- if (column == null) {
- throw new IllegalArgumentException("column cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.GREATER_THAN, new SelectItem(column)));
- }
-
- @Deprecated
- @Override
- public B higherThan(Date arg) {
- return greaterThan(arg);
- }
-
- @Override
- public B greaterThan(Date date) {
- if (date == null) {
- throw new IllegalArgumentException("date cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.GREATER_THAN, date));
- }
-
- @Deprecated
- @Override
- public B higherThan(Number arg) {
- return greaterThan(arg);
- }
-
- @Override
- public B greaterThan(Number number) {
- if (number == null) {
- throw new IllegalArgumentException("number cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.GREATER_THAN, number));
- }
-
- @Deprecated
- @Override
- public B higherThan(String arg) {
- return greaterThan(arg);
- }
-
- @Override
- public B greaterThan(String string) {
- if (string == null) {
- throw new IllegalArgumentException("string cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.GREATER_THAN, string));
- }
-
- @Override
- public B lessThan(Column column) {
- if (column == null) {
- throw new IllegalArgumentException("column cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.LESS_THAN, new SelectItem(column)));
- }
-
- @Override
- public B lessThan(Date date) {
- if (date == null) {
- throw new IllegalArgumentException("date cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.LESS_THAN, date));
- }
-
- @Override
- public B lessThan(Number number) {
- if (number == null) {
- throw new IllegalArgumentException("number cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.LESS_THAN, number));
- }
-
- @Override
- public B lessThan(String string) {
- if (string == null) {
- throw new IllegalArgumentException("string cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.LESS_THAN, string));
- }
-
- @Override
- public B lessThan(Object obj) {
- if (obj instanceof Number) {
- return lessThan((Number) obj);
- }
- if (obj instanceof Date) {
- return lessThan((Date) obj);
- }
- if (obj instanceof String) {
- return lessThan((String) obj);
- }
- throw new UnsupportedOperationException("Argument must be a Number, Date or String. Found: " + obj);
- }
-
- @Override
- public B greaterThan(Object obj) {
- if (obj instanceof Number) {
- return greaterThan((Number) obj);
- }
- if (obj instanceof Date) {
- return greaterThan((Date) obj);
- }
- if (obj instanceof String) {
- return greaterThan((String) obj);
- }
- throw new UnsupportedOperationException("Argument must be a Number, Date or String. Found: " + obj);
- }
-
- @Override
- public B like(String string) {
- if (string == null) {
- throw new IllegalArgumentException("string cannot be null");
- }
- return applyFilter(new FilterItem(_selectItem, OperatorType.LIKE, string));
- }
-
- @Override
- public B gt(Column column) {
- return greaterThan(column);
- }
-
- @Override
- public B gt(Date date) {
- return greaterThan(date);
- }
-
- @Override
- public B gt(Number number) {
- return greaterThan(number);
- }
-
- @Override
- public B gt(String string) {
- return greaterThan(string);
- }
-
- @Override
- public B lt(Column column) {
- return lessThan(column);
- }
-
- public B lt(Date date) {
- return lessThan(date);
- };
-
- public B lt(Number number) {
- return lessThan(number);
- };
-
- public B lt(String string) {
- return lessThan(string);
- };
-
- @Override
- public B eq(Boolean bool) {
- return isEquals(bool);
- }
-
- @Override
- public B eq(Column column) {
- return isEquals(column);
- }
-
- @Override
- public B eq(Date date) {
- return isEquals(date);
- }
-
- @Override
- public B eq(Number number) {
- return isEquals(number);
- }
-
- @Override
- public B eq(String string) {
- return isEquals(string);
- }
-
- @Override
- public B eq(Object obj) {
- return isEquals(obj);
- }
-
- @Override
- public B ne(Boolean bool) {
- return differentFrom(bool);
- }
-
- @Override
- public B ne(Column column) {
- return differentFrom(column);
- }
-
- @Override
- public B ne(Date date) {
- return differentFrom(date);
- }
-
- @Override
- public B ne(Number number) {
- return differentFrom(number);
- }
-
- @Override
- public B ne(String string) {
- return differentFrom(string);
- }
-
- @Override
- public B ne(Object obj) {
- return differentFrom(obj);
- }
-
- @Override
- @Deprecated
- public B equals(Boolean bool) {
- return isEquals(bool);
- }
-
- @Override
- @Deprecated
- public B equals(Column column) {
- return isEquals(column);
- }
-
- @Override
- @Deprecated
- public B equals(Date date) {
- return isEquals(date);
- }
-
- @Override
- @Deprecated
- public B equals(Number number) {
- return isEquals(number);
- }
-
- @Override
- @Deprecated
- public B equals(String string) {
- return isEquals(string);
- }
-
- @Override
- public B lt(Object obj) {
- return lessThan(obj);
- }
-
- @Override
- public B gt(Object obj) {
- return greaterThan(obj);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/query/builder/AbstractQueryFilterBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/query/builder/AbstractQueryFilterBuilder.java b/core/src/main/java/org/eobjects/metamodel/query/builder/AbstractQueryFilterBuilder.java
deleted file mode 100644
index a015292..0000000
--- a/core/src/main/java/org/eobjects/metamodel/query/builder/AbstractQueryFilterBuilder.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.eobjects.metamodel.query.builder;
-
-import java.util.Collection;
-import java.util.Date;
-
-import org.eobjects.metamodel.query.FilterItem;
-import org.eobjects.metamodel.query.SelectItem;
-import org.eobjects.metamodel.schema.Column;
-
-abstract class AbstractQueryFilterBuilder<B> extends GroupedQueryBuilderCallback implements FilterBuilder<B> {
-
- protected final AbstractFilterBuilder<B> _filterBuilder;
-
- public AbstractQueryFilterBuilder(SelectItem selectItem, GroupedQueryBuilder queryBuilder) {
- super(queryBuilder);
- _filterBuilder = new AbstractFilterBuilder<B>(selectItem) {
- @Override
- protected B applyFilter(FilterItem filter) {
- return AbstractQueryFilterBuilder.this.applyFilter(filter);
- }
- };
- }
-
- protected abstract B applyFilter(FilterItem filter);
-
- @Override
- public B in(Collection<?> values) {
- return _filterBuilder.in(values);
- }
-
- @Override
- public B in(Number... numbers) {
- return _filterBuilder.in(numbers);
- }
-
- @Override
- public B in(String... strings) {
- return _filterBuilder.in(strings);
- }
-
- @Override
- public B isNull() {
- return _filterBuilder.isNull();
- }
-
- @Override
- public B isNotNull() {
- return _filterBuilder.isNotNull();
- }
-
- @Override
- public B isEquals(Column column) {
- return _filterBuilder.isEquals(column);
- }
-
- @Override
- public B isEquals(Date date) {
- return _filterBuilder.isEquals(date);
- }
-
- @Override
- public B isEquals(Number number) {
- return _filterBuilder.isEquals(number);
- }
-
- @Override
- public B isEquals(String string) {
- return _filterBuilder.isEquals(string);
- }
-
- @Override
- public B isEquals(Boolean bool) {
- return _filterBuilder.isEquals(bool);
- }
-
- @Override
- public B isEquals(Object obj) {
- return _filterBuilder.isEquals(obj);
- }
-
- @Override
- public B differentFrom(Column column) {
- return _filterBuilder.differentFrom(column);
- }
-
- @Override
- public B differentFrom(Date date) {
- return _filterBuilder.differentFrom(date);
- }
-
- @Override
- public B differentFrom(Number number) {
- return _filterBuilder.differentFrom(number);
- }
-
- @Override
- public B differentFrom(String string) {
- return _filterBuilder.differentFrom(string);
- }
-
- @Override
- public B differentFrom(Boolean bool) {
- return _filterBuilder.differentFrom(bool);
- }
-
- @Override
- public B differentFrom(Object obj) {
- return _filterBuilder.differentFrom(obj);
- }
-
- @Deprecated
- @Override
- public B higherThan(Column arg) {
- return _filterBuilder.higherThan(arg);
- }
-
- public B greaterThan(Column column) {
- return _filterBuilder.greaterThan(column);
- }
-
- @Override
- public B greaterThan(Object obj) {
- return _filterBuilder.greaterThan(obj);
- }
-
- @Deprecated
- @Override
- public B higherThan(Date arg) {
- return _filterBuilder.higherThan(arg);
- }
-
- @Override
- public B greaterThan(Date date) {
- return _filterBuilder.greaterThan(date);
- }
-
- @Deprecated
- @Override
- public B higherThan(Number arg) {
- return _filterBuilder.higherThan(arg);
- }
-
- @Override
- public B greaterThan(Number number) {
- return _filterBuilder.greaterThan(number);
- }
-
- @Deprecated
- @Override
- public B higherThan(String arg) {
- return _filterBuilder.higherThan(arg);
- }
-
- @Override
- public B greaterThan(String string) {
- return _filterBuilder.greaterThan(string);
- }
-
- @Override
- public B lessThan(Column column) {
- return _filterBuilder.lessThan(column);
- }
-
- @Override
- public B lessThan(Date date) {
- return _filterBuilder.lessThan(date);
- }
-
- @Override
- public B lessThan(Number number) {
- return _filterBuilder.lessThan(number);
- }
-
- @Override
- public B lessThan(String string) {
- return _filterBuilder.lessThan(string);
- }
-
- @Override
- public B lessThan(Object obj) {
- return _filterBuilder.lessThan(obj);
- }
-
- @Override
- public B like(String string) {
- return _filterBuilder.like(string);
- }
-
- @Override
- public B gt(Column column) {
- return greaterThan(column);
- }
-
- @Override
- public B gt(Date date) {
- return greaterThan(date);
- }
-
- @Override
- public B gt(Number number) {
- return greaterThan(number);
- }
-
- @Override
- public B gt(String string) {
- return greaterThan(string);
- }
-
- @Override
- public B lt(Column column) {
- return lessThan(column);
- }
-
- public B lt(Date date) {
- return lessThan(date);
- };
-
- public B lt(Number number) {
- return lessThan(number);
- };
-
- public B lt(String string) {
- return lessThan(string);
- };
-
- @Override
- public B eq(Boolean bool) {
- return isEquals(bool);
- }
-
- @Override
- public B eq(Column column) {
- return isEquals(column);
- }
-
- @Override
- public B eq(Date date) {
- return isEquals(date);
- }
-
- @Override
- public B eq(Number number) {
- return isEquals(number);
- }
-
- @Override
- public B eq(String string) {
- return isEquals(string);
- }
-
- @Override
- public B eq(Object obj) {
- return isEquals(obj);
- }
-
- @Override
- public B ne(Boolean bool) {
- return differentFrom(bool);
- }
-
- @Override
- public B ne(Column column) {
- return differentFrom(column);
- }
-
- @Override
- public B ne(Date date) {
- return differentFrom(date);
- }
-
- @Override
- public B ne(Number number) {
- return differentFrom(number);
- }
-
- @Override
- public B ne(String string) {
- return differentFrom(string);
- }
-
- @Override
- public B ne(Object obj) {
- return differentFrom(obj);
- }
-
- @Override
- @Deprecated
- public B equals(Boolean bool) {
- return isEquals(bool);
- }
-
- @Override
- @Deprecated
- public B equals(Column column) {
- return isEquals(column);
- }
-
- @Override
- @Deprecated
- public B equals(Date date) {
- return isEquals(date);
- }
-
- @Override
- @Deprecated
- public B equals(Number number) {
- return isEquals(number);
- }
-
- @Override
- @Deprecated
- public B equals(String string) {
- return isEquals(string);
- }
-
- @Override
- public B lt(Object obj) {
- return lessThan(obj);
- }
-
- @Override
- public B gt(Object obj) {
- return greaterThan(obj);
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/query/builder/ColumnSelectBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/query/builder/ColumnSelectBuilder.java b/core/src/main/java/org/eobjects/metamodel/query/builder/ColumnSelectBuilder.java
deleted file mode 100644
index 00208cf..0000000
--- a/core/src/main/java/org/eobjects/metamodel/query/builder/ColumnSelectBuilder.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.eobjects.metamodel.query.builder;
-
-public interface ColumnSelectBuilder<B extends SatisfiedQueryBuilder<?>>
- extends SatisfiedSelectBuilder<B> {
-
- public B as(String alias);
-}