Name

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

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:

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.

$p = $p->set_description( $description )

Sets the element description, first converting non-Unix line endings.

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