Bric::SOAP::Workflow(3)

NAME
Bric::SOAP::Workflow - SOAP interface to Bricolage workflows.

VERSION
$LastChangedRevision$

DATE
$LastChangedDate: 2006-03-17 16:26:34 -0800 (Fri, 17 Mar 2006) $

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 Workflow module
  $soap->uri('http://bricolage.sourceforge.net/Bric/SOAP/Workflow');

DESCRIPTION
This module provides a SOAP interface to manipulating Bricolage workflows. This include facilities for moving objects onto desks, checkin, checkout, publishing and deploying.

INTERFACE

  Public Class Methods

publish
    This method handles the publishing of story and media objects. Returns "publish_ids", an array of "story_id" and/or "media_id" integers published. The method accepts the following parameters:

    story_id
        A single story to publish.

    media_id
        A single media object to publish.

    publish_ids
        A list of "story_id" and/or "media_id" elements to be published.

    publish_related_stories
        If this is set to true then related stories will be published too. In the web interface this happens if and only if the related stories have never been published before. This option is off by default.

    publish_related_media
        If this is set to true then related media will be published too. In the web interface this happens if and only if the related media objects have never been published before. This option is false by default.

    to_preview
        Set this to true to publish to the preview destination instead of the publish destination. This will fail if PREVIEW_LOCAL is On in bricolage.conf.

    publish_date
        The date and time (in ISO-8601 format) at which to publish the assets.

    Throws:

    Exception::AP

    Side Effects: Stories and media have their publish_status field set to true.

    Notes: The code for this method came mostly from comp/widgets/publish/callback.mc. It would be nice to collect this code in a module so it could be kept in one place.

    Notes about the notes. It's now lib/Bric/App/Callback/Publish.pm, This code is out of date since Mark's job-queue patch, as it still instantiates a $burner to publish immediately, so we need to update it. It's an opportunity to factor out the code into one place.

deploy
    This method handles deploying templates. The method returns "deploy_ids", a list of "template_id" integers deployed on success. The method accepts the following parameters:

    template_id
        A single template to publish.

    deploy_ids
        A list of "template_id" elements to be published.

    Throws:

    Exception::AP

    Side Effects: Templates have their deploy_status set to true.

    Notes: Code here comes from comp/widgets/desk/callback.mc. It might be cool to move this code into a module so it could be shared. It's not nearly as gnarly as the publish() code though.

checkout
    This method checks out a story, media and/or template objects. After this call the objects are visible on the user's workspace in the web interface and are not available for other users to edit.

    An error will result if you try to checkout an object that is not checked in.

    The method returns a list of ids checked out on success.

    The method accepts the following parameters:

    story_id
        A single story to checkout.

    media_id
        A single media object to checkout.

    template_id
        A single template object to checkout.

    checkout_ids
        A list of "story_id", "template_id" and/or "media_id" elements to be checked out.

    Throws:

    Exception::AP

    Side Effects: NONE

    Notes: NONE

checkin
    This method checks in a story, media and/or template objects. After this call the objects are no longer visible on the user's workspace in the web interface and are available for other users to edit.

    An error will result if you try to checkin an object that is not checked out.

    The method returns a list of ids checked in.

    The method accepts the following parameters:

    story_id
        A single story to checkin.

    media_id
        A single media object to checkin.

    template_id
        A single template object to checkin.

    checkin_ids
        A list of "story_id", "template_id" and/or "media_id" elements to be checked in.

    Throws:

    Exception::AP

    Side Effects: NONE

    Notes: NONE

move
    This method moves objects between workflows and desks. The method returns a list of ids moved. The method accepts the following parameters:

    desk (required)
        The name of the desk to move to.

    workflow
        The name of the workflow to move to. If this is unspecified then desk must refer to a desk in the current workflow for the object. If specified then only one type of object can be successfully moved since workflows are type-specific, I think.

    story_id
        A single story to move.

    media_id
        A single media object to move.

    template_id
        A single template object to move.

    move_ids
        A list of "story_id", "template_id" and/or "media_id" elements to be checked in.

    Throws:

    Exception::AP

    Side Effects: NONE

    Notes: NONE

list_ids
    This method queries the database for matching workflows and returns a list of ids. If no workflows 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).

    name (M)
        The workflow's name.

    description
        The workflow's description.

    site
        The workflow's site name.

    type
        Return workflows of type 'Story', 'Media', or 'Template'. By default all workflow types are returned.

    desk
        Given a desk name, return workflows that contain this desk.

    active
        Set false to return deleted workflows. Returns only active workflows by default.

    Throws:

    Exception::AP

    Side Effects: NONE

    Notes: NONE

export
    The export method retrieves a set of assets 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:

    workflow_id
        Specifies a single workflow_id to be retrieved.

    workflow_ids
        Specifies a list of workflow_ids. The value for this option should be an array of integer "workflow_id" assets.

    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 asset object.

    Throws:

    Exception::AP

    Side Effects: NONE

    Notes: NONE

update
    The update method updates an asset using the data in an XML document of the format created by export(). A common use of update() is to export() a selected 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 asset and may contain any number of related asset objects.

    update_ids (required)
        A list of "workflow_id" integers for the assets to be updated. These must match id attributes on asset 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:

    Exception::AP

    Side Effects: NONE

    Notes: NONE

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

    workflow_id
        Specifies a single asset ID to be deleted.

    workflow_ids
        Specifies a list of asset IDs to delete.

    Throws:

    Exception::AP

    Side Effects: NONE

    Notes: The ONLY reason this method needs overridden is because of the __WORKFLOWS__ cache.

$self->module
    Returns the module name, that is the first argument passed to bric_soap.

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, workflow_id  => $id, args     => $args)
    Serializes a single workflow object into a <workflow> workflow using the given writer and args.

@ids = _collect_ids("publish_ids", [ "story_id", "media_id" ], $env);
    This method takes care of extracting a collating the id parameters accepted by the above methods. The result is an array of SOAP::Data objects with name() and value() set accordingly.

    Throws: NONE

    Side Effects: NONE

    Notes: I bet this method is inefficient. Using XPath syntax just feels slow...

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

Scott Lanning <lannings@who.int>

SEE ALSO
Bric::SOAP, Bric::Biz::Workflow