Bric::Biz::Element(3p)

NAME
Bric::Biz::Element - Bricolage Document Element base class

VERSION
$LastChangedRevision$

DATE
$LastChangedDate: 2006-03-29 21:49:19 +0200 (Wed, 29 Mar 2006) $

SYNOPSIS
 my @elements = Bric::Biz::Element->list($params)

 $id = $element->get_id;
 $element = $element->activate;
 $element = $element->deactivate;
 my $active = $element->is_active;
 $element = $element->save;

DESCRIPTION
This class defins the common structure of elements, the building blocks of Bricolage story and media documents. There are two types of elements: container elements and data elements. Container elements can contain any number of container and data subelements. Data elements contain values, and corrspond to fields in the Bricolage UI. See Bric::Biz::Element::Container and Bric::Biz::Element::Field for details of their interfaces and how they vary from Bric::Biz::Element.

INTERFACE

  Constructors

my $element = Bric::Biz::Element->new($init)
    Constructs a new element. Its attributes can be initialized via the $init hash reference. See the subclasses for a list of parameters. Cannot be called directly, but must be called from a subclass.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

my @elements = Bric::Biz::Element->list($params)
    Searches for and returns a list or anonymous array of element objects. Cannot be called directly, but must be called from a subclass.

    Throws:

    Method Not Implemented

    Side Effects: NONE.

    Notes: NONE.

  Destructors

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

  Public Class Methods

$meths = Bric::Biz::Element->my_meths
my @meths = Bric::Biz::Element->my_meths(TRUE)
my @meths = Bric::Biz::Element->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.

my @elements = Bric::Biz::Element->list($params)
    Searches for and returns a list or anonymous array of element object IDs. Cannot be called directly, but must be called from a subclass.

    Throws:

    Method Not Implemented

    Side Effects: NONE.

    Notes: NONE.

  Public Instance Methods

my $id = $p->get_id
    Returns the element ID.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

my $name = $p->get_name
    Returns the element name.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

my $key_name = $p->get_key_name
    Returns the element key name.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

my $description = $p->get_description
    Returns the element description.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

my $parent_id = $p->get_parent_id
    Returns the ID of the element's parent element.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

$p->set_parent_id($parent_id)
    Sets the ID of the element's parent element.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

my $place = $p->get_place
    Returns the element place, that is, its place in the order of subelements of the parent element.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

$p->set_place($place)
    Sets the element place, that is, its place in the order of subelements of the parent element.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

my $object_type = $p->get_object_type
    Returns the element object type ("story" or "media");

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

$p->set_object_type($object_type)
    Sets the element object type ("story" or "media");

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

my $object_instance_id = $element->get_object_instance_id
    Returns the ID of the version of the document (story or media) that the element is associated with.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

$element->set_object_instance_id($object_instance_id)
    Sets the ID of the version of the document (story or media) that the element is associated with.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

my $has_name = $element->has_name($name);
    Returns true if an element has a name matching the $name argument. Note that this is not a direct comparison to the "name" attribute of the element object. Rather, it converts $name so that it is all lowercase and its non-alphanumeric characters are changed to underscores. The resulting value is then compared to the element's "key_name" attribute. In general, it's a better idea to use "has_key_name()", or to do direct key name comparisons yourself. This method is provided for backwards compatability.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

my $has_key_name = $element->has_key_name($key_name)
    Returns true if an element has a key name matching the $key_name argument.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

$parent_element = $element->get_parent
    Returns the parent element object.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

$element = $element->activate
    Activates the element.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

$element = $element->deactivate()
    Deactivates the element.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

my $is_active $element->is_active
    Returns true if the element is active, and false if it is not.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

PRIVATE
NONE

  Private Class Methods
NONE

  Private Instance Methods
NONE

NOTES
NONE

AUTHOR
michael soderstrom <miraso@pacbell.net>

SEE ALSO
perl, Bric, Bric::Biz::Asset::Business::Story, Bric::Biz::Asset::Business::Media, Bric::Biz::ElementType, Bric::Biz::Element::Container, Bric::Biz::Element::Tile