class RubyTeamSite::WFworkflow

Public Class Methods

new(wf_id) click to toggle source

Initialize the WFworkflow class by getting the workflow from the workflow system by ID.

# File lib/ruby_teamsite/wfworkflow.rb, line 12
def initialize(wf_id)
  @workflow_id = wf_id.strip
  @ts_bin = ts_bin
  @workflow = `#{@ts_bin}/iwgetwfobj #{wf_id.strip}`
  set_wf_info(@workflow)
end

Public Instance Methods

creator() click to toggle source

Return the name of the workflow creator.

# File lib/ruby_teamsite/wfworkflow.rb, line 30
def creator
  return @wf_creator 
end
description() click to toggle source

Return the description of the workflow.

# File lib/ruby_teamsite/wfworkflow.rb, line 40
def description
  return @wf_desc 
end
id() click to toggle source

Return the id of the workflow.

# File lib/ruby_teamsite/wfworkflow.rb, line 25
def id
  return @workflow_id 
end
name() click to toggle source

Return the name of the workflow.

# File lib/ruby_teamsite/wfworkflow.rb, line 20
def name
  return @wf_name 
end
owner() click to toggle source

Return the name of the workflow owner.

# File lib/ruby_teamsite/wfworkflow.rb, line 35
def owner
  return @wf_owner 
end
variables() click to toggle source

Return a hash of variables for this workflow. The key is the name of the variable and the value is its value.

# File lib/ruby_teamsite/wfworkflow.rb, line 50
def variables
  wf = Nokogiri::XML(@workflow, nil, 'UTF-8')
  elmnt_vars = wf.css('variables variable')
  wf_vars = Hash.new
  if elmnt_vars.empty? == false
    elmnt_vars.each {|v| wf_vars[v.attribute('key').to_s] = v.attribute('value').to_s}
  end
  return wf_vars
end
xml() click to toggle source

Return the XML output of the workflow.

# File lib/ruby_teamsite/wfworkflow.rb, line 45
def xml
  return @workflow 
end

Private Instance Methods

set_wf_info(wf) click to toggle source

Set the information for the workflow.

# File lib/ruby_teamsite/wfworkflow.rb, line 72
def set_wf_info(wf)
  workflow = Nokogiri::XML(wf, nil, 'UTF-8')
  
  # Workflow name
  wfname = workflow.root.attribute('name')
  wfn = wfname.to_s
  @wf_name = wfn.strip
   
  # Workflow owner
  wfowner = workflow.root.attribute('owner')
  wfo = wfowner.to_s
  @wf_owner = wfo.strip
  
  # Workflow creator
  wfcreator = workflow.root.attribute('creator')
  wfc = wfcreator.to_s
  @wf_creator = wfc.strip
  
  # Workflow description
  wfdesc = workflow.css('description').text
  wfd = wfdesc.to_s
  @wf_desc = wfd.strip
  
end
ts_bin() click to toggle source

Create the location to the bin directory for TeamSite.

# File lib/ruby_teamsite/wfworkflow.rb, line 63
def ts_bin
  iwhome = `iwgethome`
  ts_bin = iwhome + '/bin'
  ts_bin.gsub!(/\n/,'')
  ts_bin.strip!
  return ts_bin
end