You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2017/04/15 08:25:57 UTC
[06/19] polygene-java git commit: Bring in Stanislav's sql-generator
from GutHub, after his consent in
https://lists.apache.org/thread.html/797352ce2ad7aa7b755720a98f545a176e6050e35f56db113ba115fb@%3Cdev.polygene.apache.org%3E
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/modification/UpdateBySearchImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/modification/UpdateBySearchImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/modification/UpdateBySearchImpl.java
new file mode 100644
index 0000000..de8ae0a
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/modification/UpdateBySearchImpl.java
@@ -0,0 +1,98 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.modification;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.booleans.BooleanExpression;
+import org.apache.polygene.library.sql.generator.grammar.modification.SetClause;
+import org.apache.polygene.library.sql.generator.grammar.modification.TargetTable;
+import org.apache.polygene.library.sql.generator.grammar.modification.UpdateBySearch;
+import org.apache.polygene.library.sql.generator.grammar.modification.UpdateStatement;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class UpdateBySearchImpl extends SQLSyntaxElementBase<UpdateStatement, UpdateBySearch>
+ implements UpdateBySearch
+{
+
+ private final TargetTable _targetTable;
+
+ private final List<SetClause> _setClauses;
+
+ private final BooleanExpression _where;
+
+ public UpdateBySearchImpl( SQLProcessorAggregator processor, TargetTable targetTable,
+ List<SetClause> setClauses,
+ BooleanExpression where )
+ {
+ this( processor, UpdateBySearch.class, targetTable, setClauses, where );
+ }
+
+ protected UpdateBySearchImpl( SQLProcessorAggregator processor,
+ Class<? extends UpdateBySearch> expressionClass,
+ TargetTable targetTable, List<SetClause> setClauses, BooleanExpression where )
+ {
+ super( processor, expressionClass );
+ Objects.requireNonNull( targetTable, "target table" );
+ Objects.requireNonNull( setClauses, "set clauses" );
+ if( setClauses.isEmpty() )
+ {
+ throw new IllegalArgumentException( "At least one set clause must be present." );
+ }
+ for( SetClause clause : setClauses )
+ {
+ Objects.requireNonNull( clause, "set clause" );
+ }
+
+ this._targetTable = targetTable;
+ this._setClauses = Collections.unmodifiableList( new ArrayList<SetClause>( setClauses ) );
+ this._where = where;
+ }
+
+ public TargetTable getTargetTable()
+ {
+ return this._targetTable;
+ }
+
+ public BooleanExpression getWhere()
+ {
+ return this._where;
+ }
+
+ public List<SetClause> getSetClauses()
+ {
+ return this._setClauses;
+ }
+
+ @Override
+ protected boolean doesEqual( UpdateBySearch another )
+ {
+ return this._targetTable.equals( another.getTargetTable() )
+ && this._setClauses.equals( another.getSetClauses() )
+ && TypeableImpl.bothNullOrEquals( this._where, another.getWhere() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/modification/UpdateSourceByExpressionImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/modification/UpdateSourceByExpressionImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/modification/UpdateSourceByExpressionImpl.java
new file mode 100644
index 0000000..70d3664
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/modification/UpdateSourceByExpressionImpl.java
@@ -0,0 +1,61 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.modification;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.common.ValueExpression;
+import org.apache.polygene.library.sql.generator.grammar.modification.UpdateSource;
+import org.apache.polygene.library.sql.generator.grammar.modification.UpdateSourceByExpression;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class UpdateSourceByExpressionImpl extends SQLSyntaxElementBase<UpdateSource, UpdateSourceByExpression>
+ implements UpdateSourceByExpression
+{
+
+ private final ValueExpression _valueExpression;
+
+ public UpdateSourceByExpressionImpl( SQLProcessorAggregator processor, ValueExpression valueExpression )
+ {
+ this( processor, UpdateSourceByExpression.class, valueExpression );
+ }
+
+ protected UpdateSourceByExpressionImpl( SQLProcessorAggregator processor,
+ Class<? extends UpdateSourceByExpression> expressionClass, ValueExpression valueExpression )
+ {
+ super( processor, expressionClass );
+ Objects.requireNonNull( valueExpression, "expression" );
+ this._valueExpression = valueExpression;
+ }
+
+ public ValueExpression getValueExpression()
+ {
+ return this._valueExpression;
+ }
+
+ @Override
+ protected boolean doesEqual( UpdateSourceByExpression another )
+ {
+ return this._valueExpression.equals( another.getValueExpression() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/modification/pgsql/PgSQLInsertStatementImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/modification/pgsql/PgSQLInsertStatementImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/modification/pgsql/PgSQLInsertStatementImpl.java
new file mode 100644
index 0000000..4c96727
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/modification/pgsql/PgSQLInsertStatementImpl.java
@@ -0,0 +1,46 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.modification.pgsql;
+
+import org.apache.polygene.library.sql.generator.grammar.common.TableNameDirect;
+import org.apache.polygene.library.sql.generator.grammar.modification.ColumnSource;
+import org.apache.polygene.library.sql.generator.grammar.modification.pgsql.PgSQLInsertStatement;
+import org.apache.polygene.library.sql.generator.grammar.query.SelectColumnClause;
+import org.apache.polygene.library.sql.generator.implementation.grammar.modification.InsertStatementImpl;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+public class PgSQLInsertStatementImpl extends InsertStatementImpl implements PgSQLInsertStatement
+{
+
+ private final SelectColumnClause _returning;
+
+ public PgSQLInsertStatementImpl( SQLProcessorAggregator processor,
+ TableNameDirect tableName, ColumnSource columnSource, SelectColumnClause returning )
+ {
+ super( processor, PgSQLInsertStatement.class, tableName, columnSource );
+
+ this._returning = returning;
+ }
+
+ public SelectColumnClause getReturningClause()
+ {
+ return this._returning;
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/AsteriskSelectImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/AsteriskSelectImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/AsteriskSelectImpl.java
new file mode 100644
index 0000000..53c6e1f
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/AsteriskSelectImpl.java
@@ -0,0 +1,42 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import org.apache.polygene.library.sql.generator.grammar.common.SetQuantifier;
+import org.apache.polygene.library.sql.generator.grammar.query.AsteriskSelect;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class AsteriskSelectImpl extends SelectColumnClauseImpl<AsteriskSelect>
+ implements AsteriskSelect
+{
+ public AsteriskSelectImpl( SQLProcessorAggregator processor, SetQuantifier quantifier )
+ {
+ this( processor, AsteriskSelect.class, quantifier );
+ }
+
+ public AsteriskSelectImpl( SQLProcessorAggregator processor, Class<? extends AsteriskSelect> type,
+ SetQuantifier quantifier )
+ {
+ super( processor, type, quantifier );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/ColumnReferenceByExpressionImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/ColumnReferenceByExpressionImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/ColumnReferenceByExpressionImpl.java
new file mode 100644
index 0000000..afaf230
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/ColumnReferenceByExpressionImpl.java
@@ -0,0 +1,58 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.common.ValueExpression;
+import org.apache.polygene.library.sql.generator.grammar.query.ColumnReferenceByExpression;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class ColumnReferenceByExpressionImpl extends ColumnReferenceImpl<ColumnReferenceByExpression>
+ implements ColumnReferenceByExpression
+{
+ private final ValueExpression _expression;
+
+ public ColumnReferenceByExpressionImpl( SQLProcessorAggregator processor, ValueExpression expression )
+ {
+ this( processor, ColumnReferenceByExpression.class, expression );
+ }
+
+ protected ColumnReferenceByExpressionImpl( SQLProcessorAggregator processor,
+ Class<? extends ColumnReferenceByExpression> implClass, ValueExpression expression )
+ {
+ super( processor, implClass );
+ Objects.requireNonNull( expression, "expression" );
+ this._expression = expression;
+ }
+
+ public ValueExpression getExpression()
+ {
+ return this._expression;
+ }
+
+ @Override
+ protected boolean doesEqual( ColumnReferenceByExpression another )
+ {
+ return this._expression.equals( another.getExpression() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/ColumnReferenceByNameImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/ColumnReferenceByNameImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/ColumnReferenceByNameImpl.java
new file mode 100644
index 0000000..689c635
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/ColumnReferenceByNameImpl.java
@@ -0,0 +1,68 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.query.ColumnReferenceByName;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class ColumnReferenceByNameImpl extends ColumnReferenceImpl<ColumnReferenceByName>
+ implements ColumnReferenceByName
+{
+
+ private final String _tableName;
+
+ private final String _columnName;
+
+ public ColumnReferenceByNameImpl( SQLProcessorAggregator processor, String tableName, String columnName )
+ {
+ this( processor, ColumnReferenceByName.class, tableName, columnName );
+ }
+
+ protected ColumnReferenceByNameImpl( SQLProcessorAggregator processor,
+ Class<? extends ColumnReferenceByName> implClass, String tableName, String columnName )
+ {
+ super( processor, implClass );
+ Objects.requireNonNull( columnName, "column name" );
+ this._tableName = tableName;
+ this._columnName = columnName;
+ }
+
+ public String getColumnName()
+ {
+ return this._columnName;
+ }
+
+ public String getTableName()
+ {
+ return this._tableName;
+ }
+
+ @Override
+ protected boolean doesEqual( ColumnReferenceByName another )
+ {
+ return this._columnName.equals( another.getColumnName() )
+ && TypeableImpl.bothNullOrEquals( this._tableName, another.getTableName() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/ColumnReferenceImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/ColumnReferenceImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/ColumnReferenceImpl.java
new file mode 100644
index 0000000..22812e4
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/ColumnReferenceImpl.java
@@ -0,0 +1,38 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import org.apache.polygene.library.sql.generator.grammar.query.ColumnReference;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.NonBooleanExpressionImpl;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public abstract class ColumnReferenceImpl<ColumnReferenceType extends ColumnReference> extends
+ NonBooleanExpressionImpl<ColumnReferenceType>
+ implements ColumnReference
+{
+ public ColumnReferenceImpl( SQLProcessorAggregator processor,
+ Class<? extends ColumnReferenceType> columnReferenceClass )
+ {
+ super( processor, columnReferenceClass );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/ColumnReferencesImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/ColumnReferencesImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/ColumnReferencesImpl.java
new file mode 100644
index 0000000..7213ad1
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/ColumnReferencesImpl.java
@@ -0,0 +1,79 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.common.SetQuantifier;
+import org.apache.polygene.library.sql.generator.grammar.query.ColumnReferences;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class ColumnReferencesImpl extends SelectColumnClauseImpl<ColumnReferences>
+ implements ColumnReferences
+{
+
+ private final List<ColumnReferenceInfo> _columns;
+
+ public ColumnReferencesImpl( SQLProcessorAggregator processor, SetQuantifier quantifier,
+ ColumnReferenceInfo... columns )
+ {
+ this( processor, quantifier, Arrays.asList( columns ) );
+ }
+
+ public ColumnReferencesImpl( SQLProcessorAggregator processor, SetQuantifier quantifier,
+ List<ColumnReferenceInfo> columns )
+ {
+ this( processor, ColumnReferences.class, quantifier, columns );
+ }
+
+ public ColumnReferencesImpl( SQLProcessorAggregator processor, Class<? extends ColumnReferences> type,
+ SetQuantifier quantifier, List<ColumnReferenceInfo> columns )
+ {
+ super( processor, type, quantifier );
+ Objects.requireNonNull( columns, "columns" );
+ if( columns.isEmpty() )
+ {
+ throw new IllegalArgumentException( "Must have at least one column in column list." );
+ }
+
+ for( ColumnReferenceInfo column : columns )
+ {
+ Objects.requireNonNull( column, "column" );
+ }
+
+ this._columns = Collections.unmodifiableList( columns );
+ }
+
+ public List<ColumnReferenceInfo> getColumns()
+ {
+ return this._columns;
+ }
+
+ @Override
+ protected boolean doesEqual( ColumnReferences another )
+ {
+ return super.doesEqual( another ) && this._columns.equals( another.getColumns() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/CorrespondingSpecImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/CorrespondingSpecImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/CorrespondingSpecImpl.java
new file mode 100644
index 0000000..81780f3
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/CorrespondingSpecImpl.java
@@ -0,0 +1,60 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import org.apache.polygene.library.sql.generator.grammar.common.ColumnNameList;
+import org.apache.polygene.library.sql.generator.grammar.query.CorrespondingSpec;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class CorrespondingSpecImpl extends SQLSyntaxElementBase<CorrespondingSpec, CorrespondingSpec>
+ implements CorrespondingSpec
+{
+
+ private final ColumnNameList _columnList;
+
+ public CorrespondingSpecImpl( SQLProcessorAggregator processor, ColumnNameList columnNames )
+ {
+ this( processor, CorrespondingSpec.class, columnNames );
+ }
+
+ protected CorrespondingSpecImpl( SQLProcessorAggregator processor, Class<? extends CorrespondingSpec> implClass,
+ ColumnNameList columnNames )
+ {
+ super( processor, implClass );
+
+ this._columnList = columnNames;
+ }
+
+ public ColumnNameList getColumnList()
+ {
+ return this._columnList;
+ }
+
+ @Override
+ protected boolean doesEqual( CorrespondingSpec another )
+ {
+ return TypeableImpl.bothNullOrEquals( this._columnList, another.getColumnList() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/FromClauseImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/FromClauseImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/FromClauseImpl.java
new file mode 100644
index 0000000..44f8010
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/FromClauseImpl.java
@@ -0,0 +1,72 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.query.FromClause;
+import org.apache.polygene.library.sql.generator.grammar.query.TableReference;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class FromClauseImpl extends SQLSyntaxElementBase<FromClause, FromClause>
+ implements FromClause
+{
+
+ private List<TableReference> _tableReferences;
+
+ public FromClauseImpl( SQLProcessorAggregator processor, TableReference... tableReferences )
+ {
+ this( processor, Arrays.asList( tableReferences ) );
+ }
+
+ public FromClauseImpl( SQLProcessorAggregator processor, List<TableReference> tableReferences )
+ {
+ this( processor, FromClause.class, tableReferences );
+ }
+
+ protected FromClauseImpl( SQLProcessorAggregator processor, Class<? extends FromClause> type,
+ List<TableReference> tableReferences )
+ {
+ super( processor, type );
+ Objects.requireNonNull( tableReferences, "table references" );
+ for( TableReference ref : tableReferences )
+ {
+ Objects.requireNonNull( ref, "table reference" );
+ }
+ this._tableReferences = Collections.unmodifiableList( tableReferences );
+ }
+
+ public List<TableReference> getTableReferences()
+ {
+ return this._tableReferences;
+ }
+
+ @Override
+ protected boolean doesEqual( FromClause another )
+ {
+ return this._tableReferences.equals( another.getTableReferences() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/GroupByClauseImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/GroupByClauseImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/GroupByClauseImpl.java
new file mode 100644
index 0000000..838b1a2
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/GroupByClauseImpl.java
@@ -0,0 +1,61 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.query.GroupByClause;
+import org.apache.polygene.library.sql.generator.grammar.query.GroupingElement;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class GroupByClauseImpl extends SQLSyntaxElementBase<GroupByClause, GroupByClause>
+ implements GroupByClause
+{
+
+ private final List<GroupingElement> _groupingElements;
+
+ public GroupByClauseImpl( SQLProcessorAggregator processor, List<GroupingElement> groupingElements )
+ {
+ super( processor, GroupByClause.class );
+ Objects.requireNonNull( groupingElements, "grouping elements" );
+ for( GroupingElement element : groupingElements )
+ {
+ Objects.requireNonNull( element, "grouping element" );
+ }
+ this._groupingElements = Collections.unmodifiableList( new ArrayList<GroupingElement>( groupingElements ) );
+ }
+
+ public List<GroupingElement> getGroupingElements()
+ {
+ return this._groupingElements;
+ }
+
+ @Override
+ protected boolean doesEqual( GroupByClause another )
+ {
+ return this._groupingElements.equals( another.getGroupingElements() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/LimitSpecificationImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/LimitSpecificationImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/LimitSpecificationImpl.java
new file mode 100644
index 0000000..5c074a9
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/LimitSpecificationImpl.java
@@ -0,0 +1,59 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import org.apache.polygene.library.sql.generator.grammar.common.NonBooleanExpression;
+import org.apache.polygene.library.sql.generator.grammar.query.LimitSpecification;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author 2011 Stanislav Muhametsin
+ */
+public class LimitSpecificationImpl extends SQLSyntaxElementBase<LimitSpecification, LimitSpecification>
+ implements LimitSpecification
+{
+
+ private final NonBooleanExpression _count;
+
+ public LimitSpecificationImpl( SQLProcessorAggregator processor, NonBooleanExpression count )
+ {
+ this( processor, LimitSpecification.class, count );
+ }
+
+ protected LimitSpecificationImpl( SQLProcessorAggregator processor,
+ Class<? extends LimitSpecification> realImplementingType, NonBooleanExpression count )
+ {
+ super( processor, realImplementingType );
+
+ this._count = count;
+ }
+
+ public NonBooleanExpression getCount()
+ {
+ return this._count;
+ }
+
+ @Override
+ protected boolean doesEqual( LimitSpecification another )
+ {
+ return bothNullOrEquals( this._count, another.getCount() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/OffsetSpecificationImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/OffsetSpecificationImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/OffsetSpecificationImpl.java
new file mode 100644
index 0000000..0f3e798
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/OffsetSpecificationImpl.java
@@ -0,0 +1,60 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.common.NonBooleanExpression;
+import org.apache.polygene.library.sql.generator.grammar.query.OffsetSpecification;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author 2011 Stanislav Muhametsin
+ */
+public class OffsetSpecificationImpl extends SQLSyntaxElementBase<OffsetSpecification, OffsetSpecification>
+ implements OffsetSpecification
+{
+
+ private final NonBooleanExpression _skip;
+
+ public OffsetSpecificationImpl( SQLProcessorAggregator processor, NonBooleanExpression skip )
+ {
+ this( processor, OffsetSpecification.class, skip );
+ }
+
+ protected OffsetSpecificationImpl( SQLProcessorAggregator processor,
+ Class<? extends OffsetSpecification> realImplementingType, NonBooleanExpression skip )
+ {
+ super( processor, realImplementingType );
+ Objects.requireNonNull( skip, "Skip" );
+ this._skip = skip;
+ }
+
+ public NonBooleanExpression getSkip()
+ {
+ return this._skip;
+ }
+
+ @Override
+ protected boolean doesEqual( OffsetSpecification another )
+ {
+ return this._skip.equals( another.getSkip() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/OrderByClauseImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/OrderByClauseImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/OrderByClauseImpl.java
new file mode 100644
index 0000000..ef56170
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/OrderByClauseImpl.java
@@ -0,0 +1,62 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.query.OrderByClause;
+import org.apache.polygene.library.sql.generator.grammar.query.SortSpecification;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class OrderByClauseImpl extends SQLSyntaxElementBase<OrderByClause, OrderByClause>
+ implements OrderByClause
+{
+
+ private List<SortSpecification> _sortSpecs;
+
+ public OrderByClauseImpl( SQLProcessorAggregator processor, List<SortSpecification> sortSpecs )
+ {
+ super( processor, OrderByClause.class );
+ Objects.requireNonNull( sortSpecs, "sort specifications" );
+ for( SortSpecification sortSpec : sortSpecs )
+ {
+ Objects.requireNonNull( sortSpec, "sort specification" );
+ }
+
+ this._sortSpecs = Collections.unmodifiableList( new ArrayList<SortSpecification>( sortSpecs ) );
+ }
+
+ public List<SortSpecification> getOrderingColumns()
+ {
+ return this._sortSpecs;
+ }
+
+ @Override
+ protected boolean doesEqual( OrderByClause another )
+ {
+ return this._sortSpecs.equals( another.getOrderingColumns() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/OrdinaryGroupingSetImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/OrdinaryGroupingSetImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/OrdinaryGroupingSetImpl.java
new file mode 100644
index 0000000..3ebd307
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/OrdinaryGroupingSetImpl.java
@@ -0,0 +1,73 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.common.NonBooleanExpression;
+import org.apache.polygene.library.sql.generator.grammar.query.GroupingElement;
+import org.apache.polygene.library.sql.generator.grammar.query.OrdinaryGroupingSet;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class OrdinaryGroupingSetImpl extends SQLSyntaxElementBase<GroupingElement, OrdinaryGroupingSet>
+ implements OrdinaryGroupingSet
+{
+ private final List<NonBooleanExpression> _columns;
+
+ public OrdinaryGroupingSetImpl( SQLProcessorAggregator processor, NonBooleanExpression... columns )
+ {
+ this( processor, Arrays.asList( columns ) );
+ }
+
+ public OrdinaryGroupingSetImpl( SQLProcessorAggregator processor, List<NonBooleanExpression> columns )
+ {
+ this( processor, OrdinaryGroupingSet.class, columns );
+ }
+
+ protected OrdinaryGroupingSetImpl( SQLProcessorAggregator processor,
+ Class<? extends OrdinaryGroupingSet> implClass, List<NonBooleanExpression> columns )
+ {
+ super( processor, implClass );
+ Objects.requireNonNull( columns, "columns" );
+ for( NonBooleanExpression expr : columns )
+ {
+ Objects.requireNonNull( expr, "column" );
+ }
+ this._columns = Collections.unmodifiableList( new ArrayList<NonBooleanExpression>( columns ) );
+ }
+
+ public List<NonBooleanExpression> getColumns()
+ {
+ return this._columns;
+ }
+
+ @Override
+ protected boolean doesEqual( OrdinaryGroupingSet another )
+ {
+ return this._columns.equals( another.getColumns() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/QueryExpressionBodyBinaryImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/QueryExpressionBodyBinaryImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/QueryExpressionBodyBinaryImpl.java
new file mode 100644
index 0000000..eabbf92
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/QueryExpressionBodyBinaryImpl.java
@@ -0,0 +1,105 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.common.SetQuantifier;
+import org.apache.polygene.library.sql.generator.grammar.query.CorrespondingSpec;
+import org.apache.polygene.library.sql.generator.grammar.query.QueryExpressionBody;
+import org.apache.polygene.library.sql.generator.grammar.query.QueryExpressionBodyBinary;
+import org.apache.polygene.library.sql.generator.grammar.query.SetOperation;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class QueryExpressionBodyBinaryImpl extends QueryExpressionBodyImpl<QueryExpressionBodyBinary>
+ implements QueryExpressionBodyBinary
+{
+
+ private final SetOperation _setOperation;
+
+ private final QueryExpressionBody _left;
+
+ private final QueryExpressionBody _right;
+
+ private final SetQuantifier _setQuantifier;
+
+ private final CorrespondingSpec _correspondingColumns;
+
+ public QueryExpressionBodyBinaryImpl( SQLProcessorAggregator processor, SetOperation setOperation,
+ QueryExpressionBody left, QueryExpressionBody right, SetQuantifier setQuantifier,
+ CorrespondingSpec correspondingColumns )
+ {
+ this( processor, QueryExpressionBodyBinary.class, setOperation, left, right, setQuantifier,
+ correspondingColumns );
+ }
+
+ protected QueryExpressionBodyBinaryImpl( SQLProcessorAggregator processor,
+ Class<? extends QueryExpressionBodyBinary> implClass, SetOperation setOperation, QueryExpressionBody left,
+ QueryExpressionBody right, SetQuantifier setQuantifier, CorrespondingSpec correspondingColumns )
+ {
+ super( processor, implClass );
+ Objects.requireNonNull( setOperation, "set operation" );
+ Objects.requireNonNull( left, "left" );
+ Objects.requireNonNull( right, "right" );
+ Objects.requireNonNull( setQuantifier, "set quantifier" );
+ this._setOperation = setOperation;
+ this._left = left;
+ this._right = right;
+ this._correspondingColumns = correspondingColumns;
+ this._setQuantifier = setQuantifier;
+ }
+
+ public QueryExpressionBody getLeft()
+ {
+ return this._left;
+ }
+
+ public QueryExpressionBody getRight()
+ {
+ return this._right;
+ }
+
+ public SetOperation getSetOperation()
+ {
+ return this._setOperation;
+ }
+
+ public CorrespondingSpec getCorrespondingColumns()
+ {
+ return this._correspondingColumns;
+ }
+
+ public SetQuantifier getSetQuantifier()
+ {
+ return this._setQuantifier;
+ }
+
+ @Override
+ protected boolean doesEqual( QueryExpressionBodyBinary another )
+ {
+ return this._setOperation.equals( another.getSetOperation() )
+ && this._setQuantifier.equals( another.getSetQuantifier() )
+ && TypeableImpl.bothNullOrEquals( this._correspondingColumns, another.getCorrespondingColumns() )
+ && this._left.equals( another.getLeft() ) && this._right.equals( another.getRight() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/QueryExpressionBodyImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/QueryExpressionBodyImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/QueryExpressionBodyImpl.java
new file mode 100644
index 0000000..700dcac
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/QueryExpressionBodyImpl.java
@@ -0,0 +1,37 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import org.apache.polygene.library.sql.generator.grammar.query.QueryExpressionBody;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.NonBooleanExpressionImpl;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public abstract class QueryExpressionBodyImpl<ExpressionType extends QueryExpressionBody> extends
+ NonBooleanExpressionImpl<ExpressionType>
+{
+
+ public QueryExpressionBodyImpl( SQLProcessorAggregator processor, Class<? extends ExpressionType> expressionClass )
+ {
+ super( processor, expressionClass );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/QueryExpressionImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/QueryExpressionImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/QueryExpressionImpl.java
new file mode 100644
index 0000000..f2cb8f0
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/QueryExpressionImpl.java
@@ -0,0 +1,60 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.query.QueryExpression;
+import org.apache.polygene.library.sql.generator.grammar.query.QueryExpressionBody;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.NonBooleanExpressionImpl;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class QueryExpressionImpl extends NonBooleanExpressionImpl<QueryExpression>
+ implements QueryExpression
+{
+
+ private final QueryExpressionBody _body;
+
+ public QueryExpressionImpl( SQLProcessorAggregator processor, QueryExpressionBody body )
+ {
+ this( processor, QueryExpression.class, body );
+ }
+
+ protected QueryExpressionImpl( SQLProcessorAggregator processor, Class<? extends QueryExpression> implClass,
+ QueryExpressionBody body )
+ {
+ super( processor, implClass );
+ Objects.requireNonNull( body, "query expression body" );
+ this._body = body;
+ }
+
+ public QueryExpressionBody getQueryExpressionBody()
+ {
+ return this._body;
+ }
+
+ @Override
+ protected boolean doesEqual( QueryExpression another )
+ {
+ return this._body.equals( another.getQueryExpressionBody() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/QuerySpecificationImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/QuerySpecificationImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/QuerySpecificationImpl.java
new file mode 100644
index 0000000..812a341
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/QuerySpecificationImpl.java
@@ -0,0 +1,130 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.booleans.BooleanExpression;
+import org.apache.polygene.library.sql.generator.grammar.query.FromClause;
+import org.apache.polygene.library.sql.generator.grammar.query.GroupByClause;
+import org.apache.polygene.library.sql.generator.grammar.query.LimitSpecification;
+import org.apache.polygene.library.sql.generator.grammar.query.OffsetSpecification;
+import org.apache.polygene.library.sql.generator.grammar.query.OrderByClause;
+import org.apache.polygene.library.sql.generator.grammar.query.QuerySpecification;
+import org.apache.polygene.library.sql.generator.grammar.query.SelectColumnClause;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class QuerySpecificationImpl extends QueryExpressionBodyImpl<QuerySpecification>
+ implements QuerySpecification
+{
+
+ private final SelectColumnClause _select;
+
+ private final FromClause _from;
+
+ private final BooleanExpression _where;
+
+ private final GroupByClause _groupBy;
+
+ private final BooleanExpression _having;
+
+ private final OrderByClause _orderBy;
+
+ private final OffsetSpecification _offset;
+
+ private final LimitSpecification _limit;
+
+ public QuerySpecificationImpl( SQLProcessorAggregator processor, SelectColumnClause select, FromClause from,
+ BooleanExpression where, GroupByClause groupBy, BooleanExpression having, OrderByClause orderBy,
+ OffsetSpecification offset, LimitSpecification limit )
+ {
+ this( processor, QuerySpecification.class, select, from, where, groupBy, having, orderBy, offset, limit );
+ }
+
+ protected QuerySpecificationImpl( SQLProcessorAggregator processor, Class<? extends QuerySpecification> queryClass,
+ SelectColumnClause select, FromClause from, BooleanExpression where, GroupByClause groupBy,
+ BooleanExpression having, OrderByClause orderBy, OffsetSpecification offset, LimitSpecification limit )
+ {
+ super( processor, queryClass );
+ Objects.requireNonNull( select, "select" );
+ this._select = select;
+ this._from = from;
+ this._where = where;
+ this._groupBy = groupBy;
+ this._having = having;
+ this._orderBy = orderBy;
+ this._offset = offset;
+ this._limit = limit;
+ }
+
+ public SelectColumnClause getColumns()
+ {
+ return this._select;
+ }
+
+ public FromClause getFrom()
+ {
+ return this._from;
+ }
+
+ public BooleanExpression getWhere()
+ {
+ return this._where;
+ }
+
+ public GroupByClause getGroupBy()
+ {
+ return this._groupBy;
+ }
+
+ public BooleanExpression getHaving()
+ {
+ return this._having;
+ }
+
+ public OrderByClause getOrderBy()
+ {
+ return this._orderBy;
+ }
+
+ public LimitSpecification getLimitSpecification()
+ {
+ return this._limit;
+ }
+
+ public OffsetSpecification getOffsetSpecification()
+ {
+ return this._offset;
+ }
+
+ @Override
+ protected boolean doesEqual( QuerySpecification another )
+ {
+ return this._select.equals( another.getColumns() )
+ && TypeableImpl.bothNullOrEquals( this._from, another.getFrom() )
+ && TypeableImpl.bothNullOrEquals( this._where, another.getWhere() )
+ && TypeableImpl.bothNullOrEquals( this._groupBy, another.getGroupBy() )
+ && TypeableImpl.bothNullOrEquals( this._having, another.getHaving() )
+ && TypeableImpl.bothNullOrEquals( this._orderBy, another.getOrderBy() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/RowDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/RowDefinitionImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/RowDefinitionImpl.java
new file mode 100644
index 0000000..51cf107
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/RowDefinitionImpl.java
@@ -0,0 +1,63 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.common.ValueExpression;
+import org.apache.polygene.library.sql.generator.grammar.query.RowDefinition;
+import org.apache.polygene.library.sql.generator.grammar.query.RowValueConstructor;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class RowDefinitionImpl extends SQLSyntaxElementBase<RowValueConstructor, RowDefinition>
+ implements RowDefinition
+{
+
+ private List<ValueExpression> _rowElements;
+
+ public RowDefinitionImpl( SQLProcessorAggregator processor, List<ValueExpression> rowElements )
+ {
+ this( processor, RowDefinition.class, rowElements );
+ }
+
+ protected RowDefinitionImpl( SQLProcessorAggregator processor, Class<? extends RowDefinition> realImplementingType,
+ List<ValueExpression> rowElements )
+ {
+ super( processor, realImplementingType );
+ Objects.requireNonNull( rowElements, "row elements" );
+ this._rowElements = Collections.unmodifiableList( rowElements );
+ }
+
+ public List<ValueExpression> getRowElements()
+ {
+ return this._rowElements;
+ }
+
+ @Override
+ protected boolean doesEqual( RowDefinition another )
+ {
+ return this._rowElements.equals( another.getRowElements() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/RowSubQueryImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/RowSubQueryImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/RowSubQueryImpl.java
new file mode 100644
index 0000000..ca50e05
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/RowSubQueryImpl.java
@@ -0,0 +1,60 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.query.QueryExpression;
+import org.apache.polygene.library.sql.generator.grammar.query.RowSubQuery;
+import org.apache.polygene.library.sql.generator.grammar.query.RowValueConstructor;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class RowSubQueryImpl extends SQLSyntaxElementBase<RowValueConstructor, RowSubQuery>
+ implements RowSubQuery
+{
+ private final QueryExpression _queryExpression;
+
+ public RowSubQueryImpl( SQLProcessorAggregator processor, QueryExpression queryExpression )
+ {
+ this( processor, RowSubQuery.class, queryExpression );
+ }
+
+ protected RowSubQueryImpl( SQLProcessorAggregator processor, Class<? extends RowSubQuery> realImplementingType,
+ QueryExpression queryExpression )
+ {
+ super( processor, realImplementingType );
+ Objects.requireNonNull( queryExpression, "query expression" );
+ this._queryExpression = queryExpression;
+ }
+
+ public QueryExpression getQueryExpression()
+ {
+ return this._queryExpression;
+ }
+
+ @Override
+ protected boolean doesEqual( RowSubQuery another )
+ {
+ return this._queryExpression.equals( another.getQueryExpression() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/SelectColumnClauseImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/SelectColumnClauseImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/SelectColumnClauseImpl.java
new file mode 100644
index 0000000..8be59aa
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/SelectColumnClauseImpl.java
@@ -0,0 +1,56 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.common.SetQuantifier;
+import org.apache.polygene.library.sql.generator.grammar.query.SelectColumnClause;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public abstract class SelectColumnClauseImpl<SelectType extends SelectColumnClause> extends
+ SQLSyntaxElementBase<SelectColumnClause, SelectType>
+ implements SelectColumnClause
+{
+
+ private final SetQuantifier _setQuantifier;
+
+ protected SelectColumnClauseImpl( SQLProcessorAggregator processor, Class<? extends SelectType> type,
+ SetQuantifier quantifier )
+ {
+ super( processor, type );
+ Objects.requireNonNull( quantifier, "set quantifier" );
+ this._setQuantifier = quantifier;
+ }
+
+ public SetQuantifier getSetQuantifier()
+ {
+ return this._setQuantifier;
+ }
+
+ @Override
+ protected boolean doesEqual( SelectType another )
+ {
+ return this._setQuantifier.equals( another.getSetQuantifier() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/SortSpecificationImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/SortSpecificationImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/SortSpecificationImpl.java
new file mode 100644
index 0000000..9fbec3a
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/SortSpecificationImpl.java
@@ -0,0 +1,71 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.common.ValueExpression;
+import org.apache.polygene.library.sql.generator.grammar.query.Ordering;
+import org.apache.polygene.library.sql.generator.grammar.query.SortSpecification;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class SortSpecificationImpl extends SQLSyntaxElementBase<SortSpecification, SortSpecification>
+ implements SortSpecification
+{
+ private final Ordering _ordering;
+
+ private final ValueExpression _expression;
+
+ public SortSpecificationImpl( SQLProcessorAggregator processor, ValueExpression expression, Ordering ordering )
+ {
+ this( processor, SortSpecification.class, expression, ordering );
+ }
+
+ protected SortSpecificationImpl( SQLProcessorAggregator processor, Class<? extends SortSpecification> implClass,
+ ValueExpression expression, Ordering ordering )
+ {
+ super( processor, implClass );
+ Objects.requireNonNull( expression, "expression" );
+ Objects.requireNonNull( ordering, "ordering" );
+
+ this._expression = expression;
+ this._ordering = ordering;
+ }
+
+ public Ordering getOrderingSpecification()
+ {
+ return this._ordering;
+ }
+
+ public ValueExpression getValueExpression()
+ {
+ return this._expression;
+ }
+
+ @Override
+ protected boolean doesEqual( SortSpecification another )
+ {
+ return this._ordering.equals( another.getOrderingSpecification() )
+ && this._expression.equals( another.getOrderingSpecification() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/TableAliasImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/TableAliasImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/TableAliasImpl.java
new file mode 100644
index 0000000..04b5b57
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/TableAliasImpl.java
@@ -0,0 +1,68 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.common.ColumnNameList;
+import org.apache.polygene.library.sql.generator.grammar.query.TableAlias;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class TableAliasImpl extends SQLSyntaxElementBase<TableAlias, TableAlias>
+ implements TableAlias
+{
+ private final String _tableAlias;
+
+ private final ColumnNameList _columnAliases;
+
+ public TableAliasImpl( SQLProcessorAggregator processor, String tableAlias, ColumnNameList columnNames )
+ {
+ this( processor, TableAlias.class, tableAlias, columnNames );
+ }
+
+ protected TableAliasImpl( SQLProcessorAggregator processor, Class<? extends TableAlias> implementingClass,
+ String tableAlias, ColumnNameList columnNames )
+ {
+ super( processor, implementingClass );
+ Objects.requireNonNull( tableAlias, "table alias table name" );
+ this._tableAlias = tableAlias;
+ this._columnAliases = columnNames;
+ }
+
+ public ColumnNameList getColumnAliases()
+ {
+ return this._columnAliases;
+ }
+
+ public String getTableAlias()
+ {
+ return this._tableAlias;
+ }
+
+ @Override
+ protected boolean doesEqual( TableAlias another )
+ {
+ return this._tableAlias.equals( another.getTableAlias() )
+ && bothNullOrEquals( this._columnAliases, another.getColumnAliases() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/TableReferenceByExpressionImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/TableReferenceByExpressionImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/TableReferenceByExpressionImpl.java
new file mode 100644
index 0000000..9278dad
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/TableReferenceByExpressionImpl.java
@@ -0,0 +1,54 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.query.QueryExpression;
+import org.apache.polygene.library.sql.generator.grammar.query.TableAlias;
+import org.apache.polygene.library.sql.generator.grammar.query.TableReferenceByExpression;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class TableReferenceByExpressionImpl extends TableReferencePrimaryImpl<TableReferenceByExpression>
+ implements TableReferenceByExpression
+{
+ private final QueryExpression _expression;
+
+ public TableReferenceByExpressionImpl( SQLProcessorAggregator processor, QueryExpression expression,
+ TableAlias alias )
+ {
+ this( processor, TableReferenceByExpression.class, expression, alias );
+ }
+
+ protected TableReferenceByExpressionImpl( SQLProcessorAggregator processor,
+ Class<? extends TableReferenceByExpression> implClass, QueryExpression expression, TableAlias alias )
+ {
+ super( processor, implClass, alias );
+ Objects.requireNonNull( expression, "collection expression" );
+ this._expression = expression;
+ }
+
+ public QueryExpression getQuery()
+ {
+ return this._expression;
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/TableReferenceByNameImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/TableReferenceByNameImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/TableReferenceByNameImpl.java
new file mode 100644
index 0000000..2f54001
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/query/TableReferenceByNameImpl.java
@@ -0,0 +1,53 @@
+/*
+ * 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.apache.polygene.library.sql.generator.implementation.grammar.query;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.common.TableName;
+import org.apache.polygene.library.sql.generator.grammar.query.TableAlias;
+import org.apache.polygene.library.sql.generator.grammar.query.TableReferenceByName;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class TableReferenceByNameImpl extends TableReferencePrimaryImpl<TableReferenceByName>
+ implements TableReferenceByName
+{
+ private final TableName _tableName;
+
+ public TableReferenceByNameImpl( SQLProcessorAggregator processor, TableName tableName, TableAlias alias )
+ {
+ this( processor, TableReferenceByName.class, tableName, alias );
+ }
+
+ protected TableReferenceByNameImpl( SQLProcessorAggregator processor,
+ Class<? extends TableReferenceByName> implClass, TableName tableName, TableAlias alias )
+ {
+ super( processor, implClass, alias );
+ Objects.requireNonNull( tableName, "table name" );
+ this._tableName = tableName;
+ }
+
+ public TableName getTableName()
+ {
+ return this._tableName;
+ }
+}