Transfer version 1.1

transfer.com
Class Transfer

WEB-INF.cftags.component
        extended by transfer.com.Transfer

public class Transfer
extends WEB-INF.cftags.component

Main class of the transfer lib


Constructor Summary
init(Factory factory)
          Constructor
 
Method Summary
 void addAfterCreateObserver(any observer)
          Adds an object as a observer of after create events
 void addAfterDeleteObserver(any observer)
          Adds an object as a observer of after delete events
 void addAfterNewObserver(any observer)
          Adds an object as a observer of after new events
 void addAfterUpdateObserver(any observer)
          Adds an object as a observer of after update events
 void addBeforeCreateObserver(any observer)
          Adds an object as a observer of before create events
 void addBeforeDeleteObserver(any observer)
          Adds an object as a observer of before delete events
 void addBeforeUpdateObserver(any observer)
          Adds an object as a observer of before update events
package void cache(TransferObject transfer)
          Adds the object to the cache manager
package void cacheMiss(string className)
          add an extra count to this cache's value not being found
 void cascadeCreate(TransferObject transfer, [numeric depth='0'], [boolean useTransaction='true'])
          does a cascade down the object hierarchy, calling create() as it goes
 void cascadeDelete(TransferObject transfer, [numeric depth='0'], [boolean useTransaction='true'])
          does a cascade down the object hierarchy, calling delete() as it goes
 void cascadeSave(TransferObject transfer, [numeric depth='0'], [boolean useTransaction='true'])
          does a cascade down the object hierarchy, calling save() as it goes
 void cascadeUpdate(TransferObject transfer, [numeric depth='0'], [boolean useTransaction='true'])
          does a cascade down the object hierarchy, calling update() as it goes
 void create(TransferObject transfer, [boolean useTransaction='true'])
          Creates a new transfer in the DB. Sets the transfer's ID, and persists the object.
 Query createQuery(string tql)
          creates a query object for TQL interpretation
package TransferObjectProxy createTransferObjectProxy(string className, any key, struct propertyMap)
          creates an object proxy for usage with composites
 void delete(TransferObject transfer, [boolean useTransaction='true'])
          Deletes a transfer from the database and discard it from persistance.
 void discard(TransferObject transfer)
          Discard the object from the cache
 void discardAll()
          Discards all objects from the cache. Generally for development purposes.
 void discardByClassAndKey(string className, any key)
          Discards an Object by its class and its key, if it exists
 void discardByClassAndKeyArray(string className, array keyArray)
          Discards an Object by its class and each key in an array, if it exists
 void discardByClassAndKeyQuery(string className, query keyQuery, string columnName)
          Discards an Object by its class and each key in an array, if it exists
 TransferObject get(string class, any key)
          Retrieves a populated TransferObject of a given class and primary key. If no object exists for this key, an empty instance of the class is returned.
private CacheManager getCacheManager()
 CacheMonitor getCacheMonitor()
          returns the cache monitor
private Datasource getDatasource()
private DynamicManager getDynamicManager()
private EventManager getEventManager()
private Nullable getNullable()
private ObjectManager getObjectManager()
private SQLManager getSQLManager()
private TQLManager getTQLManager()
private Transaction getTransaction()
 Object getTransferMetaData(string className)
          Returns the Object meta data for a given transferobject class
private Utility getUtility()
package boolean isCached(string class, string key)
          Check if a transfer of a particular class is cached
 query list(string className, [string orderProperty=''], [boolean orderASC='true'], [boolean useAliases='true'])
          Lists a series of object values
 query listByProperty(string className, string propertyName, any propertyValue, [string orderProperty=''], [boolean orderASC='true'], [boolean useAliases='true'])
          Lists a series of values, filtered by a given value
 query listByPropertyMap(string className, struct propertyMap, [string orderProperty=''], [boolean orderASC='true'], [boolean useAliases='true'])
          Lists values, filtered by a Struct of Property : Value properties
 query listByQuery(Query query)
          List by a TQL Query
package void loadManyToMany(TransferObject transfer, string name)
          LazyLoads the required manytomany data into an object
package void loadManyToOne(TransferObject transfer, string name)
          LazyLoads the required manytone data into an object
package void loadOneToMany(TransferObject transfer, string name)
          LazyLoads the required onetomany data into an object
package void loadParentOneToMany(TransferObject transfer, string name)
          LazyLoads the required external onetomany data into an object
 TransferObject new(string class)
          Creates a new, empty TransferObject decorated with the given classes methods
package string rationaliseKey(string class, any key)
          rationlises the key, depending on type, to a string
private TransferObject read(string className, query query)
          Retrieves an object from a simple row query
 TransferObject readByProperty(string className, string propertyName, any propertyValue)
          retrieve an object by it's unique property. Throws an Exception if more than one object found
 TransferObject readByPropertyMap(string className, struct propertyMap)
          retrieve and object by a set of unique properties. Throws an Exception if more than one object found
 TransferObject readByQuery(string className, Query query)
          retrieve an object by a TQL query. The query must either start with 'from' or only have one column in its result
 void recycle(TransferObject transfer)
          Recycle an TransferObject for reuse by the system later on. This is good for performance. Only do this once a TransferObject has been deleted or discarded, and is not stored in any shared scopes, as the object's state is reset
 void removeAfterCreateObserver(any observer)
          removes an observer of after create events
 void removeAfterDeleteObserver(any observer)
          removes an observer of after Delete events
 void removeAfterNewObserver(any observer)
          removes an observer of after new events
 void removeAfterUpdateObserver(any observer)
          removes an observer of after update events
 void removeBeforeCreateObserver(any observer)
          removes an observer of before create events
 void removeBeforeDeleteObserver(any observer)
          removes an observer of Before Delete events
 void removeBeforeUpdateObserver(any observer)
          removes an observer of before update events
 void save(TransferObject transfer, [boolean useTransaction='true'])
          If the object has yet to be instatiated, it is inserted into the db, otherwise it is updated
private void setCacheManager(CacheManager CacheManager)
private void setDatasource(Datasource Datasource)
private void setDynamicManager(DynamicManager DynamicManager)
private void setEventManager(EventManager EventManager)
private void setNullable(Nullable Nullable)
private void setObjectManager(ObjectManager ObjectManager)
private void setSQLManager(SQLManager SQLManager)
private void setTQLManager(TQLManager TQLManager)
private void setTransaction(Transaction transaction)
private void setTransferObjectEventListeners(any softRef, string className)
          configure the event listeners to add to a particular transfer object
private void setUtility(Utility Utility)
private any throw(string type, string message, [string detail=''])
          Throws an Exception
 void update(TransferObject transfer, [boolean useTransaction='true'])
          Updates the record of a Transfer object in the database
package boolean validateIsCached(TransferObject transfer)
          validates if a TransferObject is the same one as in cache
 void visitObjectGraph(TransferObject transfer, any visitor, string visitingMethod, [struct visitArgs='[runtime expression]'], [numeric depth='0'], [boolean topDown='true'], [boolean forceLoading='false'])
          visit each of the objects in the graph, calling 'visit({transfer:transferObject, visitArgs1...})' on the visitor for each TransferObject in the graph
 
Methods inherited from class WEB-INF.cftags.component
 

Constructor Detail

init

public init(Factory factory)
Constructor

Parameters:
factory - the global factory
Method Detail

addAfterCreateObserver

public void addAfterCreateObserver(any observer)
Adds an object as a observer of after create events

Parameters:
observer - The observer

addAfterDeleteObserver

public void addAfterDeleteObserver(any observer)
Adds an object as a observer of after delete events

Parameters:
observer - The observer

addAfterNewObserver

public void addAfterNewObserver(any observer)
Adds an object as a observer of after new events

Parameters:
observer - The observer

addAfterUpdateObserver

public void addAfterUpdateObserver(any observer)
Adds an object as a observer of after update events

Parameters:
observer - The observer

addBeforeCreateObserver

public void addBeforeCreateObserver(any observer)
Adds an object as a observer of before create events

Parameters:
observer - The observer

addBeforeDeleteObserver

public void addBeforeDeleteObserver(any observer)
Adds an object as a observer of before delete events

Parameters:
observer - The observer

addBeforeUpdateObserver

public void addBeforeUpdateObserver(any observer)
Adds an object as a observer of before update events

Parameters:
observer - The observer

cache

package void cache(TransferObject transfer)
Adds the object to the cache manager

Parameters:
transfer - The transfer object to cache

cacheMiss

package void cacheMiss(string className)
add an extra count to this cache's value not being found

Parameters:
className - the className being missed

cascadeCreate

public void cascadeCreate(TransferObject transfer, [numeric depth='0'], [boolean useTransaction='true'])
does a cascade down the object hierarchy, calling create() as it goes

Parameters:
transfer - The transferObject to create
depth - the number of levels in which to cascade, 0 is unlimited
useTransaction - deprecated: use TransferFactory.getTransaction for transaction management. Whether or not to use an internal transaction block

cascadeDelete

public void cascadeDelete(TransferObject transfer, [numeric depth='0'], [boolean useTransaction='true'])
does a cascade down the object hierarchy, calling delete() as it goes

Parameters:
transfer - The transferObject to create
depth - the number of levels in which to cascade, 0 is unlimited
useTransaction - deprecated: use TransferFactory.getTransaction for transaction management. Whether or not to use an internal transaction block

cascadeSave

public void cascadeSave(TransferObject transfer, [numeric depth='0'], [boolean useTransaction='true'])
does a cascade down the object hierarchy, calling save() as it goes

Parameters:
transfer - The transferObject to create
depth - the number of levels in which to cascade, 0 is unlimited
useTransaction - deprecated: use TransferFactory.getTransaction for transaction management. Whether or not to use an internal transaction block

cascadeUpdate

public void cascadeUpdate(TransferObject transfer, [numeric depth='0'], [boolean useTransaction='true'])
does a cascade down the object hierarchy, calling update() as it goes

Parameters:
transfer - The transferObject to update
depth - the number of levels in which to cascade, 0 is unlimited
useTransaction - deprecated: use TransferFactory.getTransaction for transaction management. Whether or not to use an internal transaction block

create

public void create(TransferObject transfer, [boolean useTransaction='true'])
Creates a new transfer in the DB. Sets the transfer's ID, and persists the object.

Parameters:
transfer - The transfer to create in the DB
useTransaction - deprecated: use TransferFactory.getTransaction for transaction management. Whether or not to use an internal transaction block

createQuery

public Query createQuery(string tql)
creates a query object for TQL interpretation

Parameters:
tql - The Transfer Query Language query

createTransferObjectProxy

package TransferObjectProxy createTransferObjectProxy(string className, any key, struct propertyMap)
creates an object proxy for usage with composites

Parameters:
className - the class name of the To we're creating
key - the primary key value
propertyMap - the property map that has been set

delete

public void delete(TransferObject transfer, [boolean useTransaction='true'])
Deletes a transfer from the database and discard it from persistance.

Parameters:
transfer - The transferObject to delete
useTransaction - deprecated: use TransferFactory.getTransaction for transaction management. Whether or not to use an internal transaction block

discard

public void discard(TransferObject transfer)
Discard the object from the cache

Parameters:
transfer - The transferObject to delete

discardAll

public void discardAll()
Discards all objects from the cache. Generally for development purposes.


discardByClassAndKey

public void discardByClassAndKey(string className, any key)
Discards an Object by its class and its key, if it exists

Parameters:
className - The class name of the object to discard
key - The primary key value for the object

discardByClassAndKeyArray

public void discardByClassAndKeyArray(string className, array keyArray)
Discards an Object by its class and each key in an array, if it exists

Parameters:
className - The class name of the object to discard
keyArray - The primary key values for the object

discardByClassAndKeyQuery

public void discardByClassAndKeyQuery(string className, query keyQuery, string columnName)
Discards an Object by its class and each key in an array, if it exists

Parameters:
className - The class name of the object to discard
keyQuery - The primary key values for the object
columnName - The name of the column the the id is in

get

public TransferObject get(string class, any key)
Retrieves a populated TransferObject of a given class and primary key. If no object exists for this key, an empty instance of the class is returned.

Parameters:
class - The name of the package and class (Case Sensitive)
key - Primary key for the object in the DB, string if non composite, struct if composite

getCacheManager

private CacheManager getCacheManager()


getCacheMonitor

public CacheMonitor getCacheMonitor()
returns the cache monitor


getDatasource

private Datasource getDatasource()


getDynamicManager

private DynamicManager getDynamicManager()


getEventManager

private EventManager getEventManager()


getNullable

private Nullable getNullable()


getObjectManager

private ObjectManager getObjectManager()


getSQLManager

private SQLManager getSQLManager()


getTQLManager

private TQLManager getTQLManager()


getTransaction

private Transaction getTransaction()


getTransferMetaData

public Object getTransferMetaData(string className)
Returns the Object meta data for a given transferobject class

Parameters:
className - The class name of the transfer object

getUtility

private Utility getUtility()


isCached

package boolean isCached(string class, string key)
Check if a transfer of a particular class is cached

Parameters:
class - The name of the class
key - The key for the id of the data

list

public query list(string className, [string orderProperty=''], [boolean orderASC='true'], [boolean useAliases='true'])
Lists a series of object values

Parameters:
className - The class of the objects to list
orderProperty - The property to order by
orderASC - Boolean whether to order by ASC, otherwise order by DESC
useAliases - Boolean as to whether or not to alias columns with the transfer property names

listByProperty

public query listByProperty(string className, string propertyName, any propertyValue, [string orderProperty=''], [boolean orderASC='true'], [boolean useAliases='true'])
Lists a series of values, filtered by a given value

Parameters:
className - The class of the objects to list
propertyName - The name of the property to filter by
propertyValue - The value to filter by (only simple values)
orderProperty - The property to order by
orderASC - Boolean whether to order by ASC, otherwise order by DESC
useAliases - Boolean as to whether or not to alias columns with the transfer property names

listByPropertyMap

public query listByPropertyMap(string className, struct propertyMap, [string orderProperty=''], [boolean orderASC='true'], [boolean useAliases='true'])
Lists values, filtered by a Struct of Property : Value properties

Parameters:
className - The class of the objects to list
propertyMap - Struct with keys that match to properties, and values to filter by
orderProperty - The property to order by
orderASC - Boolean whether to order by ASC, otherwise order by DESC
useAliases - Boolean as to whether or not to alias columns with the transfer property names

listByQuery

public query listByQuery(Query query)
List by a TQL Query

Parameters:
query - A TQL Query object

loadManyToMany

package void loadManyToMany(TransferObject transfer, string name)
LazyLoads the required manytomany data into an object

Parameters:
transfer - The transfer to load into
name - The name of the manytomany to load

loadManyToOne

package void loadManyToOne(TransferObject transfer, string name)
LazyLoads the required manytone data into an object

Parameters:
transfer - The transfer to load into
name - The name of the manytoone to load

loadOneToMany

package void loadOneToMany(TransferObject transfer, string name)
LazyLoads the required onetomany data into an object

Parameters:
transfer - The transfer to load into
name - The name of the onetomany to load

loadParentOneToMany

package void loadParentOneToMany(TransferObject transfer, string name)
LazyLoads the required external onetomany data into an object

Parameters:
transfer - The transfer to load into
name - The name of the manytomany to load

new

public TransferObject new(string class)
Creates a new, empty TransferObject decorated with the given classes methods

Parameters:
class - The name of the package and class (Case Sensitive)

rationaliseKey

package string rationaliseKey(string class, any key)
rationlises the key, depending on type, to a string

Parameters:
class - The name of the class
key - The key for the id of the data

read

private TransferObject read(string className, query query)
Retrieves an object from a simple row query

Parameters:
className - The class of the objects to find
query - The query to retrieve from

readByProperty

public TransferObject readByProperty(string className, string propertyName, any propertyValue)
retrieve an object by it's unique property. Throws an Exception if more than one object found

Parameters:
className - The class of the objects to find
propertyName - The name of the property to find
propertyValue - The value to find (only simple values)

readByPropertyMap

public TransferObject readByPropertyMap(string className, struct propertyMap)
retrieve and object by a set of unique properties. Throws an Exception if more than one object found

Parameters:
className - The class of the objects to list
propertyMap - Struct with keys that match to properties, and values to filter by

readByQuery

public TransferObject readByQuery(string className, Query query)
retrieve an object by a TQL query. The query must either start with 'from' or only have one column in its result

Parameters:
className - The class of the objects to find
query - TQL Query object

recycle

public void recycle(TransferObject transfer)
Recycle an TransferObject for reuse by the system later on. This is good for performance. Only do this once a TransferObject has been deleted or discarded, and is not stored in any shared scopes, as the object's state is reset

Parameters:
transfer - The transferObject to delete

removeAfterCreateObserver

public void removeAfterCreateObserver(any observer)
removes an observer of after create events

Parameters:
observer - The observer

removeAfterDeleteObserver

public void removeAfterDeleteObserver(any observer)
removes an observer of after Delete events

Parameters:
observer - The observer

removeAfterNewObserver

public void removeAfterNewObserver(any observer)
removes an observer of after new events

Parameters:
observer - The observer

removeAfterUpdateObserver

public void removeAfterUpdateObserver(any observer)
removes an observer of after update events

Parameters:
observer - The observer

removeBeforeCreateObserver

public void removeBeforeCreateObserver(any observer)
removes an observer of before create events

Parameters:
observer - The observer

removeBeforeDeleteObserver

public void removeBeforeDeleteObserver(any observer)
removes an observer of Before Delete events

Parameters:
observer - The observer

removeBeforeUpdateObserver

public void removeBeforeUpdateObserver(any observer)
removes an observer of before update events

Parameters:
observer - The observer

save

public void save(TransferObject transfer, [boolean useTransaction='true'])
If the object has yet to be instatiated, it is inserted into the db, otherwise it is updated

Parameters:
transfer - The transfer to save
useTransaction - deprecated: use TransferFactory.getTransaction for transaction management. Whether or not to use an internal transaction block

setCacheManager

private void setCacheManager(CacheManager CacheManager)

Parameters:
CacheManager

setDatasource

private void setDatasource(Datasource Datasource)

Parameters:
Datasource

setDynamicManager

private void setDynamicManager(DynamicManager DynamicManager)

Parameters:
DynamicManager

setEventManager

private void setEventManager(EventManager EventManager)

Parameters:
EventManager

setNullable

private void setNullable(Nullable Nullable)

Parameters:
Nullable

setObjectManager

private void setObjectManager(ObjectManager ObjectManager)

Parameters:
ObjectManager

setSQLManager

private void setSQLManager(SQLManager SQLManager)

Parameters:
SQLManager

setTQLManager

private void setTQLManager(TQLManager TQLManager)

Parameters:
TQLManager

setTransaction

private void setTransaction(Transaction transaction)

Parameters:
transaction

setTransferObjectEventListeners

private void setTransferObjectEventListeners(any softRef, string className)
configure the event listeners to add to a particular transfer object

Parameters:
softRef - the soft reference to the Transfer Object to cache
className - the classname of the object

setUtility

private void setUtility(Utility Utility)

Parameters:
Utility

throw

private any throw(string type, string message, [string detail=''])
Throws an Exception

Parameters:
type - The type of exception
message - The message to accompany the exception
detail - The detail message for the exception

update

public void update(TransferObject transfer, [boolean useTransaction='true'])
Updates the record of a Transfer object in the database

Parameters:
transfer - The transferObject to update
useTransaction - deprecated: use TransferFactory.getTransaction for transaction management. Whether or not to use an internal transaction block

validateIsCached

package boolean validateIsCached(TransferObject transfer)
validates if a TransferObject is the same one as in cache

Parameters:
transfer - The transfer object to syncronise

visitObjectGraph

public void visitObjectGraph(TransferObject transfer, any visitor, string visitingMethod, [struct visitArgs='[runtime expression]'], [numeric depth='0'], [boolean topDown='true'], [boolean forceLoading='false'])
visit each of the objects in the graph, calling 'visit({transfer:transferObject, visitArgs1...})' on the visitor for each TransferObject in the graph

Parameters:
transfer - the starting object to visit
visitor - the visitor object
visitingMethod - the name of the method that is being visited
visitArgs - visiting arguments, if there are any
depth - the max depth to go to
topDown - travel top down, rather than bottom up
forceLoading - if not loaded, force loading

Transfer version 1.1