Bric::SOAP::Util(3)

NAME
Bric::SOAP::Util - utility class for the Bric::SOAP classes

VERSION
$LastChangedRevision$

DATE
$LastChangedDate: 2005-03-14 22:50:14 -0800 (Mon, 14 Mar 2005) $

SYNOPSIS
  use Bric::SOAP::Util qw(category_path_to_script)

  my $category_id = category_path_to_id($path);

DESCRIPTION
This module provides various utility methods of use throughout the Bric::SOAP classes.

INTERFACE

  Exportable Functions

$category_id = category_path_to_id($path)
    Returns a category_id for the path specified or undef if none match.

    Throws: NONE

    Side Effects: NONE

    Notes: NONE

$output_channel_id = output_channel_name_to_id($path)
    Returns an output channel ID for an output channel name.

    Throws: NONE

    Side Effects: NONE

    Notes: NONE

$workflow_id = workflow_name_to_id($path)
    Returns a workflow ID for a workflow name.

    Throws: NONE

    Side Effects: NONE

    Notes: NONE

$site_id = site_path_to_id($path)
    Returns a site_id for the path specified or undef if none match.

    Throws: NONE

    Side Effects: NONE

    Notes: NONE

$db_date = xs_date_to_db_date($xs_date)
    Transforms an XML Schema dateTime format date to a database format date. Returns undef if the input date is invalid.

    Throws: NONE

    Side Effects: NONE

    Notes: NONE

$xs_date = db_date_to_xs_date($db_date)
    Transforms a database format date into an XML Schema dataTime format date. Returns undef if the input date is invalid.

    Throws: NONE

    Side Effects: NONE

    Notes: NONE

$data = parse_asset_document($document, @extra_force_array)
    Parses an XML asset document and returns a hash structure. Inside the hash singular elements are stored as keys with scalar values. Potentially plural values are stored as array-ref values whether they're present multiple times in the document or not. This routine dies on parse errors with information about the error.

    After the document parameter you can pass extra items for the force_array XML::Simple option.

    At some point in the future this method will be augmented with XML Schema validation.

    Throws: NONE

    Side Effects: NONE

    Notes: NONE

@related = serialize_elements(writer => $writer, object => $story, args => $args)
    Creates the <elements> structure for a Story or Media object given the object and the args to export(). Returns a list of two-element arrays - [ "media", $id ] or [ "story", $id ]. These are the related objects serialized.

load_ocs($asset, $ocdata, $elem_ocs, $key, $update)
    Sets the output channels on a business asset. If it's a new asset, all of the output channels in the $ocdata array reference will be loaded into the asset. If the asset is being updated, then "load_ocs()" compares the output channels in $ocdata to those in the asset and adds and removes the appropriate output channels. The arguments are:

    $asset
        The business asset with which to associate the output channels.

    $ocdata
        The array reference of output channels from the SOAP data, e.g., "$data-"{stories}{story}[0]{output_channels}{output_channel}.

    $elem_ocs
        A hash reference of the output channels in the element that defines the asset (i.e., the story type element or the media type element). The hash keys are the output channel names, and the values are the corresponding output channel objects.

    $key
        The key name for the class of asset being updated, either "story" or "media".

    $update
        Boolean value indicating whether $asset is being updated or not.

    Throws: NONE

    Side Effects: NONE

    Notes: Only call this function if there is output channel data to be managed in the XML data. If there isn't, don't call this function, and the output channels in an asset will be left unchanged.

@relations = deseralize_elements(object => $story, data => $data, type   => 'story')
    Loads an asset object with element data from the data hash. Calls _deserialize_tile recursively down through containers.

    Throws: NONE

    Side Effects: NONE

    Notes:

  Private Class Methods

@related = _deserialize_tile(element => $element, data => $data)
    Deserializes a single tile from <elements> data into $element. Calls recursively down through containers building up fixup data from related objects in @related.

    Throws: NONE

    Side Effects: NONE

    Notes: This method isn't checking compliance with the asset type constraints in some cases. After Bric::SOAP::Element is done I should contain the kung-fu necessary for this task.

@related = _serialize_tile(writer => $writer, element => $element, args => $args)
    Serializes a single tile into the contents of an <elements> tag in the media and story elements. It calls itself recursively on containers. Returns a list of two-element arrays - [ "media", $id ] or [ "story", $id ]. These are the related objects serialized.

AUTHOR
Sam Tregar <stregar@about-inc.com>

SEE ALSO
Bric::SOAP