NAME

Bric::Biz::Org::Source - Manages content sources.

VERSION

$Revision: 1.7 $

DATE

$Date: 2002/01/06 04:40:35 $

SYNOPSIS

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;

DESCRIPTION

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.

INTERFACE

Constructors

my $src = Bric::Biz::Org::Source->new($init)

Instantiates a Bric::Biz::Org::Source object. An anonymous hash of initial values may be passed. The supported initial value keys are:

The new source will be active by default. Call $src->save() to save the new object.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

my $src = Bric::Biz::Org::Source->lookup({ id => $id })

Looks up and instantiates a new Bric::Biz::Org::Source object based on the Bric::Biz::Org::Source object ID passed. If $id is not found in the database, lookup() returns undef.

Throws:

Side Effects: If $id is found, populates the new Bric::Biz::Org::Source object with data from the database before returning it.

Notes: NONE.

my (@srcs || $srcs_aref) = Bric::Biz::Org::Source->list($params)

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:

Throws:

Side Effects: Populates each Bric::Biz::Org::Source object with data from the database before returning them all.

Notes: NONE.

Destructors

$src->DESTROY

Dummy method to prevent wasting time trying to AUTOLOAD DESTROY.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

Public Class Methods

my (@src_ids || $src_ids_aref) = Bric::Biz::Org::Source->list_ids($params)

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:

over 4

*

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.

my $meths = Bric::Biz::Org::Source->my_meths
my (@meths || $meths_aref) = Bric::Biz::Org::Source->my_meths(TRUE)

Returns an anonymous hash of instrospection data for this object. If called with a true argument, it will return an ordered list or anonymous array of intrspection data. The format for each introspection item introspection is as follows:

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:

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

Public Instance Methods

Besides the methods inherited from Bric::Biz::Org, Bric::Biz::Org::Source offers accessors relevant to source-specific data.

my $id = $src->get_id

Returns the ID of the Bric::Biz::Org::Source object.

Throws:

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.

my $org_id = $src->get_org_id

Returns the ID of the Bric::Biz::Org object from which this source object inherits.

Throws:

Side Effects: NONE.

Notes: NONE.

$self = $src->set_org($org)

Sets the ID representing Bric::Biz::Org object from which this Bric::Biz::Org::Source object inherits.

Throws:

Side Effects: NONE.

Notes: NONE.

my $source_name = $src->get_source_name

Returns the source_name of this source.

Throws:

Side Effects: NONE.

Notes: NONE.

$self = $src->set_source_name($source_name)

Sets the source_name of this source.

Throws:

Side Effects: NONE.

Notes: NONE.

my $description = $src->get_description

Returns the description of this source.

Throws:

Side Effects: NONE.

Notes: NONE.

$self = $src->set_description($description)

Sets the description of this source.

Throws:

Side Effects: NONE.

Notes: NONE.

my $expire = $src->get_expire

Returns the number of days before assets associated with this source expire.

Throws:

Side Effects: NONE.

Notes: NONE.

$self = $src->set_expire($expire)

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:

Side Effects: NONE.

Notes: NONE.

################################################################################

$self = $src->activate

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:

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.

$self = $src->deactivate

Deactivates (deletes) the Bric::Biz::Org::Source object. Call $src->save to make the change persistent.

Throws:

Side Effects: NONE.

Notes: See activate() above.

$self = $src->is_active

Returns $self if the Bric::Biz::Org::Source object is active, and undef if it is not.

Throws:

Side Effects: NONE.

Notes: See activate() above.

my (@gids || $gids_aref) = $u->get_grp_ids
my (@gids || $gids_aref) = Bric::Biz::Person::User->get_grp_ids

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.]

$self = $src->save

Saves any changes to the Bric::Biz::Org::Source object. Returns $self on success and undef on failure.

Throws:

Side Effects: NONE.

Notes: NONE.

PRIVATE

Private Class Methods

NONE.

Private Instance Methods

NONE.

Private Functions

my $src_aref = &$get_em( $pkg, $params )
my $src_ids_aref = &$get_em( $pkg, $params, 1 )

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:

Side Effects: NONE.

Notes: NONE.

NOTES

NONE.

AUTHOR

David Wheeler <david@wheeler.net>

SEE ALSO

Bric

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 423:

'=item' outside of any '=over'

Around line 505:

Expected '=item *'

Around line 507:

Expected '=item *'

Around line 509:

Expected '=item *'

Around line 511:

Expected '=item *'

Around line 513:

Expected '=item *'

Around line 515:

Expected '=item *'

Around line 517:

Expected '=item *'