NAME

Bric::SOAP::Template - SOAP interface to Bricolage templates.

VERSION

$Revision: 1.14.4.3 $

DATE

$Date: 2003/10/03 22:43:43 $

SYNOPSIS

use SOAP::Lite;
import SOAP::Data 'name';

# setup soap object to login with
my $soap = new SOAP::Lite
  uri      => 'http://bricolage.sourceforge.net/Bric/SOAP/Auth',
  readable => DEBUG;
$soap->proxy('http://localhost/soap',
             cookie_jar => HTTP::Cookies->new(ignore_discard => 1));
# login
$soap->login(name(username => USER),
             name(password => PASSWORD));

# set uri for Template module
$soap->uri('http://bricolage.sourceforge.net/Bric/SOAP/Template');

# get a list of template_ids in the root category
my $template_ids = $soap->list_ids(name(category => '/'))->result;

DESCRIPTION

This module provides a SOAP interface to manipulating Bricolage templates.

INTERFACE

Public Class Methods

list_ids

This method queries the story database for matching templates and returns a list of ids. If no templates are found an empty list will be returned.

This method can accept the following named parameters to specify the search. Some fields support matching and are marked with an (M). The value for these fields will be interpreted as an SQL match expression and will be matched case-insensitively. Other fields must specify an exact string to match. Match fields combine to narrow the search results (via ANDs in an SQL WHERE clause).

element (M)

The template's element name.

file_name (M)

The template's file_name.

output_channel

The output channel for the template.

category

A category containing the story, given as the complete category path from the root. Example: "/news/linux".

workflow

The name of the workflow containing the template.

simple (M)

a single OR search that hits element and filename.

priority

The priority of the template.

publish_status

Stories that have been published have a publish_status of "1", otherwise "0".

deploy_date_start

Lower bound on deploy date. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).

deploy_date_end

Upper bound on deploy date. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).

expire_date_start

Lower bound on expire date. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).

expire_date_end

Upper bound on expire date. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).

Throws: NONE

Side Effects: NONE

Notes: SQL tweaking paramters (Order, Limit, etc.) as in Bric::SOAP::Story are not available here. We should add them to Bric::Biz::Asset::Formatting->list() and then support them here too.

export

The export method retrieves a set of templates from the database, serializes them and returns them as a single XML document. See Bric::SOAP for the schema of the returned document.

Accepted paramters are:

template_id

Specifies a single template_id to be retrieved.

template_ids

Specifies a list of template_ids. The value for this option should be an array of interger "template_id" elements.

Throws: NONE

Side Effects: NONE

Notes: NONE

create

The create method creates new objects using the data contained in an XML document of the format created by export().

Returns a list of new ids created in the order of the assets in the document.

Available options:

document (required)

The XML document containing objects to be created. The document must contain at least one template object.

Throws: NONE

Side Effects: NONE

Notes: NONE

update

The update method updates template using the data in an XML document of the format created by export(). A common use of update() is to export() a selected template object, make changes to one or more fields and then submit the changes with update().

Returns a list of new ids created in the order of the assets in the document.

Takes the following options:

document (required)

The XML document where the objects to be updated can be found. The document must contain at least one template and may contain any number of related template objects.

update_ids (required)

A list of "template_id" integers for the assets to be updated. These must match id attributes on template elements in the document. If you include objects in the document that are not listed in update_ids then they will be treated as in create(). For that reason an update() with an empty update_ids list is equivalent to a create().

Throws: NONE

Side Effects: NONE

Notes: Due to the way Bric::Biz::Asset::Formatting->new() works it isn't possible to fully update file_name. To change it you need to update it indirectly by changing category, element and the file_name extension. This should be fixed.

delete

The delete() method deletes templates. It takes the following options:

template_id

Specifies a single template_id to be deleted.

template_ids

Specifies a list of template_ids to delete.

Throws: NONE

Side Effects: NONE

Notes: NONE

Private Class Methods

$pkg->_load_template($args)

This method provides the meat of both create() and update(). The only difference between the two methods is that update_ids will be empty on create().

$pkg->_serialize_template(writer => $writer, template_id => $template_id, args => $args)

Serializes a single template object into a <template> element using the given writer and args.

AUTHOR

Sam Tregar <stregar@about-inc.com>

SEE ALSO

Bric::SOAP