Bric::Biz::AssetType - Registers new types of assets with their fields and the rules governing them. $LastChangedRevision$ $LastChangedDate: 2004-07-06 18:50:23 -0700 (Tue, 06 Jul 2004) $ # Create new types of assets. $element = Bric::Biz::AssetType->new($init) $element = Bric::Biz::AssetType->lookup({id => $id}) ($at_list || @ats) = Bric::Biz::AssetType->list($param) ($id_list || @ids) = Bric::Biz::AssetType->list_ids($param) # Return the ID of this object. $id = $element->get_id() # Get/set this asset type's name. $element = $element->set_name( $name ) $name = $element->get_name() # Get/set the description for this asset type $element = $element->set_description($description) $description = $element->get_description() # Get/set the primary output channel ID for this asset type. $element = $element->set_primary_oc_id($oc_id, $site_id); $oc_id = $element->get_primary_oc_id($site_id); # Attribute methods. $val = $element->set_attr($name, $value); $val = $element->get_attr($name); \%val = $element->all_attr; # Attribute metadata methods. $val = $element->set_meta($name, $meta, $value); $val = $element->get_meta($name, $meta); # Manage output channels. $element = $element->add_output_channels([$output_channel]) ($oc_list || @ocs) = $element->get_output_channels() $element = $element->delete_output_channels([$output_channel]) # Manage sites $element = $element->add_sites([$site]) ($site_list || @sites) = $element->get_sites() $element = $element->remove_sites([$site]) # Manage the parts of an asset type. $element = $element->add_data($field); $element_data = $element->new_data($param); $element = $element->copy_data($at, $field); ($part_list || @parts) = $element->get_data($field); $element = $element->del_data($field); # Add, retrieve and delete containers from this asset type. $element = $element->add_containers($at || [$at]); (@at_list || $at_list) = $element->get_containers(); $element = $element->del_containers($at || [$at]); # Set the repeatability of a field. ($element || 0) = $element->is_repeatable($at_container); $element = $element->make_repeatable($at_container); $element = $element->make_nonrepeatable($at_container); # Get/set the active flag. $element = $element->activate() $element = $element->deactivate() (undef || 1) = $element->is_active() # Save this asset type. $element = $element->save() The asset type class registers new type of assets that will go through work flow. The individual parts will describe how the fields of the story will be laid out. The AssetType object is composed of AssetType Parts Data objects and AssetType Parts Container objects. These hold the fields that will become Assets when they enter workflow. Rules can be set upon these. The AssetType object also holds what output channels this asset will be allowed to go through.

Constructors
Will return a new asset type object with the optional initial state Supported Keys: Throws: NONE. Side Effects: NONE. Notes: NONE. Looks up and instantiates a new Bric::Biz::AssetType object based on the Bric::Biz::AssetType object ID or name passed. If $id or $key_name is not found in the database, "lookup()" returns "undef". Throws: Too many Bric::Biz::AssetType objects found. Side Effects: NONE Notes: NONE This will return a list of objects that match the criteria defined. Supported Keys: The name of the asset type. Matched with case-insentive LIKE. The unique key name of the asset type. Matched with case insensitive LIKE The description of the asset type. Matched with case-insentive LIKE. The ID of an output channel. Returned will be all AssetType objects that contain this output channel. The name of an AssetType::Data object. Returned will be all AssetType objects that reference this particular AssetType::Data object. The map_type__id of an AssetType::Data object. Set to 0 to return active and inactive asset types. 1, the default, returns only active asset types. match elements of a particular attype set to 1 to return only top-level elements match against a particular media asset type (att.media) match against the given site_id Throws: NONE Side Effects: NONE Notes: NONE This will return a list of objects that match the criteria defined. See the "list()" method for the allowed keys of the $param hash reference. Throws: NONE Side Effects: NONE Notes: NONE

Destructors
Dummy method to prevent wasting time trying to AUTOLOAD DESTROY.

Public Class Methods
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: The name of the property or attribute. Is the same as the hash key when an anonymous hash is returned. The display name of the property or attribute. A reference to the method that will retrieve the value of the property or attribute. An anonymous array of arguments to pass to a call to get_meth in order to retrieve the value of the property or attribute. A reference to the method that will set the value of the property or attribute. An anonymous array of arguments to pass to a call to set_meth in order to set the value of the property or attribute. The type of value the property or attribute contains. There are only three types: If the value is a 'short' value, this hash key contains the length of the field. The property is searchable via the list() and list_ids() methods. The property or attribute is required. An anonymous hash of properties used to display the property or attribute. Possible keys include: The display field type. Possible values are The Length, in letters, to display a text or password field. The maximum length of the property or value - usually defined by the SQL DDL. The number of rows to format in a textarea field. The number of columns to format in a textarea field. An anonymous hash of key/value pairs reprsenting the values and display names to use in a select list. Throws: NONE. Side Effects: NONE. Notes: NONE.

Public Instance Methods
This will return the id for the database Throws: NONE Side Effects: NONE Notes: NONE This will set the name field for the asset type Throws: NONE Side Effects: NONE Notes: NONE This will return the name field for the asset type Throws: NONE Side Effects: NONE Notes: NONE This will set the unique key name field for the asset type Throws: NONE Side Effects: NONE Notes: NONE This will return the unique key name field for the asset type Throws: NONE Side Effects: NONE Notes: NONE this sets the description field Throws: NONE Side Effects: NONE Notes: NONE This returns the description field Throws: NONE Side Effects: NONE Notes: NONE This will set the primary output channel id field for the asset type Throws: No site parameter passed to Bric::Biz::AssetType->set_primary_oc_id No output channels associated with non top-level elements. Side Effects: NONE. Notes: NONE. This will return the primary output channel id field for the asset type Throws: No site parameter passed to Bric::Biz::AssetType->get_primary_oc_id. No output channels associated with non top-level elements. Side Effects: NONE. Notes: NONE. Get the type name of the asset type. Throws: NONE Side Effects: NONE Notes: NONE Get the burner associated with the asset type. Possible values are the constants BURNER_MASON and BURNER_TEMPLATE defined in this package. Throws: NONE Side Effects: NONE Notes: NONE Get the burner associated with the asset type. Possible values are the constants BURNER_MASON and BURNER_TEMPLATE defined in this package. Throws: NONE Side Effects: NONE Notes: NONE Get the type description of the asset type. Throws: NONE Side Effects: NONE Notes: NONE Return whether this is a top level story or not. Throws: NONE Side Effects: NONE Notes: NONE Return whether this asset type should produce a paginated asset or not. Throws: NONE Side Effects: NONE Notes: NONE Return whether this asset type can have related media objects. Throws: NONE Side Effects: NONE Notes: NONE Return whether this asset type can have related story objects. Throws: NONE Side Effects: NONE Notes: NONE Mark this Asset Type as representing a media object or a story object. Media objects do not support all the options that story objects to like nested containers or references, but they include options that story doesnt like autopopulated fields. The 'is_media' method returns true if this is a media object and false otherwise. The 'set_media' method marks this as a media object. It does not take any arguments, and always sets the media flag to true, so you cant do this: $at->set_media(0) and expect to set the media flag to false. To unset the media flag (set it to false) use the 'clear_media' method. Throws: NONE Side Effects: NONE Notes: NONE The methods 'get_biz_class' and 'get_biz_class_id' get the business class name or the business class ID respectively from the class table. The 'set_biz_class' method sets the business class for this asset type given either a class name or an ID from the class table. This value represents the kind of bussiness object this asset type will represent. There are just two main kinds, story and media objects. However media objects have many subclasses, one for each type of supported media (image, audio, video, etc) increasing the number of package names this value could be set to. Throws: NONE Side Effects: NONE Notes: NONE Return whether this asset type references other data. Throws: NONE Side Effects: NONE Notes: NONE Return whether this asset type should produce a fixed url asset or not. Throws: NONE Side Effects: NONE Notes: NONE Return the at_type object associated with this element. Throws: NONE Side Effects: NONE Notes: NONE Get/Set/Delete attributes on this asset type. Throws: NONE Side Effects: NONE Notes: NONE Get/Set attribute metadata on this asset type. Calling the 'get_meta' method without '$field' returns all metadata names and values as a hash. Throws: NONE Side Effects: NONE Notes: NONE This returns a list of output channels that have been associated with this asset type. If @oc_ids is passed, then only the output channels with those IDs are returned, if they're associated with this asset type. Throws: NONE. Side Effects: NONE. Notes: The objects returned will be Bric::Biz::OutputChannel::Element objects, and these objects contain extra information relevant to the assocation between each output channel and this element object. Adds an output channel to this element object and returns the resulting Bric::Biz::OutputChannel::Element object. Can pass in either an output channel object or an output channel ID. Throws: NONE. Side Effects: If a Bric::Biz::OutputChannel object is passed in as the first argument, it will be converted into a Bric::Biz::OutputChannel::Element object. Notes: NONE. This accepts an array reference of output channel objects to be associated with this asset type. Throws: NONE. Side Effects: Any Bric::Biz::OutputChannel objects passed in will be converted into Bric::Biz::OutputChannel::Element objects. Notes: NONE. This takes an array reference of output channels and removes their association from the object. Throws: Cannot delete a primary output channel. Side Effects: NONE. Notes: NONE. This returns a list of sites that have been associated with this asset type. If @site_ids is passed, then only the sites with those IDs are returned, if they're associated with this asset type. Throws: NONE. Side Effects: NONE. Notes: The objects returned will be Bric::Biz::Site objects, and these objects contain extra information relevant to the assocation between each output channel and this element object. Adds a site to this element object and returns the resulting Bric::Biz::Site object. Can pass in either an site object or a site ID. Throws: You can only add sites to top level objects Cannot add sites to non top-level elements. No such site. Side Effects: NONE. Notes: NONE. Adds a site to this element object and returns the Bric::Biz::AssetType object. Can pass in multiple site objects or site IDs. Throws: You can only add sites to top level objects Couldn't find site Side Effects: NONE. Notes: NONE. This takes an array reference of sites and removes their association from the object. Throws: Cannot remove last site from an element. Side Effects: Also disassociates any output channels for the site that are associated with this element. Notes: NONE. This will return a list of the fields and containers that make up this asset type Throws: NONE Side Effects: NONE Notes: The parts returned here may not have their parent IDs or order set if this object has not been saved yet. This takes a list of fields and associates them with the element object Throws: NONE Side Effects: NONE Notes: NONE Adds a new data point, creating a new Bric::Biz::AssetType::Parts::Data object. The keys to $param are the same as the keys for the hash ref passed to Bric::Biz::AssetType::Parts::Data::new. Throws: NONE Side Effects: NONE Notes: NONE Copy the definition for a data field from another asset type. Keys for $param are: at An existing asset type object field_name A field name defined within the object passed with 'at' field_obj A field object. Can be given in lieu of 'at' and 'field_name'. Throws: NONE Side Effects: NONE Notes: NONE This will take a list of parts and will disassociate them from the story type. Throws: NONE Side Effects: NONE Notes: NONE Add AssetTypes to be contained by this AssetType. Throws: NONE Side Effects: NONE Notes: NONE Return all contained AssetTypes. Throws: NONE Side Effects: NONE Notes: NONE Release an AssetType from its servitude to this AssetType. The AssetType itself will not be deleted. It will simply not be associated with this AssetType any more. Throws: NONE Side Effects: NONE Notes: NONE Get/Set the repeatable flag for a contained AssetType. Note that this repeatability only applies to this AssetTypes relation to the contained AssetType. Throws: NONE Side Effects: NONE Notes: NONE Return the active flag. Throws: NONE Side Effects: NONE Notes: NONE This will set the active flag to one for the object Throws: NONE Side Effects: NONE Notes: NONE This will set the active flag to undef for the asset type Throws: NONE Side Effects: NONE Notes: NONE This will return undef if the element has been deactivated and one otherwise Throws: NONE Side Effects: NONE Notes: NONE This will save all of the changes to the database Throws: NONE Side Effects: NONE Notes: NONE

Private Class Methods
called from list and list ids this will query the db and return either ids or objects Throws: NONE Side Effects: NONE Notes: NONE

Private Instance Methods
These need documenting. Removes this object completely from the DB. Returns 1 if active or undef otherwise Throws: NONE Side Effects: NONE Notes: NONE Update values in the element table. Throws: NONE Side Effects: NONE Notes: NONE Insert new values into the element table. Throws: NONE Side Effects: NONE Notes: NONE Call the list function of Bric::Biz::AssetType::Parts::Container to return a list of conainer parts of this AssetType object, or return the existing parts if weve already loaded them. Throws: NONE Side Effects: NONE Notes: NONE

Private Functions
Returns the collection of output channels for this element. The collection is a Bric::Util::Coll::OCElement object. See that class and its parent, Bric::Util::Coll, for interface details. Throws: Bric::_get() - Problems retrieving fields. 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. Incorrect number of args to Bric::_set(). Bric::set() - Problems setting fields. Side Effects: NONE. Notes: NONE. Returns the collection of sites for this element. The collection is a Bric::Util::Coll::Site object. See that class and its parent, Bric::Util::Coll, for interface details. Throws: Bric::_get() - Problems retrieving fields. 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. Incorrect number of args to Bric::_set(). Bric::set() - Problems setting fields. Side Effects: NONE. Notes: NONE. Takes an element name and turns it into the key name. This is the name that will be used in templates and in the super bulk edit interface. Throws: NONE. Side Effects: NONE. Notes: NONE. NONE. michael soderstrom <miraso@pacbell.net> Bric, Bric::Biz::Asset, Bric::Util::Coll::OCElement.