Bric::Biz::Asset::Template(3p)

NAME
Bric::Biz::Asset::Template - Template assets

VERSION
$LastChangedRevision$

DATE
$LastChangedDate: 2006-06-14 20:40:21 +0200 (Wed, 14 Jun 2006) $

SYNOPSIS
 # Creation of Objects
 $fa = Bric::Biz::Asset::Template->new( $init )
 $fa = Bric::Biz::Asset::Template->lookup( { id => $id })
 ($fa_list || @fas) = Bric::Biz::Asset::Template->list( $param )
 ($faid_list || @fa_ids) = Bric::Biz::Asset::Template->list_ids( $param )

 # get / set the data that is contained with in
 $fa = $fa->set_data()
 $data = $fa->get_data()

 # get the file name that this will be deployed to
 $file_name = $fa->get_file_name()

 # get / set the date that this will activate
 $date = $fa->get_deploy_date()
 $fa = $fa->set_deploy_date($date)

 # get the output channel that this is associated with
 $output_channel_id = $fa->get_output_channel__id()

 # get the asset type that this is associated with
 $element_type_id = $fa->get_element_type_id()

 # get the category that this is associated with
 $category_id = $fa->get_category_id()

 # Methods Inheriated from Bric::Biz::Asset

 # 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)

 # 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()

 # 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
This has changed, it will need to be updated in a bit

INTERFACE

  Constructors

$fa = Bric::Biz::Asset::Template->new( $initial_state )
    Constructs a new template.

    Supported Keys:

    *   description

    *   data

    *   deploy_date

    *   expire_date

    *   workflow_id

    *   output_channel - Required unless output channel id passed

    *   output_channel__id - Required unless output channel object passed

    *   tplate_type - The type of template it is.

    *   name - The name of the template. Only used if tplate_type is set to UTILITY_TEMPLATE.

    *   element_type - the at object

    *   element_type_id - the id of the asset type

    *   category - the category object

    *   category__id - the category id

    *   file_type - the type of the template file - this will be used as the extension for the file_name derived from the element name. Supported file_type values are those returned as the first value in each array reference in the array reference returned by "Bric::Util::Burner->list_file_types".

    Throws:

    *   Missing required output channel parameter.

    *   Missing required parameter 'element_type' or 'element_type_id'.

    *   Invalid file_type parameter.

    *   Missing required parameter 'name'

    *   Invalid tplate_type parameter.

    *   Missing required parameter 'category' or 'category_id'.

    *   The template already exists in the output channel.

    Side Effects: NONE.

    Notes: NONE.

$template = Bric::Biz::Template->lookup( $param )
    Returns an object that matches the parameters

    Supported Keys

    id  A template asset ID.

    version
        Pass to request a specific version otherwise the most current will be returned.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    Inherited from Bric::Biz::Asset.

($fa_list || @fas) = Bric::Biz::Asset::Template->list( $criteria )
    Returns a list or anonymous array of Bric::Biz::Asset::Template objects based on the search parameters passed via an anonymous hash. The supported lookup keys are:

    name
        The name of a template. May use "ANY" for a list of possible values.

    title
        Same as "name".

    file_name
        The file name of a template. May use "ANY" for a list of possible values.

    description
        Template description. May use "ANY" for a list of possible values.

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

    exclude_id
        A template ID to exclude from the list. May use "ANY" for a list of possible values.

    version
        The template version number. May use "ANY" for a list of possible values.

    version_id
        The ID of a version of a template. May use "ANY" for a list of possible values.

    active
        Defaults to true

    user_id
        If defined will return the versions checked out to the user with this id. Otherwise , unless "checked_out" is passed, it will return the most current non-checked out versions.

    site_id
        Returns a list of templates associated with a given site ID. May use "ANY" for a list of possible values.

    site
        Returns a list of templates associated with a given site name. May use "ANY" for a list of possible values.

    category_id
        Returns a list of templates in the category represented by a category ID. May use "ANY" for a list of possible values.

    deployed_version
        Returns the versions of the templates as they were last deployed. The "checked_out" parameter will be ignored if this parameter is passed a true value.

    published_version
        An alias for "deployed_version".

    category_uri
        Returns a list of templates with a given category URI. May use "ANY" for a list of possible values.

    checked_out
        Indicates whether to list templates that are checked out or not. If "0", then only non-checked out templates will be returned. If "1", then only checked-out templates will be returned. If "all", then the checked_out attributed will be ignored (unless the "user__id" parameter is passed).

    checked_in
        If passed a true value, this parameter causes the checked in version of the most current version of the template to be returned. When a template is checked out, there are two instances of the current version: the one checked in last, and the one currently being edited. When the "checked_in" parameter is a true value, then the instance last checked in is returned, rather than the instance currently checked out. This is useful for users who do not currently have a template checked out and wish to see the template as of the last check in, rather than as currently being worked on in the current checkout. If a template is not currently checked out, this parameter has no effect.

    return_versions
        Will return all the versions of the given templates

    element_type_id
        Returns a list of templates associated with a given element type ID. May use "ANY" for a list of possible values.

    element_key_name
        Returns a list of templates associated with an element with the given key name. May use "ANY" for a list of possible values.

    note
        Returns templates with a note matching the value associated with any of their versions. May use "ANY" for a list of possible values.

    workflow_id
        Return a list of templates in the workflow represented by the workflow ID. May use "ANY" for a list of possible values.

    desk_id
        Returns a list of templates on a desk with the given ID. May use "ANY" for a list of possible values.

    output_channel_id
        Returns a list of templates associated with a given output channel ID. May use "ANY" for a list of possible values.

    priority
        Returns a list of templates associated with a given priority value. May use "ANY" for a list of possible values.

    deploy_status
        Boolean value indicating whether to return deployed or undeployed templates.

    deploy_date_start
        Returns a list of templates last deployed on or after a given date/time.

    deploy_date_end
        Returns a list of templates last deployed on or before a given date/time.

    expire_date_start
        Returns a list of templates with a expire date on or after a given date/time.

    expire_date_end
        Returns a list of templates with a expire date on or before a given date/time.

    grp_id
        Returns a list of templates that are members of the group with the specified group ID. May use "ANY" for a list of possible values.

    active
        Boolean indicating whether to return active or inactive templates.

    simple
        Triggers a single OR search that hits name and file name.

    Order
        A property name or array reference of property names to order by.

    OrderDirection
        The direction in which to order the records, either "ASC" for ascending (the default) or "DESC" for descending. This value is applied to the property specified by the "Order" parameter, and may also be an array reference. If no value is supplied for any "Order" property name, it will default to ascending.

    Limit
        A maximum number of objects to return. If not specified, all objects that match the query will be returned.

    Offset
        The number of objects to skip before listing the remaining objcts or the number of objects specified by "Limit".

    Throws: NONE.

    Side Effects: NONE.

    Notes:

    Inherited from Bric::Biz::Asset.

  Destructors

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

  Public Class Methods

($ids || @ids) = Bric::Biz::Asset::Template->list_ids($param)
    Returns an unordered list or array reference of template object IDs that match the criteria defined. The criteria are the same as those for the "list()" method except for "Order" and "OrderDirection", which "list_ids()" ignore.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    Inherited from Bric::Biz::Asset.

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

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$meths = Bric::Biz::Asset::Template->my_meths
(@meths || $meths_aref) = Bric::Biz::Asset::Formattiong->my_meths(TRUE)
my (@meths || $meths_aref) = Bric::Biz:::Asset::Template->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.

my $tplate_type = Bric::Biz::Asset::Template->get_tplate_type_code($str)
    Returns the template type number for a string value as returned by "get_tplate_type_string()".

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

my $wf_type = Bric::Biz::Asset::Template->workflow_type
    Returns the value of the Bric::Biz::Workflow "TEMPLATE_WORKFLOW" constant.

  Public Instance Methods

$template = $template->set_deploy_date($date)
$template = $template->set_cover_date($date)
    Sets the deployment date for this template

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$date = $template->get_deploy_date()
$date = $template->get_cover_date()
    Returns the deploy date set upon this template

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$status = $template->get_deploy_status()
$template = $template->get_publish_status()
    Returns the deploy status of the template asset

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    this will return the deploy date

$template = $template->set_deploy_status()
$template = $template->set_publish_status()
    sets the deploy status for this template

    Throws:

    NONE

    Side Effect:

    NONE

    Notes:

    This is really the deploy date

$uri = $template->get_uri
    Returns the URI for the template. This differs from the file_name in that the latter uses the semantics of your local file system.w

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$file_name = $template->get_file_name()
    Returns the file path of this template.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$name = $template->get_output_channel_name;
    Return the name of the output channel.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$oc = $template->get_output_channel;
$oc = $template->get_primary_oc;
    Return the output channel associated with this Template asset. The "get_primary_oc()" alias is provided to be compatible with business assets.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

my $tplate_type_string = $template->get_tplate_type_string
    Returns a the stringified name of the template type attribute.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

$name = $template->get_element_name;
    Return the name of the element associated with this object.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$key_name = $template->get_element_key_name;
    Return the key name of the element associated with this object.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$at_obj = $template->get_element_type
    Return the element type object for this template asset.

    Throws: NONE.

    Side Effects: NONE.

    Notes: "get_element()" has been deprecated in favor of this method.

$fa = $fa->set_category_id($id)
    Sets the category id for this template asset

    Throws:

    *   The template already exists in the output channel.

    Side Effects:

    NONE

    Notes:

    NONE

$fa = $fa->get_cagetory_id
    Get the category ID for this template asset.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$fa = $fa->get_category
    Returns the category object that has been associated with this template asset.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$fa = $fa->get_cagetory_path
    Returns the path from the category

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$fa = $fa->get_cagetory_name
    Get the category name of the category object associated with this template asset.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$template = $template->set_data( $data )
    Set the main data for the template asset. In future incarnations there might be more data points that surround this, but not for now.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$data = $template->get_data()
    Returns the chunk of text that makes up this template.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$format = $format->checkout($param);
    This will create a flag to add a new record to the instance table

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

($fa || undef) = $fa->is_current()
    Return whether this is the most current version or not.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$fa = $fa->cancel()
    This cancles a checkout. This will delete the record from the database

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$fa = $fa->revert()
    This will take an older version and copy its data to this version

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$fa = $fa->save()
    this will update or create a record in the database

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

  PRIVATE
    ################################################################################

  Private Instance Methods

$cat_obj = $self->_get_category_object()
    Returns the category object that this is associated with

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$self = $self->_insert_template();
    Inserts a row into the template table that represents a new template Asset.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$self = $self->_insert_instance()
    Inserts a row associated with an instance of a template asset

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$self = $self->_update_template()
    Updates the template table

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$self = $self->_update_instance()
    Updates the row related to the instance of the template asset

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$self = $self->_delete_template()
    Removes the row associated with this template asset from the database

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$self = $self->_delete_instance()
    Removes the instance specific row from the database

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

my $uri = $self->_build_file_name($file_type, $name, $cat);
    Builds the file name for a template. If $file_type, $name, or $cat are not passed, they'll be fetched (or for $file_type, computed) from $self.

    Throws:

    *   The template already exists in the output channel.

    Side Effects: NONE.

    Notes: NONE.

  Private Functions

my $name = $set_elem->($init)
    Sets the name of the template based on an element association.

    Throws:

    *   Missing required parameter 'element' or 'element_type_id'.

    Side Effects: NONE.

    Notes: NONE.

my $name = $set_util->($init)
    Sets the name of the template as a utility template, based on the "name" parameter.

    Throws:

    *   Missing required parameter 'name'.

    Side Effects: NONE.

    Notes: NONE.

NOTES
NONE

AUTHOR
michael soderstrom - miraso@pacbell.net

SEE ALSO
Bric, Bric::Biz::Asset