cpee 1.3.133 → 1.3.134

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,7 +29,15 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
29
29
  params = []
30
30
  callback = Digest::MD5.hexdigest(Kernel::rand().to_s)
31
31
  (parameters[:parameters] || {}).each do |k,v|
32
- params << Riddl::Parameter::Simple.new("#{k}",CPEE::ValueHelper::generate(v))
32
+ if v.is_a?(Struct)
33
+ if v.respond_to?(:mimetype)
34
+ params << Riddl::Parameter::Complex.new("#{k}",v.mimetype,v.value)
35
+ else
36
+ params << Riddl::Parameter::Simple.new("#{k}",CPEE::ValueHelper::generate(v.value))
37
+ end
38
+ else
39
+ params << Riddl::Parameter::Simple.new("#{k}",CPEE::ValueHelper::generate(v))
40
+ end
33
41
  end
34
42
  params << Riddl::Header.new("CPEE_BASE",@controller.base_url)
35
43
  params << Riddl::Header.new("CPEE_INSTANCE",@controller.instance_url)
@@ -105,18 +113,18 @@ class DefaultHandlerWrapper < WEEL::HandlerWrapperBase
105
113
  def inform_syntax_error(err,code)# {{{
106
114
  @controller.notify("properties/description/error", :instance => @controller.instance, :message => err.message)
107
115
  end# }}}
108
- def inform_manipulate_change(status,dataelements,endpoints) # {{{
116
+ def inform_manipulate_change(status,changed_dataelements,changed_endpoints,dataelements,endpoints) # {{{
109
117
  unless status.nil?
110
118
  @controller.serialize_status!
111
119
  @controller.notify("properties/status/change", :endpoint => @handler_endpoint, :instance => @controller.instance, :activity => @handler_position, :id => status.id, :message => status.message)
112
120
  end
113
121
  unless dataelements.nil?
114
122
  @controller.serialize_dataelements!
115
- @controller.notify("properties/dataelements/change", :endpoint => @handler_endpoint, :instance => @controller.instance, :activity => @handler_position, :changed => dataelements)
123
+ @controller.notify("properties/dataelements/change", :endpoint => @handler_endpoint, :instance => @controller.instance, :activity => @handler_position, :changed => changed_dataelements)
116
124
  end
117
125
  unless endpoints.nil?
118
126
  @controller.serialize_endpoints!
119
- @controller.notify("properties/endpoints/change", :endpoint => @handler_endpoint, :instance => @controller.instance, :activity => @handler_position, :changed => endpoints)
127
+ @controller.notify("properties/endpoints/change", :endpoint => @handler_endpoint, :instance => @controller.instance, :activity => @handler_position, :changed => changed_endpoints)
120
128
  end
121
129
  end # }}}
122
130
  def inform_position_change(ipc={}) # {{{
@@ -0,0 +1,28 @@
1
+ <subscription xmlns="http://riddl.org/ns/common-patterns/notifications-producer/1.0">
2
+ <topic id="running">
3
+ <event>activity_calling</event>
4
+ <event>activity_manipulating</event>
5
+ <event>activity_failed</event>
6
+ <event>activity_done</event>
7
+ <vote>syncing_after</vote>
8
+ </topic>
9
+ <topic id="properties/description">
10
+ <event>change</event>
11
+ <event>error</event>
12
+ </topic>
13
+ <topic id="properties/position">
14
+ <event>change</event>
15
+ </topic>
16
+ <topic id="properties/state">
17
+ <event>change</event>
18
+ </topic>
19
+ <topic id="properties/dataelements">
20
+ <event>change</event>
21
+ </topic>
22
+ <topic id="properties/endpoints">
23
+ <event>change</event>
24
+ </topic>
25
+ <topic id="properties/handlers">
26
+ <event>change</event>
27
+ </topic>
28
+ </subscription>
@@ -0,0 +1,145 @@
1
+ <properties xmlns="http://riddl.org/ns/common-patterns/properties/1.0">
2
+ <info>Enter info here</info>
3
+ <state>finished</state>
4
+ <handlerwrapper>DefaultHandlerWrapper</handlerwrapper>
5
+ <positions/>
6
+ <dataelements>
7
+ <persons>0</persons>
8
+ <card>Visa_12345</card>
9
+ <airline>Lufthansa</airline>
10
+ <hotels>["Rathaus","Rathaus","Ibis"]</hotels>
11
+ <from>Vienna</from>
12
+ <to>Prague</to>
13
+ <costs>940.0</costs>
14
+ </dataelements>
15
+ <endpoints>
16
+ <bookAir>http://gruppe.wst.univie.ac.at/~mangler/services/airline.php</bookAir>
17
+ <bookHotel>http://gruppe.wst.univie.ac.at/~mangler/services/hotel.php</bookHotel>
18
+ <approve>http://gruppe.wst.univie.ac.at/~mangler/services/approval.php</approve>
19
+ </endpoints>
20
+ <dsl>call :a1, :bookAir, { :method =&gt; :post, :parameters =&gt; {:from =&gt; data.from, :to =&gt; data.to, :persons =&gt; data.persons} }, &lt;&lt;-end
21
+ data.airline = result.value('id')
22
+ data.costs += result.value('costs').to_f
23
+ status.update 1, 'Hotel'
24
+ end
25
+ parallel do
26
+ loop pre_test{data.persons &gt; 0} do
27
+ parallel_branch data.persons do |p|
28
+ call :a2, :bookHotel, { :method =&gt; :post, :parameters =&gt; {:to =&gt; data.to} }, &lt;&lt;-end
29
+ data.hotels &lt;&lt; result.value('id')
30
+ data.costs += result.value('costs').to_f
31
+ end
32
+ end
33
+ manipulate :a3, &lt;&lt;-end
34
+ data.persons -= 1
35
+ end
36
+ end
37
+ end
38
+ choose :inclusive do
39
+ alternative "data.costs &gt; 700" do
40
+ call :a4, :approve, { :method =&gt; :post, :parameters =&gt; {:costs =&gt; data.costs} }
41
+ end
42
+ end
43
+ </dsl>
44
+ <dslx>
45
+ <description xmlns="http://cpee.org/ns/description/1.0">
46
+ <call id="a1" endpoint="bookAir">
47
+ <parameters>
48
+ <method>:post</method>
49
+ <parameters>
50
+ <from>data.from</from>
51
+ <to>data.to</to>
52
+ <persons>data.persons</persons>
53
+ </parameters>
54
+ </parameters>
55
+ <manipulate output="result"> data.airline = result.value('id')
56
+ data.costs += result.value('costs').to_f
57
+ status.update 1, 'Hotel'</manipulate>
58
+ </call>
59
+ <parallel>
60
+ <loop pre_test="data.persons &gt; 0">
61
+ <parallel_branch pass="data.persons" local="p">
62
+ <call id="a2" endpoint="bookHotel">
63
+ <parameters>
64
+ <method>:post</method>
65
+ <parameters>
66
+ <to>data.to</to>
67
+ </parameters>
68
+ </parameters>
69
+ <manipulate output="result"> data.hotels &lt;&lt; result.value('id')
70
+ data.costs += result.value('costs').to_f</manipulate>
71
+ </call>
72
+ </parallel_branch>
73
+ <manipulate id="a3"> data.persons -= 1</manipulate>
74
+ </loop>
75
+ </parallel>
76
+ <choose>
77
+ <alternative condition="data.costs &gt; 700">
78
+ <call id="a4" endpoint="approve">
79
+ <parameters>
80
+ <method>:post</method>
81
+ <parameters>
82
+ <costs>data.costs</costs>
83
+ </parameters>
84
+ </parameters>
85
+ </call>
86
+ </alternative>
87
+ </choose>
88
+ </description>
89
+ </dslx>
90
+ <status>
91
+ <id>0</id>
92
+ <message>undefined</message>
93
+ </status>
94
+ <description>
95
+ <description xmlns="http://cpee.org/ns/description/1.0">
96
+ <call id="a1" endpoint="bookAir">
97
+ <parameters>
98
+ <method>:post</method>
99
+ <parameters>
100
+ <from>data.from</from>
101
+ <to>data.to</to>
102
+ <persons>data.persons</persons>
103
+ </parameters>
104
+ </parameters>
105
+ <manipulate output="result"> data.airline = result.value('id')
106
+ data.costs += result.value('costs').to_f
107
+ status.update 1, 'Hotel'</manipulate>
108
+ </call>
109
+ <parallel>
110
+ <loop pre_test="data.persons &gt; 0">
111
+ <parallel_branch pass="data.persons" local="p">
112
+ <call id="a2" endpoint="bookHotel">
113
+ <parameters>
114
+ <method>:post</method>
115
+ <parameters>
116
+ <to>data.to</to>
117
+ </parameters>
118
+ </parameters>
119
+ <manipulate output="result"> data.hotels &lt;&lt; result.value('id')
120
+ data.costs += result.value('costs').to_f</manipulate>
121
+ </call>
122
+ </parallel_branch>
123
+ <manipulate id="a3"> data.persons -= 1</manipulate>
124
+ </loop>
125
+ </parallel>
126
+ <choose>
127
+ <alternative condition="data.costs &gt; 700">
128
+ <call id="a4" endpoint="approve">
129
+ <parameters>
130
+ <method>:post</method>
131
+ <parameters>
132
+ <costs>data.costs</costs>
133
+ </parameters>
134
+ </parameters>
135
+ </call>
136
+ </alternative>
137
+ </choose>
138
+ </description>
139
+ </description>
140
+ <transformation>
141
+ <description type="copy"/>
142
+ <dataelements type="rest"/>
143
+ <endpoints type="rest"/>
144
+ </transformation>
145
+ </properties>
@@ -0,0 +1,149 @@
1
+ <properties xmlns="http://riddl.org/ns/common-patterns/properties/1.0">
2
+ <info>sdff</info>
3
+ <state>stopped</state>
4
+ <handlerwrapper>DefaultHandlerWrapper</handlerwrapper>
5
+ <positions>
6
+ <a1>after</a1>
7
+ </positions>
8
+ <dataelements>
9
+ <persons>0</persons>
10
+ <card>Visa_12345</card>
11
+ <airline>Lufthansa</airline>
12
+ <hotels>["Mariott","Ibis","Ibis"]</hotels>
13
+ <from>Vienna</from>
14
+ <to>Prague</to>
15
+ <costs>1936.0</costs>
16
+ </dataelements>
17
+ <endpoints>
18
+ <bookAir>http://gruppe.wst.univie.ac.at/~mangler/services/airline.php</bookAir>
19
+ <bookHotel>http://gruppe.wst.univie.ac.at/~mangler/services/hotel.php</bookHotel>
20
+ <approve>http://gruppe.wst.univie.ac.at/~mangler/services/approval.php</approve>
21
+ </endpoints>
22
+ <dsl>call :a1, :bookAir, { :label =&gt; "blaa", :method =&gt; :post, :parameters =&gt; {:from =&gt; data.from, :to =&gt; data.to, :persons =&gt; data.persons} }, &lt;&lt;-end
23
+ data.airline = result.value('id')
24
+ data.costs += result.value('costs').to_f
25
+ status.update 1, 'Hotel'
26
+ end
27
+ parallel do
28
+ loop pre_test{data.persons &gt; 0} do
29
+ parallel_branch data.persons do |p|
30
+ call :a2, :bookHotel, { :method =&gt; :post, :parameters =&gt; {:to =&gt; data.to} }, &lt;&lt;-end
31
+ data.hotels &lt;&lt; result.value('id')
32
+ data.costs += result.value('costs').to_f
33
+ end
34
+ end
35
+ manipulate :a3, &lt;&lt;-end
36
+ data.persons -= 1
37
+ end
38
+ end
39
+ end
40
+ choose :inclusive do
41
+ alternative "data.costs &gt; 700" do
42
+ call :a4, :approve, { :method =&gt; :post, :parameters =&gt; {:costs =&gt; data.costs} }
43
+ end
44
+ end
45
+ </dsl>
46
+ <dslx>
47
+ <description xmlns="http://cpee.org/ns/description/1.0">
48
+ <call id="a1" endpoint="bookAir">
49
+ <parameters>
50
+ <label>"blaa"</label>
51
+ <method>:post</method>
52
+ <parameters>
53
+ <from>data.from</from>
54
+ <to>data.to</to>
55
+ <persons>data.persons</persons>
56
+ </parameters>
57
+ </parameters>
58
+ <manipulate>data.airline = result.value('id')
59
+ data.costs += result.value('costs').to_f
60
+ status.update 1, 'Hotel'</manipulate>
61
+ </call>
62
+ <parallel svg-label="">
63
+ <loop pre_test="data.persons &gt; 0" svg-label="">
64
+ <parallel_branch pass="data.persons" local="p" svg-label="">
65
+ <call id="a2" endpoint="bookHotel" svg-label="">
66
+ <parameters>
67
+ <method>:post</method>
68
+ <parameters>
69
+ <to>data.to</to>
70
+ </parameters>
71
+ </parameters>
72
+ <manipulate output="result"> data.hotels &lt;&lt; result.value('id')
73
+ data.costs += result.value('costs').to_f</manipulate>
74
+ </call>
75
+ </parallel_branch>
76
+ <manipulate id="a3" svg-label=""> data.persons -= 1</manipulate>
77
+ </loop>
78
+ </parallel>
79
+ <choose svg-label="">
80
+ <alternative condition="data.costs &gt; 700" svg-label="">
81
+ <call id="a4" endpoint="approve" svg-label="">
82
+ <parameters>
83
+ <method>:post</method>
84
+ <parameters>
85
+ <costs>data.costs</costs>
86
+ </parameters>
87
+ </parameters>
88
+ </call>
89
+ </alternative>
90
+ </choose>
91
+ </description>
92
+ </dslx>
93
+ <status>
94
+ <id>0</id>
95
+ <message>undefined</message>
96
+ </status>
97
+ <description>
98
+ <description xmlns="http://cpee.org/ns/description/1.0">
99
+ <call id="a1" endpoint="bookAir">
100
+ <parameters>
101
+ <label>"blaa"</label>
102
+ <method>:post</method>
103
+ <parameters>
104
+ <from>data.from</from>
105
+ <to>data.to</to>
106
+ <persons>data.persons</persons>
107
+ </parameters>
108
+ </parameters>
109
+ <manipulate>data.airline = result.value('id')
110
+ data.costs += result.value('costs').to_f
111
+ status.update 1, 'Hotel'</manipulate>
112
+ </call>
113
+ <parallel svg-label="">
114
+ <loop pre_test="data.persons &gt; 0" svg-label="">
115
+ <parallel_branch pass="data.persons" local="p" svg-label="">
116
+ <call id="a2" endpoint="bookHotel" svg-label="">
117
+ <parameters>
118
+ <method>:post</method>
119
+ <parameters>
120
+ <to>data.to</to>
121
+ </parameters>
122
+ </parameters>
123
+ <manipulate output="result"> data.hotels &lt;&lt; result.value('id')
124
+ data.costs += result.value('costs').to_f</manipulate>
125
+ </call>
126
+ </parallel_branch>
127
+ <manipulate id="a3" svg-label=""> data.persons -= 1</manipulate>
128
+ </loop>
129
+ </parallel>
130
+ <choose svg-label="">
131
+ <alternative condition="data.costs &gt; 700" svg-label="">
132
+ <call id="a4" endpoint="approve" svg-label="">
133
+ <parameters>
134
+ <method>:post</method>
135
+ <parameters>
136
+ <costs>data.costs</costs>
137
+ </parameters>
138
+ </parameters>
139
+ </call>
140
+ </alternative>
141
+ </choose>
142
+ </description>
143
+ </description>
144
+ <transformation>
145
+ <description type="copy"/>
146
+ <dataelements type="rest"/>
147
+ <endpoints type="rest"/>
148
+ </transformation>
149
+ </properties>
@@ -0,0 +1,145 @@
1
+ <properties xmlns="http://riddl.org/ns/common-patterns/properties/1.0">
2
+ <info>Enter info here</info>
3
+ <state>stopped</state>
4
+ <handlerwrapper>DefaultHandlerWrapper</handlerwrapper>
5
+ <positions/>
6
+ <dataelements>
7
+ <persons>0</persons>
8
+ <card>Visa_12345</card>
9
+ <airline>FlyNiki</airline>
10
+ <hotels>["Mariott","Rathaus","Mariott"]</hotels>
11
+ <from>Vienna</from>
12
+ <to>Prague</to>
13
+ <costs>1021.0</costs>
14
+ </dataelements>
15
+ <endpoints>
16
+ <bookAir>http://gruppe.wst.univie.ac.at/~mangler/services/airline.php</bookAir>
17
+ <bookHotel>http://gruppe.wst.univie.ac.at/~mangler/services/hotel.php</bookHotel>
18
+ <approve>http://gruppe.wst.univie.ac.at/~mangler/services/approval.php</approve>
19
+ </endpoints>
20
+ <dsl>call :a1, :bookAir, { :method =&gt; :post, :parameters =&gt; {:from =&gt; data.from, :to =&gt; data.to, :persons =&gt; data.persons} }, &lt;&lt;-end
21
+ data.airline = result.value('id')
22
+ data.costs += result.value('costs').to_f
23
+ status.update 1, 'Hotel'
24
+ end
25
+ parallel do
26
+ loop pre_test{data.persons &gt; 0} do
27
+ parallel_branch data.persons do |p|
28
+ call :a2, :bookHotel, { :method =&gt; :post, :parameters =&gt; {:to =&gt; data.to} }, &lt;&lt;-end
29
+ data.hotels &lt;&lt; result.value('id')
30
+ data.costs += result.value('costs').to_f
31
+ end
32
+ end
33
+ manipulate :a3, &lt;&lt;-end
34
+ data.persons -= 1
35
+ end
36
+ end
37
+ end
38
+ choose :inclusive do
39
+ alternative "data.costs &gt; 700" do
40
+ call :a4, :approve, { :method =&gt; :post, :parameters =&gt; {:costs =&gt; data.costs} }
41
+ end
42
+ end
43
+ </dsl>
44
+ <dslx>
45
+ <description xmlns="http://cpee.org/ns/description/1.0">
46
+ <call id="a1" endpoint="bookAir">
47
+ <parameters>
48
+ <method>:post</method>
49
+ <parameters>
50
+ <from>data.from</from>
51
+ <to>data.to</to>
52
+ <persons>data.persons</persons>
53
+ </parameters>
54
+ </parameters>
55
+ <manipulate output="result"> data.airline = result.value('id')
56
+ data.costs += result.value('costs').to_f
57
+ status.update 1, 'Hotel'</manipulate>
58
+ </call>
59
+ <parallel>
60
+ <loop pre_test="data.persons &gt; 0">
61
+ <parallel_branch pass="data.persons" local="p">
62
+ <call id="a2" endpoint="bookHotel">
63
+ <parameters>
64
+ <method>:post</method>
65
+ <parameters>
66
+ <to>data.to</to>
67
+ </parameters>
68
+ </parameters>
69
+ <manipulate output="result"> data.hotels &lt;&lt; result.value('id')
70
+ data.costs += result.value('costs').to_f</manipulate>
71
+ </call>
72
+ </parallel_branch>
73
+ <manipulate id="a3"> data.persons -= 1</manipulate>
74
+ </loop>
75
+ </parallel>
76
+ <choose>
77
+ <alternative condition="data.costs &gt; 700">
78
+ <call id="a4" endpoint="approve">
79
+ <parameters>
80
+ <method>:post</method>
81
+ <parameters>
82
+ <costs>data.costs</costs>
83
+ </parameters>
84
+ </parameters>
85
+ </call>
86
+ </alternative>
87
+ </choose>
88
+ </description>
89
+ </dslx>
90
+ <status>
91
+ <id>0</id>
92
+ <message>undefined</message>
93
+ </status>
94
+ <description>
95
+ <description xmlns="http://cpee.org/ns/description/1.0">
96
+ <call id="a1" endpoint="bookAir">
97
+ <parameters>
98
+ <method>:post</method>
99
+ <parameters>
100
+ <from>data.from</from>
101
+ <to>data.to</to>
102
+ <persons>data.persons</persons>
103
+ </parameters>
104
+ </parameters>
105
+ <manipulate output="result"> data.airline = result.value('id')
106
+ data.costs += result.value('costs').to_f
107
+ status.update 1, 'Hotel'</manipulate>
108
+ </call>
109
+ <parallel>
110
+ <loop pre_test="data.persons &gt; 0">
111
+ <parallel_branch pass="data.persons" local="p">
112
+ <call id="a2" endpoint="bookHotel">
113
+ <parameters>
114
+ <method>:post</method>
115
+ <parameters>
116
+ <to>data.to</to>
117
+ </parameters>
118
+ </parameters>
119
+ <manipulate output="result"> data.hotels &lt;&lt; result.value('id')
120
+ data.costs += result.value('costs').to_f</manipulate>
121
+ </call>
122
+ </parallel_branch>
123
+ <manipulate id="a3"> data.persons -= 1</manipulate>
124
+ </loop>
125
+ </parallel>
126
+ <choose>
127
+ <alternative condition="data.costs &gt; 700">
128
+ <call id="a4" endpoint="approve">
129
+ <parameters>
130
+ <method>:post</method>
131
+ <parameters>
132
+ <costs>data.costs</costs>
133
+ </parameters>
134
+ </parameters>
135
+ </call>
136
+ </alternative>
137
+ </choose>
138
+ </description>
139
+ </description>
140
+ <transformation>
141
+ <description type="copy"/>
142
+ <dataelements type="rest"/>
143
+ <endpoints type="rest"/>
144
+ </transformation>
145
+ </properties>