Bric::Biz::Asset(3p)

NAME
Bric::Biz::Asset - A base class of behaviours that all assets must exhibit. An asset is anything that goes through workflow

VERSION
$LastChangedRevision$

DATE
$LastChangedDate: 2007-01-29 20:45:23 +0100 (Mon, 29 Jan 2007) $

SYNOPSIS
 # Class Methods
 $key_name = Bric::Biz::Asset->key_name()
 %priorities = Bric::Biz::Asset->list_priorities()
 $data = Bric::Biz::Asset->my_meths

 # looking up of objects
 ($asset_list || @assets) = Bric::Biz::Asset->list( $param )

 # General information
 $asset       = $asset->get_id()
 $asset       = $asset->set_name($name)
 $name        = $asset->get_name()
 $asset       = $asset->set_description($description)
 $description = $asset->get_description()
 $priority        = $asset->get_priority()
 $asset           = $asset->set_priority($priority)

 $site_id     = $asset->get_site_id()
 $asset       = $asset->set_site_id($site_id)

 # User information
 $usr_id      = $asset->get_user__id()
 $modifier    = $asset->get_modifier()

 # Version information
 $vers        = $asset->get_version();
 $vers_id     = $asset->get_version_id();
 $current         = $asset->get_current_version();
 $checked_out = $asset->get_checked_out()

 # Publish info
 $needs_publish = $asset->needs_publish();

 # Expire Data Information
 $asset           = $asset->set_expire_date($date)
 $expire_date = $asset->get_expire_date()

 # Desk information
 $desk        = $asset->get_current_desk;
 $asset       = $asset->set_current_desk($desk);

 # Workflow methods.
 $id    = $asset->get_workflow_id;
 $obj   = $asset->get_workflow_object;
 $asset = $asset->set_workflow_id($id);

 # Access note information
 $asset         = $asset->set_note($note);
 my $note       = $asset->get_note;
 my $notes_href = $asset->get_notes()

 # Access active status
 $asset            = $asset->deactivate()
 $asset            = $asset->activate()
 ($asset || undef) = $asset->is_active()

 $asset = $asset->save()

 # returns all the groups this is a member of
 ($grps || @grps) = $asset->get_grp_ids()

DESCRIPTION
Asset is the Parent Class for everything that will go through Workflow. It contains data and actions that are common to all of these objects. Asset holds information on desks visited by the object, notes associated with the object, and versioning information. Actions that can be preformed are fork which prepares an object to be edited in a checked out state, cancel, which cancels the fork, merge which takes the forked object compares it to the stored main version and creates a new version and revert which is called on a forked object which returns the state of the object at a given version id.

A fork will preform a copy in the database keeping the asset id, and version number the same but will associate a user with the object.

INTERFACE

  Constructors

$asset = Bric::Biz::Asset::Business::Story->lookup({ id => $id })
$asset = Bric::Biz::Asset::Business::Media->lookup({ id => $id })
$asset = Bric::Biz::Asset::Template->lookup({ id => $id })
    This will return an asset that matches the ID provided.

    Throws:

    "Missing required parameter 'id'"

    Side Effects:

    NONE

    Notes:

    NONE

(@stories || $stories) = Bric::Biz::Asset::Business::Story->list($params)
(@media_objs || $media) = Bric::Biz::Asset::Business::Media->list($params)
(@template_objs || $templates) = Bric::Biz::Asset::Business::Template->list($params)
    See Also:

    Bric::Biz::Asset::Business::Story->list()
    Bric::Biz::Asset::Business::Media->list()
    Bric::Biz::Asset::Business::Template->list()
(@ids||$ids) = Bric::Biz::Asset::Business::Story->list_ids($params)
(@ids||$ids) = Bric::Biz::Asset::Business::Media->list_ids($params)
(@ids||$ids) = Bric::Biz::Asset::Business::Template->list_ids($params)
    See Also:

    Bric::Biz::Asset::Business::Story->list_ids()
    Bric::Biz::Asset::Business::Media->list_ids()
    Bric::Biz::Asset::Business::Template->list_ids()

  Destructors

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

my $key_name = Bric::Biz::Asset->key_name()
    Returns the key name of this class.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

my (%priorities || $priorities_href) = $asset->list_priorities()
    Returns a list or anonymous array of the priority labels. Each key is the priority number, and the corresponding value is its label.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

$meths = Bric::Biz::Asset->my_meths
(@meths || $meths_aref) = Bric::Biz::Asset->my_meths(TRUE)
my (@meths || $meths_aref) = Bric::Biz::Asset->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 representing the values and display names to use in a select list.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

  Public Instance Methods

$versions = $asset->get_versions
    Returns an array or array reference the previous versions of this asset in order from the first to the current.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$name = $self->get_name()
    Returns the name field from Assets

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$self = $self->set_name()
    Sets the name field for Assets

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$site_id = $asset->get_site_id
    Returns the ID of the site this asset is a part of.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

$site = $asset->get_site
    Returns the the site this asset is a part of.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

$description = $self->get_description()
    This returns the description for the asset

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$self = $self->set_description()
    This sets the description on the asset

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$priority = $asset->get_priority()
    This will return the priority that is set upon the asset

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$asset = $asset->set_priority($priority)
    This will set the priority for the asset

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$version = $asset->get_version()
    Returns the version that this asset represents.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$user__id = $asset->get_user__id()
    Returns the user__id of the person to whom the asset is checked out to

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$version_id = $asset->get_version_id()
    Returns the database id of the version of this asset.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$current_version = $asset->get_current_version()
    Returns the version that is the current one.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$user__id = $asset->get_modifier()
    Returns the user id of the person who edited this version of the asset. If the asset is checked out it will be the same as the user who checked it out.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$publish_status = $asset->get_publish_status()
    returns the publish status flag

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$asset = $asset->set_publish_status($status)
    sets the publish status flag.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$needs_publish = $asset->needs_publish()
    Compares current_version and published_version from asset table. If the same, needs_publish returns 0. If different, returns 1.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$checked_out = $asset->get_checked_out()
    Returns the checked out flag

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$self = $story->set_expire_date($expire_date)
    Sets the expire date.

    Throws:

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

    *   Unable to unpack date.

    *   Unable to format date.

    *   Incorrect number of args to Bric::_set().

    *   Bric::set() - Problems setting fields.

    Side Effects:

    NONE

    Notes:

    NONE

my $expire_date = $story->get_expire_date($format)
    Returns expire date.

    Throws:

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

    *   Unable to unpack date.

    *   Unable to format date.

    Side Effects:

    NONE

    Notes:

    NONE

$self = $self->set_current_desk($desk_object);
    This method takes a desk stamp object and adds it to the asset object

    Side Effects:

    Adds the asset_grp_id of the desk to grp_ids (unless it was already there).

$ld = $self->get_current_desk;
    This returns the desk stamp of the desk that the object is currently at

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

$self = $self->remove_from_desk
    Removes the asset from the current desk.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

$id = $asset->get_id()
    This returns the id that uniquely identifies this asset.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$id = $asset->get_workflow_id
    Returns the workflow ID that this asset is a part of

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$asset = $asset->set_workflow_id( $w_ID );
    Sets the workflow that this asset is a member of

    Side Effects:

    Adds the asset group ID of the workflow to grp_ids unless it was already there.

$workflow_obj = $asset->get_workflow_object();
    Returns the workflow object that this asset is associated with

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$id = $asset->get_desk_id
    Returns the ID for the desk the asset is currently on.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

my @grp_ids = $asset->get_grp_ids
my $grp_ids_aref = $asset->get_grp_ids
    Returns the IDs for all the groups of which the asset is an active member.

    Throws: NONE.

    Side Effects: NONE.

    Notes: This method overrides "Bric::get_grp_ids()" in order to add the site ID to the list of IDs. This works because the site ID corresponds to a secret group ID.

$self = $self->cancel
    Reverts the actions of a fork with out committing any changes. Deletes row for the checked out asset.

    Throws:

    NONE

    Side Effects:

    Removes the Asset (version) record from the database

    Notes:

    NONE

$self->set_note($note);
$self->add_note($note);
    Sets the note for this instance of the assset.

    Throws: NONE.

    Side Effects: NONE.

    Notes: "add_note()" is deprecated.

my $note = $asset->get_note
    Returns the note for this instance of the asset.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

my $notes_href = $asset->get_notes;
    Returns a hash reference of the notes for the asset. The hash keys are asset version numbers, and the values are the notes.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

my $bool = $asset->has_notes
    Returns true if the asset has notes in any of its versions, and false if it does not.

$asset = $asset->activate()
    This will activate a nonactive asset

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$asset = $asset->deactivate()
    This will set the asset to a non active state

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

($asset || undef) = $asset->is_active()
    Returns the object if it is active, undef otherwise

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$self = $self->cancel_checkout
    Cancels the checkout. Deletes the version instance record.

    Throws:

    "Cannot cancel a non checked out asset"

    Side Effects: NONE.

    Notes: NONE.

$asset = $asset->checkin
    Checks the asset in.

    Throws:

    *   Cannot checkin non checked out versions.

    Side Effects: NONE.

    Notes: NONE.

PRIVATE

  Private Class Methods
NONE

  Private Instance Methods
NONE

  Private Functions
NONE

AUTHOR

michael soderstrom <miraso@pacbell.net>
Mark Jaroski <jaroskim@who.int>
David Wheeler <david@kineticode.com>

SEE ALSO
Bric.pm,Bric::Util::Group::AssetVersion