Class: Pione::Log::XESLog
- Inherits:
-
ProcessLog
- Object
- ProcessLog
- Pione::Log::XESLog
- Defined in:
- lib/pione/log/xes-log.rb
Overview
XESLog is a class for XES formatted log.
Instance Attribute Summary collapse
-
#agent_activity_log ⇒ Object
readonly
Returns the value of attribute agent_activity_log.
-
#rule_process_log ⇒ Object
readonly
Returns the value of attribute rule_process_log.
-
#task_process_log ⇒ Object
readonly
Returns the value of attribute task_process_log.
Attributes inherited from ProcessLog
Instance Method Summary collapse
-
#format(trace_filters = []) ⇒ String
Format as a XML document.
-
#initialize(records) ⇒ XESLog
constructor
A new instance of XESLog.
Methods inherited from ProcessLog
[], group_by, #group_by, known?, read, set_filter, set_format_name
Constructor Details
#initialize(records) ⇒ XESLog
Returns a new instance of XESLog.
13 14 15 16 17 |
# File 'lib/pione/log/xes-log.rb', line 13 def initialize(records) @agent_activity_log = AgentActivityLog.new(records) @rule_process_log = RuleProcessLog.new(records) @task_process_log = TaskProcessLog.new(records) end |
Instance Attribute Details
#agent_activity_log ⇒ Object (readonly)
Returns the value of attribute agent_activity_log.
7 8 9 |
# File 'lib/pione/log/xes-log.rb', line 7 def agent_activity_log @agent_activity_log end |
#rule_process_log ⇒ Object (readonly)
Returns the value of attribute rule_process_log.
8 9 10 |
# File 'lib/pione/log/xes-log.rb', line 8 def rule_process_log @rule_process_log end |
#task_process_log ⇒ Object (readonly)
Returns the value of attribute task_process_log.
9 10 11 |
# File 'lib/pione/log/xes-log.rb', line 9 def task_process_log @task_process_log end |
Instance Method Details
#format(trace_filters = []) ⇒ String
Format as a XML document.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/pione/log/xes-log.rb', line 23 def format(trace_filters=[]) filter = Proc.new {|trace| trace_filters.empty? or trace_filters.any?{|filter| filter.call(trace)}} StringIO.new.tap do |out| XES::Document.new.tap do |doc| doc.log = XES::Log.default.tap do |log| log.concept_name = "PIONE process log" log.traces += [format_agent_activity + [format_rule_process, format_task_process]].flatten.select(&filter) log.traces.flatten! end if doc.formattable? doc.format.write(out, 2) return out.string else raise ProcessLogFormatError.new("not formattable: %s" % doc.inspect) end end end end |