cpee 1.3.195 → 1.3.196

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ca83c3343d021a5ef8d72455bc550e83201d270
4
- data.tar.gz: e2a7058f722dfd2345afb0191ac2378cde3c84ef
3
+ metadata.gz: d5200d2c427d48101d74a760328fe54294fee5fb
4
+ data.tar.gz: 2f17a1cdf61c65ae94efc2fd59903e0e5473894a
5
5
  SHA512:
6
- metadata.gz: 80af6401be78aa6963df433c8af5234189c4fc4f98a9996d521ba9908d5219ce3e94541e38032b98816017a512baae729f872b86aa60ce3b5e0d6bf2f971bda6
7
- data.tar.gz: fc348e444fb1976444e493fcbf5da7480935d829d43ee794da5827cf4b1cf5d520d95537030386658aefa4f92092049736723a87d34aaf4676e63299f8479694
6
+ metadata.gz: ebf975384da3856a6689fb1d7863128d19ab0b4e6f0ceb7d4e4cd21b42b29f219305f308b8b68cdb0372e29152ed4a34ddf001ee52e2e3f08da204be9535a713
7
+ data.tar.gz: f9e0970be02b46418936bbde573822c9e9baacbde86a88d83057339c38a648e99a3a5e8db626063d001dfe4aa455ad809d3f20aa21fb8500a1fa6fb89ccbaf94
@@ -541,6 +541,7 @@ function save_testset() {// {{{
541
541
  var name = $("value > info",res).text();
542
542
  var pars = $X('<attributes/>');
543
543
  pars.append($(res.documentElement).children());
544
+ pars.find('uuid').remove();
544
545
  testset.append(pars);
545
546
  $('#savetestset').attr('download',name + '.xml');
546
547
  $('#savetestset').attr('href','data:application/xml;charset=utf-8;base64,' + window.btoa(testset.serializePrettyXML()));
@@ -788,15 +789,24 @@ function load_testset_dataelements(url,testset) {// {{{
788
789
  function load_testset_attributes(url,testset) {// {{{
789
790
  if ($("testset > attributes",testset).length == 0) { return; }
790
791
  var ser = '';
791
- $("testset > attributes > *",testset).each(function(){
792
- ser += $(this).serializeXML() + "\n";
793
- });
794
- var val = "<content>" + ser + "</content>";
795
792
  $.ajax({
796
- type: "PUT",
797
- url: url + "/properties/values/attributes",
798
- data: ({content: val}),
799
- error: report_failure
793
+ type: "GET",
794
+ url: url + "/properties/values/attributes/uuid",
795
+ success: function(res){
796
+ var uuid = $X('<uuid/>');
797
+ uuid.text($('value',res).text());
798
+ $("testset > attributes",testset).prepend(uuid);
799
+ $("testset > attributes > *",testset).each(function(){
800
+ ser += $(this).serializeXML() + "\n";
801
+ });
802
+ var val = "<content>" + ser + "</content>";
803
+ $.ajax({
804
+ type: "PUT",
805
+ url: url + "/properties/values/attributes",
806
+ data: ({content: val}),
807
+ error: report_failure
808
+ });
809
+ }
800
810
  });
801
811
  }// }}}
802
812
  function load_testset_endpoints(url,testset) {// {{{
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee"
3
- s.version = "1.3.195"
3
+ s.version = "1.3.196"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "Preliminary release of cloud process execution engine (cpee). If you just need workflow execution, without a rest/xmpp service exposing it, then use WEEL"
@@ -12,61 +12,78 @@ require 'riddl/utils/turtle'
12
12
 
13
13
 
14
14
  class Logging < Riddl::Implementation #{{{
15
+ LOGTEMPLATE = <<-END
16
+ <log xmlns="http://www.xes-standard.org/" xes.version="2.0" xes.features="nested-attributes">
17
+ <extension name="Time" prefix="time" uri="http://www.xes-standard.org/time.xesext"/>
18
+ <extension name="Concept" prefix="concept" uri="http://www.xes-standard.org/concept.xesext"/>
19
+ <extension name="Organizational" prefix="org" uri="http://www.xes-standard.org/org.xesext"/>
20
+ <trace/>
21
+ </log>
22
+ END
15
23
  def response
16
24
  topic = @p[1].value
17
- event = @p[2].value
18
- if(topic == 'activity' && (event=='done' || event == 'calling'))
25
+ event_name = @p[2].value
26
+ if(topic == 'activity' && (event_name=='done' || event_name == 'calling'))
19
27
  log_dir = ::File.dirname(__FILE__) + "/logs"
20
28
  instancenr = @h['CPEE_INSTANCE'].split('/').last
21
29
  notification = JSON.parse(@p[3].value)
30
+ uuid = notification['instance_uuid']
22
31
  parameters = notification['parameters']
23
- log_hash = notification['log_hash']
24
- Dir.mkdir(log_dir+'/'+instancenr) unless Dir.exist?(log_dir+'/'+instancenr)
25
- unless File.exist?(log_dir+'/'+instancenr+'/log.xes')
26
- FileUtils.cp(::File.dirname(__FILE__)+'/template.xes', log_dir+'/'+instancenr+'/log.xes')
27
- XML::Smart.modify(log_dir+'/'+instancenr+'/log.xes') do |xml|
32
+ Dir.mkdir(log_dir+'/'+uuid) unless Dir.exist?(log_dir+'/'+uuid)
33
+ time_added=false
34
+ XML::Smart.modify(log_dir+'/'+uuid+'/log.xes',LOGTEMPLATE) do |xml|
35
+ begin
28
36
  trace = xml.find("/xmlns:log/xmlns:trace").first
29
- trace.add 'string', :key => "concept:name", :value => "Instance #{instancenr}"
37
+ trace.add 'string', :key => "concept:name", :value => "Instance #{instancenr}" if trace.find('xmlns:string').empty?
38
+ event = trace.add "event"
39
+ event.add 'string', :key => "concept:name", :value => parameters["label"] if parameters && parameters.has_key?('label')
40
+ event.add 'string', :key => "concept:instance", :value => notification["endpoint"] if notification["endpoint"]
41
+ event.add 'string', :key => "id:id", :value => notification["activity"]
42
+ event.add 'string', :key => "lifecycle:transition", :value => event_name=='done'?"complete":"start"
43
+ data_send = ((parameters[:arguments].nil? ? [] : parameters[:arguments]) rescue [])
44
+ if data_send.any?
45
+ list = event.add 'list', :key => "data_send"
46
+ data_send.each do |k,v|
47
+ list.add 'string', :key => k , :value => v
48
+ end
49
+ end
50
+ event.add 'date', :key => "time:timestamp", :value => Time.now unless time_added
51
+ rescue => e
52
+ puts e.message
53
+ puts e.backtrace
30
54
  end
31
55
  end
32
-
56
+ elsif(event_name=='receiving')
57
+ log_dir = ::File.dirname(__FILE__) + "/logs"
58
+ instancenr = @h['CPEE_INSTANCE'].split('/').last
59
+ notification = JSON.parse(@p[3].value)
60
+ uuid = notification['instance_uuid']
61
+ receiving = notification['received']
62
+ Dir.mkdir(log_dir+'/'+uuid) unless Dir.exist?(log_dir+'/'+uuid)
33
63
  time_added=false
34
- XML::Smart.modify(log_dir+'/'+instancenr+'/log.xes') do |xml|
35
- trace = xml.find("/xmlns:log/xmlns:trace").first
36
- event = trace.add "event"
37
- event.add 'string', :key => "concept:name", :value => parameters["label"]
38
- event.add 'string', :key => "lifecycle:transition", :value => event=='done'?"complete":"start"
39
- data_send = ((parameters[:arguments].nil? ? [] : parameters[:arguments]) rescue [])
40
- if data_send.any?
41
- list = event.add 'list', :key => "data_send"
42
- data_send.each do |k,v|
43
- list.add 'string', :key => k , :value => v
44
- end
45
- end
46
- if log_hash.has_key?("data_received")
47
- log_hash["data_received"].delete_if do |e|
48
- if e.keys[0]=="timestamp"
49
- event.add 'date', :key => "time:timestamp", :value => e.values[0]
50
- time_added=true
51
- true
52
- else
53
- false
54
- end
55
- end
56
- if log_hash["data_received"].length > 0
64
+ XML::Smart.modify(log_dir+'/'+uuid+'/log.xes',LOGTEMPLATE) do |xml|
65
+ begin
66
+ trace = xml.find("/xmlns:log/xmlns:trace").first
67
+ trace.add 'string', :key => "concept:name", :value => "Instance #{instancenr}" if trace.find('xmlns:string').empty?
68
+ event = trace.add "event"
69
+ event.add 'string', :key => "concept:instance", :value => notification["endpoint"] if notification["endpoint"]
70
+ event.add 'string', :key => "id:id", :value => notification["activity"]
71
+ event.add 'string', :key => "lifecycle:transition", :value => "unknown"
72
+ if receiving.any?
57
73
  list = event.add 'list', :key => "data_received"
58
- log_hash["data_received"].each{|e| list.add 'string', :key => e.keys[0] , :value => e.values[0]}
74
+ receiving.each do |k,v|
75
+ list.add 'string', :key => k, :value => v
76
+ end
59
77
  end
78
+ event.add 'date', :key => "time:timestamp", :value => Time.now unless time_added
79
+ rescue => e
80
+ puts e.message
81
+ puts e.backtrace
60
82
  end
61
- event.add 'date', :key => "time:timestamp", :value => Time.now unless time_added
62
- end
83
+ end
63
84
  else
64
85
  pp "Something wrong"
65
86
  end
66
-
67
-
68
-
69
-
70
87
  end
71
88
  end #}}}
72
89
 
@@ -44,8 +44,7 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
44
44
  end # }}}
45
45
 
46
46
  def activity_handle(passthrough, parameters) # {{{
47
- @controller.notify("activity/calling", :instance => @controller.instance, :activity => @handler_position, :passthrough => passthrough, :endpoint => @handler_endpoint, :parameters => parameters)
48
-
47
+ @controller.notify("activity/calling", :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :passthrough => passthrough, :endpoint => @handler_endpoint, :parameters => parameters)
49
48
  result = []
50
49
  if passthrough.nil?
51
50
  params = []
@@ -110,36 +109,36 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
110
109
  end # }}}
111
110
 
112
111
  def inform_activity_done # {{{
113
- @controller.notify("activity/done", :endpoint => @handler_endpoint, :instance => @controller.instance, :activity => @handler_position)
112
+ @controller.notify("activity/done", :endpoint => @handler_endpoint, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position)
114
113
  end # }}}
115
114
  def inform_activity_manipulate # {{{
116
- @controller.notify("activity/manipulating", :endpoint => @handler_endpoint, :instance => @controller.instance, :activity => @handler_position)
115
+ @controller.notify("activity/manipulating", :endpoint => @handler_endpoint, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position)
117
116
  end # }}}
118
117
  def inform_activity_failed(err) # {{{
119
118
  puts err.message
120
119
  puts err.backtrace
121
- @controller.notify("activity/failed", :endpoint => @handler_endpoint, :instance => @controller.instance, :activity => @handler_position, :message => err.message, :line => err.backtrace[0].match(/(.*?):(\d+):/)[2], :where => err.backtrace[0].match(/(.*?):(\d+):/)[1])
120
+ @controller.notify("activity/failed", :endpoint => @handler_endpoint, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :message => err.message, :line => err.backtrace[0].match(/(.*?):(\d+):/)[2], :where => err.backtrace[0].match(/(.*?):(\d+):/)[1])
122
121
  end # }}}
123
122
  def inform_manipulate_change(status,changed_dataelements,changed_endpoints,dataelements,endpoints) # {{{
124
123
  unless status.nil?
125
124
  @controller.serialize_status!
126
- @controller.notify("status/change", :endpoint => @handler_endpoint, :instance => @controller.instance, :activity => @handler_position, :id => status.id, :message => status.message)
125
+ @controller.notify("status/change", :endpoint => @handler_endpoint, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :id => status.id, :message => status.message)
127
126
  end
128
127
  unless changed_dataelements.nil?
129
128
  @controller.serialize_dataelements!
130
- @controller.notify("dataelements/change", :endpoint => @handler_endpoint, :instance => @controller.instance, :activity => @handler_position, :changed => changed_dataelements)
129
+ @controller.notify("dataelements/change", :endpoint => @handler_endpoint, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :changed => changed_dataelements)
131
130
  end
132
131
  unless changed_endpoints.nil?
133
132
  @controller.serialize_endpoints!
134
- @controller.notify("endpoints/change", :endpoint => @handler_endpoint, :instance => @controller.instance, :activity => @handler_position, :changed => changed_endpoints)
133
+ @controller.notify("endpoints/change", :endpoint => @handler_endpoint, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :changed => changed_endpoints)
135
134
  end
136
135
  end # }}}
137
136
 
138
137
  def vote_sync_after # {{{
139
- @controller.call_vote("activity/syncing_after", :endpoint => @handler_endpoint, :instance => @controller.instance, :activity => @handler_position)
138
+ @controller.call_vote("activity/syncing_after", :endpoint => @handler_endpoint, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position)
140
139
  end # }}}
141
140
  def vote_sync_before(parameters=nil) # {{{
142
- @controller.call_vote("activity/syncing_before", :endpoint => @handler_endpoint, :instance => @controller.instance, :activity => @handler_position)
141
+ @controller.call_vote("activity/syncing_before", :endpoint => @handler_endpoint, :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position)
143
142
  end # }}}
144
143
 
145
144
  def simplify_result(result)
@@ -181,12 +180,12 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
181
180
  end
182
181
 
183
182
  def callback(result=nil,options={})
184
- @controller.notify("activity/receiving", :instance => @controller.instance, :activity => @handler_position, :endpoint => @handler_endpoint, :received => structurize_result(result))
183
+ @controller.notify("activity/receiving", :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :endpoint => @handler_endpoint, :received => structurize_result(result))
185
184
  result = simplify_result(result)
186
185
  if options['CPEE_UPDATE']
187
186
  @handler_returnValue = result
188
187
  if options['CPEE_UPDATE_STATUS']
189
- @controller.notify("activity/status", :instance => @controller.instance, :activity => @handler_position, :endpoint => @handler_endpoint, :status => options['CPEE_UPDATE_STATUS'])
188
+ @controller.notify("activity/status", :instance => @controller.instance, :instance_uuid => @controller.uuid, :activity => @handler_position, :endpoint => @handler_endpoint, :status => options['CPEE_UPDATE_STATUS'])
190
189
  end
191
190
  @handler_continue.continue WEEL::Signal::Again
192
191
  else
@@ -203,6 +202,7 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
203
202
  @controller.call_vote("simulating/step",
204
203
  :endpoint => @handler_endpoint,
205
204
  :instance => @controller.instance,
205
+ :instance_uuid => @controller.uuid,
206
206
  :activity => tid,
207
207
  :type => type,
208
208
  :nesting => nesting,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.195
4
+ version: 1.3.196
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler