Bric::SOAP::Workflow - SOAP interface to Bricolage workflows. $LastChangedRevision$ $LastChangedDate: 2006-03-18 01:26:34 +0100 (Sat, 18 Mar 2006) $ 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'); This module provides a SOAP interface to manipulating Bricolage workflows. This include facilities for moving objects onto desks, checkin, checkout, publishing and deploying.

Public Class Methods
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: A single story to publish. A single media object to publish. A list of "story_id" and/or "media_id" elements to be published. 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. 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. 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. The date and time (in ISO-8601 format) at which to publish the assets. Throws: 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. 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: A single template to publish. A list of "template_id" elements to be published. Throws: 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. 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: A single story to checkout. A single media object to checkout. A single template object to checkout. A list of "story_id", "template_id" and/or "media_id" elements to be checked out. Throws: Side Effects: NONE Notes: NONE 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: A single story to checkin. A single media object to checkin. A single template object to checkin. A list of "story_id", "template_id" and/or "media_id" elements to be checked in. Throws: Side Effects: NONE Notes: NONE This method moves objects between workflows and desks. The method returns a list of ids moved. The method accepts the following parameters: The name of the desk to move to. 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. A single story to move. A single media object to move. A single template object to move. A list of "story_id", "template_id" and/or "media_id" elements to be checked in. Throws: Side Effects: NONE Notes: NONE 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). The workflow's name. The workflow's description. The workflow's site name. Return workflows of type 'Story', 'Media', or 'Template'. By default all workflow types are returned. Given a desk name, return workflows that contain this desk. Set false to return deleted workflows. Returns only active workflows by default. Throws: Side Effects: NONE Notes: NONE 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: Specifies a single workflow_id to be retrieved. Specifies a list of workflow_ids. The value for this option should be an array of integer "workflow_id" assets. Throws: Side Effects: NONE Notes: NONE 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: The XML document containing objects to be created. The document must contain at least one asset object. Throws: Side Effects: NONE Notes: NONE 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: 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. 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: Side Effects: NONE Notes: NONE The delete() method deletes assets. It takes the following options: Specifies a single asset ID to be deleted. Specifies a list of asset IDs to delete. Throws: Side Effects: NONE Notes: The ONLY reason this method needs overridden is because of the __WORKFLOWS__ cache. Returns the module name, that is the first argument passed to bric_soap. Returns true if $param is an allowed parameter to the $method method.

Private Class Methods
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(). Serializes a single workflow object into a <workflow> workflow using the given writer and args. 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... Sam Tregar <stregar@about-inc.com> Scott Lanning <lannings@who.int> Bric::SOAP, Bric::Biz::Workflow