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/19 11:33:18 UTC
[35/61] [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/delete/DeleteFrom.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/delete/DeleteFrom.java b/core/src/main/java/org/eobjects/metamodel/delete/DeleteFrom.java
deleted file mode 100644
index 6e6751e..0000000
--- a/core/src/main/java/org/eobjects/metamodel/delete/DeleteFrom.java
+++ /dev/null
@@ -1,94 +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.delete;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eobjects.metamodel.DataContext;
-import org.eobjects.metamodel.UpdateCallback;
-import org.eobjects.metamodel.UpdateScript;
-import org.eobjects.metamodel.UpdateableDataContext;
-import org.eobjects.metamodel.data.WhereClauseBuilder;
-import org.eobjects.metamodel.query.FilterItem;
-import org.eobjects.metamodel.query.SelectItem;
-import org.eobjects.metamodel.query.builder.AbstractFilterBuilder;
-import org.eobjects.metamodel.query.builder.FilterBuilder;
-import org.eobjects.metamodel.schema.Column;
-import org.eobjects.metamodel.schema.Table;
-
-/**
- * Represents a single DELETE FROM operation to be applied to a
- * {@link UpdateableDataContext}. Instead of providing a custom implementation
- * of the {@link UpdateScript} interface, one can use this pre-built delete from
- * implementation. Some {@link DataContext}s may even optimize specifically
- * based on the knowledge that there will only be a single delete from statement
- * executed.
- */
-public final class DeleteFrom implements UpdateScript, WhereClauseBuilder<DeleteFrom> {
-
- private final List<FilterItem> _whereItems;
- private final Table _table;
-
- public DeleteFrom(Table table) {
- _table = table;
- _whereItems = new ArrayList<FilterItem>();
- }
-
- @Override
- public void run(UpdateCallback callback) {
- callback.deleteFrom(_table).where(_whereItems).execute();
- }
-
- @Override
- public FilterBuilder<DeleteFrom> where(Column column) {
- SelectItem selectItem = new SelectItem(column);
- return new AbstractFilterBuilder<DeleteFrom>(selectItem) {
- @Override
- protected DeleteFrom applyFilter(FilterItem filter) {
- return where(filter);
- }
- };
- }
-
- @Override
- public FilterBuilder<DeleteFrom> where(String columnName) {
- Column column = _table.getColumnByName(columnName);
- if (column == null) {
- throw new IllegalArgumentException("No such column: " + columnName);
- }
- return where(column);
- }
-
- @Override
- public DeleteFrom where(FilterItem... filterItems) {
- for (FilterItem filterItem : filterItems) {
- _whereItems.add(filterItem);
- }
- return this;
- }
-
- @Override
- public DeleteFrom where(Iterable<FilterItem> filterItems) {
- for (FilterItem filterItem : filterItems) {
- _whereItems.add(filterItem);
- }
- return this;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/delete/RowDeletable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/delete/RowDeletable.java b/core/src/main/java/org/eobjects/metamodel/delete/RowDeletable.java
deleted file mode 100644
index 0c25c04..0000000
--- a/core/src/main/java/org/eobjects/metamodel/delete/RowDeletable.java
+++ /dev/null
@@ -1,68 +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.delete;
-
-import org.eobjects.metamodel.schema.Table;
-
-public interface RowDeletable {
-
- /**
- * Determines whether row delete is supported
- *
- * @return true if row delete is supported
- */
- public boolean isDeleteSupported();
-
- /**
- * Initiates a row deletion builder.
- *
- * @param table
- * @return
- * @throws IllegalArgumentException
- * @throws IllegalStateException
- * @throws UnsupportedOperationException
- */
- public RowDeletionBuilder deleteFrom(Table table) throws IllegalArgumentException, IllegalStateException,
- UnsupportedOperationException;
-
- /**
- * Initiates a row deletion builder.
- *
- * @param tableName
- * @return
- * @throws IllegalArgumentException
- * @throws IllegalStateException
- * @throws UnsupportedOperationException
- */
- public RowDeletionBuilder deleteFrom(String tableName) throws IllegalArgumentException, IllegalStateException,
- UnsupportedOperationException;
-
- /**
- * Initiates a row deletion builder.
- *
- * @param schemaName
- * @param tableName
- * @return
- * @throws IllegalArgumentException
- * @throws IllegalStateException
- * @throws UnsupportedOperationException
- */
- public RowDeletionBuilder deleteFrom(String schemaName, String tableName) throws IllegalArgumentException,
- IllegalStateException, UnsupportedOperationException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/delete/RowDeletionBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/delete/RowDeletionBuilder.java b/core/src/main/java/org/eobjects/metamodel/delete/RowDeletionBuilder.java
deleted file mode 100644
index 308b096..0000000
--- a/core/src/main/java/org/eobjects/metamodel/delete/RowDeletionBuilder.java
+++ /dev/null
@@ -1,57 +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.delete;
-
-import org.eobjects.metamodel.DataContext;
-import org.eobjects.metamodel.MetaModelException;
-import org.eobjects.metamodel.data.WhereClauseBuilder;
-import org.eobjects.metamodel.schema.Table;
-
-/**
- * Builder object for row deletions in a {@link Table}.
- *
- * @author Kasper Sørensen
- */
-public interface RowDeletionBuilder extends WhereClauseBuilder<RowDeletionBuilder> {
-
- /**
- * Gets the table that this delete statement pertains to.
- *
- * @return the table that this delete statement pertains to.
- */
- public Table getTable();
-
- /**
- * Gets a SQL representation of this delete operation. Note that the
- * generated SQL is dialect agnostic, so it is not accurately the same as
- * what will be passed to a potential backing database.
- *
- * @return a SQL representation of this delete operation.
- */
- public String toSql();
-
- /**
- * Commits the row deletion operation. This operation will delete rows in
- * the {@link DataContext}.
- *
- * @throws MetaModelException
- * if the operation was rejected
- */
- public void execute() throws MetaModelException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/delete/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/delete/package-info.java b/core/src/main/java/org/eobjects/metamodel/delete/package-info.java
deleted file mode 100644
index a84729f..0000000
--- a/core/src/main/java/org/eobjects/metamodel/delete/package-info.java
+++ /dev/null
@@ -1,23 +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.
- */
-/**
- * API for deleting rows
- */
-package org.eobjects.metamodel.delete;
-
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/drop/AbstractTableDropBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/drop/AbstractTableDropBuilder.java b/core/src/main/java/org/eobjects/metamodel/drop/AbstractTableDropBuilder.java
deleted file mode 100644
index ac56795..0000000
--- a/core/src/main/java/org/eobjects/metamodel/drop/AbstractTableDropBuilder.java
+++ /dev/null
@@ -1,51 +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.drop;
-
-import org.eobjects.metamodel.schema.Table;
-
-/**
- * Abstract {@link TableDropBuilder} implementation
- */
-public abstract class AbstractTableDropBuilder implements TableDropBuilder {
-
- private final Table _table;
-
- public AbstractTableDropBuilder(Table table) {
- if (table == null) {
- throw new IllegalArgumentException("Table cannot be null");
- }
- _table = table;
- }
-
- @Override
- public final Table getTable() {
- return _table;
- }
-
- @Override
- public String toString() {
- return toSql();
- }
-
- @Override
- public String toSql() {
- return "DROP TABLE " + _table.getQualifiedLabel();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/drop/DropTable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/drop/DropTable.java b/core/src/main/java/org/eobjects/metamodel/drop/DropTable.java
deleted file mode 100644
index 042208b..0000000
--- a/core/src/main/java/org/eobjects/metamodel/drop/DropTable.java
+++ /dev/null
@@ -1,68 +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.drop;
-
-import org.eobjects.metamodel.DataContext;
-import org.eobjects.metamodel.UpdateCallback;
-import org.eobjects.metamodel.UpdateScript;
-import org.eobjects.metamodel.UpdateableDataContext;
-import org.eobjects.metamodel.schema.Schema;
-import org.eobjects.metamodel.schema.Table;
-
-/**
- * Represents a single DROP TABLE operation to be applied to a
- * {@link UpdateableDataContext}. Instead of providing a custom implementation
- * of the {@link UpdateScript} interface, one can use this pre-built drop table
- * implementation. Some {@link DataContext}s may even optimize specifically
- * based on the knowledge that there will only be a single table dropped.
- */
-public final class DropTable implements UpdateScript {
-
- private final String _schemaName;
- private final String _tableName;
-
- public DropTable(Table table) {
- this(table.getSchema().getName(), table.getName());
- }
-
- public DropTable(String tableName) {
- this((String) null, tableName);
- }
-
- public DropTable(Schema schema, String tableName) {
- this(schema.getName(), tableName);
- }
-
- public DropTable(String schemaName, String tableName) {
- _schemaName = schemaName;
- _tableName = tableName;
- }
-
- @Override
- public void run(UpdateCallback callback) {
- final TableDropBuilder dropBuilder;
- if (_schemaName == null) {
- dropBuilder = callback.dropTable(_tableName);
- } else {
- dropBuilder = callback.dropTable(_schemaName, _tableName);
- }
- dropBuilder.execute();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/drop/TableDropBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/drop/TableDropBuilder.java b/core/src/main/java/org/eobjects/metamodel/drop/TableDropBuilder.java
deleted file mode 100644
index d1ac018..0000000
--- a/core/src/main/java/org/eobjects/metamodel/drop/TableDropBuilder.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.drop;
-
-import org.eobjects.metamodel.MetaModelException;
-import org.eobjects.metamodel.schema.Table;
-
-public interface TableDropBuilder {
-
- /**
- * Gets the table that this drop statement pertains to
- *
- * @return the table that this drop statement pertains to
- */
- public Table getTable();
-
- /**
- * Gets a SQL representation of this drop table operation. Note that the
- * generated SQL is dialect agnostic, so it is not accurately the same as
- * what will be passed to a potential backing database.
- *
- * @return a SQL representation of this drop table operation.
- */
- public String toSql();
-
- /**
- * Executes the drop table operation
- *
- * @throws MetaModelException
- * if the operation was rejected
- */
- public void execute() throws MetaModelException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/drop/TableDroppable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/drop/TableDroppable.java b/core/src/main/java/org/eobjects/metamodel/drop/TableDroppable.java
deleted file mode 100644
index 427bebb..0000000
--- a/core/src/main/java/org/eobjects/metamodel/drop/TableDroppable.java
+++ /dev/null
@@ -1,44 +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.drop;
-
-import org.eobjects.metamodel.schema.Schema;
-import org.eobjects.metamodel.schema.Table;
-
-public interface TableDroppable {
-
- /**
- * Determines whether table drop is supported
- *
- * @return true if table drop is supported
- */
- public boolean isDropTableSupported();
-
- public TableDropBuilder dropTable(Schema schema, String tableName) throws IllegalArgumentException,
- IllegalStateException, UnsupportedOperationException;
-
- public TableDropBuilder dropTable(String schemaName, String tableName) throws IllegalArgumentException,
- IllegalStateException, UnsupportedOperationException;
-
- public TableDropBuilder dropTable(String tableName) throws IllegalArgumentException, IllegalStateException,
- UnsupportedOperationException;
-
- public TableDropBuilder dropTable(Table table) throws IllegalArgumentException, IllegalStateException,
- UnsupportedOperationException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/drop/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/drop/package-info.java b/core/src/main/java/org/eobjects/metamodel/drop/package-info.java
deleted file mode 100644
index 6c5e201..0000000
--- a/core/src/main/java/org/eobjects/metamodel/drop/package-info.java
+++ /dev/null
@@ -1,23 +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.
- */
-/**
- * API for dropping tables
- */
-package org.eobjects.metamodel.drop;
-
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/insert/AbstractRowInsertionBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/insert/AbstractRowInsertionBuilder.java b/core/src/main/java/org/eobjects/metamodel/insert/AbstractRowInsertionBuilder.java
deleted file mode 100644
index 3308d1d..0000000
--- a/core/src/main/java/org/eobjects/metamodel/insert/AbstractRowInsertionBuilder.java
+++ /dev/null
@@ -1,108 +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.insert;
-
-import org.eobjects.metamodel.UpdateCallback;
-import org.eobjects.metamodel.data.AbstractRowBuilder;
-import org.eobjects.metamodel.data.Row;
-import org.eobjects.metamodel.query.SelectItem;
-import org.eobjects.metamodel.schema.Column;
-import org.eobjects.metamodel.schema.Table;
-
-/**
- * Abstract implementation of the {@link RowInsertionBuilder} interface,
- * provided as a convenience to {@link RowInsertable} implementations. Handles
- * all the building operations, but not the commit operation.
- *
- * @author Kasper Sørensen
- */
-public abstract class AbstractRowInsertionBuilder<U extends UpdateCallback> extends
- AbstractRowBuilder<RowInsertionBuilder> implements RowInsertionBuilder {
-
- private final U _updateCallback;
- private final Table _table;
-
- public AbstractRowInsertionBuilder(U updateCallback, Table table) {
- super(table);
- _updateCallback = updateCallback;
- _table = table;
- }
-
- @Override
- public Table getTable() {
- return _table;
- }
-
- protected U getUpdateCallback() {
- return _updateCallback;
- }
-
- @Override
- public RowInsertionBuilder like(Row row) {
- SelectItem[] selectItems = row.getSelectItems();
- for (int i = 0; i < selectItems.length; i++) {
- SelectItem selectItem = selectItems[i];
- Column column = selectItem.getColumn();
- if (column != null) {
- if (_table == column.getTable()) {
- value(column, row.getValue(i));
- } else {
- value(column.getName(), row.getValue(i));
- }
- }
- }
- return this;
- }
-
- @Override
- public String toSql() {
- StringBuilder sb = new StringBuilder();
- sb.append("INSERT INTO ");
- sb.append(_table.getQualifiedLabel());
- sb.append("(");
- Column[] columns = getColumns();
- for (int i = 0; i < columns.length; i++) {
- if (i != 0) {
- sb.append(',');
- }
- sb.append(columns[i].getName());
- }
- sb.append(") VALUES (");
- Object[] values = getValues();
- for (int i = 0; i < values.length; i++) {
- Object value = values[i];
- final String stringValue;
- if (value == null) {
- stringValue = "NULL";
- } else if (value instanceof String) {
- stringValue = "\"" + value + "\"";
- } else {
- stringValue = value.toString();
- }
- sb.append(stringValue);
- }
- sb.append(")");
- return sb.toString();
- }
-
- @Override
- public String toString() {
- return toSql();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/insert/InsertInto.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/insert/InsertInto.java b/core/src/main/java/org/eobjects/metamodel/insert/InsertInto.java
deleted file mode 100644
index 6dd057d..0000000
--- a/core/src/main/java/org/eobjects/metamodel/insert/InsertInto.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.insert;
-
-import org.eobjects.metamodel.DataContext;
-import org.eobjects.metamodel.UpdateCallback;
-import org.eobjects.metamodel.UpdateScript;
-import org.eobjects.metamodel.UpdateableDataContext;
-import org.eobjects.metamodel.data.AbstractRowBuilder;
-import org.eobjects.metamodel.data.RowBuilder;
-import org.eobjects.metamodel.data.Style;
-import org.eobjects.metamodel.schema.Column;
-import org.eobjects.metamodel.schema.Table;
-
-/**
- * Represents a single INSERT INTO operation to be applied to a
- * {@link UpdateableDataContext}. Instead of providing a custom implementation
- * of the {@link UpdateScript} interface, one can use this pre-built
- * single-record insertion implementation. Some {@link DataContext}s may even
- * optimize specifically based on the knowledge that there will only be a single
- * record inserted.
- */
-public final class InsertInto extends AbstractRowBuilder<InsertInto> implements UpdateScript, RowBuilder<InsertInto> {
-
- private final Table _table;
-
- public InsertInto(Table table) {
- super(table);
- _table = table;
- }
-
- @Override
- public void run(UpdateCallback callback) {
- RowInsertionBuilder insertBuilder = callback.insertInto(getTable());
-
- final Column[] columns = getColumns();
- final Object[] values = getValues();
- final Style[] styles = getStyles();
- final boolean[] explicitNulls = getExplicitNulls();
-
- for (int i = 0; i < columns.length; i++) {
- Object value = values[i];
- Column column = columns[i];
- Style style = styles[i];
- if (value == null) {
- if (explicitNulls[i]) {
- insertBuilder = insertBuilder.value(column, value, style);
- }
- } else {
- insertBuilder = insertBuilder.value(column, value, style);
- }
- }
-
- insertBuilder.execute();
- }
-
- @Override
- public Table getTable() {
- return _table;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/insert/RowInsertable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/insert/RowInsertable.java b/core/src/main/java/org/eobjects/metamodel/insert/RowInsertable.java
deleted file mode 100644
index 94c812b..0000000
--- a/core/src/main/java/org/eobjects/metamodel/insert/RowInsertable.java
+++ /dev/null
@@ -1,92 +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.insert;
-
-import org.eobjects.metamodel.schema.Table;
-
-/**
- * An interface for objects that support inserting rows into tables.
- *
- * @author Kasper Sørensen
- */
-public interface RowInsertable {
-
- /**
- * Determines whether row insertion is supported
- *
- * @return true if row insertion is supported
- */
- public boolean isInsertSupported();
-
- /**
- * Initiates the building of a row insertion operation.
- *
- * @param table
- * the table to insert a row into
- * @return a builder object on which values can be added and the statement
- * can be committed.
- * @throws IllegalArgumentException
- * if the table argument is null or invalid.
- * @throws IllegalStateException
- * if the connection to the DataContext is read-only or another
- * access restriction is preventing the operation.
- * @throws UnsupportedOperationException
- * in case {@link #isInsertSupported()} is false
- */
- public RowInsertionBuilder insertInto(Table table) throws IllegalArgumentException, IllegalStateException,
- UnsupportedOperationException;
-
- /**
- * Initiates the building of a row insertion operation.
- *
- * @param tableName
- * the name of the table to insert a row into
- * @return a builder object on which values can be added and the statement
- * can be committed.
- * @throws IllegalArgumentException
- * if the tableName argument is null or invalid.
- * @throws IllegalStateException
- * if the connection to the DataContext is read-only or another
- * access restriction is preventing the operation.
- * @throws UnsupportedOperationException
- * in case {@link #isInsertSupported()} is false
- */
- public RowInsertionBuilder insertInto(String tableName) throws IllegalArgumentException, IllegalStateException,
- UnsupportedOperationException;
-
- /**
- * Initiates the building of a row insertion operation.
- *
- * @param schemaName
- * the name of the schema
- * @param tableName
- * the name of the table to insert a row into
- * @return a builder object on which values can be added and the statement
- * can be committed.
- * @throws IllegalArgumentException
- * if the tableName argument is null or invalid.
- * @throws IllegalStateException
- * if the connection to the DataContext is read-only or another
- * access restriction is preventing the operation.
- * @throws UnsupportedOperationException
- * in case {@link #isInsertSupported()} is false
- */
- public RowInsertionBuilder insertInto(String schemaName, String tableName) throws IllegalArgumentException,
- IllegalStateException, UnsupportedOperationException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/insert/RowInsertionBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/insert/RowInsertionBuilder.java b/core/src/main/java/org/eobjects/metamodel/insert/RowInsertionBuilder.java
deleted file mode 100644
index b2f0617..0000000
--- a/core/src/main/java/org/eobjects/metamodel/insert/RowInsertionBuilder.java
+++ /dev/null
@@ -1,68 +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.insert;
-
-import org.eobjects.metamodel.DataContext;
-import org.eobjects.metamodel.MetaModelException;
-import org.eobjects.metamodel.data.Row;
-import org.eobjects.metamodel.data.RowBuilder;
-import org.eobjects.metamodel.schema.Table;
-
-/**
- * Builder object for row insertion, into a {@link Table}.
- *
- * @author Kasper Sørensen
- */
-public interface RowInsertionBuilder extends RowBuilder<RowInsertionBuilder> {
-
- /**
- * Gets the table that this insert pertains to.
- *
- * @return the table that this insert pertains to.
- */
- @Override
- public Table getTable();
-
- /**
- * Sets all values like the provided row (for easy duplication of a row).
- *
- * @param row
- * the row from which to take values
- * @return the builder itself
- */
- public RowInsertionBuilder like(Row row);
-
- /**
- * Commits the row insertion operation. This operation will write the row to
- * the {@link DataContext}.
- *
- * @throws MetaModelException
- * if the operation was rejected
- */
- public void execute() throws MetaModelException;
-
- /**
- * Gets a SQL representation of this insert operation. Note that the
- * generated SQL is dialect agnostic, so it is not accurately the same as
- * what will be passed to a potential backing database.
- *
- * @return a SQL representation of this insert operation.
- */
- public String toSql();
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/insert/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/insert/package-info.java b/core/src/main/java/org/eobjects/metamodel/insert/package-info.java
deleted file mode 100644
index 09f8b81..0000000
--- a/core/src/main/java/org/eobjects/metamodel/insert/package-info.java
+++ /dev/null
@@ -1,23 +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.
- */
-/**
- * API for inserting rows
- */
-package org.eobjects.metamodel.insert;
-
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/intercept/DataSetInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/intercept/DataSetInterceptor.java b/core/src/main/java/org/eobjects/metamodel/intercept/DataSetInterceptor.java
deleted file mode 100644
index 77d61fa..0000000
--- a/core/src/main/java/org/eobjects/metamodel/intercept/DataSetInterceptor.java
+++ /dev/null
@@ -1,31 +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.intercept;
-
-import org.eobjects.metamodel.data.DataSet;
-
-/**
- * An {@link Interceptor} for {@link DataSet}s, allowing to touch, enrich or
- * modify a dataset before it is returned to the user.
- *
- * @author Kasper Sørensen
- */
-public interface DataSetInterceptor extends Interceptor<DataSet> {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableColumnCreationBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableColumnCreationBuilder.java b/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableColumnCreationBuilder.java
deleted file mode 100644
index be95494..0000000
--- a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableColumnCreationBuilder.java
+++ /dev/null
@@ -1,102 +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.intercept;
-
-import org.eobjects.metamodel.MetaModelException;
-import org.eobjects.metamodel.create.ColumnCreationBuilder;
-import org.eobjects.metamodel.create.TableCreationBuilder;
-import org.eobjects.metamodel.schema.Column;
-import org.eobjects.metamodel.schema.ColumnType;
-import org.eobjects.metamodel.schema.Table;
-
-final class InterceptableColumnCreationBuilder implements ColumnCreationBuilder {
-
- private final ColumnCreationBuilder _columnCreationBuilder;
- private final InterceptableTableCreationBuilder _tableCreationBuilder;
-
- public InterceptableColumnCreationBuilder(
- ColumnCreationBuilder columnCreationBuilder,
- InterceptableTableCreationBuilder tableCreationBuilder) {
- _columnCreationBuilder = columnCreationBuilder;
- _tableCreationBuilder = tableCreationBuilder;
- }
-
- @Override
- public String toSql() {
- return _tableCreationBuilder.toSql();
- }
-
- @Override
- public TableCreationBuilder like(Table table) {
- return _tableCreationBuilder.like(table);
- }
-
- @Override
- public ColumnCreationBuilder withColumn(String name) {
- _columnCreationBuilder.withColumn(name);
- return this;
- }
-
- @Override
- public Table toTable() {
- return _tableCreationBuilder.toTable();
- }
-
- @Override
- public Table execute() throws MetaModelException {
- return _tableCreationBuilder.execute();
- }
-
- @Override
- public ColumnCreationBuilder like(Column column) {
- _columnCreationBuilder.like(column);
- return this;
- }
-
- @Override
- public ColumnCreationBuilder asPrimaryKey() {
- _columnCreationBuilder.asPrimaryKey();
- return this;
- }
-
- @Override
- public ColumnCreationBuilder ofType(ColumnType type) {
- _columnCreationBuilder.ofType(type);
- return this;
- }
-
- @Override
- public ColumnCreationBuilder ofNativeType(String nativeType) {
- _columnCreationBuilder.ofNativeType(nativeType);
- return this;
- }
-
- @Override
- public ColumnCreationBuilder ofSize(int size) {
- _columnCreationBuilder.ofSize(size);
- return this;
- }
-
- @Override
- public ColumnCreationBuilder nullable(boolean nullable) {
- _columnCreationBuilder.nullable(nullable);
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableDataContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableDataContext.java b/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableDataContext.java
deleted file mode 100644
index 41ec82e..0000000
--- a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableDataContext.java
+++ /dev/null
@@ -1,284 +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.intercept;
-
-import org.eobjects.metamodel.DataContext;
-import org.eobjects.metamodel.MetaModelException;
-import org.eobjects.metamodel.UpdateScript;
-import org.eobjects.metamodel.UpdateableDataContext;
-import org.eobjects.metamodel.create.TableCreationBuilder;
-import org.eobjects.metamodel.data.DataSet;
-import org.eobjects.metamodel.delete.RowDeletionBuilder;
-import org.eobjects.metamodel.drop.TableDropBuilder;
-import org.eobjects.metamodel.insert.RowInsertionBuilder;
-import org.eobjects.metamodel.query.CompiledQuery;
-import org.eobjects.metamodel.query.Query;
-import org.eobjects.metamodel.query.builder.InitFromBuilder;
-import org.eobjects.metamodel.query.builder.InitFromBuilderImpl;
-import org.eobjects.metamodel.schema.Column;
-import org.eobjects.metamodel.schema.Schema;
-import org.eobjects.metamodel.schema.Table;
-import org.eobjects.metamodel.update.RowUpdationBuilder;
-import org.eobjects.metamodel.util.HasNameMapper;
-
-public class InterceptableDataContext implements UpdateableDataContext {
-
- private final DataContext _delegate;
- private final InterceptorList<DataSet> _dataSetInterceptors;
- private final InterceptorList<Query> _queryInterceptors;
- private final InterceptorList<Schema> _schemaInterceptors;
- private final InterceptorList<RowInsertionBuilder> _rowInsertionInterceptors;
- private final InterceptorList<RowUpdationBuilder> _rowUpdationInterceptors;
- private final InterceptorList<RowDeletionBuilder> _rowDeletionInterceptors;
- private final InterceptorList<TableCreationBuilder> _tableCreationInterceptors;
- private final InterceptorList<TableDropBuilder> _tableDropInterceptors;
-
- protected InterceptableDataContext(DataContext delegate) {
- _delegate = delegate;
- _dataSetInterceptors = new InterceptorList<DataSet>();
- _queryInterceptors = new InterceptorList<Query>();
- _schemaInterceptors = new InterceptorList<Schema>();
- _rowInsertionInterceptors = new InterceptorList<RowInsertionBuilder>();
- _rowUpdationInterceptors = new InterceptorList<RowUpdationBuilder>();
- _rowDeletionInterceptors = new InterceptorList<RowDeletionBuilder>();
- _tableCreationInterceptors = new InterceptorList<TableCreationBuilder>();
- _tableDropInterceptors = new InterceptorList<TableDropBuilder>();
- }
-
- public InterceptableDataContext addTableCreationInterceptor(TableCreationInterceptor interceptor) {
- _tableCreationInterceptors.add(interceptor);
- return this;
- }
-
- public InterceptableDataContext removeTableCreationInterceptor(TableCreationInterceptor interceptor) {
- _tableCreationInterceptors.remove(interceptor);
- return this;
- }
-
- public InterceptableDataContext addTableDropInterceptor(TableDropInterceptor interceptor) {
- _tableDropInterceptors.add(interceptor);
- return this;
- }
-
- public InterceptableDataContext removeTableDropInterceptor(TableDropInterceptor interceptor) {
- _tableDropInterceptors.remove(interceptor);
- return this;
- }
-
- public InterceptableDataContext addRowInsertionInterceptor(RowInsertionInterceptor interceptor) {
- _rowInsertionInterceptors.add(interceptor);
- return this;
- }
-
- public InterceptableDataContext removeRowInsertionInterceptor(RowInsertionInterceptor interceptor) {
- _rowInsertionInterceptors.remove(interceptor);
- return this;
- }
-
- public InterceptableDataContext addRowUpdationInterceptor(RowUpdationInterceptor interceptor) {
- _rowUpdationInterceptors.add(interceptor);
- return this;
- }
-
- public InterceptableDataContext removeRowUpdationInterceptor(RowUpdationInterceptor interceptor) {
- _rowUpdationInterceptors.remove(interceptor);
- return this;
- }
-
- public InterceptableDataContext addRowDeletionInterceptor(RowDeletionInterceptor interceptor) {
- _rowDeletionInterceptors.add(interceptor);
- return this;
- }
-
- public InterceptableDataContext removeRowDeletionInterceptor(RowDeletionInterceptor interceptor) {
- _rowDeletionInterceptors.remove(interceptor);
- return this;
- }
-
- public InterceptableDataContext addQueryInterceptor(QueryInterceptor interceptor) {
- _queryInterceptors.add(interceptor);
- return this;
- }
-
- public InterceptableDataContext removeQueryInterceptor(QueryInterceptor interceptor) {
- _queryInterceptors.remove(interceptor);
- return this;
- }
-
- public InterceptableDataContext addSchemaInterceptor(SchemaInterceptor interceptor) {
- _schemaInterceptors.add(interceptor);
- return this;
- }
-
- public InterceptableDataContext removeSchemaInterceptor(SchemaInterceptor interceptor) {
- _schemaInterceptors.remove(interceptor);
- return this;
- }
-
- public InterceptableDataContext addDataSetInterceptor(DataSetInterceptor interceptor) {
- _dataSetInterceptors.add(interceptor);
- return this;
- }
-
- public InterceptableDataContext removeDataSetInterceptor(DataSetInterceptor interceptor) {
- _dataSetInterceptors.remove(interceptor);
- return this;
- }
-
- public InterceptorList<DataSet> getDataSetInterceptors() {
- return _dataSetInterceptors;
- }
-
- public InterceptorList<Query> getQueryInterceptors() {
- return _queryInterceptors;
- }
-
- public InterceptorList<RowInsertionBuilder> getRowInsertionInterceptors() {
- return _rowInsertionInterceptors;
- }
-
- public InterceptorList<RowUpdationBuilder> getRowUpdationInterceptors() {
- return _rowUpdationInterceptors;
- }
-
- public InterceptorList<RowDeletionBuilder> getRowDeletionInterceptors() {
- return _rowDeletionInterceptors;
- }
-
- public InterceptorList<Schema> getSchemaInterceptors() {
- return _schemaInterceptors;
- }
-
- public InterceptorList<TableCreationBuilder> getTableCreationInterceptors() {
- return _tableCreationInterceptors;
- }
-
- public DataContext getDelegate() {
- return _delegate;
- }
-
- @Override
- public DataSet executeQuery(Query query) throws MetaModelException {
- query = _queryInterceptors.interceptAll(query);
- DataSet dataSet = _delegate.executeQuery(query);
- dataSet = _dataSetInterceptors.interceptAll(dataSet);
- return dataSet;
- }
-
- @Override
- public UpdateableDataContext refreshSchemas() {
- _delegate.refreshSchemas();
- return this;
- }
-
- @Override
- public Schema[] getSchemas() throws MetaModelException {
- Schema[] schemas = _delegate.getSchemas();
- if (!_schemaInterceptors.isEmpty()) {
- for (int i = 0; i < schemas.length; i++) {
- schemas[i] = _schemaInterceptors.interceptAll(schemas[i]);
- }
- }
- return schemas;
- }
-
- @Override
- public String[] getSchemaNames() throws MetaModelException {
- if (_schemaInterceptors.isEmpty()) {
- return _delegate.getSchemaNames();
- }
- Schema[] schemas = getSchemas();
- String[] schemaNames = new String[schemas.length];
- for (int i = 0; i < schemaNames.length; i++) {
- schemaNames[i] = new HasNameMapper().eval(schemas[i]);
- }
- return schemaNames;
- }
-
- @Override
- public Schema getDefaultSchema() throws MetaModelException {
- Schema schema = _delegate.getDefaultSchema();
- schema = _schemaInterceptors.interceptAll(schema);
- return schema;
- }
-
- @Override
- public Schema getSchemaByName(String name) throws MetaModelException {
- Schema schema = _delegate.getSchemaByName(name);
- schema = _schemaInterceptors.interceptAll(schema);
- return schema;
- }
-
- @Override
- public InitFromBuilder query() {
- return new InitFromBuilderImpl(this);
- }
-
- @Override
- public Column getColumnByQualifiedLabel(String columnName) {
- return _delegate.getColumnByQualifiedLabel(columnName);
- }
-
- @Override
- public Table getTableByQualifiedLabel(String tableName) {
- return _delegate.getTableByQualifiedLabel(tableName);
- }
-
- @Override
- public void executeUpdate(UpdateScript update) {
- if (!(_delegate instanceof UpdateableDataContext)) {
- throw new UnsupportedOperationException("Delegate is not an UpdateableDataContext");
- }
- final UpdateableDataContext delegate = (UpdateableDataContext) _delegate;
-
- if (_tableCreationInterceptors.isEmpty() && _tableDropInterceptors.isEmpty()
- && _rowInsertionInterceptors.isEmpty() && _rowUpdationInterceptors.isEmpty()
- && _rowDeletionInterceptors.isEmpty()) {
- delegate.executeUpdate(update);
- return;
- }
-
- UpdateScript interceptableUpdateScript = new InterceptableUpdateScript(this, update,
- _tableCreationInterceptors, _tableDropInterceptors, _rowInsertionInterceptors,
- _rowUpdationInterceptors, _rowDeletionInterceptors);
- delegate.executeUpdate(interceptableUpdateScript);
- }
-
- @Override
- public Query parseQuery(String queryString) throws MetaModelException {
- return _delegate.parseQuery(queryString);
- }
-
- @Override
- public DataSet executeQuery(String queryString) throws MetaModelException {
- final Query query = parseQuery(queryString);
- final DataSet dataSet = executeQuery(query);
- return dataSet;
- }
-
- @Override
- public CompiledQuery compileQuery(Query query) {
- return _delegate.compileQuery(query);
- }
-
- @Override
- public DataSet executeQuery(CompiledQuery compiledQuery, Object... values) {
- return _delegate.executeQuery(compiledQuery, values);
- }
-}
\ 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/intercept/InterceptableRowDeletionBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableRowDeletionBuilder.java b/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableRowDeletionBuilder.java
deleted file mode 100644
index 2cd32a7..0000000
--- a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableRowDeletionBuilder.java
+++ /dev/null
@@ -1,87 +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.intercept;
-
-import org.eobjects.metamodel.MetaModelException;
-import org.eobjects.metamodel.delete.RowDeletionBuilder;
-import org.eobjects.metamodel.query.FilterItem;
-import org.eobjects.metamodel.query.SelectItem;
-import org.eobjects.metamodel.query.builder.AbstractFilterBuilder;
-import org.eobjects.metamodel.query.builder.FilterBuilder;
-import org.eobjects.metamodel.schema.Column;
-import org.eobjects.metamodel.schema.Table;
-
-final class InterceptableRowDeletionBuilder implements RowDeletionBuilder {
-
- private final RowDeletionBuilder _rowDeletionBuilder;
- private final InterceptorList<RowDeletionBuilder> _rowDeletionInterceptors;
-
- public InterceptableRowDeletionBuilder(RowDeletionBuilder rowDeletionBuilder,
- InterceptorList<RowDeletionBuilder> rowDeletionInterceptors) {
- _rowDeletionBuilder = rowDeletionBuilder;
- _rowDeletionInterceptors = rowDeletionInterceptors;
- }
-
- @Override
- public FilterBuilder<RowDeletionBuilder> where(Column column) {
- final SelectItem selectItem = new SelectItem(column);
- return new AbstractFilterBuilder<RowDeletionBuilder>(selectItem) {
- @Override
- protected RowDeletionBuilder applyFilter(FilterItem filter) {
- return where(filter);
- }
- };
- }
-
- @Override
- public FilterBuilder<RowDeletionBuilder> where(String columnName) {
- Column column = getTable().getColumnByName(columnName);
- return where(column);
- }
-
- @Override
- public RowDeletionBuilder where(FilterItem... filterItems) {
- _rowDeletionBuilder.where(filterItems);
- return this;
- }
-
- @Override
- public RowDeletionBuilder where(Iterable<FilterItem> filterItems) {
- _rowDeletionBuilder.where(filterItems);
- return this;
- }
-
- @Override
- public Table getTable() {
- return _rowDeletionBuilder.getTable();
- }
-
- @Override
- public String toSql() {
- return _rowDeletionBuilder.toSql();
- }
-
- @Override
- public void execute() throws MetaModelException {
- RowDeletionBuilder rowDeletionBuilder = _rowDeletionBuilder;
- rowDeletionBuilder = _rowDeletionInterceptors.interceptAll(rowDeletionBuilder);
- rowDeletionBuilder.execute();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableRowInsertionBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableRowInsertionBuilder.java b/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableRowInsertionBuilder.java
deleted file mode 100644
index a8179db..0000000
--- a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableRowInsertionBuilder.java
+++ /dev/null
@@ -1,111 +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.intercept;
-
-import org.eobjects.metamodel.MetaModelException;
-import org.eobjects.metamodel.data.Row;
-import org.eobjects.metamodel.data.Style;
-import org.eobjects.metamodel.insert.RowInsertionBuilder;
-import org.eobjects.metamodel.schema.Column;
-import org.eobjects.metamodel.schema.Table;
-
-final class InterceptableRowInsertionBuilder implements RowInsertionBuilder {
-
- private final RowInsertionBuilder _rowInsertionBuilder;
- private final InterceptorList<RowInsertionBuilder> _rowInsertionInterceptors;
-
- public InterceptableRowInsertionBuilder(
- RowInsertionBuilder rowInsertionBuilder,
- InterceptorList<RowInsertionBuilder> rowInsertionInterceptors) {
- _rowInsertionBuilder = rowInsertionBuilder;
- _rowInsertionInterceptors = rowInsertionInterceptors;
- }
-
- @Override
- public String toSql() {
- return _rowInsertionBuilder.toSql();
- }
-
- @Override
- public RowInsertionBuilder value(int columnIndex, Object value) {
- _rowInsertionBuilder.value(columnIndex, value);
- return this;
- }
-
- @Override
- public RowInsertionBuilder value(int columnIndex, Object value, Style style) {
- _rowInsertionBuilder.value(columnIndex, value, style);
- return this;
- }
-
- @Override
- public RowInsertionBuilder value(Column column, Object value) {
- _rowInsertionBuilder.value(column, value);
- return this;
- }
-
- @Override
- public RowInsertionBuilder value(Column column, Object value, Style style) {
- _rowInsertionBuilder.value(column, value, style);
- return this;
- }
-
- @Override
- public RowInsertionBuilder value(String columnName, Object value) {
- _rowInsertionBuilder.value(columnName, value);
- return this;
- }
-
- @Override
- public RowInsertionBuilder like(Row row) {
- _rowInsertionBuilder.like(row);
- return this;
- }
-
- @Override
- public RowInsertionBuilder value(String columnName, Object value,
- Style style) {
- _rowInsertionBuilder.value(columnName, value, style);
- return this;
- }
-
- @Override
- public void execute() throws MetaModelException {
- RowInsertionBuilder rowInsertionBuilder = _rowInsertionBuilder;
- rowInsertionBuilder = _rowInsertionInterceptors
- .interceptAll(rowInsertionBuilder);
- rowInsertionBuilder.execute();
- }
-
- @Override
- public Row toRow() {
- return _rowInsertionBuilder.toRow();
- }
-
- @Override
- public Table getTable() {
- return _rowInsertionBuilder.getTable();
- }
-
- @Override
- public boolean isSet(Column column) {
- return _rowInsertionBuilder.isSet(column);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableRowUpdationBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableRowUpdationBuilder.java b/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableRowUpdationBuilder.java
deleted file mode 100644
index a8ead41..0000000
--- a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableRowUpdationBuilder.java
+++ /dev/null
@@ -1,136 +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.intercept;
-
-import org.eobjects.metamodel.MetaModelException;
-import org.eobjects.metamodel.data.Row;
-import org.eobjects.metamodel.data.Style;
-import org.eobjects.metamodel.query.FilterItem;
-import org.eobjects.metamodel.query.SelectItem;
-import org.eobjects.metamodel.query.builder.AbstractFilterBuilder;
-import org.eobjects.metamodel.query.builder.FilterBuilder;
-import org.eobjects.metamodel.schema.Column;
-import org.eobjects.metamodel.schema.Table;
-import org.eobjects.metamodel.update.RowUpdationBuilder;
-
-final class InterceptableRowUpdationBuilder implements RowUpdationBuilder {
-
- private final RowUpdationBuilder _rowUpdationBuilder;
- private final InterceptorList<RowUpdationBuilder> _rowUpdationInterceptors;
-
- public InterceptableRowUpdationBuilder(RowUpdationBuilder rowUpdationBuilder,
- InterceptorList<RowUpdationBuilder> rowUpdationInterceptors) {
- _rowUpdationBuilder = rowUpdationBuilder;
- _rowUpdationInterceptors = rowUpdationInterceptors;
- }
-
- @Override
- public RowUpdationBuilder value(int columnIndex, Object value) {
- _rowUpdationBuilder.value(columnIndex, value);
- return this;
- }
-
- @Override
- public RowUpdationBuilder value(int columnIndex, Object value, Style style) {
- _rowUpdationBuilder.value(columnIndex, value, style);
- return this;
- }
-
- @Override
- public RowUpdationBuilder value(Column column, Object value) {
- _rowUpdationBuilder.value(column, value);
- return this;
- }
-
- @Override
- public RowUpdationBuilder value(Column column, Object value, Style style) {
- _rowUpdationBuilder.value(column, value, style);
- return this;
- }
-
- @Override
- public RowUpdationBuilder value(String columnName, Object value) {
- _rowUpdationBuilder.value(columnName, value);
- return this;
- }
-
- @Override
- public RowUpdationBuilder value(String columnName, Object value, Style style) {
- _rowUpdationBuilder.value(columnName, value, style);
- return this;
- }
-
- @Override
- public Row toRow() {
- return _rowUpdationBuilder.toRow();
- }
-
- @Override
- public boolean isSet(Column column) {
- return _rowUpdationBuilder.isSet(column);
- }
-
- @Override
- public FilterBuilder<RowUpdationBuilder> where(Column column) {
- final SelectItem selectItem = new SelectItem(column);
- return new AbstractFilterBuilder<RowUpdationBuilder>(selectItem) {
- @Override
- protected RowUpdationBuilder applyFilter(FilterItem filter) {
- where(filter);
- return InterceptableRowUpdationBuilder.this;
- }
- };
- }
-
- @Override
- public FilterBuilder<RowUpdationBuilder> where(String columnName) {
- Column column = getTable().getColumnByName(columnName);
- return where(column);
- }
-
- @Override
- public RowUpdationBuilder where(FilterItem... filterItems) {
- _rowUpdationBuilder.where(filterItems);
- return this;
- }
-
- @Override
- public RowUpdationBuilder where(Iterable<FilterItem> filterItems) {
- _rowUpdationBuilder.where(filterItems);
- return this;
- }
-
- @Override
- public String toSql() {
- return _rowUpdationBuilder.toSql();
- }
-
- @Override
- public Table getTable() {
- return _rowUpdationBuilder.getTable();
- }
-
- @Override
- public void execute() throws MetaModelException {
- RowUpdationBuilder rowUpdationBuilder = _rowUpdationBuilder;
- rowUpdationBuilder = _rowUpdationInterceptors.interceptAll(rowUpdationBuilder);
- rowUpdationBuilder.execute();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableTableCreationBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableTableCreationBuilder.java b/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableTableCreationBuilder.java
deleted file mode 100644
index dd85590..0000000
--- a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableTableCreationBuilder.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.intercept;
-
-import org.eobjects.metamodel.MetaModelException;
-import org.eobjects.metamodel.create.ColumnCreationBuilder;
-import org.eobjects.metamodel.create.TableCreationBuilder;
-import org.eobjects.metamodel.schema.Table;
-
-final class InterceptableTableCreationBuilder implements TableCreationBuilder {
-
- private final TableCreationBuilder _tabelCreationBuilder;
- private final InterceptorList<TableCreationBuilder> _tableCreationInterceptors;
-
- public InterceptableTableCreationBuilder(
- TableCreationBuilder tabelCreationBuilder,
- InterceptorList<TableCreationBuilder> tableCreationInterceptors) {
- _tabelCreationBuilder = tabelCreationBuilder;
- _tableCreationInterceptors = tableCreationInterceptors;
- }
-
- @Override
- public String toSql() {
- return _tabelCreationBuilder.toSql();
- }
-
- @Override
- public TableCreationBuilder like(Table table) {
- _tabelCreationBuilder.like(table);
- return this;
- }
-
- @Override
- public ColumnCreationBuilder withColumn(String name) {
- ColumnCreationBuilder columnCreationBuilder = _tabelCreationBuilder
- .withColumn(name);
- return new InterceptableColumnCreationBuilder(columnCreationBuilder,
- this);
- }
-
- @Override
- public Table toTable() {
- return _tabelCreationBuilder.toTable();
- }
-
- @Override
- public Table execute() throws MetaModelException {
- TableCreationBuilder tableCreationBuilder = _tabelCreationBuilder;
- tableCreationBuilder = _tableCreationInterceptors
- .interceptAll(tableCreationBuilder);
- return tableCreationBuilder.execute();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableTableDropBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableTableDropBuilder.java b/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableTableDropBuilder.java
deleted file mode 100644
index 445b10d..0000000
--- a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableTableDropBuilder.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.intercept;
-
-import org.eobjects.metamodel.MetaModelException;
-import org.eobjects.metamodel.drop.TableDropBuilder;
-import org.eobjects.metamodel.schema.Table;
-
-final class InterceptableTableDropBuilder implements TableDropBuilder {
-
- private final TableDropBuilder _tableDropBuilder;
- private final InterceptorList<TableDropBuilder> _tableDropInterceptors;
-
- public InterceptableTableDropBuilder(TableDropBuilder tableDropBuilder,
- InterceptorList<TableDropBuilder> tableDropInterceptors) {
- _tableDropBuilder = tableDropBuilder;
- _tableDropInterceptors = tableDropInterceptors;
- }
-
- @Override
- public Table getTable() {
- return _tableDropBuilder.getTable();
- }
-
- @Override
- public String toSql() {
- return _tableDropBuilder.toSql();
- }
-
- @Override
- public void execute() throws MetaModelException {
- TableDropBuilder tableDropBuilder = _tableDropBuilder;
- tableDropBuilder = _tableDropInterceptors.interceptAll(_tableDropBuilder);
- tableDropBuilder.execute();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableUpdateCallback.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableUpdateCallback.java b/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableUpdateCallback.java
deleted file mode 100644
index f5a27ed..0000000
--- a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableUpdateCallback.java
+++ /dev/null
@@ -1,128 +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.intercept;
-
-import org.eobjects.metamodel.AbstractUpdateCallback;
-import org.eobjects.metamodel.UpdateCallback;
-import org.eobjects.metamodel.create.TableCreationBuilder;
-import org.eobjects.metamodel.delete.RowDeletionBuilder;
-import org.eobjects.metamodel.drop.TableDropBuilder;
-import org.eobjects.metamodel.insert.RowInsertionBuilder;
-import org.eobjects.metamodel.schema.Schema;
-import org.eobjects.metamodel.schema.Table;
-import org.eobjects.metamodel.update.RowUpdationBuilder;
-
-/**
- * {@link UpdateCallback} wrapper that allows adding interceptors for certain operations.
- */
-final class InterceptableUpdateCallback extends AbstractUpdateCallback implements UpdateCallback {
-
- private final UpdateCallback _updateCallback;
- private final InterceptorList<TableCreationBuilder> _tableCreationInterceptors;
- private final InterceptorList<TableDropBuilder> _tableDropInterceptors;
- private final InterceptorList<RowInsertionBuilder> _rowInsertionInterceptors;
- private final InterceptorList<RowUpdationBuilder> _rowUpdationInterceptors;
- private final InterceptorList<RowDeletionBuilder> _rowDeletionInterceptors;
-
- public InterceptableUpdateCallback(InterceptableDataContext dataContext, UpdateCallback updateCallback,
- InterceptorList<TableCreationBuilder> tableCreationInterceptors,
- InterceptorList<TableDropBuilder> tableDropInterceptors,
- InterceptorList<RowInsertionBuilder> rowInsertionInterceptors,
- InterceptorList<RowUpdationBuilder> rowUpdationInterceptors,
- InterceptorList<RowDeletionBuilder> rowDeletionInterceptors) {
- super(dataContext);
- _updateCallback = updateCallback;
- _tableCreationInterceptors = tableCreationInterceptors;
- _tableDropInterceptors = tableDropInterceptors;
- _rowInsertionInterceptors = rowInsertionInterceptors;
- _rowUpdationInterceptors = rowUpdationInterceptors;
- _rowDeletionInterceptors = rowDeletionInterceptors;
- }
-
- @Override
- public TableCreationBuilder createTable(Schema schema, String name) throws IllegalArgumentException,
- IllegalStateException {
- TableCreationBuilder tabelCreationBuilder = _updateCallback.createTable(schema, name);
- if (_tableCreationInterceptors.isEmpty()) {
- return tabelCreationBuilder;
- }
- return new InterceptableTableCreationBuilder(tabelCreationBuilder, _tableCreationInterceptors);
- }
-
- @Override
- public RowInsertionBuilder insertInto(Table table) throws IllegalArgumentException, IllegalStateException {
- RowInsertionBuilder rowInsertionBuilder = _updateCallback.insertInto(table);
- if (_rowInsertionInterceptors.isEmpty()) {
- return rowInsertionBuilder;
- }
- return new InterceptableRowInsertionBuilder(rowInsertionBuilder, _rowInsertionInterceptors);
- }
-
- @Override
- public boolean isCreateTableSupported() {
- return _updateCallback.isCreateTableSupported();
- }
-
- @Override
- public boolean isDropTableSupported() {
- return _updateCallback.isDropTableSupported();
- }
-
- @Override
- public TableDropBuilder dropTable(Table table) {
- TableDropBuilder tableDropBuilder = _updateCallback.dropTable(table);
- if (_tableDropInterceptors.isEmpty()) {
- return tableDropBuilder;
- }
- return new InterceptableTableDropBuilder(tableDropBuilder, _tableDropInterceptors);
- }
-
- @Override
- public boolean isInsertSupported() {
- return _updateCallback.isInsertSupported();
- }
-
- @Override
- public boolean isUpdateSupported() {
- return _updateCallback.isUpdateSupported();
- }
-
- @Override
- public RowUpdationBuilder update(Table table) {
- RowUpdationBuilder rowUpdationBuilder = _updateCallback.update(table);
- if (_rowUpdationInterceptors.isEmpty()) {
- return rowUpdationBuilder;
- }
- return new InterceptableRowUpdationBuilder(rowUpdationBuilder, _rowUpdationInterceptors);
- }
-
- @Override
- public boolean isDeleteSupported() {
- return _updateCallback.isDeleteSupported();
- }
-
- @Override
- public RowDeletionBuilder deleteFrom(Table table) {
- RowDeletionBuilder rowDeletionBuilder = _updateCallback.deleteFrom(table);
- if (_rowDeletionInterceptors.isEmpty()) {
- return rowDeletionBuilder;
- }
- return new InterceptableRowDeletionBuilder(rowDeletionBuilder, _rowDeletionInterceptors);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableUpdateScript.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableUpdateScript.java b/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableUpdateScript.java
deleted file mode 100644
index 2c11d6b..0000000
--- a/core/src/main/java/org/eobjects/metamodel/intercept/InterceptableUpdateScript.java
+++ /dev/null
@@ -1,62 +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.intercept;
-
-import org.eobjects.metamodel.UpdateCallback;
-import org.eobjects.metamodel.UpdateScript;
-import org.eobjects.metamodel.create.TableCreationBuilder;
-import org.eobjects.metamodel.delete.RowDeletionBuilder;
-import org.eobjects.metamodel.drop.TableDropBuilder;
-import org.eobjects.metamodel.insert.RowInsertionBuilder;
-import org.eobjects.metamodel.update.RowUpdationBuilder;
-
-final class InterceptableUpdateScript implements UpdateScript {
-
- private final InterceptableDataContext _interceptableDataContext;
- private final UpdateScript _updateScript;
- private final InterceptorList<TableCreationBuilder> _tableCreationInterceptors;
- private final InterceptorList<TableDropBuilder> _tableDropInterceptors;
- private final InterceptorList<RowInsertionBuilder> _rowInsertionInterceptors;
- private final InterceptorList<RowUpdationBuilder> _rowUpdationInterceptors;
- private final InterceptorList<RowDeletionBuilder> _rowDeletionInterceptors;
-
- public InterceptableUpdateScript(InterceptableDataContext interceptableDataContext, UpdateScript updateScript,
- InterceptorList<TableCreationBuilder> tableCreationInterceptors,
- InterceptorList<TableDropBuilder> tableDropInterceptors,
- InterceptorList<RowInsertionBuilder> rowInsertionInterceptors,
- InterceptorList<RowUpdationBuilder> rowUpdationInterceptors,
- InterceptorList<RowDeletionBuilder> rowDeletionInterceptors) {
- _interceptableDataContext = interceptableDataContext;
- _updateScript = updateScript;
- _tableCreationInterceptors = tableCreationInterceptors;
- _tableDropInterceptors = tableDropInterceptors;
- _rowInsertionInterceptors = rowInsertionInterceptors;
- _rowUpdationInterceptors = rowUpdationInterceptors;
- _rowDeletionInterceptors = rowDeletionInterceptors;
- }
-
- @Override
- public void run(UpdateCallback callback) {
- UpdateCallback interceptableUpdateCallback = new InterceptableUpdateCallback(_interceptableDataContext,
- callback, _tableCreationInterceptors, _tableDropInterceptors, _rowInsertionInterceptors,
- _rowUpdationInterceptors, _rowDeletionInterceptors);
- _updateScript.run(interceptableUpdateCallback);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-metamodel/blob/e2e2b37a/core/src/main/java/org/eobjects/metamodel/intercept/Interceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/eobjects/metamodel/intercept/Interceptor.java b/core/src/main/java/org/eobjects/metamodel/intercept/Interceptor.java
deleted file mode 100644
index 36f503b..0000000
--- a/core/src/main/java/org/eobjects/metamodel/intercept/Interceptor.java
+++ /dev/null
@@ -1,52 +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.intercept;
-
-/**
- * Defines a high-level interface for interceptors in MetaModel.
- *
- * An intereptor can touch, modify, enhance or do other operations on certain
- * object types as they are passed around for execution in MetaModel. There are
- * 5 types of concrete interceptors:
- *
- * @see QueryInterceptor
- * @see DataSetInterceptor
- * @see RowInsertionInterceptor
- * @see TableCreationInterceptor
- * @see SchemaInterceptor
- *
- * @author Kasper Sørensen
- *
- * @param <E>
- * the type of object to intercept
- */
-public interface Interceptor<E> {
-
- /**
- * Interception method invoked by MetaModel when the intercepted object is
- * being activated.
- *
- * @param input
- * the intercepted object
- * @return the intercepted object, or a modification of this if the object
- * is to be replaced by the interceptor. The returned object must
- * not be null.
- */
- public E intercept(E input);
-}