Class OpenWFE::LaunchItem
In: lib/openwfe/workitem.rb
Parent: WorkItem

LaunchItem instances are used to instantiate and launch processes. They contain attributes that are used as the initial payload of the workitem circulating in the process instances.

Methods

from_h   new   to_h  

Constants

DEF = "__definition"
FIELD_DEF = "field:#{DEF}"

External Aliases

workflow_definition_url -> wfdurl
  , :description_map
workflow_definition_url= -> wfdurl=

Attributes

workflow_definition_url  [RW] 

Public Class methods

[Source]

     # File lib/openwfe/workitem.rb, line 462
462:         def LaunchItem.from_h (h)
463: 
464:             li = super
465:             li.workflow_definition_url = h[:workflow_definition_url]
466:             li
467:         end

This constructor will build an empty LaunchItem.

If the optional parameter process_definition is set, the definition will be embedded in the launchitem attributes for retrieval by the engine.

There are several ways to specify the process definition. Here are some examples:

  # Use a Ruby class that extends OpenWFE::ProcessDefinition
  LaunchItem.new(MyProcessDefinition)

  # Provide an XML process definition as a string
  definition = """
    <process-definition name="x" revision="y">
      <sequence>
        <participant ref="alpha" />
        <participant ref="bravo" />
      </sequence>
    </process-definition>
  """.strip
  LaunchItem.new(definition)

  # Load an XML process definition from a local file
  require 'uri'
  LaunchItem.new(URI.parse("file:///tmp/my_process_definition.xml"))

  # If you initialized your engine with
  # {:remote_definitions_allowed => true}, then you can also load an
  # XML process definition from a remote url
  require 'uri'
  LaunchItem.new(URI.parse("http://foo.bar/my_process_definition.xml"))

[Source]

     # File lib/openwfe/workitem.rb, line 441
441:         def initialize (process_definition=nil)
442: 
443:             super()
444: 
445:             if process_definition
446:                 @workflow_definition_url = FIELD_DEF
447:                 @attributes[DEF] = process_definition
448:             end
449:         end

Public Instance methods

Turns the LaunchItem instance into a simple ‘hash’ (easily serializable to other formats).

[Source]

     # File lib/openwfe/workitem.rb, line 455
455:         def to_h
456: 
457:             h = super
458:             h[:workflow_definition_url] = @workflow_definition_url
459:             h
460:         end

[Validate]