org.synchronoss.cpo
Interface CpoAdapter

Package class diagram package CpoAdapter
All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
CpoTrxAdapter
All Known Implementing Classes:
CpoAdapterBean, JdbcCpoAdapter, JdbcCpoTrxAdapter

public interface CpoAdapter
extends java.io.Serializable

CpoAdapter is an interface for a set of routines that are responsible for Creating, Retrieving, Updating, and Deleting (CRUD) value objects within a datasource. CpoAdapter is an interface that acts as a common facade for different datasources. It is conceivable that an CpoAdapter can be implemented for JDBC, CSV, XML, LDAP, and more datasources producing classes such as JdbcCpoAdapter, CsvCpoAdapter, XmlCpoAdapter, LdapCpoAdapter, etc.

Author:
david berry

Field Summary
static int CREATE
          Static integer to be used with the CpoObject.
static int DELETE
          Static integer to be used with the CpoObject.
static int EXECUTE
          Static integer to be used with the CpoObject.
static int EXIST
          Static integer to be used with the CpoObject.
static int INSERT
          Static integer to be used with the CpoObject.
static int LIST
          Static integer to be used with the CpoObject.
static int PERSIST
          Static integer to be used with the CpoObject.
static int RETRIEVE
          Static integer to be used with the CpoObject.
static int UPDATE
          Static integer to be used with the CpoObject.
 
Method Summary
 void clearMetaClass()
          Clears the metadata for all classes for the current datasource.
 void clearMetaClass(boolean all)
          Clears the metadata for all classes.
 void clearMetaClass(java.lang.Object obj)
          Clears the metadata for the specified object.
 void clearMetaClass(java.lang.String className)
          Clears the metadata for the specified fully qualifed class name.
<T> long
deleteObject(java.lang.String name, T obj)
          Removes the Object from the datasource.
<T> long
deleteObject(T obj)
          Removes the Object from the datasource.
<T> long
deleteObjects(java.util.Collection<T> coll)
          Removes the Objects contained in the collection from the datasource.
<T> long
deleteObjects(java.lang.String name, java.util.Collection<T> coll)
          Removes the Objects contained in the collection from the datasource.
<T,C> T
executeObject(java.lang.String name, C criteria, T result)
          Executes an Object that represents an executable object within the datasource.
<T> T
executeObject(java.lang.String name, T object)
          Executes an Object whose metadata will call an executable within the datasource.
<T> T
executeObject(T obj)
          Executes an Object whose metadata will call an executable within the datasource.
<T> long
existsObject(java.lang.String name, T obj)
          The CpoAdapter will check to see if this object exists in the datasource.
<T> long
existsObject(java.lang.String name, T obj, java.util.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.
 CpoTrxAdapter getCpoTrxAdapter()
          Provides a mechanism for the user to obtain a CpoTrxAdapter object.
<T> long
insertObject(java.lang.String name, T obj)
          Creates the Object in the datasource.
<T> long
insertObject(T obj)
          Creates the Object in the datasource.
<T> long
insertObjects(java.util.Collection<T> coll)
          Iterates through a collection of Objects, creates and stores them in the datasource.
<T> long
insertObjects(java.lang.String name, java.util.Collection<T> coll)
          Iterates through a collection of Objects, creates and stores them in the datasource.
 CpoOrderBy newOrderBy(java.lang.String attribute, boolean ascending)
          newOrderBy allows you to dynamically change the order of the objects in the resulting collection.
 CpoOrderBy newOrderBy(java.lang.String attribute, boolean ascending, java.lang.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, java.lang.String attr, int comp, T value)
          DOCUMENT ME!
<T> CpoWhere
newWhere(int logical, java.lang.String attr, int comp, T value, boolean not)
          DOCUMENT ME!
<T> long
persistObject(java.lang.String name, T obj)
          Persists the Object into the datasource.
<T> long
persistObject(T obj)
          Persists the Object into the datasource.
<T> long
persistObjects(java.util.Collection<T> coll)
          Persists a collection of Objects into the datasource.
<T> long
persistObjects(java.lang.String name, java.util.Collection<T> coll)
          Persists a collection of Objects into the datasource.
<T,C> T
retrieveBean(java.lang.String name, C criteria, T result, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy)
          Retrieves the bean from the datasource.
<T,C> T
retrieveBean(java.lang.String name, C criteria, T result, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy, java.util.Collection<CpoNativeQuery> nativeQueries)
          Retrieves the bean from the datasource.
<T> T
retrieveBean(java.lang.String name, T bean)
          Retrieves the bean from the datasource.
<T> T
retrieveBean(T bean)
          Retrieves the Bean from the datasource.
<C> java.util.List<C>
retrieveBeans(java.lang.String name, C criteria)
          Retrieves the bean from the datasource.
<C> java.util.List<C>
retrieveBeans(java.lang.String name, C criteria, java.util.Collection<CpoOrderBy> orderBy)
          Retrieves the bean from the datasource.
<C> java.util.List<C>
retrieveBeans(java.lang.String name, C criteria, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy)
          Retrieves the bean from the datasource.
<C> java.util.List<C>
retrieveBeans(java.lang.String name, C criteria, CpoWhere where, java.util.Collection<CpoOrderBy> orderBy)
          Retrieves the bean from the datasource.
<T,C> java.util.List<T>
retrieveBeans(java.lang.String name, C criteria, T result)
          Retrieves the bean from the datasource.
<T,C> java.util.List<T>
retrieveBeans(java.lang.String name, C criteria, T result, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy)
          Retrieves the bean from the datasource.
<T,C> java.util.List<T>
retrieveBeans(java.lang.String name, C criteria, T result, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy, java.util.Collection<CpoNativeQuery> nativeQueries)
          Retrieves the bean from the datasource.
<T,C> CpoResultSet<T>
retrieveBeans(java.lang.String name, C criteria, T result, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy, java.util.Collection<CpoNativeQuery> nativeQueries, int queueSize)
          Retrieves the bean from the datasource.
<T,C> java.util.List<T>
retrieveBeans(java.lang.String name, C criteria, T result, CpoWhere where, java.util.Collection<CpoOrderBy> orderBy)
          Retrieves the bean from the datasource.
<T,C> T
retrieveObject(java.lang.String name, C criteria, T result, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy)
          Deprecated. use retrieveBean
<T,C> T
retrieveObject(java.lang.String name, C criteria, T result, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy, java.util.Collection<CpoNativeQuery> nativeQueries)
          Deprecated. use retrieveBean
<T> T
retrieveObject(java.lang.String name, T obj)
          Deprecated. use retrieveBean
<T> T
retrieveObject(T obj)
          Deprecated. use retrieveBean
<T,C> java.util.Collection<T>
retrieveObjects(java.lang.String name, C criteria, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy, java.util.Collection<CpoNativeQuery> nativeQueries, T result)
          Deprecated. use retrieveBeans
<T,C> CpoResultSet<T>
retrieveObjects(java.lang.String name, C criteria, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy, java.util.Collection<CpoNativeQuery> nativeQueries, T result, int queueSize)
          Deprecated. use retrieveBeans
<T,C> java.util.Collection<T>
retrieveObjects(java.lang.String name, C criteria, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy, T result)
          Deprecated. use retrieveBean
<T> long
transactObjects(java.util.Collection<CpoObject<T>> coll)
          Deprecated.  
<T> long
updateObject(java.lang.String name, T obj)
          Update the Object in the datasource.
<T> long
updateObject(T obj)
          Update the Object in the datasource.
<T> long
updateObjects(java.util.Collection<T> coll)
          Updates a collection of Objects in the datasource.
<T> long
updateObjects(java.lang.String name, java.util.Collection<T> coll)
          Updates a collection of Objects in the datasource.
 

Field Detail

CREATE

static final int CREATE
Static integer to be used with the CpoObject. It identifies the operation to be processed by the CpoObject. CREATE signifies that the CpoObject will try to add the object to the datasource.

See Also:
CpoObject, Constant Field Values

INSERT

static final int INSERT
Static integer to be used with the CpoObject. It identifies the operation to be processed by the CpoObject. INSERT signifies that the CpoObject will try to add the object to the datasource.

See Also:
CpoObject, Constant Field Values

UPDATE

static final int UPDATE
Static integer to be used with the CpoObject. It identifies the operation to be processed by the CpoObject. UPDATE signifies that the CpoObject will try to update the object in the datasource.

See Also:
CpoObject, Constant Field Values

DELETE

static final int DELETE
Static integer to be used with the CpoObject. It identifies the operation to be processed by the CpoObject. DELETE signifies that the CpoObject will try to delete the object in the datasource.

See Also:
CpoObject, Constant Field Values

RETRIEVE

static final int RETRIEVE
Static integer to be used with the CpoObject. It identifies the operation to be processed by the CpoObject. RETRIEVE signifies that the CpoObject will try to retrieve a single object from the datasource.

See Also:
CpoObject, Constant Field Values

LIST

static final int LIST
Static integer to be used with the CpoObject. It identifies the operation to be processed by the CpoObject. LIST signifies that the CpoObject will try to retrieve one or more objects from the datasource.

See Also:
CpoObject, Constant Field Values

PERSIST

static final int PERSIST
Static integer to be used with the CpoObject. It identifies the operation to be processed by the CpoObject. PERSIST signifies that the CpoObject will try to add or update the object in the datasource.

See Also:
CpoObject, Constant Field Values

EXIST

static final int EXIST
Static integer to be used with the CpoObject. It identifies the operation to be processed by the CpoObject. EXIST signifies that the CpoObject will check to see if the object exists in the datasource.

See Also:
CpoObject, Constant Field Values

EXECUTE

static final int EXECUTE
Static integer to be used with the CpoObject. It identifies the operation to be processed by the CpoObject. EXECUTE signifies that the CpoObject will try to execute a function or procedure in the datasource.

See Also:
CpoObject, Constant Field Values
Method Detail

clearMetaClass

void clearMetaClass(java.lang.Object obj)
                    throws CpoException
Clears the metadata for the specified object. The metadata will be reloaded the next time that CPO is called to access this object

Parameters:
obj - The object whose metadata must be cleared
Throws:
CpoException - Thrown if there are errors accessing the datasource

clearMetaClass

void clearMetaClass(java.lang.String className)
                    throws CpoException
Clears the metadata for the specified fully qualifed class name. The metadata will be reloaded the next time CPO is called to access this class.

Parameters:
className - The fully qualified class name for the class that needs its metadata cleared.
Throws:
CpoException - Thrown if there are errors accessing the datasource

clearMetaClass

void clearMetaClass(boolean all)
                    throws CpoException
Clears the metadata for all classes. The metadata will be lazy-loaded from the metadata repository as classes are accessed.

Parameters:
all - true - clear all classes for all datasources. false - clear all classes for the current datasource.
Throws:
CpoException - Thrown if there are errors accessing the datasource

clearMetaClass

void clearMetaClass()
                    throws CpoException
Clears the metadata for all classes for the current datasource. The metadata will be lazy-loaded from the metadata repository as classes are accessed.

Throws:
CpoException - Thrown if there are errors accessing the datasource

insertObject

<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

<T> long insertObject(java.lang.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 Query 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

insertObjects

<T> long insertObjects(java.util.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

<T> long insertObjects(java.lang.String name,
                       java.util.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 Query 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

deleteObject

<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

<T> long deleteObject(java.lang.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 Query 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

deleteObjects

<T> long deleteObjects(java.util.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

<T> long deleteObjects(java.lang.String name,
                       java.util.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 Query 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

executeObject

<T> T executeObject(T obj)
                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:
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. This object is used to populate the IN parameters 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 parameters returned from the executable object
Throws:
CpoException - Thrown if there are errors accessing the datasource

executeObject

<T> T executeObject(java.lang.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 parameters 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 parameters
Throws:
CpoException - DOCUMENT ME!

executeObject

<T,C> T executeObject(java.lang.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 Query 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 parameters 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 parameters
Throws:
CpoException - Thrown if there are errors accessing the datasource

existsObject

<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

<T> long existsObject(java.lang.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 Query 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

<T> long existsObject(java.lang.String name,
                      T obj,
                      java.util.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 Query 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 collection of CpoWhere objects that pass in run-time constraints to the query 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

newOrderBy

CpoOrderBy newOrderBy(java.lang.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

CpoOrderBy newOrderBy(java.lang.String attribute,
                      boolean ascending,
                      java.lang.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

newWhere

CpoWhere newWhere()
                  throws CpoException
DOCUMENT ME!

Returns:
DOCUMENT ME!
Throws:
CpoException - Thrown if there are errors accessing the datasource

newWhere

<T> CpoWhere newWhere(int logical,
                      java.lang.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 - Thrown if there are errors accessing the datasource

newWhere

<T> CpoWhere newWhere(int logical,
                      java.lang.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 - Thrown if there are errors accessing the datasource

persistObject

<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 query 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

<T> long persistObject(java.lang.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 Query 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

<T> long persistObjects(java.util.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

<T> long persistObjects(java.lang.String name,
                        java.util.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 Query 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

<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 query defined for these beans returns more than one row, an exception will be thrown.

Parameters:
bean - This is a 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 query.
Returns:
A bean of the same type as the result parameter that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBean

<T> T retrieveBean(java.lang.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 query 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 query.
Returns:
An bean of the same type as the result parameter that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBean

<T,C> T retrieveBean(java.lang.String name,
                     C criteria,
                     T result,
                     java.util.Collection<CpoWhere> wheres,
                     java.util.Collection<CpoOrderBy> orderBy)
               throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource. If the retrieve query 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 parameters 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 parameter that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBean

<T,C> T retrieveBean(java.lang.String name,
                     C criteria,
                     T result,
                     java.util.Collection<CpoWhere> wheres,
                     java.util.Collection<CpoOrderBy> orderBy,
                     java.util.Collection<CpoNativeQuery> nativeQueries)
               throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource. If the retrieve query 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 parameters 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
nativeQueries - Native query text that will be used to augment the query text stored in the meta data. This text will be embedded at run-time
Returns:
An bean of the same type as the result parameter that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

<C> java.util.List<C> retrieveBeans(java.lang.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 parameters 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

<C> java.util.List<C> retrieveBeans(java.lang.String name,
                                    C criteria,
                                    CpoWhere where,
                                    java.util.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 parameters 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

<C> java.util.List<C> retrieveBeans(java.lang.String name,
                                    C criteria,
                                    java.util.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 parameters 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

<C> java.util.List<C> retrieveBeans(java.lang.String name,
                                    C criteria,
                                    java.util.Collection<CpoWhere> wheres,
                                    java.util.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 parameters 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

<T,C> java.util.List<T> retrieveBeans(java.lang.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 parameters 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

<T,C> java.util.List<T> retrieveBeans(java.lang.String name,
                                      C criteria,
                                      T result,
                                      CpoWhere where,
                                      java.util.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 parameters 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

<T,C> java.util.List<T> retrieveBeans(java.lang.String name,
                                      C criteria,
                                      T result,
                                      java.util.Collection<CpoWhere> wheres,
                                      java.util.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 parameters 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

<T,C> java.util.List<T> retrieveBeans(java.lang.String name,
                                      C criteria,
                                      T result,
                                      java.util.Collection<CpoWhere> wheres,
                                      java.util.Collection<CpoOrderBy> orderBy,
                                      java.util.Collection<CpoNativeQuery> nativeQueries)
                                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 parameters 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
nativeQueries - Native query text that will be used to augment the query text 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

<T,C> CpoResultSet<T> retrieveBeans(java.lang.String name,
                                    C criteria,
                                    T result,
                                    java.util.Collection<CpoWhere> wheres,
                                    java.util.Collection<CpoOrderBy> orderBy,
                                    java.util.Collection<CpoNativeQuery> nativeQueries,
                                    int queueSize)
                              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 parameters 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
nativeQueries - Native query text that will be used to augment the query text stored in the meta data. This text will be embedded at run-time
the - queue size of the buffer that it uses to send the beans from the producer to the consumer.
Returns:
A CpoResultSet that can be iterated through
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveObject

@Deprecated
<T> T retrieveObject(T obj)
                 throws CpoException
Deprecated. use retrieveBean

Retrieves the Object from the datasource. The assumption is that the object exists in the datasource. If the retrieve query defined for this objects returns more than one row, an exception will be thrown.

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. The input object is used to specify the search criteria, the output object is populated with the results of the query.
Returns:
An object of the same type as the result parameter that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveObject

@Deprecated
<T> T retrieveObject(java.lang.String name,
                                T obj)
                 throws CpoException
Deprecated. use retrieveBean

Retrieves the Object from the datasource. The assumption is that the object exists in the datasource. If the retrieve query defined for this objects returns more than one row, an exception will be thrown.

Parameters:
name - DOCUMENT ME!
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. The input object is used to specify the search criteria, the output object is populated with the results of the query.
Returns:
An object of the same type as the result parameter that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveObject

@Deprecated
<T,C> T retrieveObject(java.lang.String name,
                                  C criteria,
                                  T result,
                                  java.util.Collection<CpoWhere> wheres,
                                  java.util.Collection<CpoOrderBy> orderBy)
                 throws CpoException
Deprecated. use retrieveBean

Retrieves the Object from the datasource. The assumption is that the object exists in the datasource. If the retrieve query defined for this objects returns more than one row, an exception will be thrown.

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 specify the parameters 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 is used to specify the object type that will be returned in the collection.
wheres - A collection of CpoWhere objects that define the constraints that should be used when retrieving objects
orderBy - The CpoOrderBy object that defines the order in which objects should be returned
Returns:
An object of the same type as the result parameter that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveObject

@Deprecated
<T,C> T retrieveObject(java.lang.String name,
                                  C criteria,
                                  T result,
                                  java.util.Collection<CpoWhere> wheres,
                                  java.util.Collection<CpoOrderBy> orderBy,
                                  java.util.Collection<CpoNativeQuery> nativeQueries)
                 throws CpoException
Deprecated. use retrieveBean

Retrieves the Object from the datasource. The assumption is that the object exists in the datasource. If the retrieve query defined for this objects returns more than one row, an exception will be thrown.

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 specify the parameters 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 is used to specify the object type that will be returned in the collection.
wheres - A collection of CpoWhere objects that define the constraints that should be used when retrieving objects
orderBy - The CpoOrderBy object that defines the order in which objects should be returned
nativeQueries - Native query text that will be used to augment the query text stored in the meta data. This text will be embedded at run-time
Returns:
An object of the same type as the result parameter that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveObjects

@Deprecated
<T,C> java.util.Collection<T> retrieveObjects(java.lang.String name,
                                                         C criteria,
                                                         java.util.Collection<CpoWhere> wheres,
                                                         java.util.Collection<CpoOrderBy> orderBy,
                                                         T result)
                                        throws CpoException
Deprecated. use retrieveBean

Retrieves the Object from the datasource. The 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 specify the parameters 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 is used to specify the object type that will be returned in the collection.
wheres - A collection of CpoWhere objects that define the constraints that should be used when retrieving objects
orderBy - The CpoOrderBy object that defines the order in which objects should be returned
Returns:
A collection of objects will be returned that meet the criteria specified by obj. The objects will be of the same type as the Object that was passed in. If no objects match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveObjects

@Deprecated
<T,C> java.util.Collection<T> retrieveObjects(java.lang.String name,
                                                         C criteria,
                                                         java.util.Collection<CpoWhere> wheres,
                                                         java.util.Collection<CpoOrderBy> orderBy,
                                                         java.util.Collection<CpoNativeQuery> nativeQueries,
                                                         T result)
                                        throws CpoException
Deprecated. use retrieveBeans

Retrieves the Object from the datasource. The 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 specify the parameters 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 is used to specify the object type that will be returned in the collection.
wheres - A collection of CpoWhere objects that define the constraints that should be used when retrieving objects
orderBy - The CpoOrderBy object that defines the order in which objects should be returned
nativeQueries - Native query text that will be used to augment the query text stored in the meta data. This text will be embedded at run-time
Returns:
A collection of objects will be returned that meet the criteria specified by obj. The objects will be of the same type as the Object that was passed in. If no objects match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveObjects

@Deprecated
<T,C> CpoResultSet<T> retrieveObjects(java.lang.String name,
                                                 C criteria,
                                                 java.util.Collection<CpoWhere> wheres,
                                                 java.util.Collection<CpoOrderBy> orderBy,
                                                 java.util.Collection<CpoNativeQuery> nativeQueries,
                                                 T result,
                                                 int queueSize)
                                throws CpoException
Deprecated. use retrieveBeans

Retrieves the Object from the datasource. The 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 specify the parameters 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 is used to specify the object type that will be returned in the collection.
wheres - A collection of CpoWhere objects that define the constraints that should be used when retrieving objects
orderBy - The CpoOrderBy object that defines the order in which objects should be returned
nativeQueries - Native query text that will be used to augment the query text stored in the meta data. This text will be embedded at run-time
the - queue size of the buffer that it uses to send the objects from the producer to the consumer.
Returns:
A CpoResultSet that can be iterated through
Throws:
CpoException - Thrown if there are errors accessing the datasource

transactObjects

@Deprecated
<T> long transactObjects(java.util.Collection<CpoObject<T>> coll)
                     throws CpoException
Deprecated. 

Allows you to perform a series of object interactions with the database. This method pre-dates CpoTrxAdapter and can be used without a programmer needing to remember to call commit() or 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();
    so = new SomeObject();
    so.setId(1);
    so.setName("SomeName");
    CpoObject cobj = new CpoObject(CpoAdapter.CREATE,"MyCreate",so);
    al.add(cobj);
    so = new SomeObject();
    so.setId(3);
    so.setName("New Name");
    CpoObject cobj = new CpoObject(CpoAdapter.PERSIST,"MyPersist",so);
    al.add(cobj);
    
    try{
      cpo.transactObjects(al);
    } catch (CpoException ce) {
      // Handle the error
    }
  }

Parameters:
coll - This is a collection of CpoObject 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

updateObject

<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

<T> long updateObject(java.lang.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 Query 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

updateObjects

<T> long updateObjects(java.util.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

<T> long updateObjects(java.lang.String name,
                       java.util.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 Query 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

getCpoTrxAdapter

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


Copyright © 2010. All Rights Reserved.