Bric::Biz::Org::Source - Manages content sources.
$Revision: 1.15.4.2 $
$Date: 2003/08/14 20:33:45 $
use Bric::Biz::Org::Source;
# Constructors.
my $src = Bric::Biz::Org::Source->new($init);
$src = Bric::Biz::Org::Source->lookup({ id => $id });
my @srces = Bric::Biz::Org::Source->list($params);
# Class methods.
my @sids = Bric::Biz::Org::Source->list_ids($params);
my $meths = Bric::Biz::Org::Source->my_meths;
# Instance Methods.
my $id = $src->get_id;
my $org_id = $src->get_org_id;
$src = $src->set_org($org);
my $src_name = $src->get_source_name;
$src = $src->set_source_name($src_name);
my $desc = $src->get_description;
$src = $src->set_description($desc);
my $expire = $src->get_expire;
$src = $src->set_expire($expire);
$src = $src->activate;
$src = $src->deactivate;
print "Active: ", $src->is_active ? 'Yes' : 'No', "\n";
$src = $src->save;
This class manages asset sources. A source is an organization that provides content, such as a wire service or a syndicate. Thus, each source object is a kind of organization, and inherits all of an relevant data accessors, including those for addresses.
This class adds three basic data points to the organization: A description, an expire, and an active flag. The description is a simple free-text description of the source. The expire property is a simple integer representing the number of days an asset provided by a given source may be used before it must be removed as content. The active flag is just like any other active flag, except that it is separate from the Bric::Biz::Org active flag. Thus a Bric::Biz::Org::Source object may be deactivated while its parent Bric::Biz::Org object remains active.
Instantiates a Bric::Biz::Org::Source object. An anonymous hash of initial values may be passed. The supported initial value keys are:
name
long_name
description
expire
The new source will be active by default. Call $src->save() to save the new object.
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Looks up and instantiates a new Bric::Biz::Org::Source object based on the Bric::Biz::Org::Source object ID or name passed. If $id or $name is not found in the database, lookup() returns undef.
Throws:
Invalid property.
Too many Bric::Dist::Biz::Org::Source objects found.
Unable to connect to database.
Unable to prepare SQL statement.
Unable to connect to database.
Unable to select column into arrayref.
Unable to execute SQL statement.
Unable to bind to columns to statement handle.
Unable to fetch row from statement handle.
Side Effects: If $id is found, populates the new Bric::Biz::Org::Source object with data from the database before returning it.
Notes: NONE.
Returns a list or anonymous array of Bric::Biz::Org::Source objects based on the search parameters passed via an anonymous hash. The supported lookup keys are:
name
long_name
source_name
description
expire
org_id
grp_id
Throws:
Unable to connect to database.
Unable to prepare SQL statement.
Unable to connect to database.
Unable to select column into arrayref.
Unable to execute SQL statement.
Unable to bind to columns to statement handle.
Unable to fetch row from statement handle.
Side Effects: Populates each Bric::Biz::Org::Source object with data from the database before returning them all.
Notes: NONE.
Dummy method to prevent wasting time trying to AUTOLOAD DESTROY.
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Returns a list or anonymous array of Bric::Biz::Org::Source object IDs based on the search criteria passed via an anonymous hash. The supported lookup keys are the same as those for list().
Throws:
Invalid property.
Unable to connect to database.
Unable to prepare SQL statement.
Unable to connect to database.
Unable to select column into arrayref.
Unable to execute SQL statement.
Unable to bind to columns to statement handle.
Unable to fetch row from statement handle.
Side Effects: NONE.
Notes: NONE.
Returns an anonymous hash of introspection data for this object. If called with a true argument, it will return an ordered list or anonymous array of introspection data. If a second true argument is passed instead of a first, then a list or anonymous array of introspection data will be returned for properties that uniquely identify an object (excluding id, which is assumed).
Each hash key is the name of a property or attribute of the object. The value for a hash key is another anonymous hash containing the following keys:
The name of the property or attribute. Is the same as the hash key when an anonymous hash is returned.
The display name of the property or attribute.
A reference to the method that will retrieve the value of the property or attribute.
An anonymous array of arguments to pass to a call to get_meth in order to retrieve the value of the property or attribute.
A reference to the method that will set the value of the property or attribute.
An anonymous array of arguments to pass to a call to set_meth in order to set the value of the property or attribute.
The type of value the property or attribute contains. There are only three types:
If the value is a 'short' value, this hash key contains the length of the field.
The property is searchable via the list() and list_ids() methods.
The property or attribute is required.
An anonymous hash of properties used to display the property or attribute. Possible keys include:
The display field type. Possible values are
The Length, in letters, to display a text or password field.
The maximum length of the property or value - usually defined by the SQL DDL.
The number of rows to format in a textarea field.
The number of columns to format in a textarea field.
An anonymous hash of key/value pairs reprsenting the values and display names to use in a select list.
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Besides the methods inherited from Bric::Biz::Org, Bric::Biz::Org::Source offers accessors relevant to source-specific data.
Returns the ID of the Bric::Biz::Org::Source object.
Throws:
Bric::_get() - Problems retrieving fields.
Side Effects: NONE.
Notes: If the Bric::Biz::Org::Source object has been instantiated via the new() constructor and has not yet been saved, the object will not yet have an ID, so this method call will return undef.
Returns the ID of the Bric::Biz::Org object from which this source object inherits.
Throws:
Bric::_get() - Problems retrieving fields.
Side Effects: NONE.
Notes: NONE.
Sets the ID representing Bric::Biz::Org object from which this Bric::Biz::Org::Source object inherits.
Throws:
Bric::_get() - Problems retrieving fields.
Incorrect number of args to Bric::_set().
Bric::set() - Problems setting fields.
Side Effects: NONE.
Notes: NONE.
Returns the source_name of this source.
Throws:
Bad AUTOLOAD method format.
Cannot AUTOLOAD private methods.
Access denied: READ access for field 'source_name' required.
No AUTOLOAD method.
Side Effects: NONE.
Notes: NONE.
Sets the source_name of this source.
Throws:
Bad AUTOLOAD method format.
Cannot AUTOLOAD private methods.
Access denied: WRITE access for field 'source_name' required.
No AUTOLOAD method.
Side Effects: NONE.
Notes: NONE.
Returns the description of this source.
Throws:
Bad AUTOLOAD method format.
Cannot AUTOLOAD private methods.
Access denied: READ access for field 'description' required.
No AUTOLOAD method.
Side Effects: NONE.
Notes: NONE.
Sets the description of this source.
Throws:
Bad AUTOLOAD method format.
Cannot AUTOLOAD private methods.
Access denied: WRITE access for field 'description' required.
No AUTOLOAD method.
Side Effects: NONE.
Notes: NONE.
Returns the number of days before assets associated with this source expire.
Throws:
Bad AUTOLOAD method format.
Cannot AUTOLOAD private methods.
Access denied: READ access for field 'expire' required.
No AUTOLOAD method.
Side Effects: NONE.
Notes: NONE.
Sets the number of days before assets associated with this source expire. Set this value to 0 (zero) to prevent assets provided by this source from ever expiring.
Throws:
Bad AUTOLOAD method format.
Cannot AUTOLOAD private methods.
Access denied: WRITE access for field 'expire' required.
No AUTOLOAD method.
Side Effects: NONE.
Notes: NONE.
################################################################################
Activates the Bric::Biz::Org::Source object. Call $src->save to make the change persistent. Bric::Biz::Org::Source objects instantiated by new() are active by default.
Throws:
Incorrect number of args to Bric::_set().
Bric::set() - Problems setting fields.
Side Effects: NONE.
Notes: A Bric::Biz::Org::Source object's active status is not inherited from Bric::Biz::Org. A Bric::Biz::Org::Source object may be deactivated while its parent Bric::Biz::Org object remains active.
Deactivates (deletes) the Bric::Biz::Org::Source object. Call $src->save to make the change persistent.
Throws:
Incorrect number of args to Bric::_set().
Bric::set() - Problems setting fields.
Side Effects: NONE.
Notes: See activate() above.
Returns $self if the Bric::Biz::Org::Source object is active, and undef if it is not.
Throws:
Bric::_get() - Problems retrieving fields.
Side Effects: NONE.
Notes: See activate() above.
Returns a list or anonymous array of Bric::Biz::Group object ids representing the groups of which this Bric::Biz::Org::Source object is a member.
Throws: See Bric::Util::Grp::list().
Side Effects: NONE.
Notes: This method returns the group IDs for the current object both as a Bric::Biz::Org object and as a Bric::Biz::Org::Source object. [Actually, I've commented this out for now, since it seems more likely at this point that we'll want only the source group IDs, not also the organization IDs. We can uncomment this later if we decide we need it, though.]
Saves any changes to the Bric::Biz::Org::Source object. Returns $self on success and undef on failure.
Throws:
Bric::_get() - Problems retrieving fields.
Unable to connect to database.
Unable to prepare SQL statement.
Unable to execute SQL statement.
Unable to select row.
Incorrect number of args to _set.
Bric::_set() - Problems setting fields.
Side Effects: NONE.
Notes: NONE.
NONE.
NONE.
Function used by lookup() and list() to return a list of Bric::Biz::Org::Source objects or, if called with an optional third argument, returns a listof Bric::Biz::Org::Source object IDs (used by list_ids()).
Throws:
Unable to connect to database.
Unable to prepare SQL statement.
Unable to connect to database.
Unable to select column into arrayref.
Unable to execute SQL statement.
Unable to bind to columns to statement handle.
Unable to fetch row from statement handle.
Side Effects: NONE.
Notes: NONE.
NONE.
David Wheeler <david@wheeler.net>