Name

Bric::Util::Grp::Category - A module to group assets into categories.

Synopsis

use Bric::Util::Grp::Asset;

# Return a new category object.
my $bag = new Bric::Util::Grp::Asset($init);

my $bag = lookup Bric::Util::Grp::Asset({'id' => $cat_id});

my @bag = list Bric::Util::Grp::Asset($param);

# Get/set the name of this category.
$bag    = $bag->set_name($name);
$name   = $bag->get_name()

# Get/set the description of this category.
$bag    = $bag->set_description()
$desc   = $bag->get_description()

# Get the parent of this category.
$parent  = $bag->get_parent();

# Add one or more sub categories to this category.
$bag     = $bag->add_asset([@ba_obj]);
$bag     = $bag->add_media_id([$id]);
$bag     = $bag->add_story_id([$id]);

# Return all sub bagegories of this bagegory.
@bags    = $bag->get_assets();

# Save this category to the database.
$success = $bag->save();

# Remove this category from the database.
$success = $bag->remove();

Description

Allows assets to be grouped into categories. In addition to assets a category can contain other categories, allowing a hierarchical layout of categories and assets.

Interface

Constructors

$obj = new Bric::Util::Grp::Asset($init);

Inherited

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

@objs = lookup Bric::Util::Grp::Asset($cat_id);

Inherited

Throws:

NONE

Side Effects:

NONE

Notes:

This is the default lookup constructor which should be overrided in all derived classes even if it just calls 'die'.

@objs = list Bric::Util::Grp::Asset($param);

Inherited.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

Destructors

$self->DESTROY

Dummy method to prevent wasting time trying to AUTOLOAD DESTROY

Public Class Methods

NONE

Public Instance Methods

$class_id = Bric::Util::Grp::Asset->get_class_id()

This will return the class id that this group is associated with it should have an id that maps to the class object instance that is associated with the class of the grp ie Bric::Util::Grp::AssetVersion

Throws:

NONE

Side Effects:

NONE

Notes:

Overwrite this in your sub classes

my $h = $cat->get_supported_classes;

This supplies a package to table name mapping.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

my @list_classes = Bric::Util::Grp::Asset->get_list_classes

Returns a list or anonymous array of the supported classes in the group that can have their list() methods called in succession to assemble a list of member objects. This data varies from that stored in the keys in the hash reference returned by get_supported_classes in that some classes' list() methods may inherit from others, and we don't want the same list() method executed more than once.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

my $class = Bric::Util::Grp::Asset->my_class()

Returns a Bric::Util::Class object describing this class.

Throws: NONE.

Side Effects: NONE.

Notes: Uses Bric::Util::Class->lookup() internally.

my $class = Bric::Util::Grp::Asset->member_class()

Returns a Bric::Util::Class object describing the members of this group.

Throws: NONE.

Side Effects: NONE.

Notes: Uses Bric::Util::Class->lookup() internally.

$success = $grp->add_asset([$asset_obj]);

Add one or more sub categories to this category.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$success = $cat->grp_story_id([$story_id]);

Add a story asset ID.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$success = $grp->add_media_id([$media_id]);

Add a media asset ID.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$success = $grp->add_template_id([$media_id]);

Add a template ID.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

@assets = $grp->get_assets

Return all assets.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$success = $cat->remove();

Remove this category from the database.

Throws:

Side Effects:

NONE

Notes:

This call will remove itself and all its associations with keywords, other categories and assets. This will *not* delete the objects attached to these associations.

Private Methods

Private Class Methods

NONE

Private Instance Methods

NONE

Notes

NONE

Author

"Garth Webb" <garth@perijove.com> Bricolage Engineering

See Also

perl, Bric, Bric::Util::Grp