Name

Bric::Biz::Asset::Business - An object that houses the business Assets

Synopsis

# Constructor
$biz = Bric::Biz::Asset::Business->new($param);
# DB object looukp
$biz = Bric::Biz::Asset::Business->lookup({'id' => $biz_id});

# Getting a list of objects
($biz_asset_list||@biz_assets) = Bric::Biz::Asset::Business->list( $criteria )

# Geting a list of ids
($biz_ids || @biz_ids) = Bric::Biz::Asset::Business->list_ids( $criteria )


# 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)
$alias_id    = $asset->get_alias_id()
$asset       = $asset->set_alias_id($alias_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()

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

# Output channel associations.
my @ocs = $asset->get_output_channels;
$asset->add_output_channels(@ocs);
$asset->del_output_channels(@ocs);

# 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 is the parent class for all the documents, including stories and media documents. It inherits from Bric::Biz::Asset.

Assumption here is that all Business assets have rights, publish dates and keywords associated with them.

This class contains all the interfact to these data points

Interface

Constructors

$asset = Bric::Biz::Asset::Business->new( $initial_state )

new will only be called by Bric::Biz::Asset::Business's inherited classes

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

Destructors

$self->DESTROY

Dummy method to prevent wasting time trying to AUTOLOAD DESTROY.

my $key_name = Bric::Biz::Asset::Business->key_name()

Returns the key name of this class.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

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

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

Public Instance Methods

$uuid = $asset->get_uuid
$uuid = $asset->get_uuid_bin
$uuid = $asset->get_uuid_hex
$uuid = $asset->get_uuid_base64

These methods the UUID field for this document. get_uuid returns the string representation of the UUID, such as "7713585E-0501-11DA-B4F2-BC394F2854A1". This is the form of the UUID stored in the database. get_uuid_bin() returns the binary representation of the UUID. get_uuid_hex() returns the UUID as a hex string. get_uuid_base64() returns the base64-encoded representation of the UUID.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

$title = $asset->get_title()

Returns the title field for this asset

Throws:

NONE

Side Effects:

NONE

Notes:

title is the same as the name field

$asset = $asset->set_title($title)

sets the title for this asset

Throws:

NONE

Side Effects:

NONE

Notes:

title is the same as the name field

$alias_id = $biz->get_alias_id()

Returns the alias id from this business asset

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$biz = $biz->set_source_id($s_id)

Sets the source id upon this story

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$source = $biz->get_source_id()

Returns the source id from this business asset

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$at_id = $biz->get_element_type_id()

Returns the element type id that this story is associated with

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$biz = $biz->set_element_type_id($at_id)

Sets the element type id that this story is associated with.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

my $primary_oc_id = $p->get_primary_oc_id

Returns the asset's primary output channel ID.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

my $oc = $p->get_primary_oc

Returns the primary output channel object.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

$self = $p->set_primary_oc_id($primary_oc_id)

Sets the asset's primary output channel ID.

Throws: NONE.

Side Effects: The URIs for the asset will be changed.

Notes: NONE.

$biz->add_contributor($contrib, $role);

Takes a contributor object or id and their role in the context of this story and associates them

Throws:

Side Effects:

NONE

Notes:

NONE

($contribs || @contribs) = $story->get_contributors()

Returns a list or list ref of the contributors that have been assigned to this story

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$role = $biz->get_contributor_role($contrib)

Returns the role played by this contributor

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$story = $story->delete_contributors( $contributors )

Recieves a list of contributrs or their ids and deletes them from the story

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$asset = $asset->reorder_contributors(@contributors)

Takes a list of ids and sets the new order upon them

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

my @ocs = $biz->get_output_channels
my $ocs_aref = $biz->get_output_channels
my @ocs = $biz->get_output_channels(@oc_ids)
my $ocs_aref = $biz->get_output_channels(@oc_ids)

Returns a list or anonymous array of the output channels the business asset will be output to when it is published. If @oc_ids is passed, then only the output channels with those IDs are returned, if they're associated with this asset.

Throws:

Side Effects: NONE.

Notes: NONE.

$ba = $ba->add_output_channels(@ocs)

Adds output channels to the list of output channels to which this story will be output upon publication.

Throws: NONE.

Side Effects: NONE.

Throws:

Side Effects: NONE.

Notes: NONE.

$biz = $biz->del_output_channels(@ocs)
$biz = $biz->del_output_channels(@oc_ids)

Removes output channels from this asset, so that it won't be output to these output channels when it is published.

Throws: NONE.

Side Effects: NONE.

Throws:

Side Effects: NONE.

Notes: NONE.

get_element_name()

Returns the name of the asset type that this is based on. This is the same as the name of the top level element.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

get_element_key_name()

Returns the key name of the asset type that this is based on. This is the same as the key name of the top level element.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$ba->get_possible_field_types()
$ba->get_possible_data()

Returns a list or array reference of the field types that define the structure of fields that can be added to the business document's element.

Throws: NONE.

Side Effects: NONE.

Notes: get_possible_data() is the deprecated form of this method.

$ba->get_possible_containers()

Returns a list or array reference of the element types that define the structure of elements that can be added to the business document's element.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

$self = $story->set_cover_date($cover_date)

Sets the cover date.

Throws:

Side Effects:

NONE

Notes:

NONE

my $cover_date = $story->get_cover_date($format)

Returns cover date.

Throws:

Side Effects:

NONE

Notes:

NONE

my $first_publish_date = $story->get_first_publish_date($format)

Returns the date the business asset was first published.

Throws:

Side Effects: NONE.

Notes: NONE.

$self = $story->set_publish_date($publish_date)

Sets the publish date.

Throws:

Side Effects:

Also sets the first publish date if it hasn't been set before.

Notes:

NONE

$self = $story->set_first_publish_date($publish_date)

Sets the first publish date.

Throws:

Side Effects:

NONE.

Notes:

NONE

$self = $story->set_publish_status($bool)

Sets the publish status to a true or false value.

Throws: NONE.

Side Effects: Also sets the first published_version to the value stored in the version attribute if it hasn't been set before.

Notes: NONE.

$self = $story->set_published_version($version)

Sets the published version of the document.

Throws: NONE.

Side Effects: Also sets the first publishstatus if it's set to a false value.

Notes: NONE.

my $publish_date = $story->get_publish_date($format)

Returns publish date.

Throws:

Side Effects: NONE.

Notes: NONE.

$self = $story->mark_as_published
$doc->mark_as_published;
$doc->save;

If the document is not already marked as published, this method does so, setting the publish status and publish date and saving the story. Use with caution, since this method does not actually publish the document (no jobs are created and no templates are executed).

Throws: NONE.

Side Effects: Sets the publish_status to true and the publish_date to the current date and time, unless the document is already marked as published. The setting of <publish_date> causes the first_publish_date to be set to the same date.

Notes: This method is usually used when you have sucked the content of the asset into something else that you are really publishing and want this asset to be marked as published without creating any content on its own.

(@objs || $objs) = $asset->get_related_objects

Return all the related story or media objects for this business asset. If the asset is an alias of another asset, related objects will only be returned if they are in the same site as the asset, or if there are aliases in the asset's site for the related media associated with the aliased asset.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$element = $ba->get_element
my $element = $ba->get_element;
$element = $ba->get_element; # Deprecated form.

Returns the top level element that contains content for this document.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$elem_type = $self->get_element_type

Returns the element object that coresponds defines the structure of the elements of the document.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

$uri = $biz->get_primary_uri

Returns the primary URL for this business asset. The primary URL is determined by the pre- and post- directory strings of the primary output channel, the URI of the business object's asset type, and the cover date if the asset type is not a fixed URL.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

$bool = $biz->is_fixed

Returns a boolean value: true if the business asset has a fixed URL (for example, a Cover), false otherwise.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

get_elements
my $elements = $ba->get_elements;
my @elements = $ba->get_elements;
$elements    = $ba->get_elements(@key_names);
@elements    = $ba->get_elements(@key_names);

# Deprecated forms:
$elements = $ba->get_tiles;
@elements = $ba->get_tiles;
$elements = $ba->get_tiles(@key_names);
@elements = $ba->get_tiles(@key_names);

Returns the elements that are held with in the top level element of this business asset. Convenience shortcut to $ba->get_element->get_elements.

Throws: NONE.

Side Effects: NONE.

Notes: get_tiles() is the deprecated form of this method.

$ba->add_field($field_type, $value)
$ba->add_data($field_type, $value)

Creates a new field and adds it to the business document's element. Convenience shortcut to $ba->get_element->add_field.

Throws: NONE.

Side Effects: NONE.

Notes: add_data() is the deprecated form of this method.

$new_container = $ba->add_container( $atc_obj )

This will create and return a new container element that is added to the current container. Convenience shortcut to $ba->get_element->add_container.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$value = $ba->get_value( $key_name, $obj_order )
$value = $ba->get_value( $key_name, $obj_order, $format )
$value = $ba->get_data( $key_name, $obj_order )
$value = $ba->get_data( $key_name, $obj_order, $format )

Returns the value for a field with the given key name and object order. Convenience shortcut to $ba->get_element->get_value.

Throws: NONE.

Side Effects: NONE.

Notes:

get_data() is the deprecated form of this method. For fields that can contain multiple values, call get_values(), instead.

$container = $ba->get_container( $key_name, $obj_order )

Returns a container element object with the given key name and the given object order position. Convenience shortcut to $ba->get_element->get_container.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

$ba = $ba->add_keywords(@keywords);
$ba = $ba->add_keywords(\@keywords);
$ba = $ba->add_keywords(@keyword_ids);
$ba = $ba->add_keywords(\@keyword_ids);

Associates a each of the keyword in a list or array reference of keywords with the business asset.

Throws: NONE.

Side Effects: NONE

Notes: NONE

@keywords = $cat->get_keywords;
@keywords = $cat->get_keywords(@keyword_ids);

Returns a list of keyword objects associated with this business asset. If passed a list of keyword IDs, it will return only those keyword objects.

Throws: NONE

Side Effects: NONE

Notes: NONE

$kw_aref || @kws = $asset->get_all_keywords()

Returns an array ref or an array of keyword objects assigned to this Business Asset and to its categories.

Throws: NONE

Side Effects: NONE

Notes: NONE

$ba = $ba->del_keywords(@keywords);
$ba = $ba->del_keywords(\@keywords);
$ba = $ba->del_keywords(@keyword_ids);
$ba = $ba->del_keywords(\@keyword_ids);

Dissociates a list or array reference of keyword objects or IDs from the business asset.

Throws: NONE.

Side Effects: NONE

Notes: NONE

($self || undef) = $ba->has_keyword($keyword)

Returns a keyword if the keyword object is associated with this asset.

Throws: NONE.

Side Effects: NONE

Notes: Uses get_keywords() internally.

$self = $self->cancel()

Called upon a checked out asset. This unchecks it out.

XXX Actually, it deletes the asset! I don't think that's what we want. Don't use this method!

Throws:

"Cannot cancel a non checked out asset"

Side Effects:

This will remove the coresponding object from the database

Notes:

NONE

($ba || undef) = $ba->is_current()

Return whether this is the most current version or not.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

= $biz = $biz->checkout( { user__id => $user_id })

checks out the asset to the specified user

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$ba = $ba->save()

Commits the changes to the database

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$story_name = $story->check_uri;
$story_name = $story->check_uri($user_id);

Returns name of story that has clashing URI.

Notes: This method has been deprecated. URI uniqueness is now checked by save(), so this method is no longer strictly necessary.

Private

Private Class Methods

$self = $self->_init()

Preforms functions needed to create new business assets

Throws:

Side Effects:

NONE

Notes:

NONE

Private Instance Methods

$at_obj = $self->_construct_uri()

Returns URI contructed from the output chanel paths, categories and the date.

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$self = $self->_sync_contributors()

Syncs the contributors for this story

Throws:

NONE

Side Effects:

NONE

Notes:

NONE

$self = $self->_delete_uris;

Deletes the URI records for this document. Called by save() when the document has been deactivated.

Throws:

Exception::DA
$self = $self->_update_uris;

Updates the URI records for this document.

Throws:

Error::NotUnique
Exception::DA
$self = $self->_can_expire()

Returns true if the documement can be expired. Specifically, if the document has been published.

Throws: NONE.

Side Effects: NONE.

Notes: NONE.

Private Functions

my $oc_coll = $get_oc_coll->($ba)

Returns the collection of output channels for this asset. Bric::Util::Coll::OutputChannel object. See that class and its parent, Bric::Util::Coll, for interface details.

Throws:

Side Effects: NONE.

Notes: NONE.

my $kw_coll = &$get_kw_coll($self)

Returns the collection of keywords for this business asset. The collection is a Bric::Util::Coll::Keyword object. See that class and its parent, Bric::Util::Coll, for interface details.

Throws:

Side Effects: NONE.

Notes: NONE.

Notes

NONE

Author

michael soderstrom <miraso@pacbell.net>

See Also

Bric, Bric::Biz::Asset