NAME

Bric::Util::EventType - Interface to Types of Events

VERSION

$Revision: 1.7 $

DATE

$Date: 2002/08/30 22:13:41 $

SYNOPSIS

# Constructors
my $et = Bric::Util::EventType->lookup({name => 'Story Published'});
my @ets = Bric::Util::EventType->list($params);

# Class Methods.
my @et_ids = Bric::Util::EventType->list_ids($params);
my $trig_meths = Bric::Util::EventType->my_trig_meths;

# Instance Methods
my $id = $et->get_id;
my $key_name = $et->get_key_name;
my $name = $et->get_name;
my $desc = $et->get_description;
my $class = $et->get_class;
my @attr = $et->get_attr;
$et = $ae->activate;
$et = $ae->deactivate;
$et = $ae->is_active;
my $event = $et->log_event($user, $obj);

DESCRIPTION

Bric::Util::EventType is designed to be the interface to the different types of events Bricolage. New events cannot be created; they are defined ahead of time in the database. Thus, the primary purpose of this class is to offer up a list of events for which alerts can be set by Bric::Util::AlertType. Internally, it can be used by the Bricolage APIs to log individual events.

INTERFACE

Constructors

my $et = Bric::Util::EventType->lookup({id => $et_id})
my $et = Bric::Util::EventType->lookup({key_name => $key_name})

Looks up and instantiates a new Bric::Util::EventType object based on a Bric::Util::EventType object ID or name. If the existing object is not found in the database, lookup() returns undef.

Throws:

Side Effects: If $id or $key_name is found, populates the new Bric::Util::EventType object with data from the database before returning it.

Notes: NONE.

my (@ets || $ets_aref) = Bric::Util::EventType->list($params)

Returns a list or anonymous array of Bric::Util::EventType objects based on the search parameters passed via a hashref. The supported lookup keys are:

Throws:

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

Notes: NONE.

Destructors

$p->DESTROY

Dummy method to prevent wasting time trying to AUTOLOAD DESTROY.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

Public Class Methods

my (@et_ids || $et_ids_aref) = Bric::Util::EventType->list_ids($params)

Returns a list or anonymous array of Bric::Util::EventType object IDs based on the search parameters passed via anonymous hash. The search parameters are the same as those for list() above.

Throws:

Side Effects: NONE.

Notes: NONE.

my (@classes || $classes_aref) = Bric::Util::EventType->list_classes()

Returns a list or an anonymous array of anonymous arrays of Bricolage classes for which types of events have been defined in the database. The each array ref in the list contains two values: the first is the ID of the class, and the second is its display name.

Throws:

Side Effects: NONE.

Notes: NONE.

$meths = Bric::Util::EventType->my_meths
(@meths || $meths_aref) = Bric::Util::EventType->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.

my $meths = Bric::Util::EventType->my_trig_meths
my @meths = Bric::Util::EventType->my_trig_meths(1)

Functions similarly to the my_meths() method on most business objects, except that it returns that metadata for accessing data on users.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

Public Instance Methods

my $id = $et->get_id

Returns the event type object ID.

Throws:

Side Effects: NONE.

Notes: NONE.

my $key_name = $et->get_key_name

Returns the event type key name.

Throws:

Side Effects: NONE.

Notes: NONE.

my $name = $et->get_name

Returns the event type name.

Throws:

Side Effects: NONE.

Notes: NONE.

my $description = $et->get_description

Returns the event type description.

Throws:

Side Effects: NONE.

Notes: NONE.

my $class = $et->get_class

Returns name of the class of object for which events of this type may be logged.

Throws:

Side Effects: NONE.

Notes: NONE.

my $attr_href = $et->get_attr

Returns an anonymous hash of the attributes required of Bric::Util::Event objects of this Bric::Util::EventType type. The keys are the attribute names and the values are the default values.

Throws:

Side Effects: Uses Bric::Util::Grp::Event internally.

Notes: NONE.

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

$self = $et->is_active

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

Throws:

Side Effects: NONE.

Notes: NONE.

my $event = $et->log_event($user, $obj)
my $event = $et->log_event($user, $obj, $ettr)

A shortcut to Bric::Util::Event->new. Pass in a Bric::Biz::Person::User object and an object of the type defined by get_class(), along with any attribute/value pairs, and a new event of this type will be logged for the object passed. Note that not all attributes need to be explicitly passed in order to log a new event. Any that can be called via a get_ accessor on $obj, where the method combines 'get_' with an attribute's name, will automatically call that accessor.

See Bric::Util::Event for more information and for details on how it expects arugments to be passed.

Throws:

Side Effects: Uses Bric::Util::Event->new() internally.

Notes: NONE.

my (@props || $props_aref) = $et->get_alert_props

Returns a list or anonymous arry of anonymous arrays that define properties that a user can use to refine which events of a specific type will trigger alerts. Each anonymous array within the list of alert properties contains two values. The first is the name of the property, and the second is the display name.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

PRIVATE

Private Class Methods

NONE.

Private Instance Methods

NONE.

Private Functions

my $event_types_aref = &$get_em( $pkg, $params )
my $event_types_aref = &$get_em( $pkg, $params, 1 )

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

Throws:

Side Effects: NONE.

Notes: NONE.

my $et = &$make_obj( $pkg, $init )

Instantiates a Bric::Util::EventType object. Used by &$get_em().

Throws:

Side Effects: NONE.

Notes: NONE.

NOTES

This is an early draft of this class, and therefore subject to change.

AUTHOR

David Wheeler <david@wheeler.net>

SEE ALSO

Bric, Bric::Util::Event, Bric::Util::AlertType, Bric::Util::Alert

POD ERRORS

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

Around line 250:

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

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 478:

Expected '=item *'

Around line 961:

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