SDRAgent Class Reference
[SDR Model Objects]

Model class for SDRAgent entity. More...

Inheritance diagram for SDRAgent:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 __construct ($constraints=null)
 Constructs new SDRAgent object.
 addSDRVersion ($parent=null, $cserd, $state= '', $comment= '', $created= '', $modified= '0000-00-00 00:00:00')
 Add new SDRVersion object connected to this object.
 getDisplayName ()
 Return a display name for this agent.
 listSDRVersions ($constraints=array(), $limit=array(), $order=array(), $count=false)
 Retrieves list of children SDRVersion objects.
 listSDRVersionsMulti ($constraints=array(), $limit=array(), $order=array(), $count=false, $depth=1)
 Retrieves list of children SDRVersion objects using joins.

Static Public Member Functions

static agentFromCSERDUser ($user)
 Retrieve or create an SDRAgent corresponding to a CSERD user.
static agentFromS2User ($user, $realm)
 Retrieve or create an SDRAgent corresponding to an SUser object.
static agentFromSUser ($user, $realm)
 Retrieve or create an SDRAgent corresponding to an SUser object.
static exists ($constraints=array())
 Checks to see if object exists according to constraints.
static getAttributesStatic ()
 Retrieves attributes and information about them.
static getList ($constraints=array(), $limit=array(), $order=array(), $count=false)
 Retrieves list of SDRAgent objects.
static getTableNameStatic ()
 Retrieves name of table represented by this class.
static retrieve ($constraints=array(), $checkOnly=false)
 Retrieves a single object of this type, given the constraints.

Static Public Attributes

static $ATTRIBUTES
 Attributes for this entity and information about them.


Detailed Description

Model class for SDRAgent entity.

Use agentFromSUser() or agentFromCSERDUser() to construct agents representing users from the LDAP or CSERD realms.


Constructor & Destructor Documentation

SDRAgent::__construct ( constraints = null  ) 

Constructs new SDRAgent object.

This method will only populate the object if a constraints array is passed in, to use for selecting the information for the object from the database (see Guide to Database Constraints).

Parameters:
$constraints [array]: constraints array for populating


Member Function Documentation

SDRAgent::addSDRVersion ( parent = null,
cserd,
state = '',
comment = '',
created = '',
modified = '0000-00-00 00:00:00' 
)

Add new SDRVersion object connected to this object.

This method creates a new SDRVersion and makes sure that relevant foreign keys in that object point to this object and any other necessary objects as passed in as parameters to this method. For parameters that request another model object, you may either pass in the model object itself, or the id value for that object, as would be used in the foreign key of the new SDRVersion object. For example, if the new object needs to point to both this object and, say, a user object, then you can either pass in a user object, or a user ID.

Parameters:
$parent [int]: INSERT DESCRIPTION HERE
$cserd [SDRResource]: Can also be foreign key value. INSERT DESCRIPTION HERE
$state [string]: INSERT DESCRIPTION HERE
$comment [string]: INSERT DESCRIPTION HERE
$created [time]: INSERT DESCRIPTION HERE
$modified [time]: INSERT DESCRIPTION HERE
Returns:
[SDRVersion]: new object (already committed) or null on failure

static SDRAgent::agentFromCSERDUser ( user  )  [static]

Retrieve or create an SDRAgent corresponding to a CSERD user.

Customized version of agentFromSUser for CSERDUser objects. Store the CSERDUserId in the SDRAgent object to provide more audit information.

Parameters:
$user [CSERDUser]: The CSERD user to which the SDRAgent should correspond
Returns:
[SDRAgent]: The agent corresponding to the user

static SDRAgent::agentFromS2User ( user,
realm 
) [static]

Retrieve or create an SDRAgent corresponding to an SUser object.

An SDR agent corresponds either to a user within an authentication realm (i.e., cserd, ldap) or a service accessing the api (use 'api' as the realm and the name of the service or user agent as the username).

Return an agent, creating one if it does not already exist.

Parameters:
$user [SUser]: The user to which the SDRAgent should correspond
$realm [string]: The name of the realm for this user (i.e., cserd, ldap, or api)
Returns:
[SDRAgent]: An agent corresponding to the SUser (or false on failure)

static SDRAgent::agentFromSUser ( user,
realm 
) [static]

Retrieve or create an SDRAgent corresponding to an SUser object.

An SDR agent corresponds either to a user within an authentication realm (i.e., cserd, ldap) or a service accessing the api (use 'api' as the realm and the name of the service or user agent as the username).

Return an agent, creating one if it does not already exist.

Parameters:
$user [SUser]: The user to which the SDRAgent should correspond
$realm [string]: The name of the realm for this user (i.e., cserd, ldap, or api)
Returns:
[SDRAgent]: An agent corresponding to the SUser (or false on failure)

static SDRAgent::exists ( constraints = array()  )  [static]

Checks to see if object exists according to constraints.

This is simply an alias for retrieve($constraints, true);

Parameters:
$constraints [array]: constraints used to check for existence of object
Returns:
[boolean]: whether object exists in DB

static SDRAgent::getAttributesStatic (  )  [static]

Retrieves attributes and information about them.

This method is needed because there is no generic way to get at the $ATTRIBUTES static member variable without this kind of method. If you do not need to generically grab the attributes of a model class, just use ModelClass::$ATTRIBUTES or $obj->getAttributes().

Returns:
[array]: contents of static $ATTRIBUTES array

SDRAgent::getDisplayName (  ) 

Return a display name for this agent.

If a full name exists, return that. Otherwise, just return the username. Append the realm afterwards in parentheses.

Returns:
[string]: A display name for this agent

static SDRAgent::getList ( constraints = array(),
limit = array(),
order = array(),
count = false 
) [static]

Retrieves list of SDRAgent objects.

See Guide to Database Constraints for more on how to construct constraint and other arrays for this method.

Parameters:
$constraints [array]: limit results by criteria
$limit [array]: limit results by count
$order [array]: change ordering of results
$count [boolean]: if true, return the number of objects that would have been returned, rather than the objects themselves
Returns:
[array of SDRAgent]: list of objects matching the criteria, if any, or null on error

static SDRAgent::getTableNameStatic (  )  [static]

Retrieves name of table represented by this class.

Returns:
[string]: table name

SDRAgent::listSDRVersions ( constraints = array(),
limit = array(),
order = array(),
count = false 
)

Retrieves list of children SDRVersion objects.

This method retrieves objects of type SDRVersion which have their modifiedAgentId field equal to the value of this object's id field. The constraints, limit and order parameters can be used to trim down and order the results. See Guide to Database Constraints for more on using database constraints with DBI2/SModel2.

Parameters:
$constraints [array]: constraints array to further limit results
$limit [array]: limit array to control how many and which results are returned
$order [array]: order array to control the ordering of the returned results
$count [boolean]: if true, only return the count of how many objects would be returned, rather than the objects themselves
Returns:
[SDRVersion]: array of child objects, or an integer if $count is true, or null on error

SDRAgent::listSDRVersionsMulti ( constraints = array(),
limit = array(),
order = array(),
count = false,
depth = 1 
)

Retrieves list of children SDRVersion objects using joins.

This method retrieves objects of type SDRVersion which have their modifiedAgentId field equal to the value of this object's id field. The constraints, limit and order parameters can be used to trim down and order the results. See Guide to Database Constraints for more on using database constraints with DBI2/SModel2. Unlike listSDRVersions(), this method joins the child objects with their parent objects.

Parameters:
$constraints [array]: constraints array to further limit results
$limit [array]: limit array to control how many and which results are returned
$order [array]: order array to control the ordering of the returned results
$count [boolean]: if true, only return the count of how many objects would be returned, rather than the objects themselves
$depth [int]: how deep to traverse dependencies when doing joins
Returns:
[SDRVersion]: array of child objects, or an integer if $count is true, or null on error

static SDRAgent::retrieve ( constraints = array(),
checkOnly = false 
) [static]

Retrieves a single object of this type, given the constraints.

Use this method instead of the constructor since the constructor cannot return error conditions properly.

Parameters:
$constraints [array]: constraints to use when retrieving object
$checkOnly [boolean]: if true, just return whether the row exists in the DB
Returns:
[SDRAgent]: retrieved object, or null on error or object does not exist (or true/false if $checkOnly is true, to indicate whether the row exists in the DB)


The documentation for this class was generated from the following file:

Generated on Wed Nov 24 02:02:34 2010 for Common by  doxygen 1.5.6