Bric::Dist::ActionType(3)

NAME
Bric::Dist::ActionType - Interface to types of actions supported by Bricolage distribution.

VERSION
$LastChangedRevision$

DATE
$LastChangedDate: 2004-08-12 17:13:34 -0700 (Thu, 12 Aug 2004) $

SYNOPSIS
  use Bric::Dist::ActionType;

  # Constructors.
  # Create a new object.
  my $at = Bric::Dist::ActionType->new;
  # Look up an existing object.
  $at = Bric::Dist::ActionType->lookup({ id => 1 });
  # Get a list of action type objects.
  my @servers = Bric::Dist::ActionType->list({ description => 'File%' });

  # Class methods.
  # Get a list of object IDs.
  my @st_ids = Bric::Dist::ActionType->list_ids({ description => 'File%' });
  # Get an introspection hashref.
  my $int = Bric::Dist::ActionType->my_meths;

  # Instance Methods.
  my $id = $at->get_id;
  my $name = $at->get_name;
  my $description = $at->get_description;
  my @medias = $at->get_media_types;
  my $medias = $at->get_medias_href;
  print "AT is ", $at->is_active ? '' : 'not ', "active\n";

DESCRIPTION
This class defines types of actions that can be performed on resources. Types of actions include "Akamaize," "Gzip," "Put," "Delete," etc. All actions are created at development time by Bricolage developers and cannot be created or changed by users. Users can specify what types of actions apply to jobs executed for given server types by accessing the Bric::Dist::Action class. Use Bric::Dist::ActionType objects to help define Bric::Dist::Action objects.

INTERFACE

  Constructors

my $at = Bric::Dist::ActionType->lookup({ id => $id })
my $at = Bric::Dist::ActionType->lookup({ name => $name })
    Looks up and instantiates a new Bric::Dist::ActionType object based on the Bric::Dist::ActionType object ID or name passed. If $id or $name is not found in the database, "lookup()" returns "undef".

    Throws:

    *   Too many Bric::Dist::Dist::ActionType objects found.

    *   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: If $id is found, populates the new Bric::Dist::ActionType object with data from the database before returning it.

    Notes: NONE.

my (@ats || $ats_aref) = Bric::Dist::ActionType->list($params)
    Returns a list or anonymous array of Bric::Dist::ActionType objects based on the search parameters passed via an anonymous hash. The supported lookup keys are:

    *   description

    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::Dist::ActionType object with data from the database before returning them all.

    Notes: NONE.

  Destructors

$at->DESTROY
    Dummy method to prevent wasting time trying to AUTOLOAD DESTROY.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

  Public Class Methods

my (@at_ids || $at_ids_aref) = Bric::Dist::ActionType->list_ids($params)
    Returns a list or anonymous array of Bric::Dist::ActionType object IDs based on the search criteria passed via an anonymous hash. The supported lookup keys are the same as those for list().

    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.

$meths = Bric::Dist::ActionType->my_meths
(@meths || $meths_aref) = Bric::Dist::ActionType->my_meths(TRUE)
my (@meths || $meths_aref) = Bric::Dist::ActionType->my_meths(0, TRUE)
    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:

    name
        The name of the property or attribute. Is the same as the hash key when an anonymous hash is returned.

    disp
        The display name of the property or attribute.

    get_meth
        A reference to the method that will retrieve the value of the property or attribute.

    get_args
        An anonymous array of arguments to pass to a call to get_meth in order to retrieve the value of the property or attribute.

    set_meth
        A reference to the method that will set the value of the property or attribute.

    set_args
        An anonymous array of arguments to pass to a call to set_meth in order to set the value of the property or attribute.

    type
        The type of value the property or attribute contains. There are only three types:

        short
        date
        blob
    len If the value is a 'short' value, this hash key contains the length of the field.

    search
        The property is searchable via the list() and list_ids() methods.

    req The property or attribute is required.

    props
        An anonymous hash of properties used to display the property or attribute. Possible keys include:

        type
            The display field type. Possible values are

            text
            textarea
            password
            hidden
            radio
            checkbox
            select
        length
            The Length, in letters, to display a text or password field.

        maxlength
            The maximum length of the property or value - usually defined by the SQL DDL.

    rows
        The number of rows to format in a textarea field.

    cols
        The number of columns to format in a textarea field.

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

  Public Instance Methods

my $id = $at->get_id
    Returns the ID of the Bric::Dist::ActionType object.

    Throws:

    *   Bad AUTOLOAD method format.

    *   Cannot AUTOLOAD private methods.

    *   Access denied: READ access for field 'id' required.

    *   No AUTOLOAD method.

    Side Effects: NONE.

    Notes: If the Bric::Dist::ActionType object has been instantiated via the new() constructor and has not yet been "save"d, the object will not yet have an ID, so this method call will return undef.

my $name = $at->get_name
    Returns the name of this type of action.

    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.

my $description = $at->get_description
    Returns the description of this type of action.

    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.

my (@medias || $medias_aref) = $at->get_media_types
    Returns a list or anonymous array of the media types that apply to this action. Returns an empty list (or undef in a scalar context) if this action applies to all media types.

    Throws:

    *   Bric::_get() - Problems retrieving fields.

    Side Effects: NONE.

    Notes: NONE.

my (@medias || $medias_aref) = $at->get_medias_href
    Returns an anonymous hash of the MEDIA types that apply to this action. Returns undef if this action applies to all MEDIA types.

    Throws:

    *   Bric::_get() - Problems retrieving fields.

    Side Effects: NONE.

    Notes: NONE.

$self = $st->is_active
    Returns $self if the Bric::Dist::ActionType object is active, and undef if it is not.

    Throws:

    *   Bric::_get() - Problems retrieving fields.

    Side Effects: NONE.

    Notes: NONE.

PRIVATE

  Private Class Methods
NONE.

  Private Instance Methods
NONE.

  Private Functions

my $at_aref = &$get_em( $pkg, $params )
my $at_ids_aref = &$get_em( $pkg, $params, 1 )
    Function used by lookup() and list() to return a list of Bric::Dist::ActionType objects or, if called with an optional third argument, returns a listof Bric::Dist::ActionType object IDs (used by list_ids()).

    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.

NOTES
NONE.

AUTHOR
David Wheeler <david@wheeler.net>

SEE ALSO
Bric