Bric::Util::EventType - Interface to Types of Events $LastChangedRevision$ $LastChangedDate: 2006-03-18 01:26:34 +0100 (Sat, 18 Mar 2006) $ # 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); 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.

Constructors
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: Too many Bric::Util::EventType objects found. 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 or $key_name is found, populates the new Bric::Util::EventType object with data from the database before returning it. Notes: NONE. 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: Event type ID. May use "ANY" for a list of possible values. Event type key name. May use "ANY" for a list of possible values. Event type name. May use "ANY" for a list of possible values. Event type description. May use "ANY" for a list of possible values. Class package name to which event types apply. May use "ANY" for a list of possible values. ID of class object to which event types apply. May use "ANY" for a list of possible values. Throws: Unable to connect to database. Unable to prepare SQL statement. 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::Util::EventType object with data from the database before returning them all. Notes: NONE.

Destructors
Dummy method to prevent wasting time trying to AUTOLOAD DESTROY. Throws: NONE. Side Effects: NONE. Notes: NONE.

Public Class Methods
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: Unable to connect to database. Unable to prepare SQL statement. 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 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: Unable to connect to database. Unable to prepare SQL statement. 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. 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
Returns the event type object ID. Throws: Bad AUTOLOAD method format. Cannot AUTOLOAD private methods. Access denied: READ access for field 'id' required. No AUTOLOAD method. Side Effects: NONE. Notes: NONE. Returns the event type key name. Throws: Bad AUTOLOAD method format. Cannot AUTOLOAD private methods. Access denied: READ access for field 'key_name' required. No AUTOLOAD method. Side Effects: NONE. Notes: NONE. Returns the event type name. Throws: Bad AUTOLOAD method format. Cannot AUTOLOAD private methods. Access denied: READ access for field 'name' required. No AUTOLOAD method. Side Effects: NONE. Notes: NONE. Returns the event type description. 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. Returns name of the class of object for which events of this type may be logged. Throws: Bad AUTOLOAD method format. Cannot AUTOLOAD private methods. Access denied: READ access for field 'class' required. No AUTOLOAD method. Side Effects: NONE. Notes: NONE. 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: Bric::_get() - Problems retrieving fields. Too many Bric::Util::Grp::Event objects found. 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. Incorrect number of args to _set. Bric::_set() - Problems setting fields. Side Effects: Uses Bric::Util::Grp::Event internally. Notes: NONE. ################################################################################ Returns $self if the Bric::Util::EventType object is active, and undef if it is not. Throws: Bric::_get() - Problems retrieving fields. Side Effects: NONE. Notes: NONE. 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: No Bric::Util::EventType object, ID, or name passed to Bric::Util::Event::new(). Too many Bric::Util::EventType objects found. 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. Incorrect number of args to Bric::_set(). Bric::set() - Problems setting fields. Bric::Util::Event::new() expects an object of type $class. No Bric::Biz::Person::User object passed to Bric::Util::Event::new(). Side Effects: Uses Bric::Util::Event->new() internally. Notes: NONE. Returns a list or anonymous array 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 Class Methods
NONE.

Private Instance Methods
NONE.

Private Functions
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: 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. Instantiates a Bric::Util::EventType object. Used by &$get_em(). Throws: Unable to load action subclass. Invalid parameter passed to constructor method. Incorrect number of args to Bric::_set(). Bric::set() - Problems setting fields. Side Effects: NONE. Notes: NONE. NONE. David Wheeler <david@justatheory.com> Bric, Bric::Util::Event, Bric::Util::AlertType, Bric::Util::Alert