You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2013/02/20 22:06:37 UTC
svn commit: r1448414 [4/14] - in
/db/torque/torque4/trunk/torque-runtime/src: main/java/org/apache/torque/
main/java/org/apache/torque/adapter/ main/java/org/apache/torque/criteria/
main/java/org/apache/torque/map/ main/java/org/apache/torque/oid/ main...
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/PreparedStatementPart.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/PreparedStatementPart.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/PreparedStatementPart.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/PreparedStatementPart.java Wed Feb 20 21:06:35 2013
@@ -1,178 +1,178 @@
-package org.apache.torque.criteria;
-
-/*
- * 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.
- */
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-/**
- * The rendered SQL for a part of a prepared statement.
- *
- * @version $Id$
- */
-public class PreparedStatementPart implements Serializable
-{
- /** Version id for serializing. */
- private static final long serialVersionUID = 1L;
-
- /**
- * The SQL for the part, not null.
- */
- private final StringBuilder sql = new StringBuilder();
-
- /**
- * The replacements for the prepared statement, not null.
- */
- private final List<Object> preparedStatementReplacements
- = new ArrayList<Object>();
-
- /**
- * Default constructor, creates an empty PreparedStatementPart.
- */
- public PreparedStatementPart()
- {
- // empty
- }
-
- /**
- * Constructor, creates a pre-filled PreparedStatementPart.
- *
- * @param sql The sql to fill into the sql buffer initially, or null.
- * @param preparedStatementReplacements the prepared statement replacements
- * to start with, or null.
- */
- public PreparedStatementPart(
- String sql,
- Object... preparedStatementReplacements)
- {
- if (!StringUtils.isEmpty(sql))
- {
- this.sql.append(sql);
- }
- if (preparedStatementReplacements != null)
- {
- this.preparedStatementReplacements.addAll(
- Arrays.asList(preparedStatementReplacements));
- }
- }
-
- /**
- * Returns the SQL of the part.
- *
- * @return the SQL as mutable StringBuilder, not null.
- */
- public StringBuilder getSql()
- {
- return sql;
- }
-
- /**
- * Returns the SQL of the part as String.
- *
- * @return the SQL, not null.
- */
- public String getSqlAsString()
- {
- return sql.toString();
- }
-
- /**
- * Returns the list of prepared statement replacements.
- *
- * @return the modifiable list of prepared statement replacements, not null.
- */
- public List<Object> getPreparedStatementReplacements()
- {
- return preparedStatementReplacements;
- }
-
- /**
- * Appends another PreparedStatementPart to this part.
- *
- * @param toAppend the part to append, not null.
- *
- * @return this PreparedStatementPart (with toAppend appended).
- */
- public PreparedStatementPart append(PreparedStatementPart toAppend)
- {
- sql.append(toAppend.sql);
- preparedStatementReplacements.addAll(
- toAppend.preparedStatementReplacements);
- return this;
- }
-
- /**
- * Appends a SqlEnum to this part.
- *
- * @param toAppend the part to append, not null.
- *
- * @return this PreparedStatementPart (with toAppend appended).
- */
- public PreparedStatementPart append(SqlEnum toAppend)
- {
- sql.append(toAppend);
- return this;
- }
-
- @Override
- public int hashCode()
- {
- HashCodeBuilder hashCodeBuilder = new HashCodeBuilder();
- hashCodeBuilder.append(sql);
- hashCodeBuilder.append(preparedStatementReplacements);
- return hashCodeBuilder.toHashCode();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (this == obj)
- {
- return true;
- }
- if (obj == null)
- {
- return false;
- }
- if (getClass() != obj.getClass())
- {
- return false;
- }
- PreparedStatementPart other = (PreparedStatementPart) obj;
- EqualsBuilder equalsBuilder = new EqualsBuilder();
- equalsBuilder.append(other.sql, this.sql);
- equalsBuilder.append(
- other.preparedStatementReplacements,
- this.preparedStatementReplacements);
- return equalsBuilder.isEquals();
- }
-
- @Override
- public String toString()
- {
- return sql + ", preparedStatementReplacements="
- + preparedStatementReplacements;
- }
-}
+package org.apache.torque.criteria;
+
+/*
+ * 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.
+ */
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+/**
+ * The rendered SQL for a part of a prepared statement.
+ *
+ * @version $Id$
+ */
+public class PreparedStatementPart implements Serializable
+{
+ /** Version id for serializing. */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * The SQL for the part, not null.
+ */
+ private final StringBuilder sql = new StringBuilder();
+
+ /**
+ * The replacements for the prepared statement, not null.
+ */
+ private final List<Object> preparedStatementReplacements
+ = new ArrayList<Object>();
+
+ /**
+ * Default constructor, creates an empty PreparedStatementPart.
+ */
+ public PreparedStatementPart()
+ {
+ // empty
+ }
+
+ /**
+ * Constructor, creates a pre-filled PreparedStatementPart.
+ *
+ * @param sql The sql to fill into the sql buffer initially, or null.
+ * @param preparedStatementReplacements the prepared statement replacements
+ * to start with, or null.
+ */
+ public PreparedStatementPart(
+ String sql,
+ Object... preparedStatementReplacements)
+ {
+ if (!StringUtils.isEmpty(sql))
+ {
+ this.sql.append(sql);
+ }
+ if (preparedStatementReplacements != null)
+ {
+ this.preparedStatementReplacements.addAll(
+ Arrays.asList(preparedStatementReplacements));
+ }
+ }
+
+ /**
+ * Returns the SQL of the part.
+ *
+ * @return the SQL as mutable StringBuilder, not null.
+ */
+ public StringBuilder getSql()
+ {
+ return sql;
+ }
+
+ /**
+ * Returns the SQL of the part as String.
+ *
+ * @return the SQL, not null.
+ */
+ public String getSqlAsString()
+ {
+ return sql.toString();
+ }
+
+ /**
+ * Returns the list of prepared statement replacements.
+ *
+ * @return the modifiable list of prepared statement replacements, not null.
+ */
+ public List<Object> getPreparedStatementReplacements()
+ {
+ return preparedStatementReplacements;
+ }
+
+ /**
+ * Appends another PreparedStatementPart to this part.
+ *
+ * @param toAppend the part to append, not null.
+ *
+ * @return this PreparedStatementPart (with toAppend appended).
+ */
+ public PreparedStatementPart append(PreparedStatementPart toAppend)
+ {
+ sql.append(toAppend.sql);
+ preparedStatementReplacements.addAll(
+ toAppend.preparedStatementReplacements);
+ return this;
+ }
+
+ /**
+ * Appends a SqlEnum to this part.
+ *
+ * @param toAppend the part to append, not null.
+ *
+ * @return this PreparedStatementPart (with toAppend appended).
+ */
+ public PreparedStatementPart append(SqlEnum toAppend)
+ {
+ sql.append(toAppend);
+ return this;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ HashCodeBuilder hashCodeBuilder = new HashCodeBuilder();
+ hashCodeBuilder.append(sql);
+ hashCodeBuilder.append(preparedStatementReplacements);
+ return hashCodeBuilder.toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ PreparedStatementPart other = (PreparedStatementPart) obj;
+ EqualsBuilder equalsBuilder = new EqualsBuilder();
+ equalsBuilder.append(other.sql, this.sql);
+ equalsBuilder.append(
+ other.preparedStatementReplacements,
+ this.preparedStatementReplacements);
+ return equalsBuilder.isEquals();
+ }
+
+ @Override
+ public String toString()
+ {
+ return sql + ", preparedStatementReplacements="
+ + preparedStatementReplacements;
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/PreparedStatementPart.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/package.html
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/package.html?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/package.html (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/package.html Wed Feb 20 21:06:35 2013
@@ -1,25 +1,25 @@
-<!--
- 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.
--->
-<html>
- <head>
- </head>
- <body>
- This package contains Torque's Criteria classes.
- </body>
-</html>
+<!--
+ 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.
+-->
+<html>
+ <head>
+ </head>
+ <body>
+ This package contains Torque's Criteria classes.
+ </body>
+</html>
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/package.html
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/ForeignKeyMap.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/ForeignKeyMap.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/ForeignKeyMap.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/ForeignKeyMap.java Wed Feb 20 21:06:35 2013
@@ -1,313 +1,313 @@
-package org.apache.torque.map;
-
-/*
- * 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.
- */
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * ForeignKeyMap is used to model a foreign key in a database.
- *
- * @version $Id$
- */
-public class ForeignKeyMap implements Serializable
-{
- /**
- * Serial version.
- */
- private static final long serialVersionUID = 1L;
-
- /** The table to which the foreign key belongs, not null. */
- private final TableMap table;
-
- /**
- * The table which is referenced by the foreign key, can be null if
- * the foreign table is not yet in the database map.
- */
- private TableMap foreignTable;
-
- /**
- * The name of the foreign table, in the case that the foreign table
- * map builder was not yet built when this foreign key was initialized.
- */
- private String foreignTableName;
-
- /** The column pairs for the foreign key, not null, not empty, */
- private final List<ColumnPair> columns = new ArrayList<ColumnPair>();
-
- /**
- * Constructor.
- *
- * @param table the local table, not null.
- * @param foreignTable the foreign table, not null.
- *
- * @throws NullPointerException if an argument is null.
- */
- public ForeignKeyMap(TableMap table, TableMap foreignTable)
- {
- if (table == null)
- {
- throw new NullPointerException("table is null");
- }
- if (foreignTable == null)
- {
- throw new NullPointerException("foreignTable is null");
- }
- this.table = table;
- this.foreignTable = foreignTable;
- }
-
- /**
- * Constructor.
- *
- * @param table the local table, not null.
- * @param foreignTableName the name of the foreign table, not null.
- *
- * @throws NullPointerException if an argument is null.
- */
- public ForeignKeyMap(TableMap table, String foreignTableName)
- {
- if (table == null)
- {
- throw new NullPointerException("table is null");
- }
- if (foreignTableName == null)
- {
- throw new NullPointerException("foreignTableName is null");
- }
- this.table = table;
- this.foreignTableName = foreignTableName;
- }
-
- /**
- * Adds a column pair to the foreign key.
- *
- * @param columnPair the column pair to add, not null.
- */
- public void addColumns(ColumnPair columnPair)
- {
- if (columnPair == null)
- {
- throw new NullPointerException("columnPair is null");
- }
- columns.add(columnPair);
- }
-
- /**
- * Returns the local table of the foreign key.
- *
- * @return the referencing table, not null.
- */
- public TableMap getTable()
- {
- return table;
- }
-
- /**
- * Returns the foreign table of the foreign key.
- *
- * @return the referenced table, not null.
- *
- * @throws IllegalStateException if the foreign table map builder
- * was not yet built.
- */
- public TableMap getForeignTable()
- {
- if (foreignTable == null)
- {
- foreignTable = table.getDatabaseMap().getTable(foreignTableName);
- if (foreignTable == null)
- {
- throw new IllegalStateException(
- "Map builder for "
- + foreignTableName
- + " was not yet built.");
- }
- foreignTableName = null;
- }
- return foreignTable;
- }
-
- /**
- * Returns name of the foreign table of the foreign key.
- *
- * @return the name of the referenced table, not null.
- */
- public String getForeignTableName()
- {
- if (foreignTable == null)
- {
- return foreignTableName;
- }
- return foreignTable.getName();
- }
-
- /**
- * Returns the column pairs.
- *
- * @return the column pairs, not null, as unmodifiable list.
- */
- public List<ColumnPair> getColumns()
- {
- return Collections.unmodifiableList(columns);
- }
-
- /**
- * A pair of local and Foreign column.
- * This class is immutable.
- */
- public static class ColumnPair implements Serializable
- {
- /**
- * Serial version.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * The foreign key map this ColumnPair belongs to.
- */
- private final ForeignKeyMap foreignKeyMap;
-
- /**
- * The foreign column of the pair, not null.
- */
- private final ColumnMap local;
-
- /**
- * The foreign column of the pair, can be null if the
- * foreign table was not yet in the database.
- */
- private ColumnMap foreign;
-
- /**
- * The name of foreign column of the pair,
- * or null if the foreign column is already filled.
- */
- private String foreignName;
-
- /**
- * Constructor.
- *
- * @param foreignKeyMap the foreign key map this columnPait belongs to.
- * @param local the local column, not null.
- * @param foreign the foreign column, not null.
- *
- * @throws NullPointerException if local or doreign are null.
- */
- public ColumnPair(
- ForeignKeyMap foreignKeyMap,
- ColumnMap local,
- ColumnMap foreign)
- {
- if (foreignKeyMap == null)
- {
- throw new NullPointerException("foreignKeyMap is null");
- }
- if (local == null)
- {
- throw new NullPointerException("local is null");
- }
- if (foreign == null)
- {
- throw new NullPointerException("foreign is null");
- }
- this.foreignKeyMap = foreignKeyMap;
- this.local = local;
- this.foreign = foreign;
- }
-
- /**
- * Constructor.
- *
- * @param foreignKeyMap the foreign key map this columnPait belongs to.
- * @param local the local column, not null.
- * @param foreignName the foreign column, not null.
- *
- * @throws NullPointerException if local or doreign are null.
- */
- public ColumnPair(
- ForeignKeyMap foreignKeyMap,
- ColumnMap local,
- String foreignName)
- {
- if (foreignKeyMap == null)
- {
- throw new NullPointerException("foreignKeyMap is null");
- }
- if (local == null)
- {
- throw new NullPointerException("local is null");
- }
- if (foreignName == null)
- {
- throw new NullPointerException("foreignName is null");
- }
- this.foreignKeyMap = foreignKeyMap;
- this.local = local;
- this.foreignName = foreignName;
- }
-
- /**
- * Returns the associated foreign key map.
- *
- * @return the associated foreign key map, not null.
- */
- public ForeignKeyMap getForeignKeyMap()
- {
- return foreignKeyMap;
- }
-
- /**
- * Returns the local column of the pair.
- *
- * @return the local column of the pair, not null.
- */
- public ColumnMap getLocal()
- {
- return local;
- }
-
- /**
- * Returns the foreign column of the pair.
- *
- * @return the foreign column of the pair, not null.
- *
- * @throws IllegalStateException if the foreign table map builder
- * was not yet built.
- */
- public ColumnMap getForeign()
- {
- if (foreign == null)
- {
- TableMap foreignTable = foreignKeyMap.getForeignTable();
- foreign = foreignTable.getColumn(foreignName);
- if (foreign == null)
- {
- throw new IllegalStateException(
- "Table " + foreignKeyMap.getForeignTableName()
- + " has no column named " + foreignName);
- }
- }
- return foreign;
- }
- }
-}
+package org.apache.torque.map;
+
+/*
+ * 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.
+ */
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * ForeignKeyMap is used to model a foreign key in a database.
+ *
+ * @version $Id$
+ */
+public class ForeignKeyMap implements Serializable
+{
+ /**
+ * Serial version.
+ */
+ private static final long serialVersionUID = 1L;
+
+ /** The table to which the foreign key belongs, not null. */
+ private final TableMap table;
+
+ /**
+ * The table which is referenced by the foreign key, can be null if
+ * the foreign table is not yet in the database map.
+ */
+ private TableMap foreignTable;
+
+ /**
+ * The name of the foreign table, in the case that the foreign table
+ * map builder was not yet built when this foreign key was initialized.
+ */
+ private String foreignTableName;
+
+ /** The column pairs for the foreign key, not null, not empty, */
+ private final List<ColumnPair> columns = new ArrayList<ColumnPair>();
+
+ /**
+ * Constructor.
+ *
+ * @param table the local table, not null.
+ * @param foreignTable the foreign table, not null.
+ *
+ * @throws NullPointerException if an argument is null.
+ */
+ public ForeignKeyMap(TableMap table, TableMap foreignTable)
+ {
+ if (table == null)
+ {
+ throw new NullPointerException("table is null");
+ }
+ if (foreignTable == null)
+ {
+ throw new NullPointerException("foreignTable is null");
+ }
+ this.table = table;
+ this.foreignTable = foreignTable;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param table the local table, not null.
+ * @param foreignTableName the name of the foreign table, not null.
+ *
+ * @throws NullPointerException if an argument is null.
+ */
+ public ForeignKeyMap(TableMap table, String foreignTableName)
+ {
+ if (table == null)
+ {
+ throw new NullPointerException("table is null");
+ }
+ if (foreignTableName == null)
+ {
+ throw new NullPointerException("foreignTableName is null");
+ }
+ this.table = table;
+ this.foreignTableName = foreignTableName;
+ }
+
+ /**
+ * Adds a column pair to the foreign key.
+ *
+ * @param columnPair the column pair to add, not null.
+ */
+ public void addColumns(ColumnPair columnPair)
+ {
+ if (columnPair == null)
+ {
+ throw new NullPointerException("columnPair is null");
+ }
+ columns.add(columnPair);
+ }
+
+ /**
+ * Returns the local table of the foreign key.
+ *
+ * @return the referencing table, not null.
+ */
+ public TableMap getTable()
+ {
+ return table;
+ }
+
+ /**
+ * Returns the foreign table of the foreign key.
+ *
+ * @return the referenced table, not null.
+ *
+ * @throws IllegalStateException if the foreign table map builder
+ * was not yet built.
+ */
+ public TableMap getForeignTable()
+ {
+ if (foreignTable == null)
+ {
+ foreignTable = table.getDatabaseMap().getTable(foreignTableName);
+ if (foreignTable == null)
+ {
+ throw new IllegalStateException(
+ "Map builder for "
+ + foreignTableName
+ + " was not yet built.");
+ }
+ foreignTableName = null;
+ }
+ return foreignTable;
+ }
+
+ /**
+ * Returns name of the foreign table of the foreign key.
+ *
+ * @return the name of the referenced table, not null.
+ */
+ public String getForeignTableName()
+ {
+ if (foreignTable == null)
+ {
+ return foreignTableName;
+ }
+ return foreignTable.getName();
+ }
+
+ /**
+ * Returns the column pairs.
+ *
+ * @return the column pairs, not null, as unmodifiable list.
+ */
+ public List<ColumnPair> getColumns()
+ {
+ return Collections.unmodifiableList(columns);
+ }
+
+ /**
+ * A pair of local and Foreign column.
+ * This class is immutable.
+ */
+ public static class ColumnPair implements Serializable
+ {
+ /**
+ * Serial version.
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * The foreign key map this ColumnPair belongs to.
+ */
+ private final ForeignKeyMap foreignKeyMap;
+
+ /**
+ * The foreign column of the pair, not null.
+ */
+ private final ColumnMap local;
+
+ /**
+ * The foreign column of the pair, can be null if the
+ * foreign table was not yet in the database.
+ */
+ private ColumnMap foreign;
+
+ /**
+ * The name of foreign column of the pair,
+ * or null if the foreign column is already filled.
+ */
+ private String foreignName;
+
+ /**
+ * Constructor.
+ *
+ * @param foreignKeyMap the foreign key map this columnPait belongs to.
+ * @param local the local column, not null.
+ * @param foreign the foreign column, not null.
+ *
+ * @throws NullPointerException if local or doreign are null.
+ */
+ public ColumnPair(
+ ForeignKeyMap foreignKeyMap,
+ ColumnMap local,
+ ColumnMap foreign)
+ {
+ if (foreignKeyMap == null)
+ {
+ throw new NullPointerException("foreignKeyMap is null");
+ }
+ if (local == null)
+ {
+ throw new NullPointerException("local is null");
+ }
+ if (foreign == null)
+ {
+ throw new NullPointerException("foreign is null");
+ }
+ this.foreignKeyMap = foreignKeyMap;
+ this.local = local;
+ this.foreign = foreign;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param foreignKeyMap the foreign key map this columnPait belongs to.
+ * @param local the local column, not null.
+ * @param foreignName the foreign column, not null.
+ *
+ * @throws NullPointerException if local or doreign are null.
+ */
+ public ColumnPair(
+ ForeignKeyMap foreignKeyMap,
+ ColumnMap local,
+ String foreignName)
+ {
+ if (foreignKeyMap == null)
+ {
+ throw new NullPointerException("foreignKeyMap is null");
+ }
+ if (local == null)
+ {
+ throw new NullPointerException("local is null");
+ }
+ if (foreignName == null)
+ {
+ throw new NullPointerException("foreignName is null");
+ }
+ this.foreignKeyMap = foreignKeyMap;
+ this.local = local;
+ this.foreignName = foreignName;
+ }
+
+ /**
+ * Returns the associated foreign key map.
+ *
+ * @return the associated foreign key map, not null.
+ */
+ public ForeignKeyMap getForeignKeyMap()
+ {
+ return foreignKeyMap;
+ }
+
+ /**
+ * Returns the local column of the pair.
+ *
+ * @return the local column of the pair, not null.
+ */
+ public ColumnMap getLocal()
+ {
+ return local;
+ }
+
+ /**
+ * Returns the foreign column of the pair.
+ *
+ * @return the foreign column of the pair, not null.
+ *
+ * @throws IllegalStateException if the foreign table map builder
+ * was not yet built.
+ */
+ public ColumnMap getForeign()
+ {
+ if (foreign == null)
+ {
+ TableMap foreignTable = foreignKeyMap.getForeignTable();
+ foreign = foreignTable.getColumn(foreignName);
+ if (foreign == null)
+ {
+ throw new IllegalStateException(
+ "Table " + foreignKeyMap.getForeignTableName()
+ + " has no column named " + foreignName);
+ }
+ }
+ return foreign;
+ }
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/ForeignKeyMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/InheritanceMap.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/InheritanceMap.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/InheritanceMap.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/InheritanceMap.java Wed Feb 20 21:06:35 2013
@@ -1,156 +1,156 @@
-package org.apache.torque.map;
-
-/*
- * 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.
- */
-
-import java.io.Serializable;
-
-/**
- * InheritanceMap is used to model OM inheritance classes.
- *
- * @author <a href="mailto:greg.monroe@dukece.com">Greg Monroe</a>
- * @version $Id$
- */
-public class InheritanceMap implements Serializable
-{
- /**
- * Serial version.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * The value in the related column that is associated with
- * this information.
- */
- private String key;
-
- /**
- * The name of the class which impliments this inheritance mode.
- */
- private String className;
-
- /**
- * The name of class which class name extends.
- * Retrieved via getExtends().
- */
- private String ancestor;
-
- /** The column this info is related to. */
- private ColumnMap column;
-
- /**
- * Create an inheritance map object.
- *
- * @param column The column this inheritance map belongs to.
- * @param key Key to determine which subclass applies
- * @param className package.Name of sub class to use for record.
- * @param ancestor package.Name of class that className extends.
- */
- public InheritanceMap(ColumnMap column, String key, String className,
- String ancestor)
- {
- setColumn(column);
- setKey(key);
- setClassName(className);
- setExtends(ancestor);
- }
-
- /**
- * Returns the ancestor class for the class described by this
- * InheritanceMap.
- *
- * @return the ancestor class for the class described by this
- * InheritanceMap.
- */
- public String getExtends()
- {
- return ancestor;
- }
-
- /**
- * Sets the ancestor class for the class described by this InheritanceMap.
- *
- * @param ancestor The ancestor for the class described by this
- * InheritanceMap.
- */
- public void setExtends(String ancestor)
- {
- this.ancestor = ancestor;
- }
-
- /**
- * Returns the class name for this InheritanceMap.
- *
- * @return The class name for this InheritanceMap.
- */
- public String getClassName()
- {
- return className;
- }
-
- /**
- * Sets the class name for this InheritanceMap.
- *
- * @param className The className for this InheritanceMap.
- */
- public void setClassName(String className)
- {
- this.className = className;
- }
-
- /**
- * Returns the column this inheritance map belongs to.
- *
- * @return the column this inheritance map belongs to.
- */
- public ColumnMap getColumn()
- {
- return column;
- }
-
- /**
- * Sets the column this inheritance map belongs to.
- *
- * @param column the column this inheritance map belongs to.
- */
- public void setColumn(ColumnMap column)
- {
- this.column = column;
- }
-
- /**
- * Returns the key by which this inheritanceMap is activated.
- *
- * @return The key by which this inheritanceMap is activated.
- */
- public String getKey()
- {
- return key;
- }
-
- /**
- * Sets the key by which this inheritanceMap is activated.
- *
- * @param key The key by which this inheritanceMap is activated.
- */
- public void setKey(String key)
- {
- this.key = key;
- }
-}
+package org.apache.torque.map;
+
+/*
+ * 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.
+ */
+
+import java.io.Serializable;
+
+/**
+ * InheritanceMap is used to model OM inheritance classes.
+ *
+ * @author <a href="mailto:greg.monroe@dukece.com">Greg Monroe</a>
+ * @version $Id$
+ */
+public class InheritanceMap implements Serializable
+{
+ /**
+ * Serial version.
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * The value in the related column that is associated with
+ * this information.
+ */
+ private String key;
+
+ /**
+ * The name of the class which impliments this inheritance mode.
+ */
+ private String className;
+
+ /**
+ * The name of class which class name extends.
+ * Retrieved via getExtends().
+ */
+ private String ancestor;
+
+ /** The column this info is related to. */
+ private ColumnMap column;
+
+ /**
+ * Create an inheritance map object.
+ *
+ * @param column The column this inheritance map belongs to.
+ * @param key Key to determine which subclass applies
+ * @param className package.Name of sub class to use for record.
+ * @param ancestor package.Name of class that className extends.
+ */
+ public InheritanceMap(ColumnMap column, String key, String className,
+ String ancestor)
+ {
+ setColumn(column);
+ setKey(key);
+ setClassName(className);
+ setExtends(ancestor);
+ }
+
+ /**
+ * Returns the ancestor class for the class described by this
+ * InheritanceMap.
+ *
+ * @return the ancestor class for the class described by this
+ * InheritanceMap.
+ */
+ public String getExtends()
+ {
+ return ancestor;
+ }
+
+ /**
+ * Sets the ancestor class for the class described by this InheritanceMap.
+ *
+ * @param ancestor The ancestor for the class described by this
+ * InheritanceMap.
+ */
+ public void setExtends(String ancestor)
+ {
+ this.ancestor = ancestor;
+ }
+
+ /**
+ * Returns the class name for this InheritanceMap.
+ *
+ * @return The class name for this InheritanceMap.
+ */
+ public String getClassName()
+ {
+ return className;
+ }
+
+ /**
+ * Sets the class name for this InheritanceMap.
+ *
+ * @param className The className for this InheritanceMap.
+ */
+ public void setClassName(String className)
+ {
+ this.className = className;
+ }
+
+ /**
+ * Returns the column this inheritance map belongs to.
+ *
+ * @return the column this inheritance map belongs to.
+ */
+ public ColumnMap getColumn()
+ {
+ return column;
+ }
+
+ /**
+ * Sets the column this inheritance map belongs to.
+ *
+ * @param column the column this inheritance map belongs to.
+ */
+ public void setColumn(ColumnMap column)
+ {
+ this.column = column;
+ }
+
+ /**
+ * Returns the key by which this inheritanceMap is activated.
+ *
+ * @return The key by which this inheritanceMap is activated.
+ */
+ public String getKey()
+ {
+ return key;
+ }
+
+ /**
+ * Sets the key by which this inheritanceMap is activated.
+ *
+ * @param key The key by which this inheritanceMap is activated.
+ */
+ public void setKey(String key)
+ {
+ this.key = key;
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/InheritanceMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/MapHelper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/MapHelper.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/MapHelper.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/MapHelper.java Wed Feb 20 21:06:35 2013
@@ -1,170 +1,170 @@
-package org.apache.torque.map;
-
-/*
- * 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.
- */
-
-import java.util.Map;
-
-import org.apache.torque.Column;
-import org.apache.torque.Torque;
-import org.apache.torque.TorqueException;
-import org.apache.torque.criteria.CriteriaInterface;
-
-/**
- * Utility methods for Database, Table and Column Maps.
- *
- * @version $Id$
- */
-@SuppressWarnings("deprecation")
-public final class MapHelper
-{
- /** Private constructor. */
- private MapHelper()
- {
- // empty
- }
-
- /**
- * Returns the table map for a table name.
- * As aliases and asColumns are resolved, the returned table map need not
- * contain the same table name as the column.
- *
- * @param possibleColumn the possible column to get the table map for.
- * @param criteria A criteria containing the database name and perhaps
- * aliases for the column and table name, not null.
- * @param defaultTableMap a default table map which is used if the table
- * name cannot be resolved, may be null.
- *
- * @return the table map, or null if possibleColumn does not implement
- * the column interface or if the table name cannot be resolved.
- *
- * @throws TorqueException possibly if Torque is not initialized.
- */
- public static TableMap getTableMap(
- Object possibleColumn,
- CriteriaInterface<?> criteria,
- TableMap defaultTableMap)
- throws TorqueException
- {
- if (!(possibleColumn instanceof Column))
- {
- return null;
- }
- Column column = (Column) possibleColumn;
- TableMap result = null;
- String tableName = column.getTableName();
- if (tableName == null)
- {
- // try asColumns
- Column asColumn = criteria.getAsColumns().get(
- column.getSqlExpression());
- if (asColumn != null)
- {
- tableName = asColumn.getTableName();
- }
- }
- if (tableName != null)
- {
- String databaseName = criteria.getDbName();
- DatabaseMap databaseMap = Torque.getDatabaseMap(databaseName);
- if (databaseMap != null)
- {
- result = databaseMap.getTable(tableName);
- }
- if (result != null)
- {
- return result;
- }
- // try aliases
- Map<String, ? extends Object> aliases = criteria.getAliases();
- Object aliasMappedTo = aliases.get(tableName);
- if (aliasMappedTo != null && aliasMappedTo instanceof String)
- {
- tableName = (String) aliasMappedTo;
- result = databaseMap.getTable(tableName);
- }
- }
- if (result == null)
- {
- result = defaultTableMap;
- }
- return result;
- }
-
- /**
- * Returns the column map for a column.
- * As aliases and asColumns are resolved, the returned column map need not
- * contain the same column name as the column.
- *
- * @param column the column to get the column map for.
- * @param criteria A criteria containing the database name and perhaps
- * aliases for the column and table name, not null.
- *
- * @return the column map, or null if the column name cannot be resolved.
- *
- * @throws TorqueException if Torque is not initialized and criteria's
- * databaseName is null.
- */
- public static ColumnMap getColumnMap(
- Column column,
- CriteriaInterface<?> criteria)
- throws TorqueException
- {
- String tableName = column.getTableName();
- {
- // try asColumns
- Column asColumn = criteria.getAsColumns().get(
- column.getSqlExpression());
- if (asColumn != null)
- {
- column = asColumn;
- tableName = asColumn.getTableName();
- }
- }
-
- if (tableName == null)
- {
- return null;
- }
- String databaseName = criteria.getDbName();
- DatabaseMap databaseMap = Torque.getDatabaseMap(databaseName);
- TableMap tableMap = null;
- if (databaseMap != null)
- {
- tableMap = databaseMap.getTable(tableName);
- }
- if (tableMap == null)
- {
- // try aliases
- Map<String, ? extends Object> aliases = criteria.getAliases();
- Object aliasMappedTo = aliases.get(tableName);
- if (aliasMappedTo != null && aliasMappedTo instanceof String)
- {
- tableName = (String) aliasMappedTo;
- tableMap = databaseMap.getTable(tableName);
- }
- }
- // try aliases
- if (tableMap == null)
- {
- return null;
- }
- return tableMap.getColumn(column.getColumnName());
- }
-}
+package org.apache.torque.map;
+
+/*
+ * 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.
+ */
+
+import java.util.Map;
+
+import org.apache.torque.Column;
+import org.apache.torque.Torque;
+import org.apache.torque.TorqueException;
+import org.apache.torque.criteria.CriteriaInterface;
+
+/**
+ * Utility methods for Database, Table and Column Maps.
+ *
+ * @version $Id$
+ */
+@SuppressWarnings("deprecation")
+public final class MapHelper
+{
+ /** Private constructor. */
+ private MapHelper()
+ {
+ // empty
+ }
+
+ /**
+ * Returns the table map for a table name.
+ * As aliases and asColumns are resolved, the returned table map need not
+ * contain the same table name as the column.
+ *
+ * @param possibleColumn the possible column to get the table map for.
+ * @param criteria A criteria containing the database name and perhaps
+ * aliases for the column and table name, not null.
+ * @param defaultTableMap a default table map which is used if the table
+ * name cannot be resolved, may be null.
+ *
+ * @return the table map, or null if possibleColumn does not implement
+ * the column interface or if the table name cannot be resolved.
+ *
+ * @throws TorqueException possibly if Torque is not initialized.
+ */
+ public static TableMap getTableMap(
+ Object possibleColumn,
+ CriteriaInterface<?> criteria,
+ TableMap defaultTableMap)
+ throws TorqueException
+ {
+ if (!(possibleColumn instanceof Column))
+ {
+ return null;
+ }
+ Column column = (Column) possibleColumn;
+ TableMap result = null;
+ String tableName = column.getTableName();
+ if (tableName == null)
+ {
+ // try asColumns
+ Column asColumn = criteria.getAsColumns().get(
+ column.getSqlExpression());
+ if (asColumn != null)
+ {
+ tableName = asColumn.getTableName();
+ }
+ }
+ if (tableName != null)
+ {
+ String databaseName = criteria.getDbName();
+ DatabaseMap databaseMap = Torque.getDatabaseMap(databaseName);
+ if (databaseMap != null)
+ {
+ result = databaseMap.getTable(tableName);
+ }
+ if (result != null)
+ {
+ return result;
+ }
+ // try aliases
+ Map<String, ? extends Object> aliases = criteria.getAliases();
+ Object aliasMappedTo = aliases.get(tableName);
+ if (aliasMappedTo != null && aliasMappedTo instanceof String)
+ {
+ tableName = (String) aliasMappedTo;
+ result = databaseMap.getTable(tableName);
+ }
+ }
+ if (result == null)
+ {
+ result = defaultTableMap;
+ }
+ return result;
+ }
+
+ /**
+ * Returns the column map for a column.
+ * As aliases and asColumns are resolved, the returned column map need not
+ * contain the same column name as the column.
+ *
+ * @param column the column to get the column map for.
+ * @param criteria A criteria containing the database name and perhaps
+ * aliases for the column and table name, not null.
+ *
+ * @return the column map, or null if the column name cannot be resolved.
+ *
+ * @throws TorqueException if Torque is not initialized and criteria's
+ * databaseName is null.
+ */
+ public static ColumnMap getColumnMap(
+ Column column,
+ CriteriaInterface<?> criteria)
+ throws TorqueException
+ {
+ String tableName = column.getTableName();
+ {
+ // try asColumns
+ Column asColumn = criteria.getAsColumns().get(
+ column.getSqlExpression());
+ if (asColumn != null)
+ {
+ column = asColumn;
+ tableName = asColumn.getTableName();
+ }
+ }
+
+ if (tableName == null)
+ {
+ return null;
+ }
+ String databaseName = criteria.getDbName();
+ DatabaseMap databaseMap = Torque.getDatabaseMap(databaseName);
+ TableMap tableMap = null;
+ if (databaseMap != null)
+ {
+ tableMap = databaseMap.getTable(tableName);
+ }
+ if (tableMap == null)
+ {
+ // try aliases
+ Map<String, ? extends Object> aliases = criteria.getAliases();
+ Object aliasMappedTo = aliases.get(tableName);
+ if (aliasMappedTo != null && aliasMappedTo instanceof String)
+ {
+ tableName = (String) aliasMappedTo;
+ tableMap = databaseMap.getTable(tableName);
+ }
+ }
+ // try aliases
+ if (tableMap == null)
+ {
+ return null;
+ }
+ return tableMap.getColumn(column.getColumnName());
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/MapHelper.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/AbstractIdGenerator.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/AbstractIdGenerator.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/AbstractIdGenerator.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/AbstractIdGenerator.java Wed Feb 20 21:06:35 2013
@@ -38,7 +38,7 @@ import org.apache.torque.util.BasePeerIm
* autoincrement-based id generators
*
* @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
- * @version $Id: AutoIncrementIdGenerator.java 1355228 2012-06-29 03:38:08Z tfischer $
+ * @version $Id$
*/
public abstract class AbstractIdGenerator implements IdGenerator
{
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/AbstractIdGenerator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/AbstractIdGenerator.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/BooleanKey.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/BooleanKey.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/BooleanKey.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/BooleanKey.java Wed Feb 20 21:06:35 2013
@@ -1,155 +1,155 @@
-package org.apache.torque.om;
-
-/*
- * 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.
- */
-
-import java.sql.Types;
-
-/**
- * This class can be used as an ObjectKey to uniquely identify an
- * object within an application where the id consists
- * of a Boolean.
- *
- * @author <a href="mailto:jmcnally@apache.org">John McNally</a>
- * @version $Id$
- */
-public class BooleanKey extends SimpleKey
-{
- /**
- * Serial version
- */
- private static final long serialVersionUID = 5109588772086713341L;
-
- /**
- * Creates an SimpleKey whose internal representation will be
- * set later, through a set method
- */
- public BooleanKey()
- {
- // empty
- }
-
- /**
- * Creates a BooleanKey whose internal representation is a Boolean
- *
- * @param key the key value
- */
- public BooleanKey(Boolean key)
- {
- this.key = key;
- }
-
- /**
- * Creates a BooleanKey that is equivalent to key.
- *
- * @param key the key value
- */
- public BooleanKey(BooleanKey key)
- {
- if (key != null)
- {
- this.key = key.getValue();
- }
- else
- {
- this.key = null;
- }
- }
-
- /**
- * Sets the internal representation to a String.
- *
- * @param key the key value
- */
- public void setValue(String key)
- {
- if (key == null)
- {
- this.key = null;
- }
- else
- {
- this.key = Boolean.parseBoolean(key);
- }
- }
-
- /**
- * Sets the internal representation to a Boolean.
- *
- * @param key the key value
- */
- public void setValue(Boolean key)
- {
- this.key = key;
- }
-
- /**
- * Sets the internal representation to the same object used by key.
- *
- * @param key the key value
- */
- public void setValue(BooleanKey key)
- {
- if (key != null)
- {
- this.key = key.getValue();
- }
- else
- {
- this.key = null;
- }
- }
-
- /**
- * Access the underlying Boolean object.
- *
- * @return a <code>Boolean</code> value
- */
- public Boolean getBoolean()
- {
- return (Boolean) key;
- }
-
- /**
- * Returns the JDBC type of the key
- * as defined in <code>java.sql.Types</code>.
- *
- * @return <code>Types.BIT</code>.
- */
- public int getJdbcType()
- {
- return Types.BIT;
- }
-
- /**
- * Get a String representation of this key.
- *
- * @return a String representation of this key,
- * or an empty String if the value is null.
- */
- @Override
- public String toString()
- {
- if (key != null)
- {
- return key.toString();
- }
- return "";
- }
-}
+package org.apache.torque.om;
+
+/*
+ * 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.
+ */
+
+import java.sql.Types;
+
+/**
+ * This class can be used as an ObjectKey to uniquely identify an
+ * object within an application where the id consists
+ * of a Boolean.
+ *
+ * @author <a href="mailto:jmcnally@apache.org">John McNally</a>
+ * @version $Id$
+ */
+public class BooleanKey extends SimpleKey
+{
+ /**
+ * Serial version
+ */
+ private static final long serialVersionUID = 5109588772086713341L;
+
+ /**
+ * Creates an SimpleKey whose internal representation will be
+ * set later, through a set method
+ */
+ public BooleanKey()
+ {
+ // empty
+ }
+
+ /**
+ * Creates a BooleanKey whose internal representation is a Boolean
+ *
+ * @param key the key value
+ */
+ public BooleanKey(Boolean key)
+ {
+ this.key = key;
+ }
+
+ /**
+ * Creates a BooleanKey that is equivalent to key.
+ *
+ * @param key the key value
+ */
+ public BooleanKey(BooleanKey key)
+ {
+ if (key != null)
+ {
+ this.key = key.getValue();
+ }
+ else
+ {
+ this.key = null;
+ }
+ }
+
+ /**
+ * Sets the internal representation to a String.
+ *
+ * @param key the key value
+ */
+ public void setValue(String key)
+ {
+ if (key == null)
+ {
+ this.key = null;
+ }
+ else
+ {
+ this.key = Boolean.parseBoolean(key);
+ }
+ }
+
+ /**
+ * Sets the internal representation to a Boolean.
+ *
+ * @param key the key value
+ */
+ public void setValue(Boolean key)
+ {
+ this.key = key;
+ }
+
+ /**
+ * Sets the internal representation to the same object used by key.
+ *
+ * @param key the key value
+ */
+ public void setValue(BooleanKey key)
+ {
+ if (key != null)
+ {
+ this.key = key.getValue();
+ }
+ else
+ {
+ this.key = null;
+ }
+ }
+
+ /**
+ * Access the underlying Boolean object.
+ *
+ * @return a <code>Boolean</code> value
+ */
+ public Boolean getBoolean()
+ {
+ return (Boolean) key;
+ }
+
+ /**
+ * Returns the JDBC type of the key
+ * as defined in <code>java.sql.Types</code>.
+ *
+ * @return <code>Types.BIT</code>.
+ */
+ public int getJdbcType()
+ {
+ return Types.BIT;
+ }
+
+ /**
+ * Get a String representation of this key.
+ *
+ * @return a String representation of this key,
+ * or an empty String if the value is null.
+ */
+ @Override
+ public String toString()
+ {
+ if (key != null)
+ {
+ return key.toString();
+ }
+ return "";
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/BooleanKey.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ColumnAccessByName.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ColumnAccessByName.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ColumnAccessByName.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ColumnAccessByName.java Wed Feb 20 21:06:35 2013
@@ -1,106 +1,106 @@
-package org.apache.torque.om;
-
-/*
- * 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.
- */
-
-import org.apache.torque.TorqueException;
-
-/**
- * Define accessors by name.
- *
- * @version $Id$
- */
-public interface ColumnAccessByName
-{
- /**
- * Retrieves a field from the object by name.
- *
- * @param field The name of the field to retrieve.
- *
- * @return The retrieved field value
- */
- Object getByName(String field);
-
- /**
- * Set a field in the object by field (Java) name.
- *
- * @param name field name.
- * @param value field value.
- *
- * @return True if value was set, false if not (invalid name / protected
- * field).
- *
- * @throws IllegalArgumentException if object type of value does not match
- * field object type.
- * @throws TorqueException If a problem occurs with the set[Field] method.
- */
- boolean setByName(String name, Object value)
- throws TorqueException;
-
- /**
- * Retrieves a field from the object by name passed in as a String.
- *
- * @param name field name.
- *
- * @return value of the field.
- */
- Object getByPeerName(String name);
-
- /**
- * Set field values by Peer Field Name-
- *
- * @param name field name.
- * @param value field value.
- *
- * @return True if value was set, false if not (invalid name / protected
- * field).
- *
- * @throws IllegalArgumentException if object type of value does not match
- * field object type.
- * @throws TorqueException If a problem occurs with the set[Field] method.
- */
- boolean setByPeerName(String name, Object value)
- throws TorqueException;
-
- /**
- * Retrieves a field from the object by position as specified in a database
- * schema for example.
- *
- * @param pos field position.
- *
- * @return the value of the field.
- */
- Object getByPosition(int pos);
-
- /**
- * Set field values by it's position (zero based) in the XML schema.
- *
- * @param position The field position.
- * @param value field value.
- *
- * @return True if value was set, false if not (invalid position / protected
- * field).
- *
- * @throws IllegalArgumentException if object type of value does not match
- * field object type.
- * @throws TorqueException If a problem occurs with the set[Field] method.
- */
- boolean setByPosition(int position, Object value)
- throws TorqueException;
-}
+package org.apache.torque.om;
+
+/*
+ * 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.
+ */
+
+import org.apache.torque.TorqueException;
+
+/**
+ * Define accessors by name.
+ *
+ * @version $Id$
+ */
+public interface ColumnAccessByName
+{
+ /**
+ * Retrieves a field from the object by name.
+ *
+ * @param field The name of the field to retrieve.
+ *
+ * @return The retrieved field value
+ */
+ Object getByName(String field);
+
+ /**
+ * Set a field in the object by field (Java) name.
+ *
+ * @param name field name.
+ * @param value field value.
+ *
+ * @return True if value was set, false if not (invalid name / protected
+ * field).
+ *
+ * @throws IllegalArgumentException if object type of value does not match
+ * field object type.
+ * @throws TorqueException If a problem occurs with the set[Field] method.
+ */
+ boolean setByName(String name, Object value)
+ throws TorqueException;
+
+ /**
+ * Retrieves a field from the object by name passed in as a String.
+ *
+ * @param name field name.
+ *
+ * @return value of the field.
+ */
+ Object getByPeerName(String name);
+
+ /**
+ * Set field values by Peer Field Name-
+ *
+ * @param name field name.
+ * @param value field value.
+ *
+ * @return True if value was set, false if not (invalid name / protected
+ * field).
+ *
+ * @throws IllegalArgumentException if object type of value does not match
+ * field object type.
+ * @throws TorqueException If a problem occurs with the set[Field] method.
+ */
+ boolean setByPeerName(String name, Object value)
+ throws TorqueException;
+
+ /**
+ * Retrieves a field from the object by position as specified in a database
+ * schema for example.
+ *
+ * @param pos field position.
+ *
+ * @return the value of the field.
+ */
+ Object getByPosition(int pos);
+
+ /**
+ * Set field values by it's position (zero based) in the XML schema.
+ *
+ * @param position The field position.
+ * @param value field value.
+ *
+ * @return True if value was set, false if not (invalid position / protected
+ * field).
+ *
+ * @throws IllegalArgumentException if object type of value does not match
+ * field object type.
+ * @throws TorqueException If a problem occurs with the set[Field] method.
+ */
+ boolean setByPosition(int position, Object value)
+ throws TorqueException;
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ColumnAccessByName.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/BigDecimalMapper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/BigDecimalMapper.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/BigDecimalMapper.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/BigDecimalMapper.java Wed Feb 20 21:06:35 2013
@@ -1,88 +1,88 @@
-package org.apache.torque.om.mapper;
-
-/*
- * 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.
- */
-
-import java.math.BigDecimal;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import org.apache.torque.TorqueException;
-import org.apache.torque.criteria.CriteriaInterface;
-
-/**
- * Maps a database record to a BigDecimal.
- *
- * @version $Id$
- */
-public class BigDecimalMapper implements RecordMapper<BigDecimal>
-{
- /** Serial Version UID. */
- private static final long serialVersionUID = 1L;
-
- /** The internal offset for the mapper. */
- private final int internalOffset;
-
- /**
- * Constructs a BigDecimalMapper with an offset of 0.
- */
- public BigDecimalMapper()
- {
- internalOffset = 0;
- }
-
- /**
- * Constructs a BigDecimalMapper with the given offset.
- *
- * @param offset the additional offset (0 based).
- */
- public BigDecimalMapper(int offset)
- {
- this.internalOffset = offset;
- }
-
- /**
- * Maps the current row in the result to a BigDecimal.
- *
- * @param resultSet the result set to map, not null.
- * @param rowOffset a possible offset in the columns to be considered
- * (if previous columns contain other objects), or 0 for no offset.
- * @param criteria The criteria which created the result set, or null
- * if not known. This parameter is not used by this record mapper.
- *
- * @return the BigDecimal retrieved from the result set.
- */
- public BigDecimal processRow(
- ResultSet resultSet,
- int rowOffset,
- CriteriaInterface<?> criteria)
- throws TorqueException
- {
- try
- {
- return resultSet.getBigDecimal(rowOffset + internalOffset + 1);
- }
- catch (SQLException e)
- {
- throw new TorqueException(
- "Result could not be mapped to a BigDecimal",
- e);
- }
- }
-}
+package org.apache.torque.om.mapper;
+
+/*
+ * 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.
+ */
+
+import java.math.BigDecimal;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.apache.torque.TorqueException;
+import org.apache.torque.criteria.CriteriaInterface;
+
+/**
+ * Maps a database record to a BigDecimal.
+ *
+ * @version $Id$
+ */
+public class BigDecimalMapper implements RecordMapper<BigDecimal>
+{
+ /** Serial Version UID. */
+ private static final long serialVersionUID = 1L;
+
+ /** The internal offset for the mapper. */
+ private final int internalOffset;
+
+ /**
+ * Constructs a BigDecimalMapper with an offset of 0.
+ */
+ public BigDecimalMapper()
+ {
+ internalOffset = 0;
+ }
+
+ /**
+ * Constructs a BigDecimalMapper with the given offset.
+ *
+ * @param offset the additional offset (0 based).
+ */
+ public BigDecimalMapper(int offset)
+ {
+ this.internalOffset = offset;
+ }
+
+ /**
+ * Maps the current row in the result to a BigDecimal.
+ *
+ * @param resultSet the result set to map, not null.
+ * @param rowOffset a possible offset in the columns to be considered
+ * (if previous columns contain other objects), or 0 for no offset.
+ * @param criteria The criteria which created the result set, or null
+ * if not known. This parameter is not used by this record mapper.
+ *
+ * @return the BigDecimal retrieved from the result set.
+ */
+ public BigDecimal processRow(
+ ResultSet resultSet,
+ int rowOffset,
+ CriteriaInterface<?> criteria)
+ throws TorqueException
+ {
+ try
+ {
+ return resultSet.getBigDecimal(rowOffset + internalOffset + 1);
+ }
+ catch (SQLException e)
+ {
+ throw new TorqueException(
+ "Result could not be mapped to a BigDecimal",
+ e);
+ }
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/BigDecimalMapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/CompositeMapper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/CompositeMapper.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/CompositeMapper.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/CompositeMapper.java Wed Feb 20 21:06:35 2013
@@ -1,132 +1,132 @@
-package org.apache.torque.om.mapper;
-
-/*
- * 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.
- */
-
-import java.io.Serializable;
-import java.sql.ResultSet;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.torque.TorqueException;
-import org.apache.torque.criteria.CriteriaInterface;
-
-/**
- * Uses a list of mappers to map a database record to a list of objects.
- *
- * @version $Id$
- */
-public class CompositeMapper implements RecordMapper<List<Object>>
-{
- /** Serial Version UID. */
- private static final long serialVersionUID = 1L;
-
- /**
- * All mappers which should be appliead to a result set, combined with
- * their individual offset.
- */
- private final List<MapperWithOffset> mapperList
- = new ArrayList<MapperWithOffset>();
-
- /**
- * Adds a new mapper to be applied to a result set.
- *
- * @param mapper the mapper.
- * @param offset the offset of the mapper within this mapper, 0 based.
- */
- public void addMapper(RecordMapper<?> mapper, int offset)
- {
- mapperList.add(new MapperWithOffset(mapper, offset));
- }
-
- /**
- * Maps the current row in the result Set by applying all known mappers
- * and putting the result of each mapper in the result list.
- *
- * @param resultSet the result set to map, not null.
- * @param offset the total column offset of this mapper
- * within the result set.
- * @param criteria The criteria which created the result set, or null
- * if not known. This parameter is not used by this record mapper.
- *
- * @return a list of mapped objects in the same order as the mappers
- * were ordered, not null.
- */
- public List<Object> processRow(
- ResultSet resultSet,
- int offset,
- CriteriaInterface<?> criteria)
- throws TorqueException
- {
- List<Object> result = new ArrayList<Object>(mapperList.size());
- for (MapperWithOffset mapperWithOffset : mapperList)
- {
- int totalOffset = offset + mapperWithOffset.getOffset();
- RecordMapper<?> mapper = mapperWithOffset.getMapper();
- result.add(mapper.processRow(resultSet, totalOffset, criteria));
- }
- return result;
- }
-
- /** Contains a row mapper plus the internal offset of the mapper. */
- private static class MapperWithOffset implements Serializable
- {
- /** Serial Version UID. */
- private static final long serialVersionUID = 1L;
-
- /** The row mapper. */
- private final RecordMapper<?> mapper;
-
- /** The offset. */
- private final int offset;
-
- /**
- * Constructor.
- *
- * @param mapper the mapper, not null.
- * @param offset the internal offset of the mapper.
- */
- public MapperWithOffset(RecordMapper<?> mapper, int offset)
- {
- this.mapper = mapper;
- this.offset = offset;
- }
-
- /**
- * Returns the mapper.
- *
- * @return the mapper.
- */
- public RecordMapper<?> getMapper()
- {
- return mapper;
- }
-
- /**
- * Returns the offset.
- *
- * @return the offset.
- */
- public int getOffset()
- {
- return offset;
- }
- }
-}
-
+package org.apache.torque.om.mapper;
+
+/*
+ * 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.
+ */
+
+import java.io.Serializable;
+import java.sql.ResultSet;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.torque.TorqueException;
+import org.apache.torque.criteria.CriteriaInterface;
+
+/**
+ * Uses a list of mappers to map a database record to a list of objects.
+ *
+ * @version $Id$
+ */
+public class CompositeMapper implements RecordMapper<List<Object>>
+{
+ /** Serial Version UID. */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * All mappers which should be appliead to a result set, combined with
+ * their individual offset.
+ */
+ private final List<MapperWithOffset> mapperList
+ = new ArrayList<MapperWithOffset>();
+
+ /**
+ * Adds a new mapper to be applied to a result set.
+ *
+ * @param mapper the mapper.
+ * @param offset the offset of the mapper within this mapper, 0 based.
+ */
+ public void addMapper(RecordMapper<?> mapper, int offset)
+ {
+ mapperList.add(new MapperWithOffset(mapper, offset));
+ }
+
+ /**
+ * Maps the current row in the result Set by applying all known mappers
+ * and putting the result of each mapper in the result list.
+ *
+ * @param resultSet the result set to map, not null.
+ * @param offset the total column offset of this mapper
+ * within the result set.
+ * @param criteria The criteria which created the result set, or null
+ * if not known. This parameter is not used by this record mapper.
+ *
+ * @return a list of mapped objects in the same order as the mappers
+ * were ordered, not null.
+ */
+ public List<Object> processRow(
+ ResultSet resultSet,
+ int offset,
+ CriteriaInterface<?> criteria)
+ throws TorqueException
+ {
+ List<Object> result = new ArrayList<Object>(mapperList.size());
+ for (MapperWithOffset mapperWithOffset : mapperList)
+ {
+ int totalOffset = offset + mapperWithOffset.getOffset();
+ RecordMapper<?> mapper = mapperWithOffset.getMapper();
+ result.add(mapper.processRow(resultSet, totalOffset, criteria));
+ }
+ return result;
+ }
+
+ /** Contains a row mapper plus the internal offset of the mapper. */
+ private static class MapperWithOffset implements Serializable
+ {
+ /** Serial Version UID. */
+ private static final long serialVersionUID = 1L;
+
+ /** The row mapper. */
+ private final RecordMapper<?> mapper;
+
+ /** The offset. */
+ private final int offset;
+
+ /**
+ * Constructor.
+ *
+ * @param mapper the mapper, not null.
+ * @param offset the internal offset of the mapper.
+ */
+ public MapperWithOffset(RecordMapper<?> mapper, int offset)
+ {
+ this.mapper = mapper;
+ this.offset = offset;
+ }
+
+ /**
+ * Returns the mapper.
+ *
+ * @return the mapper.
+ */
+ public RecordMapper<?> getMapper()
+ {
+ return mapper;
+ }
+
+ /**
+ * Returns the offset.
+ *
+ * @return the offset.
+ */
+ public int getOffset()
+ {
+ return offset;
+ }
+ }
+}
+
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/CompositeMapper.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org