Class: OpenWFE::FieldWfidGenerator

Inherits:
KotobaWfidGenerator show all
Defined in:
lib/openwfe/expool/wfidgen.rb

Overview

This wfid generator returns as wfid the value found in a given field of the launchitem (if any).

If there is no launchitem or no field, a Kotoba wfid is returned.

This generator is useful for engines that have to use workflow instance ids generated by other systems.

Instance Attribute Summary

Attributes included from ServiceMixin

#service_name

Attributes included from Contextual

#application_context

Instance Method Summary collapse

Methods inherited from KotobaWfidGenerator

from_time, split_wfid, to_string, #to_string, to_time

Methods inherited from DefaultWfidGenerator

split_wfid, #split_wfid, #stop, #to_string

Methods included from ServiceMixin

#service_init, #stop

Methods included from Contextual

#get_work_directory, #init_service, #lookup

Methods included from Logging

#ldebug, #ldebug_callstack, #lerror, #lfatal, #linfo, #llog, #lunknown, #lwarn

Constructor Details

#initialize(service_name, application_context, field_name) ⇒ FieldWfidGenerator

Returns a new instance of FieldWfidGenerator.



265
266
267
268
269
270
# File 'lib/openwfe/expool/wfidgen.rb', line 265

def initialize (service_name, application_context, field_name)

    super service_name, application_context

    @field_name = field_name
end

Instance Method Details

#generate(launchitem = nil) ⇒ Object



272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/openwfe/expool/wfidgen.rb', line 272

def generate (launchitem=nil)

    return super unless launchitem

    wfid = launchitem.attributes[@field_name]

    return wfid.to_s if wfid

    super
        #
        # if the field is not present in the launchitem, will
        # return a Kotoba wfid
end