Bric::Biz::Workflow::Parts::Desk(3p)

NAME
Bric::Biz::Workflow::Parts::Desk - Desks in Workflow

VERSION
$LastChangedRevision$

DATE
$LastChangedDate: 2005-10-12 21:48:33 +0200 (Wed, 12 Oct 2005) $

SYNOPSIS
 use Bric::Biz::Workflow::Parts::Desk;

 my $desk = new Bric::Biz::Workflow::Parts::Desk($init);

 my $desk = lookup Bric::Biz::Workflow::Parts::Desk($param);

 my @dsks = list Bric::Biz::Workflow::Parts::Desk($param);

 my $name = $desk->get_name;
 my $desk = $desk->set_name($name);

 my $dscr = $desk->get_description;
 my $desk = $desk->set_description($dscr);

 $desk    = $desk->link_desk($param)

 $desk    = $desk->unlink_desk({});

 $desk    = $desk->add_rule({'rule_pkg'  => $pkg,
                             'rule_name' => $name})

 $desk    = $desk->del_rule({'rule_pkg'  => $pkg, 'rule_name' => $name});

 # Return a list of assets on this desk.
 @assets  = $desk->assets();

 # Transfer a asset to a different desk.
 $ret     = $desk->transfer($asset_obj, $another_desk);

 # Accept a asset from another desk.
 $ret     = $desk->accept($asset_obj);

 $desk    = $desk->save;

DESCRIPTION
A desk is something that defines the steps in a workflow. Assets arrive at a desk and remain there until they are approved and moved to the next desk in the workflow.

A desk may have any number of assets associated with it at any time. Users may checkout copies of these assets from the desk, make changes to them and check them back into the desk. Users may also get read only copies.

INTERFACE

  Constructors

$success = $obj = new Bric::Biz::Workflow::Parts::Desk($init);
    The following is a list of parameter keys and their associated values.

    Keys for $init are:

    *   name

        The name of this desk

    *   description

        A description of this desk

    *   publish

        Boolean; true if this is a publish desk

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

my $desk = Bric::Biz::Workflow::Parts::Desk->lookup({ id => $id });
my $desk = Bric::Biz::Workflow::Parts::Desk->lookup({ name => $name });
    Looks up and instantiates a new Bric::Biz::Workflow::Parts::Desk object based on the Bric::Biz::Workflow::Parts::Desk object ID or name passed. If $id or $name is not found in the database, "lookup()" returns "undef".

    Throws:

    *   Unable to prepare SQL statement.

    *   Unable to connect to database.

    *   Unable to select column into arrayref.

    *   Unable to execute SQL statement.

    *   Unable to bind to columns to statement handle.

    *   Unable to fetch row from statement handle.

    *   Too many Bric::Biz::Workflow::Parts::Desk objects found.

    Side Effects: NONE.

    Notes: NONE.

@objs = Bric::Biz::Workflow::Parts::Desk->list($param);
    Returns a list of desk objects based on $param. Keys of $param are:

    "id"
        Desk ID. May use "ANY" for a list of possible values.

    "name"
        Return all desks matching a certain name. May use "ANY" for a list of possible values.

    "description"
        Return all desks with a matching description. May use "ANY" for a list of possible values.

    "publish"
        Boolean; returns all desks that can or cannot publish assets.

    "active"
        Boolean; Return all in/active desks.

    "grp_id"
        Return all desks in the group corresponding to this group ID. May use "ANY" for a list of possible values.

    Throws:

    *   Unable to prepare SQL statement.

    *   Unable to connect to database.

    *   Unable to select column into arrayref.

    *   Unable to execute SQL statement.

    *   Unable to bind to columns to statement handle.

    *   Unable to fetch row from statement handle.

    Side Effects: NONE.

    Notes: Searches against "name" and "description" use the LIKE operator, so '%' can be used for substring searching.

(@ids || $ids) = Bric::Biz::Workflow::Parts::Desk->list_ids($params);
    Return a list of desk IDs. See "list()" for a list of the relevant keys in the $params hash reference.

    Throws:

    *   Unable to prepare SQL statement.

    *   Unable to connect to database.

    *   Unable to select column into arrayref.

    *   Unable to execute SQL statement.

    *   Unable to bind to columns to statement handle.

    *   Unable to fetch row from statement handle.

    Side Effects: NONE.

    Notes: Searches against "name" and "description" use the LIKE operator, so '%' can be used for substring searching.

  Destructors

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

  Public Class Methods

my $meths = Bric::Biz::Workflow::Parts::Desk->my_meths
my (@meths || $meths_aref) = Bric::Biz::Workflow::Parts::Desk->my_meths(TRUE)
my (@meths || $meths_aref) = Bric::Biz::Workflow::Parts::Desk->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

@assets = $desk->assets();
    Return a list of assets on this desk.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$ret = $desk->checkin($asset_obj);
$ret = $desk->checkout($asset_obj, $user_id);
    Checkin/checkout an asset from this desk.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$ret = $desk->transfer($param);
    Transfer an asset to a different desk. Keys for $param are:

    *   asset

        An asset object.

    *   to

        The desk to which this asset should be transfered.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$ret = $desk->accept($param);
    Accept an asset from another desk. Keys for $param are:

    *   from

        The desk from which this asset is coming. Can be omitted if this is the first desk in the workflow.

    *   asset

        The asset to accept.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$ret = $desk->remove_asset();
    Remove an asset from this desk.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$assets = $desk->get_assets;
    Return a list of assets on this desk.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$assets_href = $desk->get_assets_href;
    Return an anonymous hash of assets on this desk. The keys are the key names of the class of each asset, and the values are anonymous arrays of the assets of that type.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

$att || undef = $desk->can_publish
$att = $desk->make_publish_desk;
$att = $desk->make_regular_desk;
    Get/Set is-publish-desk flag.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$att || undef = $desk->is_active;
$att = $desk->activate;
$att = $desk->deactivate;
    Get/Set the active flag.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$desk->remove;
    Get/Set the active flag.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$desk = $desk->save;
    Checks the user to see if s/he has the right privileges to checkout stories.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

PRIVATE

  Private Class Methods
NONE

  Private Instance Methods
A few of these still need documenting.

_sync_checkin
_sync_checkout
_sync_transfer
$obj = $desk->_get_grp_obj($id_field, $obj_field)
    Retrieve the group object if it's set in this object. Otherwise, try to look it up via the ID field passed.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$desk = $desk->_insert_desk
    Insert values into the Desk table from the desk structure.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$desk = $desk->_update_desk
    Update values from the desk structure.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$desk = $desk->_remove_desk
    Remove this desk.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

  Private Functions

my $desk_aref = &$get_em( $pkg, $search_href )
my $desk_ids_aref = &$get_em( $pkg, $search_href, 1 )
    Function used by "lookup()" and "list()" to return a list of Bric::Biz::Workflow::Parts::Desk objects or, if called with an optional third argument, returns a list of Bric::Biz::Workflow::Parts::Desk object IDs (used by "list_ids()").

    Throws:

    *   Unable to prepare SQL statement.

    *   Unable to connect to database.

    *   Unable to select column into arrayref.

    *   Unable to execute SQL statement.

    *   Unable to bind to columns to statement handle.

    *   Unable to fetch row from statement handle.

    Side Effects: NONE.

    Notes: NONE.

NOTES
NONE

AUTHOR
Garth Webb <garth@perijove.com>

SEE ALSO
Bric, Bric::Biz::Workflow, perl