NAME

Bric::Biz::Org - Bricolage Interface to Organizations

VERSION

$Revision: 1.8 $

DATE

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

SYNOPSIS

# Constructors.
my $org = Bric::Biz::Org->new;
my $org = Bric::Biz::Org->lookup({ id => $id });
my @orgs = Bric::Biz::Org->list($search_href);

# Class Methods.
my @org_ids = Bric::Biz::Org->list_ids($search_href);

# Instance Methods.
my $id = $org->get_id;
my $name = $org->get_name($name);
$org = $org->set_name($name);
my $long_name = $org->get_long_name($long_name);
$org = $org->set_long_name($long_name);

$org = $org->activate;
$org = $org->deactivate;
$org = $org->is_active;

my $porg = $org->add_object($person);

my @addr = $org->get_addr;
my $addr = $org->new_addr;
$org = $org->del_addr;

$org->save;

DESCRIPTION

This class represents organizations in Bricolage. Organizations may be the companies for whom a person represented by a Bric::Biz::Person object works, or an organization that owns the rights to a given asset, or with whom a product is associated (this last use will be included in a future version).

The primary use for Bric::Biz::Org as of this writing, however, is to associate people (Bric::Biz::Person objects) with companies and their addresses. These associations are created by the Bric::Biz::Org add_object() method, and by the Bric::Biz::Org::Person subclass it returns. See Bric::Biz::Org::Person for its additions to the Bric::Biz::Org API.

INTERFACE

Constructors

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

Instantiates a Bric::Biz::Org object. A hashref of initial values may be passed. The supported intial value keys are:

Call $org->save to save the new object.

Throws:

Side Effects: NONE.

Notes: NONE.

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

Looks up and instantiates a new Bric::Biz::Org object based on the Bric::Biz::Org object ID passed. If $id is not found in the database, lookup() returns undef. If the ID is found more than once, lookup() throws an exception. This should not happen.

Throws:

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

Notes: NONE.

my (@orgs || $orgs_aref) = Bric::Biz::Org->list($params)

Returns a list or anonymous array of Bric::Biz::Org objects based on the search criteria passed via a hashref. The lookup searches are case-insensitive. The supported lookup parameter keys are:

Throws:

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

Notes: This method is overridden by the list() method of the Bric::Biz::Org::Person class.

Destructors

$org->DESTROY

Dummy method to prevent wasting time trying to AUTOLOAD DESTROY.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

Public Class Methods

my (@org_ids || $org_ids_aref) = Bric::Biz::Org->list_ids($params)

Functionally identical to list(), but returns Bric::Biz::Org object IDs rather than objects. See list() for a description of its interface.

Throws:

Side Effects: NONE.

Notes: NONE.

$meths = Bric::Biz::Person->my_meths
(@meths || $meths_aref) = Bric::Biz::Person->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

my $id = $org->get_id

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

Throws:

Side Effects: NONE.

Notes: If the Bric::Biz::Org 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 $name = $org->get_name

Returns the common name for the Bric::Biz::Org object.

Throws:

Side Effects: NONE.

Notes: NONE.

$self = $org->set_name($name)

Sets the common name of the Bric::Biz::Org object. Returns $self on success and undef on failure.

Throws:

Side Effects: NONE.

Notes: NONE.

my $long_name = $org->get_long_name

Returns the formal name for the Bric::Biz::Org object.

Throws:

Side Effects: NONE.

Notes: NONE.

$self = $org->set_long_name($long_name)

Sets the formal name for the Bric::Biz::Org object. Returns $self on success And Undef on failure

Throws:

Side Effects: NONE.

Notes: NONE.

$self = $org->activate

Activates the Bric::Biz::Org object. Call $org->save to make the change persistent. Bric::Biz::Org objects instantiated by new() are active by default.

Throws:

Side Effects: NONE.

Notes: NONE.

$self = $org->deactivate

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

Throws:

Side Effects: NONE.

Notes: NONE.

$self = $org->is_active

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

Throws:

Side Effects: NONE.

Notes: NONE.

$self = $org->is_personal

Returns $self if the Bric::Biz::Org object is personal, and undef if it is not. By personal I mean that it is directly related to an individual person, and all the addresses are associated with that person. This setting cannot be changed; it is set to true for the personal organization created for a person whenever a person is created.

Throws:

PRIVATE

Private Class Methods

NONE.

Private Instance Methods

NONE.

Private Functions

my $orgs_aref = &$get_em( $pkg, $search_href )
my $org_ids_aref = &$get_em( $pkg, $search_href, 1 )

Function used by lookup() and list() to return a list of Bric::Biz::Org objects or, if called with an optional third argument, returns a list of Bric::Biz::Org object IDs (used by list_ids()).

Throws:

Side Effects: NONE.

Notes: NONE.

my $addr_col = &$get_addr_coll($self)

Returns the collection of addresses for this organization. The collection is a Bric::Util::Coll::Addr object. See that class and its parent, Bric::Util::Coll, for interface details.

Throws:

NOTES

NONE.

AUTHOR

David Wheeler <david@wheeler.net>

SEE ALSO

Bric, Bric::Biz::Person

POD ERRORS

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

Around line 309:

=back doesn't take any parameters, but you said =back 4

Around line 464:

Expected '=item *'

Around line 466:

Expected '=item *'

Around line 468:

Expected '=item *'

Around line 470:

Expected '=item *'

Around line 472:

Expected '=item *'

Around line 474:

Expected '=item *'

Around line 476:

Expected '=item *'

Around line 847:

Expected '=item *'

Around line 890:

Expected '=item *'

Around line 892:

Expected '=item *'

Around line 952:

Expected '=item *'

Around line 1013:

Expected '=item *'

Around line 1015:

Expected '=item *'

Around line 1078:

Expected '=item *'

Around line 1171:

=back doesn't take any parameters, but you said =back 4

Around line 1173:

You forgot a '=back' before '=head1'

Around line 1347:

You forgot a '=back' before '=head1'