Name

Bric::Biz::ElementType::Subelement - Maps a subelement ElementType to its parent's Element Types with occurrence relations and place.

Synopsis

use Bric::Biz::ElementType::Subelement;

# Constructors.
my $subelem = Bric::Biz::ElementType::Subelement->new($init);
my $subelems_href = Bric::Biz::ElementType::Subelement->href($params);

# Instance methods.
my $element_type_id = $subelem->get_parent_element_type_id;
$subelem->set_parent_element_type_id($element_type_id);

my $min = $subelem->get_min_occurrence;
$subelem->set_min_occurrence($min);

my $max = $subelem->get_max_occurrence;
$subelem->set_max_occurrence($max);

my $place = $subelem->get_place;
$subelem->set_place($place);

$subelem->save;

Description

This subclass of Bric::Biz::ElementType manages the relationship between parent ElementTypes and subelement ElementTypes. It contains information on the minimum and maximum occurrence that can be used, and also the place it should appear in when displaying. This class provides accessors to the relevant properties, as well as an href() method to help along the use of a Bric::Util::Coll object.

Interface

This class inherits the majority of its interface from Bric::Biz::ElementType. Only additional methods are documented here.

Constructors

my $subelem = Bric::Biz::ElementType::Subelement->new($init);

Constructs a new Bric::Biz::ElementType::Subelement object intialized with the values in the $init hash reference and returns it. The suported values for the $init hash reference are the same as those supported by Bric::Biz::ElementType::Subelement->new, with the addition of the following:

child_id

The ID of the element type object on which the new Bric::Biz::ElementType::Subelement will be based. The relevant Bric::Biz::ElementType object will be looked up from the database. Note that all of the $init parameters documented in Bric::Biz::ElementType will be ignored if this parameter is passed.

child

The element type object on which the new Bric::Biz::ElementType::Subelement will be based. Note that all of the $init parameters documented in Bric::Biz::ElementType will be ignored if this parameter is passed.

parent_id

The ID of the Bric::Biz::ElementType object to which this subelement is mapped.

min_occurrence

The minimum occurrence that the child ElementType must exist within any element with the parent ElementType

max_occurrence

The maximum occurrence that the child ElementType may exist within any element with the parent ElementType. A max of 0 means that there is no maximum.

place

The place that the child exists in relation to the other children within the parent element type.

Throws:

Side Effects: If you pass in an element type object via the child parameter, that element type will be converted into a Bric::Biz::ElementType::Subelement object.

Notes: NONE.

my $subelem_href = Bric::Biz::ElementType::Subelement->href({ parent_id => $eid });

Returns a hash reference of Bric::Biz::ElementType::Subelement objects. Each hash key is a Bric::Biz::ElementType::Subelement ID, and the values are the corresponding Bric::Biz::ElementType::Subelement objects. Only a single parameter argument is allowed, parent_id, though ANY may be used to specify a list of element type IDs. All of the child element types associated with that parent element type ID will be returned.

Throws:

Side Effects: NONE.

Notes: NONE.

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

Public Instance Methods

my $eid = $subelem->get_parent_id

Returns the ID of the Element Type definition of the parent with which this sub element is associated.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

$subelem = $subelem->set_parent_id($eid)

Sets the ID of the parent element type definition with which this sub element is associated.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

$subelem = $subelem->set_min_occurrence($min)

Set the minimum occurrence for this subelement

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

$min = $subelem->get_min_occurrence

Get the minimum occurrence for this subelement

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

$subelem = $subelem->set_max_occurrence($max)

Set the maximum occurrence for this subelement

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

$max = $subelem->get_max_occurrence

Get the maximum occurrence for this subelement

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

$subelem = $subelem->set_place($place)

Set the place for this subelement

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

$place = $subelem->get_place

Get the place for this subelement

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

$subelem = $subelem->remove

Marks this parent/child element type association to be removed. Call the save() method to remove the mapping from the database.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

$subelem = $subelem->save

Saves the subelement.

Throws:

Side Effects: NONE.

Notes: NONE.

Notes

NONE.

Author

David Wheeler <christian.muise@gmail.com>

See Also

Bric::Biz::ElementType,