Name

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

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.

site

The name of the site that the template is in.

simple (M)

a single OR search that hits element and filename.

priority

The priority of the template.

deploy_status

Templates that have been deployed have a deploy_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:

Exception::AP

Side Effects: NONE

Notes: In addition to the parameters listed above, you can use most of the parameters listed in the documentation for the list method in Bric::Biz::Asset::Template.

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:

Exception::AP

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.

workflow

Specifies the initial workflow the story is to be created in

desk

Specifies the initial desk the story is to be created on

Throws:

Exception::AP

Side Effects: NONE

Notes: New stories are put in the first "template workflow" unless you pass in the --workflow option. The start desk of the workflow is used unless you pass the --desk option.

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

workflow

Specifies the workflow to move the template to

desk

Specifies the desk to move the template to

Throws:

Exception::AP

Side Effects: NONE

Notes: Due to the way Bric::Biz::Asset::Template->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:

Exception::AP

Side Effects: NONE

Notes: NONE

$self->module

Returns the module name, that is the first argument passed to bric_soap.

$self->class

Returns the class name used for 'lookup' (used in the delete method).

is_allowed_param
$pkg->is_allowed_param($param, $method)

Returns true if $param is an allowed parameter to the $method method.

Private Class Methods

$pkg->load_asset($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_asset(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