org.synchronoss.cpo.jdbc
Class JdbcCpoAdapter

java.lang.Object
  extended by org.synchronoss.cpo.cache.CpoAdapterCache
      extended by org.synchronoss.cpo.CpoBaseAdapter<DataSource>
          extended by org.synchronoss.cpo.jdbc.JdbcCpoAdapter
All Implemented Interfaces:
Serializable, CpoAdapter
Direct Known Subclasses:
JdbcCpoTrxAdapter

public class JdbcCpoAdapter
extends CpoBaseAdapter<DataSource>

JdbcCpoAdapter is an interface for a set of routines that are responsible for managing value objects from a datasource.

Author:
david berry
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.synchronoss.cpo.CpoBaseAdapter
CpoBaseAdapter.RetrieverThread<T,C>
 
Field Summary
 
Fields inherited from interface org.synchronoss.cpo.CpoAdapter
CREATE, CREATE_GROUP, DELETE, DELETE_GROUP, EXECUTE, EXECUTE_GROUP, EXIST, EXIST_GROUP, GROUP_IDS, INSERT, LIST, LIST_GROUP, PERSIST, PERSIST_GROUP, RETRIEVE, RETRIEVE_GROUP, UPDATE, UPDATE_GROUP
 
Constructor Summary
protected JdbcCpoAdapter()
           
protected JdbcCpoAdapter(JdbcCpoMetaDescriptor metaDescriptor, boolean batchSupported, String dataSourceName)
          This constructor is used specifically to create a JdbcCpoTrxAdapter.
protected JdbcCpoAdapter(JdbcCpoMetaDescriptor metaDescriptor, DataSourceInfo<DataSource> jdsiTrx)
          Creates a JdbcCpoAdapter.
protected JdbcCpoAdapter(JdbcCpoMetaDescriptor metaDescriptor, DataSourceInfo<DataSource> jdsiWrite, DataSourceInfo<DataSource> jdsiRead)
          Creates a JdbcCpoAdapter.
 
Method Summary
protected  void clearConnectionBusy(Connection c)
           
protected  void closeConnection(Connection connection)
          DOCUMENT ME!
protected  void commitConnection(Connection connection)
          DOCUMENT ME!
<T> long
deleteObject(String name, T obj)
          Removes the Object from the datasource.
<T> long
deleteObject(String name, T obj, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions)
          Removes the Object from the datasource.
<T> long
deleteObject(T obj)
          Removes the Object from the datasource.
<T> long
deleteObjects(Collection<T> coll)
          Removes the Objects contained in the collection from the datasource.
<T> long
deleteObjects(String name, Collection<T> coll)
          Removes the Objects contained in the collection from the datasource.
<T> long
deleteObjects(String name, Collection<T> coll, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions)
          Removes the Objects contained in the collection from the datasource.
<T,C> T
executeObject(String name, C criteria, T result)
          Executes an Object that represents an executable object within the datasource.
<T> T
executeObject(String name, T object)
          Executes an Object whose metadata will call an executable within the datasource.
<T> T
executeObject(T object)
          Executes an Object whose metadata will call an executable within the datasource.
<T> long
existsObject(String name, T obj)
          The CpoAdapter will check to see if this object exists in the datasource.
<T> long
existsObject(String name, T obj, Collection<CpoWhere> wheres)
          The CpoAdapter will check to see if this object exists in the datasource.
protected
<T> long
existsObject(String name, T obj, Connection con, Collection<CpoWhere> wheres)
          The CpoAdapter will check to see if this object exists in the datasource.
<T> long
existsObject(T obj)
          The CpoAdapter will check to see if this object exists in the datasource.
protected  Context getContext()
          DOCUMENT ME!
 List<CpoAttribute> getCpoAttributes(String expression)
           
 CpoMetaDescriptor getCpoMetaDescriptor()
           
 CpoTrxAdapter getCpoTrxAdapter()
          Provides a mechanism for the user to obtain a CpoTrxAdapter object.
protected
<T> String
getGroupType(T obj, String type, String name, Connection c)
          DOCUMENT ME!
static JdbcCpoAdapter getInstance(JdbcCpoMetaDescriptor metaDescriptor, DataSourceInfo jdsiTrx)
           
static JdbcCpoAdapter getInstance(JdbcCpoMetaDescriptor metaDescriptor, DataSourceInfo jdsiWrite, DataSourceInfo jdsiRead)
          Creates a JdbcCpoAdapter.
protected  Connection getReadConnection()
          DOCUMENT ME!
protected  Connection getStaticConnection()
           
protected  Connection getWriteConnection()
          DOCUMENT ME!
<T> long
insertObject(String name, T obj)
          Creates the Object in the datasource.
<T> long
insertObject(String name, T obj, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions)
          Creates the Object in the datasource.
<T> long
insertObject(T obj)
          Creates the Object in the datasource.
<T> long
insertObjects(Collection<T> coll)
          Iterates through a collection of Objects, creates and stores them in the datasource.
<T> long
insertObjects(String name, Collection<T> coll)
          Iterates through a collection of Objects, creates and stores them in the datasource.
<T> long
insertObjects(String name, Collection<T> coll, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions)
          Iterates through a collection of Objects, creates and stores them in the datasource.
protected  boolean isConnectionBusy(Connection c)
           
protected  boolean isStaticConnection(Connection c)
           
 CpoOrderBy newOrderBy(String attribute, boolean ascending)
          newOrderBy allows you to dynamically change the order of the objects in the resulting collection.
 CpoOrderBy newOrderBy(String attribute, boolean ascending, String function)
          newOrderBy allows you to dynamically change the order of the objects in the resulting collection.
 CpoOrderBy newOrderBy(String marker, String attribute, boolean ascending)
          newOrderBy allows you to dynamically change the order of the objects in the resulting collection.
 CpoOrderBy newOrderBy(String marker, String attribute, boolean ascending, String function)
          newOrderBy allows you to dynamically change the order of the objects in the resulting collection.
 CpoWhere newWhere()
          DOCUMENT ME!
<T> CpoWhere
newWhere(int logical, String attr, int comp, T value)
          DOCUMENT ME!
<T> CpoWhere
newWhere(int logical, String attr, int comp, T value, boolean not)
          DOCUMENT ME!
<T> long
persistObject(String name, T obj)
          Persists the Object into the datasource.
<T> long
persistObject(T obj)
          Persists the Object into the datasource.
<T> long
persistObjects(Collection<T> coll)
          Persists a collection of Objects into the datasource.
<T> long
persistObjects(String name, Collection<T> coll)
          Persists a collection of Objects into the datasource.
protected
<T> long
processBatchUpdateGroup(T[] arr, String groupType, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions, Connection con)
          DOCUMENT ME!
protected
<T,C> T
processExecuteGroup(String name, C criteria, T result)
          Executes an Object whose MetaData contains a stored procedure.
protected
<T,C> T
processExecuteGroup(String name, C criteria, T result, Connection conn)
          DOCUMENT ME!
protected
<T,C> List<T>
processSelectGroup(String name, C criteria, T result, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions, boolean useRetrieve)
          DOCUMENT ME!
protected
<T,C> void
processSelectGroup(String name, C criteria, T result, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions, boolean useRetrieve, CpoResultSet<T> resultSet)
           
protected
<T,C> void
processSelectGroup(String name, C criteria, T result, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions, Connection con, boolean useRetrieve, CpoResultSet<T> resultSet)
          DOCUMENT ME!
protected
<T> T
processSelectGroup(T obj, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions)
          Retrieves the Object from the datasource.
protected
<T> T
processSelectGroup(T obj, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions, Connection con)
          DOCUMENT ME!
protected
<T> long
processUpdateGroup(Collection<T> coll, String groupType, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions)
          DOCUMENT ME!
protected
<T> long
processUpdateGroup(Collection<T> coll, String groupType, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions, Connection con)
          DOCUMENT ME!
protected
<T> long
processUpdateGroup(T obj, String groupType, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions)
          DOCUMENT ME!
protected
<T> long
processUpdateGroup(T obj, String groupType, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions, Connection con)
          DOCUMENT ME!
<T,C> T
retrieveBean(String name, C criteria, T result, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy)
          Retrieves the bean from the datasource.
<T,C> T
retrieveBean(String name, C criteria, T result, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions)
          Retrieves the bean from the datasource.
<T> T
retrieveBean(String name, T bean)
          Retrieves the bean from the datasource.
<T> T
retrieveBean(String name, T bean, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions)
          Retrieves the bean from the datasource.
<T> T
retrieveBean(T bean)
          Retrieves the bean from the datasource.
<C> List<C>
retrieveBeans(String name, C criteria)
          Retrieves the bean from the datasource.
<C> List<C>
retrieveBeans(String name, C criteria, Collection<CpoOrderBy> orderBy)
          Retrieves the bean from the datasource.
<C> List<C>
retrieveBeans(String name, C criteria, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy)
          Retrieves the bean from the datasource.
<C> List<C>
retrieveBeans(String name, C criteria, CpoWhere where, Collection<CpoOrderBy> orderBy)
          Retrieves the bean from the datasource.
<T,C> List<T>
retrieveBeans(String name, C criteria, T result)
          Retrieves the bean from the datasource.
<T,C> List<T>
retrieveBeans(String name, C criteria, T result, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy)
          Retrieves the bean from the datasource.
<T,C> List<T>
retrieveBeans(String name, C criteria, T result, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions)
          Retrieves the bean from the datasource.
<T,C> CpoResultSet<T>
retrieveBeans(String name, C criteria, T result, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions, int queueSize)
          Retrieves the bean from the datasource.
<T,C> List<T>
retrieveBeans(String name, C criteria, T result, CpoWhere where, Collection<CpoOrderBy> orderBy)
          Retrieves the bean from the datasource.
protected  void rollbackConnection(Connection connection)
          DOCUMENT ME!
protected  void setConnectionBusy(Connection c)
           
protected  void setContext(Context context)
          DOCUMENT ME!
protected  void setStaticConnection(Connection c)
           
<T> long
updateObject(String name, T obj)
          Update the Object in the datasource.
<T> long
updateObject(String name, T obj, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions)
          Update the Object in the datasource.
<T> long
updateObject(T obj)
          Update the Object in the datasource.
<T> long
updateObjects(Collection<T> coll)
          Updates a collection of Objects in the datasource.
<T> long
updateObjects(String name, Collection<T> coll)
          Updates a collection of Objects in the datasource.
<T> long
updateObjects(String name, Collection<T> coll, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions)
          Updates a collection of Objects in the datasource.
 
Methods inherited from class org.synchronoss.cpo.CpoBaseAdapter
getDataSourceName, getReadDataSource, getWriteDataSource, setDataSourceName, setReadDataSource, setWriteDataSource
 
Methods inherited from class org.synchronoss.cpo.cache.CpoAdapterCache
addCpoAdapter, findCpoAdapter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcCpoAdapter

protected JdbcCpoAdapter()

JdbcCpoAdapter

protected JdbcCpoAdapter(JdbcCpoMetaDescriptor metaDescriptor,
                         DataSourceInfo<DataSource> jdsiTrx)
                  throws CpoException
Creates a JdbcCpoAdapter.

Parameters:
metaDescriptor - This datasource that identifies the cpo metadata datasource
jdsiTrx - The datasoruce that identifies the transaction database.
Throws:
CpoException - exception

JdbcCpoAdapter

protected JdbcCpoAdapter(JdbcCpoMetaDescriptor metaDescriptor,
                         DataSourceInfo<DataSource> jdsiWrite,
                         DataSourceInfo<DataSource> jdsiRead)
                  throws CpoException
Creates a JdbcCpoAdapter.

Parameters:
metaDescriptor - This datasource that identifies the cpo metadata datasource
jdsiWrite - The datasource that identifies the transaction database for write transactions.
jdsiRead - The datasource that identifies the transaction database for read-only transactions.
Throws:
CpoException - exception

JdbcCpoAdapter

protected JdbcCpoAdapter(JdbcCpoMetaDescriptor metaDescriptor,
                         boolean batchSupported,
                         String dataSourceName)
                  throws CpoException
This constructor is used specifically to create a JdbcCpoTrxAdapter.

Parameters:
metaDescriptor -
batchSupported -
dataSourceName -
Throws:
CpoException
Method Detail

getInstance

public static JdbcCpoAdapter getInstance(JdbcCpoMetaDescriptor metaDescriptor,
                                         DataSourceInfo jdsiTrx)
                                  throws CpoException
Throws:
CpoException

getInstance

public static JdbcCpoAdapter getInstance(JdbcCpoMetaDescriptor metaDescriptor,
                                         DataSourceInfo jdsiWrite,
                                         DataSourceInfo jdsiRead)
                                  throws CpoException
Creates a JdbcCpoAdapter.

Parameters:
metaDescriptor - This datasource that identifies the cpo metadata datasource
jdsiWrite - The datasource that identifies the transaction database for write transactions.
jdsiRead - The datasource that identifies the transaction database for read-only transactions.
Throws:
CpoException - exception

insertObject

public <T> long insertObject(T obj)
                  throws CpoException
Creates the Object in the datasource. The assumption is that the object does not exist in the datasource. This method creates and stores the object in the datasource.

Example:
 
 

class SomeObject so = new SomeObject(); class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.insertObject(so); } catch (CpoException ce) { // Handle the error

} }

Parameters:
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects created in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

insertObject

public <T> long insertObject(String name,
                             T obj)
                  throws CpoException
Creates the Object in the datasource. The assumption is that the object does not exist in the datasource. This method creates and stores the object in the datasource

Example:
 
 

class SomeObject so = new SomeObject(); class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.insertObject("IDNameInsert",so); } catch (CpoException ce) { // Handle the error } }

Parameters:
name - The String name of the CREATE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used which is equivalent to insertObject(Object obj);
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects created in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

insertObject

public <T> long insertObject(String name,
                             T obj,
                             Collection<CpoWhere> wheres,
                             Collection<CpoOrderBy> orderBy,
                             Collection<CpoNativeFunction> nativeExpressions)
                  throws CpoException
Creates the Object in the datasource. The assumption is that the object does not exist in the datasource. This method creates and stores the object in the datasource

Example:
 
 

class SomeObject so = new SomeObject(); class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.insertObject("IDNameInsert",so); } catch (CpoException ce) { // Handle the error } }

Parameters:
name - The String name of the CREATE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used which is equivalent to insertObject(Object obj);
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
wheres - A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
nativeExpressions - Native expression that will be used to augment the expression stored in the meta data. This text will be embedded at run-time
Returns:
The number of objects created in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

insertObjects

public <T> long insertObjects(Collection<T> coll)
                   throws CpoException
Iterates through a collection of Objects, creates and stores them in the datasource. The assumption is that the objects contained in the collection do not exist in the datasource.

This method creates and stores the objects in the datasource. The objects in the collection will be treated as one transaction, assuming the datasource supports transactions.

This means that if one of the objects fail being created in the datasource then the CpoAdapter will stop processing the remainder of the collection and rollback all the objects created thus far. Rollback is on the underlying datasource's support of rollback.

Example:
 
 

class SomeObject so = null; class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { ArrayList al = new ArrayList(); for (int i=0; i<3; i++){ so = new SomeObject(); so.setId(1); so.setName("SomeName"); al.add(so); } try{ cpo.insertObjects(al); } catch (CpoException ce) { // Handle the error } }

Parameters:
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects created in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

insertObjects

public <T> long insertObjects(String name,
                              Collection<T> coll)
                   throws CpoException
Iterates through a collection of Objects, creates and stores them in the datasource. The assumption is that the objects contained in the collection do not exist in the datasource.

This method creates and stores the objects in the datasource. The objects in the collection will be treated as one transaction, assuming the datasource supports transactions.

This means that if one of the objects fail being created in the datasource then the CpoAdapter should stop processing the remainder of the collection, and if supported, rollback all the objects created thus far.

Example:
 
 

class SomeObject so = null; class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; } if (cpo!=null) { ArrayList al = new ArrayList(); for (int i=0; i<3; i++){ so = new SomeObject(); so.setId(1); so.setName("SomeName"); al.add(so); } try{ cpo.insertObjects("IdNameInsert",al); } catch (CpoException ce) { // Handle the error } }

Parameters:
name - The String name of the CREATE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used.
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects created in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

insertObjects

public <T> long insertObjects(String name,
                              Collection<T> coll,
                              Collection<CpoWhere> wheres,
                              Collection<CpoOrderBy> orderBy,
                              Collection<CpoNativeFunction> nativeExpressions)
                   throws CpoException
Iterates through a collection of Objects, creates and stores them in the datasource. The assumption is that the objects contained in the collection do not exist in the datasource.

This method creates and stores the objects in the datasource. The objects in the collection will be treated as one transaction, assuming the datasource supports transactions.

This means that if one of the objects fail being created in the datasource then the CpoAdapter should stop processing the remainder of the collection, and if supported, rollback all the objects created thus far.

Example:
 
 

class SomeObject so = null; class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; } if (cpo!=null) { ArrayList al = new ArrayList(); for (int i=0; i<3; i++){ so = new SomeObject(); so.setId(1); so.setName("SomeName"); al.add(so); } try{ cpo.insertObjects("IdNameInsert",al); } catch (CpoException ce) { // Handle the error } }

Parameters:
name - The String name of the CREATE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used.
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
wheres - A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
nativeExpressions - Native expression that will be used to augment the expression stored in the meta data. This text will be embedded at run-time
Returns:
The number of objects created in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

deleteObject

public <T> long deleteObject(T obj)
                  throws CpoException
Removes the Object from the datasource. The assumption is that the object exists in the datasource. This method stores the object in the datasource

Example:
 
 

class SomeObject so = new SomeObject(); class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.deleteObject(so); } catch (CpoException ce) { // Handle the error } }

Parameters:
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource an exception will be thrown.
Returns:
The number of objects deleted from the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

deleteObject

public <T> long deleteObject(String name,
                             T obj)
                  throws CpoException
Removes the Object from the datasource. The assumption is that the object exists in the datasource. This method stores the object in the datasource

Example:
 
 

class SomeObject so = new SomeObject(); class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.deleteObject("DeleteById",so); } catch (CpoException ce) { // Handle the error } }

Parameters:
name - The String name of the DELETE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used.
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource an exception will be thrown.
Returns:
The number of objects deleted from the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

deleteObject

public <T> long deleteObject(String name,
                             T obj,
                             Collection<CpoWhere> wheres,
                             Collection<CpoOrderBy> orderBy,
                             Collection<CpoNativeFunction> nativeExpressions)
                  throws CpoException
Removes the Object from the datasource. The assumption is that the object exists in the datasource. This method stores the object in the datasource

Example:
 
 

class SomeObject so = new SomeObject(); class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.deleteObject("DeleteById",so); } catch (CpoException ce) { // Handle the error } }

Parameters:
name - The String name of the DELETE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used.
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource an exception will be thrown.
wheres - A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
nativeExpressions - Native expression that will be used to augment the expression stored in the meta data. This text will be embedded at run-time
Returns:
The number of objects deleted from the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

deleteObjects

public <T> long deleteObjects(Collection<T> coll)
                   throws CpoException
Removes the Objects contained in the collection from the datasource. The assumption is that the object exists in the datasource. This method stores the objects contained in the collection in the datasource. The objects in the collection will be treated as one transaction, assuming the datasource supports transactions.

This means that if one of the objects fail being deleted in the datasource then the CpoAdapter should stop processing the remainder of the collection, and if supported, rollback all the objects deleted thus far.

Example:
 
 

class SomeObject so = null; class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { ArrayList al = new ArrayList(); for (int i=0; i<3; i++){ so = new SomeObject(); so.setId(1); so.setName("SomeName"); al.add(so); } try{ cpo.deleteObjects(al); } catch (CpoException ce) { // Handle the error } }

Parameters:
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects deleted from the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

deleteObjects

public <T> long deleteObjects(String name,
                              Collection<T> coll)
                   throws CpoException
Removes the Objects contained in the collection from the datasource. The assumption is that the object exists in the datasource. This method stores the objects contained in the collection in the datasource. The objects in the collection will be treated as one transaction, assuming the datasource supports transactions.

This means that if one of the objects fail being deleted in the datasource then the CpoAdapter should stop processing the remainder of the collection, and if supported, rollback all the objects deleted thus far.

Example:
 
 

class SomeObject so = null; class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { ArrayList al = new ArrayList(); for (int i=0; i<3; i++){ so = new SomeObject(); so.setId(1); so.setName("SomeName"); al.add(so); }

try{ cpo.deleteObjects("IdNameDelete",al); } catch (CpoException ce) { // Handle the error } }

Parameters:
name - The String name of the DELETE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used.
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects deleted from the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

deleteObjects

public <T> long deleteObjects(String name,
                              Collection<T> coll,
                              Collection<CpoWhere> wheres,
                              Collection<CpoOrderBy> orderBy,
                              Collection<CpoNativeFunction> nativeExpressions)
                   throws CpoException
Removes the Objects contained in the collection from the datasource. The assumption is that the object exists in the datasource. This method stores the objects contained in the collection in the datasource. The objects in the collection will be treated as one transaction, assuming the datasource supports transactions.

This means that if one of the objects fail being deleted in the datasource then the CpoAdapter should stop processing the remainder of the collection, and if supported, rollback all the objects deleted thus far.

Example:
 
 

class SomeObject so = null; class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { ArrayList al = new ArrayList(); for (int i=0; i<3; i++){ so = new SomeObject(); so.setId(1); so.setName("SomeName"); al.add(so); }

try{ cpo.deleteObjects("IdNameDelete",al); } catch (CpoException ce) { // Handle the error } }

Parameters:
name - The String name of the DELETE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used.
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
wheres - A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
nativeExpressions - Native expression that will be used to augment the expression stored in the meta data. This text will be embedded at run-time
Returns:
The number of objects deleted from the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

executeObject

public <T> T executeObject(T object)
                throws CpoException
Executes an Object whose metadata will call an executable within the datasource. It is assumed that the executable object exists in the metadatasource. If the executable does not exist, an exception will be thrown.

Example:
 
 

class SomeObject so = new SomeObject(); class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.executeObject(so); } catch (CpoException ce) { // Handle the error } }

Parameters:
object - This is an Object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to populate the IN arguments used to executed the datasource object.

An object of this type will be created and filled with the returned data from the value_object. This newly created object will be returned from this method.

Returns:
An object populated with the OUT arguments returned from the executable object
Throws:
CpoException - Thrown if there are errors accessing the datasource

executeObject

public <T> T executeObject(String name,
                           T object)
                throws CpoException
Executes an Object whose metadata will call an executable within the datasource. It is assumed that the executable object exists in the metadatasource. If the executable does not exist, an exception will be thrown.

Example:
 
 

class SomeObject so = new SomeObject(); class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.executeObject("execNotifyProc",so); } catch (CpoException ce) { // Handle the error } }

Parameters:
name - The filter name which tells the datasource which objects should be returned. The name also signifies what data in the object will be populated.
object - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to populate the IN arguments used to retrieve the collection of objects. This object defines the object type that will be returned in the collection and contain the result set data or the OUT Parameters.
Returns:
A result object populate with the OUT arguments
Throws:
CpoException - if there are errors accessing the datasource

executeObject

public <T,C> T executeObject(String name,
                             C criteria,
                             T result)
                throws CpoException
Executes an Object that represents an executable object within the datasource. It is assumed that the object exists in the datasource. If the object does not exist, an exception will be thrown

Example:
 
 

class SomeObject so = new SomeObject(); class SomeResult sr = new SomeResult(); class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ sr = (SomeResult)cpo.executeObject("execNotifyProc",so, sr); } catch (CpoException ce) { // Handle the error } }

Parameters:
name - The String name of the EXECUTE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used.
criteria - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to populate the IN arguments used to retrieve the collection of objects.
result - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object defines the object type that will be created, filled with the return data and returned from this method.
Returns:
An object populated with the out arguments
Throws:
CpoException - Thrown if there are errors accessing the datasource

existsObject

public <T> long existsObject(T obj)
                  throws CpoException
The CpoAdapter will check to see if this object exists in the datasource.

Example:
 
 

class SomeObject so = new SomeObject(); long count = 0; class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ count = cpo.existsObject(so); if (count>0) { // object exists } else { // object does not exist } } catch (CpoException ce) { // Handle the error } }

Parameters:
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. This object will be searched for inside the datasource.
Returns:
The number of objects that exist in the datasource that match the specified object
Throws:
CpoException - Thrown if there are errors accessing the datasource

existsObject

public <T> long existsObject(String name,
                             T obj)
                  throws CpoException
The CpoAdapter will check to see if this object exists in the datasource.

Example:
 
 

class SomeObject so = new SomeObject(); long count = 0; class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ count = cpo.existsObject("SomeExistCheck",so); if (count>0) { // object exists } else { // object does not exist } } catch (CpoException ce) { // Handle the error } }

Parameters:
name - The String name of the EXISTS Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used.
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. This object will be searched for inside the datasource.
Returns:
The number of objects that exist in the datasource that match the specified object
Throws:
CpoException - Thrown if there are errors accessing the datasource

existsObject

public <T> long existsObject(String name,
                             T obj,
                             Collection<CpoWhere> wheres)
                  throws CpoException
The CpoAdapter will check to see if this object exists in the datasource.

Example:
 
 

class SomeObject so = new SomeObject(); long count = 0; class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ CpoWhere where = cpo.newCpoWhere(CpoWhere.LOGIC_NONE, id, CpoWhere.COMP_EQ); count = cpo.existsObject("SomeExistCheck",so, where); if (count>0) { // object exists } else { // object does not exist } } catch (CpoException ce) { // Handle the error } }

Parameters:
name - The String name of the EXISTS Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used.
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. This object will be searched for inside the datasource.
wheres - A CpoWhere object that passes in run-time constraints to the function that performs the the exist
Returns:
The number of objects that exist in the datasource that match the specified object
Throws:
CpoException - Thrown if there are errors accessing the datasource

existsObject

protected <T> long existsObject(String name,
                                T obj,
                                Connection con,
                                Collection<CpoWhere> wheres)
                     throws CpoException
The CpoAdapter will check to see if this object exists in the datasource.

Parameters:
name - The name which identifies which EXISTS, INSERT, and UPDATE Function Groups to execute to persist the object.
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
con - The datasource Connection with which to check if the object exists
Returns:
The int value of the first column returned in the record set
Throws:
CpoException - exception will be thrown if the Function Group has a function count != 1

newOrderBy

public CpoOrderBy newOrderBy(String attribute,
                             boolean ascending)
                      throws CpoException
newOrderBy allows you to dynamically change the order of the objects in the resulting collection. This allows you to apply user input in determining the order of the collection

Parameters:
attribute - The name of the attribute from the pojo that will be sorted.
ascending - If true, sort ascending. If false sort descending.
Returns:
A CpoOrderBy object to be passed into retrieveBeans.
Throws:
CpoException - Thrown if there are errors accessing the datasource

newOrderBy

public CpoOrderBy newOrderBy(String marker,
                             String attribute,
                             boolean ascending)
                      throws CpoException
newOrderBy allows you to dynamically change the order of the objects in the resulting collection. This allows you to apply user input in determining the order of the collection

Parameters:
marker - the marker that will be replaced in the expression with the string representation of this orderBy
attribute - The name of the attribute from the pojo that will be sorted.
ascending - If true, sort ascending. If false sort descending.
Returns:
A CpoOrderBy object to be passed into retrieveBeans.
Throws:
CpoException - Thrown if there are errors accessing the datasource

newOrderBy

public CpoOrderBy newOrderBy(String attribute,
                             boolean ascending,
                             String function)
                      throws CpoException
newOrderBy allows you to dynamically change the order of the objects in the resulting collection. This allows you to apply user input in determining the order of the collection

Parameters:
attribute - The name of the attribute from the pojo that will be sorted.
ascending - If true, sort ascending. If false sort descending.
function - A string which represents a datasource function that will be called on the attribute. must be contained in the function string. The attribute name will be replaced at run-time with its datasource counterpart
Returns:
A CpoOrderBy object to be passed into retrieveBeans.
Throws:
CpoException - Thrown if there are errors accessing the datasource

newOrderBy

public CpoOrderBy newOrderBy(String marker,
                             String attribute,
                             boolean ascending,
                             String function)
                      throws CpoException
newOrderBy allows you to dynamically change the order of the objects in the resulting collection. This allows you to apply user input in determining the order of the collection

Parameters:
marker - the marker that will be replaced in the expression with the string representation of this orderBy
attribute - The name of the attribute from the pojo that will be sorted.
ascending - If true, sort ascending. If false sort descending.
function - A string which represents a datasource function that will be called on the attribute. must be contained in the function string. The attribute name will be replaced at run-time with its datasource counterpart
Returns:
A CpoOrderBy object to be passed into retrieveBeans.
Throws:
CpoException - Thrown if there are errors accessing the datasource

newWhere

public CpoWhere newWhere()
                  throws CpoException
DOCUMENT ME!

Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

newWhere

public <T> CpoWhere newWhere(int logical,
                             String attr,
                             int comp,
                             T value)
                  throws CpoException
DOCUMENT ME!

Parameters:
logical - DOCUMENT ME!
attr - DOCUMENT ME!
comp - DOCUMENT ME!
value - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

newWhere

public <T> CpoWhere newWhere(int logical,
                             String attr,
                             int comp,
                             T value,
                             boolean not)
                  throws CpoException
DOCUMENT ME!

Parameters:
logical - DOCUMENT ME!
attr - DOCUMENT ME!
comp - DOCUMENT ME!
value - DOCUMENT ME!
not - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

persistObject

public <T> long persistObject(T obj)
                   throws CpoException
Persists the Object into the datasource. The CpoAdapter will check to see if this object exists in the datasource. If it exists, the object is updated in the datasource If the object does not exist, then it is created in the datasource. This method stores the object in the datasource. This method uses the default EXISTS, CREATE, and UPDATE Function Groups specified for this object.

Example:
 
 

class SomeObject so = new SomeObject(); class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.persistObject(so); } catch (CpoException ce) { // Handle the error } }

Parameters:
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
A count of the number of objects persisted
Throws:
CpoException - Thrown if there are errors accessing the datasource
See Also:
existsObject(T), insertObject(T), updateObject(T)

persistObject

public <T> long persistObject(String name,
                              T obj)
                   throws CpoException
Persists the Object into the datasource. The CpoAdapter will check to see if this object exists in the datasource. If it exists, the object is updated in the datasource If the object does not exist, then it is created in the datasource. This method stores the object in the datasource.

Example:
 
 

class SomeObject so = new SomeObject(); class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.persistObject("persistSomeObject",so); } catch (CpoException ce) { // Handle the error } }

Parameters:
name - The name which identifies which EXISTS, INSERT, and UPDATE Function Groups to execute to persist the object.
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
A count of the number of objects persisted
Throws:
CpoException - Thrown if there are errors accessing the datasource
See Also:
existsObject(T), insertObject(T), updateObject(T)

persistObjects

public <T> long persistObjects(Collection<T> coll)
                    throws CpoException
Persists a collection of Objects into the datasource. The CpoAdapter will check to see if this object exists in the datasource. If it exists, the object is updated in the datasource If the object does not exist, then it is created in the datasource. This method stores the object in the datasource. The objects in the collection will be treated as one transaction, meaning that if one of the objects fail being inserted or updated in the datasource then the entire collection will be rolled back.

Example:
 
 

class SomeObject so = null; class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { ArrayList al = new ArrayList(); for (int i=0; i<3; i++){ so = new SomeObject(); so.setId(1); so.setName("SomeName"); al.add(so); } try{ cpo.persistObjects(al); } catch (CpoException ce) { // Handle the error } }

Parameters:
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
DOCUMENT ME!
Throws:
CpoException - Thrown if there are errors accessing the datasource
See Also:
existsObject(T), insertObject(T), updateObject(T)

persistObjects

public <T> long persistObjects(String name,
                               Collection<T> coll)
                    throws CpoException
Persists a collection of Objects into the datasource. The CpoAdapter will check to see if this object exists in the datasource. If it exists, the object is updated in the datasource If the object does not exist, then it is created in the datasource. This method stores the object in the datasource. The objects in the collection will be treated as one transaction, meaning that if one of the objects fail being inserted or updated in the datasource then the entire collection will be rolled back.

Example:
 
 

class SomeObject so = null; class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { ArrayList al = new ArrayList(); for (int i=0; i<3; i++){ so = new SomeObject(); so.setId(1); so.setName("SomeName"); al.add(so); } try{ cpo.persistObjects("myPersist",al); } catch (CpoException ce) { // Handle the error } }

Parameters:
name - The name which identifies which EXISTS, INSERT, and UPDATE Function Groups to execute to persist the object.
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
DOCUMENT ME!
Throws:
CpoException - Thrown if there are errors accessing the datasource
See Also:
existsObject(T), insertObject(T), updateObject(T)

retrieveBean

public <T> T retrieveBean(T bean)
               throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource. If the retrieve function defined for this beans returns more than one row, an exception will be thrown.

Parameters:
bean - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. The input bean is used to specify the search criteria, the output bean is populated with the results of the function.
Returns:
An bean of the same type as the result argument that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBean

public <T> T retrieveBean(String name,
                          T bean)
               throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource. If the retrieve function defined for this beans returns more than one row, an exception will be thrown.

Parameters:
name - DOCUMENT ME!
bean - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. The input bean is used to specify the search criteria, the output bean is populated with the results of the function.
Returns:
An bean of the same type as the result argument that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBean

public <T> T retrieveBean(String name,
                          T bean,
                          Collection<CpoWhere> wheres,
                          Collection<CpoOrderBy> orderBy,
                          Collection<CpoNativeFunction> nativeExpressions)
               throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource. If the retrieve function defined for this beans returns more than one row, an exception will be thrown.

Parameters:
name - DOCUMENT ME!
bean - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. The input bean is used to specify the search criteria, the output bean is populated with the results of the function.
wheres - A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
nativeExpressions - Native expression that will be used to augment the expression stored in the meta data. This text will be embedded at run-time
Returns:
An bean of the same type as the result argument that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBean

public <T,C> T retrieveBean(String name,
                            C criteria,
                            T result,
                            Collection<CpoWhere> wheres,
                            Collection<CpoOrderBy> orderBy)
               throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource. If the retrieve function defined for this beans returns more than one row, an exception will be thrown.

Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the arguments used to retrieve the collection of beans.
result - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the bean type that will be returned in the collection.
wheres - A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
Returns:
An bean of the same type as the result argument that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBean

public <T,C> T retrieveBean(String name,
                            C criteria,
                            T result,
                            Collection<CpoWhere> wheres,
                            Collection<CpoOrderBy> orderBy,
                            Collection<CpoNativeFunction> nativeExpressions)
               throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource. If the retrieve function defined for this beans returns more than one row, an exception will be thrown.

Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the arguments used to retrieve the collection of beans.
result - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the bean type that will be returned in the collection.
wheres - A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
nativeExpressions - Native expression that will be used to augment the expression stored in the meta data. This text will be embedded at run-time
Returns:
An bean of the same type as the result argument that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

public <C> List<C> retrieveBeans(String name,
                                 C criteria)
                      throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource.

Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the arguments used to retrieve the collection of beans.
Returns:
A collection of beans will be returned that meet the criteria specified by obj. The beans will be of the same type as the bean that was passed in. If no beans match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

public <C> List<C> retrieveBeans(String name,
                                 C criteria,
                                 CpoWhere where,
                                 Collection<CpoOrderBy> orderBy)
                      throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource.

Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the arguments used to retrieve the collection of beans.
where - A CpoWhere bean that defines the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
Returns:
A collection of beans will be returned that meet the criteria specified by obj. The beans will be of the same type as the bean that was passed in. If no beans match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

public <C> List<C> retrieveBeans(String name,
                                 C criteria,
                                 Collection<CpoWhere> wheres,
                                 Collection<CpoOrderBy> orderBy)
                      throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource.

Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the arguments used to retrieve the collection of beans.
wheres - A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
Returns:
A collection of beans will be returned that meet the criteria specified by obj. The beans will be of the same type as the bean that was passed in. If no beans match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

public <C> List<C> retrieveBeans(String name,
                                 C criteria,
                                 Collection<CpoOrderBy> orderBy)
                      throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource.

Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the arguments used to retrieve the collection of beans.
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
Returns:
A collection of beans will be returned that meet the criteria specified by obj. The beans will be of the same type as the bean that was passed in. If no beans match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

public <T,C> List<T> retrieveBeans(String name,
                                   C criteria,
                                   T result)
                      throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource.

Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the arguments used to retrieve the collection of beans.
result - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the bean type that will be returned in the collection.
Returns:
A collection of beans will be returned that meet the criteria specified by obj. The beans will be of the same type as the bean that was passed in. If no beans match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

public <T,C> List<T> retrieveBeans(String name,
                                   C criteria,
                                   T result,
                                   CpoWhere where,
                                   Collection<CpoOrderBy> orderBy)
                      throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource.

Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the arguments used to retrieve the collection of beans.
result - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the bean type that will be returned in the collection.
where - A CpoWhere bean that defines the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
Returns:
A collection of beans will be returned that meet the criteria specified by obj. The beans will be of the same type as the bean that was passed in. If no beans match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

public <T,C> List<T> retrieveBeans(String name,
                                   C criteria,
                                   T result,
                                   Collection<CpoWhere> wheres,
                                   Collection<CpoOrderBy> orderBy)
                      throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource.

Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the arguments used to retrieve the collection of beans.
result - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the bean type that will be returned in the collection.
wheres - A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
Returns:
A collection of beans will be returned that meet the criteria specified by obj. The beans will be of the same type as the bean that was passed in. If no beans match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

public <T,C> List<T> retrieveBeans(String name,
                                   C criteria,
                                   T result,
                                   Collection<CpoWhere> wheres,
                                   Collection<CpoOrderBy> orderBy,
                                   Collection<CpoNativeFunction> nativeExpressions)
                      throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource.

Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the arguments used to retrieve the collection of beans.
result - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the bean type that will be returned in the collection.
wheres - A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
nativeExpressions - Native expression that will be used to augment the expression stored in the meta data. This text will be embedded at run-time
Returns:
A collection of beans will be returned that meet the criteria specified by obj. The beans will be of the same type as the bean that was passed in. If no beans match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

public <T,C> CpoResultSet<T> retrieveBeans(String name,
                                           C criteria,
                                           T result,
                                           Collection<CpoWhere> wheres,
                                           Collection<CpoOrderBy> orderBy,
                                           Collection<CpoNativeFunction> nativeExpressions,
                                           int queueSize)
                              throws CpoException
Retrieves the bean from the datasource. This method returns an Iterator immediately. The iterator will get filled asynchronously by the cpo framework. The framework will stop supplying the iterator with beans if the beanBufferSize is reached.

If the consumer of the iterator is processing records faster than the framework is filling it, then the iterator will wait until it has data to provide.

Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the arguments used to retrieve the collection of beans.
result - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the bean type that will be returned in the collection.
wheres - A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
nativeExpressions - Native expression that will be used to augment the expression stored in the meta data. This text will be embedded at run-time
queueSize - the maximum number of beans that the Iterator is allowed to cache. Once reached, the CPO framework will halt processing records from the datasource.
Returns:
An iterator that will be fed beans from the CPO framework.
Throws:
CpoException - Thrown if there are errors accessing the datasource

updateObject

public <T> long updateObject(T obj)
                  throws CpoException
Update the Object in the datasource. The CpoAdapter will check to see if the object exists in the datasource. If it exists then the object will be updated. If it does not exist, an exception will be thrown

Example:
 
 

class SomeObject so = new SomeObject(); class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.updateObject(so); } catch (CpoException ce) { // Handle the error } }

Parameters:
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects updated in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

updateObject

public <T> long updateObject(String name,
                             T obj)
                  throws CpoException
Update the Object in the datasource. The CpoAdapter will check to see if the object exists in the datasource. If it exists then the object will be updated. If it does not exist, an exception will be thrown

Example:
 
 

class SomeObject so = new SomeObject(); class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.updateObject("updateSomeObject",so); } catch (CpoException ce) { // Handle the error } }

Parameters:
name - The String name of the UPDATE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used.
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects updated in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

updateObject

public <T> long updateObject(String name,
                             T obj,
                             Collection<CpoWhere> wheres,
                             Collection<CpoOrderBy> orderBy,
                             Collection<CpoNativeFunction> nativeExpressions)
                  throws CpoException
Update the Object in the datasource. The CpoAdapter will check to see if the object exists in the datasource. If it exists then the object will be updated. If it does not exist, an exception will be thrown

Example:
 
 

class SomeObject so = new SomeObject(); class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.updateObject("updateSomeObject",so); } catch (CpoException ce) { // Handle the error } }

Parameters:
name - The String name of the UPDATE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used.
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
wheres - A collection of CpoWhere objects to be used by the function
orderBy - A collection of CpoOrderBy objects to be used by the function
nativeExpressions - A collection of CpoNativeFunction objects to be used by the function
Returns:
The number of objects updated in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

updateObjects

public <T> long updateObjects(Collection<T> coll)
                   throws CpoException
Updates a collection of Objects in the datasource. The assumption is that the objects contained in the collection exist in the datasource. This method stores the object in the datasource. The objects in the collection will be treated as one transaction, meaning that if one of the objects fail being updated in the datasource then the entire collection will be rolled back, if supported by the datasource.

Example:
 
 

class SomeObject so = null; class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { ArrayList al = new ArrayList(); for (int i=0; i<3; i++){ so = new SomeObject(); so.setId(1); so.setName("SomeName"); al.add(so); } try{ cpo.updateObjects(al); } catch (CpoException ce) { // Handle the error } }

Parameters:
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects updated in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

updateObjects

public <T> long updateObjects(String name,
                              Collection<T> coll)
                   throws CpoException
Updates a collection of Objects in the datasource. The assumption is that the objects contained in the collection exist in the datasource. This method stores the object in the datasource. The objects in the collection will be treated as one transaction, meaning that if one of the objects fail being updated in the datasource then the entire collection will be rolled back, if supported by the datasource.

Example:
 
 

class SomeObject so = null; class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { ArrayList al = new ArrayList(); for (int i=0; i<3; i++){ so = new SomeObject(); so.setId(1); so.setName("SomeName"); al.add(so); } try{ cpo.updateObjects("myUpdate",al); } catch (CpoException ce) { // Handle the error } }

Parameters:
name - The String name of the UPDATE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used.
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects updated in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

updateObjects

public <T> long updateObjects(String name,
                              Collection<T> coll,
                              Collection<CpoWhere> wheres,
                              Collection<CpoOrderBy> orderBy,
                              Collection<CpoNativeFunction> nativeExpressions)
                   throws CpoException
Updates a collection of Objects in the datasource. The assumption is that the objects contained in the collection exist in the datasource. This method stores the object in the datasource. The objects in the collection will be treated as one transaction, meaning that if one of the objects fail being updated in the datasource then the entire collection will be rolled back, if supported by the datasource.

Example:
 
 

class SomeObject so = null; class CpoAdapter cpo = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { ArrayList al = new ArrayList(); for (int i=0; i<3; i++){ so = new SomeObject(); so.setId(1); so.setName("SomeName"); al.add(so); } try{ cpo.updateObjects("myUpdate",al); } catch (CpoException ce) { // Handle the error } }

Parameters:
name - The String name of the UPDATE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used.
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
wheres - A collection of CpoWhere objects to be used by the function
orderBy - A collection of CpoOrderBy objects to be used by the function
nativeExpressions - A collection of CpoNativeFunction objects to be used by the function
Returns:
The number of objects updated in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

setContext

protected void setContext(Context context)
                   throws CpoException
DOCUMENT ME!

Parameters:
context - DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

getContext

protected Context getContext()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getGroupType

protected <T> String getGroupType(T obj,
                                  String type,
                                  String name,
                                  Connection c)
                       throws CpoException
DOCUMENT ME!

Parameters:
obj - DOCUMENT ME!
type - DOCUMENT ME!
name - DOCUMENT ME!
c - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

getReadConnection

protected Connection getReadConnection()
                                throws CpoException
DOCUMENT ME!

Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

getWriteConnection

protected Connection getWriteConnection()
                                 throws CpoException
DOCUMENT ME!

Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

getStaticConnection

protected Connection getStaticConnection()
                                  throws CpoException
Throws:
CpoException

isStaticConnection

protected boolean isStaticConnection(Connection c)

setStaticConnection

protected void setStaticConnection(Connection c)

closeConnection

protected void closeConnection(Connection connection)
DOCUMENT ME!

Parameters:
connection - DOCUMENT ME!

commitConnection

protected void commitConnection(Connection connection)
DOCUMENT ME!

Parameters:
connection - DOCUMENT ME!

rollbackConnection

protected void rollbackConnection(Connection connection)
DOCUMENT ME!

Parameters:
connection - DOCUMENT ME!

processExecuteGroup

protected <T,C> T processExecuteGroup(String name,
                                      C criteria,
                                      T result)
                         throws CpoException
Executes an Object whose MetaData contains a stored procedure. An assumption is that the object exists in the datasource.

Parameters:
name - The filter name which tells the datasource which objects should be returned. The name also signifies what data in the object will be populated.
criteria - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to populate the IN arguments used to retrieve the collection of objects.
result - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object defines the object type that will be returned in the
Returns:
A result object populate with the OUT arguments
Throws:
CpoException - DOCUMENT ME!

processExecuteGroup

protected <T,C> T processExecuteGroup(String name,
                                      C criteria,
                                      T result,
                                      Connection conn)
                         throws CpoException
DOCUMENT ME!

Parameters:
name - DOCUMENT ME!
criteria - DOCUMENT ME!
result - DOCUMENT ME!
conn - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

processSelectGroup

protected <T> T processSelectGroup(T obj,
                                   String groupName,
                                   Collection<CpoWhere> wheres,
                                   Collection<CpoOrderBy> orderBy,
                                   Collection<CpoNativeFunction> nativeExpressions)
                        throws CpoException
Retrieves the Object from the datasource.

Parameters:
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. The input object is used to specify the search criteria.
groupName - The name which identifies which RETRIEVE Function Group to execute to retrieve the object.
wheres - A collection of CpoWhere objects to be used by the function
orderBy - A collection of CpoOrderBy objects to be used by the function
nativeExpressions - A collection of CpoNativeFunction objects to be used by the function
Returns:
A populated object of the same type as the Object passed in as a argument. If no objects match the criteria a NULL will be returned.
Throws:
CpoException - the retrieve function defined for this objects returns more than one row, an exception will be thrown.

processSelectGroup

protected <T> T processSelectGroup(T obj,
                                   String groupName,
                                   Collection<CpoWhere> wheres,
                                   Collection<CpoOrderBy> orderBy,
                                   Collection<CpoNativeFunction> nativeExpressions,
                                   Connection con)
                        throws CpoException
DOCUMENT ME!

Parameters:
obj - DOCUMENT ME!
groupName - DOCUMENT ME!
con - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

processSelectGroup

protected <T,C> List<T> processSelectGroup(String name,
                                           C criteria,
                                           T result,
                                           Collection<CpoWhere> wheres,
                                           Collection<CpoOrderBy> orderBy,
                                           Collection<CpoNativeFunction> nativeExpressions,
                                           boolean useRetrieve)
                              throws CpoException
DOCUMENT ME!

Parameters:
name - DOCUMENT ME!
criteria - DOCUMENT ME!
result - DOCUMENT ME!
wheres - DOCUMENT ME!
orderBy - DOCUMENT ME!
useRetrieve - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

processSelectGroup

protected <T,C> void processSelectGroup(String name,
                                        C criteria,
                                        T result,
                                        Collection<CpoWhere> wheres,
                                        Collection<CpoOrderBy> orderBy,
                                        Collection<CpoNativeFunction> nativeExpressions,
                                        boolean useRetrieve,
                                        CpoResultSet<T> resultSet)
                           throws CpoException
Specified by:
processSelectGroup in class CpoBaseAdapter<DataSource>
Throws:
CpoException

processSelectGroup

protected <T,C> void processSelectGroup(String name,
                                        C criteria,
                                        T result,
                                        Collection<CpoWhere> wheres,
                                        Collection<CpoOrderBy> orderBy,
                                        Collection<CpoNativeFunction> nativeExpressions,
                                        Connection con,
                                        boolean useRetrieve,
                                        CpoResultSet<T> resultSet)
                           throws CpoException
DOCUMENT ME!

Parameters:
name - DOCUMENT ME!
criteria - DOCUMENT ME!
result - DOCUMENT ME!
wheres - DOCUMENT ME!
orderBy - DOCUMENT ME!
con - DOCUMENT ME!
useRetrieve - DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

processUpdateGroup

protected <T> long processUpdateGroup(T obj,
                                      String groupType,
                                      String groupName,
                                      Collection<CpoWhere> wheres,
                                      Collection<CpoOrderBy> orderBy,
                                      Collection<CpoNativeFunction> nativeExpressions)
                           throws CpoException
DOCUMENT ME!

Parameters:
obj - DOCUMENT ME!
groupType - DOCUMENT ME!
groupName - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

processUpdateGroup

protected <T> long processUpdateGroup(T obj,
                                      String groupType,
                                      String groupName,
                                      Collection<CpoWhere> wheres,
                                      Collection<CpoOrderBy> orderBy,
                                      Collection<CpoNativeFunction> nativeExpressions,
                                      Connection con)
                           throws CpoException
DOCUMENT ME!

Parameters:
obj - DOCUMENT ME!
groupType - DOCUMENT ME!
groupName - DOCUMENT ME!
con - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

processBatchUpdateGroup

protected <T> long processBatchUpdateGroup(T[] arr,
                                           String groupType,
                                           String groupName,
                                           Collection<CpoWhere> wheres,
                                           Collection<CpoOrderBy> orderBy,
                                           Collection<CpoNativeFunction> nativeExpressions,
                                           Connection con)
                                throws CpoException
DOCUMENT ME!

Parameters:
arr - DOCUMENT ME!
groupType - DOCUMENT ME!
groupName - DOCUMENT ME!
con - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

processUpdateGroup

protected <T> long processUpdateGroup(Collection<T> coll,
                                      String groupType,
                                      String groupName,
                                      Collection<CpoWhere> wheres,
                                      Collection<CpoOrderBy> orderBy,
                                      Collection<CpoNativeFunction> nativeExpressions)
                           throws CpoException
DOCUMENT ME!

Parameters:
coll - DOCUMENT ME!
groupType - DOCUMENT ME!
groupName - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

processUpdateGroup

protected <T> long processUpdateGroup(Collection<T> coll,
                                      String groupType,
                                      String groupName,
                                      Collection<CpoWhere> wheres,
                                      Collection<CpoOrderBy> orderBy,
                                      Collection<CpoNativeFunction> nativeExpressions,
                                      Connection con)
                           throws CpoException
DOCUMENT ME!

Parameters:
coll - DOCUMENT ME!
groupType - DOCUMENT ME!
groupName - DOCUMENT ME!
wheres - DOCUMENT ME!
orderBy - DOCUMENT ME!
nativeExpressions - DOCUMENT ME!
con - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

getCpoTrxAdapter

public CpoTrxAdapter getCpoTrxAdapter()
                               throws CpoException
Provides a mechanism for the user to obtain a CpoTrxAdapter object. This object allows the to control when commits and rollbacks occur on CPO.

Example:
 
 

class SomeObject so = null; class CpoAdapter cpo = null; class CpoTrxAdapter cpoTrx = null;

try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); cpoTrx = cpo.getCpoTrxAdapter(); } catch (CpoException ce) { // Handle the error cpo = null; }

if (cpo!=null) { try{ for (int i=0; i<3; i++){ so = new SomeObject(); so.setId(1); so.setName("SomeName"); cpo.updateObject("myUpdate",so); } cpoTrx.commit(); } catch (CpoException ce) { // Handle the error cpoTrx.rollback(); } }

Returns:
A CpoTrxAdapter to manage the transactionality of CPO
Throws:
CpoException - Thrown if there are errors accessing the datasource
See Also:
CpoTrxAdapter

isConnectionBusy

protected boolean isConnectionBusy(Connection c)

setConnectionBusy

protected void setConnectionBusy(Connection c)

clearConnectionBusy

protected void clearConnectionBusy(Connection c)

getCpoMetaDescriptor

public CpoMetaDescriptor getCpoMetaDescriptor()

getCpoAttributes

public List<CpoAttribute> getCpoAttributes(String expression)
                                    throws CpoException
Throws:
CpoException


Copyright © 2014. All Rights Reserved.