cpee 2.1.135 → 2.1.136

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/cockpit/compliance-view.html +12 -13
  4. data/cockpit/compliance.html +12 -13
  5. data/cockpit/css/llm.css +3 -3
  6. data/cockpit/css/llmmodel.css +140 -0
  7. data/cockpit/css/model.css +0 -1
  8. data/cockpit/css/ui.css +13 -7
  9. data/cockpit/css/wfadaptor.css +15 -10
  10. data/cockpit/edit.html +12 -13
  11. data/cockpit/graph.html +8 -8
  12. data/cockpit/index.html +12 -13
  13. data/cockpit/js/build-bpmn2.js +302 -0
  14. data/cockpit/js/details.js +27 -10
  15. data/cockpit/js/instance.js +193 -203
  16. data/cockpit/js/llm-ui-bubble.js +36 -0
  17. data/cockpit/js/llm-ui-status.js +34 -0
  18. data/cockpit/js/llm-ui.js +87 -0
  19. data/cockpit/js/llm.js +463 -118
  20. data/cockpit/js/parameters.js +45 -14
  21. data/cockpit/js/wfadaptor.js +394 -75
  22. data/cockpit/llm.html +17 -15
  23. data/cockpit/llmmodel.html +18 -17
  24. data/cockpit/model.html +9 -9
  25. data/cockpit/only_llm.html +15 -13
  26. data/cockpit/themes/base.js +1 -1
  27. data/cockpit/themes/packed/theme.js +3 -0
  28. data/cockpit/themes/presetlr/rngs/alternative.rng +28 -0
  29. data/cockpit/themes/presetlr/rngs/call.rng +249 -0
  30. data/cockpit/themes/presetlr/rngs/callmanipulate.rng +281 -0
  31. data/cockpit/themes/presetlr/rngs/choose.rng +27 -0
  32. data/cockpit/themes/presetlr/rngs/closed_loop.rng +62 -0
  33. data/cockpit/themes/presetlr/rngs/closed_loop_cancel.rng +5 -0
  34. data/cockpit/themes/presetlr/rngs/closed_loop_control.rng +31 -0
  35. data/cockpit/themes/presetlr/rngs/closed_loop_measuring.rng +12 -0
  36. data/cockpit/themes/presetlr/rngs/critical.rng +8 -0
  37. data/cockpit/themes/presetlr/rngs/escape.rng +5 -0
  38. data/cockpit/themes/presetlr/rngs/group.rng +3 -0
  39. data/cockpit/themes/presetlr/rngs/loop.rng +40 -0
  40. data/cockpit/themes/presetlr/rngs/manipulate.rng +76 -0
  41. data/cockpit/themes/presetlr/rngs/otherwise.rng +25 -0
  42. data/cockpit/themes/presetlr/rngs/parallel.rng +24 -0
  43. data/cockpit/themes/presetlr/rngs/parallel_branch.rng +5 -0
  44. data/cockpit/themes/presetlr/rngs/scripts.rng +23 -0
  45. data/cockpit/themes/presetlr/rngs/start.rng +143 -0
  46. data/cockpit/themes/presetlr/rngs/stop.rng +5 -0
  47. data/cockpit/themes/presetlr/rngs/terminate.rng +8 -0
  48. data/cockpit/themes/presetlr/rngs/wait_for_signal.rng +8 -0
  49. data/cockpit/themes/presetlr/symbols/alternative.svg +19 -0
  50. data/cockpit/themes/presetlr/symbols/arrow.svg +1 -0
  51. data/cockpit/themes/presetlr/symbols/call.svg +1 -0
  52. data/cockpit/themes/presetlr/symbols/call_sensor.svg +1 -0
  53. data/cockpit/themes/presetlr/symbols/callmanipulate.svg +1 -0
  54. data/cockpit/themes/presetlr/symbols/callmanipulate_sensor.svg +1 -0
  55. data/cockpit/themes/presetlr/symbols/callmanipulate_sensor_signal.svg +1 -0
  56. data/cockpit/themes/presetlr/symbols/callmanipulate_signal.svg +1 -0
  57. data/cockpit/themes/presetlr/symbols/choose.svg +15 -0
  58. data/cockpit/themes/presetlr/symbols/choose_exclusive.svg +15 -0
  59. data/cockpit/themes/presetlr/symbols/choose_exclusive_finish.svg +1 -0
  60. data/cockpit/themes/presetlr/symbols/choose_inclusive.svg +13 -0
  61. data/cockpit/themes/presetlr/symbols/choose_inclusive_finish.svg +1 -0
  62. data/cockpit/themes/presetlr/symbols/closed_loop.svg +1 -0
  63. data/cockpit/themes/presetlr/symbols/closed_loop_cancel.svg +1 -0
  64. data/cockpit/themes/presetlr/symbols/closed_loop_control.svg +1 -0
  65. data/cockpit/themes/presetlr/symbols/closed_loop_measuring.svg +1 -0
  66. data/cockpit/themes/presetlr/symbols/complex.svg +1 -0
  67. data/cockpit/themes/presetlr/symbols/critical.svg +1 -0
  68. data/cockpit/themes/presetlr/symbols/delete.svg +1 -0
  69. data/cockpit/themes/presetlr/symbols/end.svg +1 -0
  70. data/cockpit/themes/presetlr/symbols/escape.svg +1 -0
  71. data/cockpit/themes/presetlr/symbols/event_end.svg +1 -0
  72. data/cockpit/themes/presetlr/symbols/event_start.svg +1 -0
  73. data/cockpit/themes/presetlr/symbols/loop.svg +15 -0
  74. data/cockpit/themes/presetlr/symbols/loop_end.svg +15 -0
  75. data/cockpit/themes/presetlr/symbols/loop_end_pre.svg +15 -0
  76. data/cockpit/themes/presetlr/symbols/manipulate.svg +1 -0
  77. data/cockpit/themes/presetlr/symbols/mark.svg +1 -0
  78. data/cockpit/themes/presetlr/symbols/otherwise.svg +7 -0
  79. data/cockpit/themes/presetlr/symbols/parallel.svg +1 -0
  80. data/cockpit/themes/presetlr/symbols/parallel_branch.svg +7 -0
  81. data/cockpit/themes/presetlr/symbols/parallel_branch_event.svg +14 -0
  82. data/cockpit/themes/presetlr/symbols/parallel_branch_event_rev.svg +11 -0
  83. data/cockpit/themes/presetlr/symbols/parallel_branch_normal.svg +7 -0
  84. data/cockpit/themes/presetlr/symbols/parallel_eventbased_exclusive.svg +1 -0
  85. data/cockpit/themes/presetlr/symbols/parallel_eventbased_parallel.svg +1 -0
  86. data/cockpit/themes/presetlr/symbols/scripts.svg +1 -0
  87. data/cockpit/themes/presetlr/symbols/start.svg +1 -0
  88. data/cockpit/themes/presetlr/symbols/start_event.svg +1 -0
  89. data/cockpit/themes/presetlr/symbols/stop.svg +1 -0
  90. data/cockpit/themes/presetlr/symbols/terminate.svg +1 -0
  91. data/cockpit/themes/presetlr/symbols/wait_for_signal.svg +1 -0
  92. data/cockpit/themes/presetlr/theme.js +54 -0
  93. data/cockpit/themes/wellformed/rngs/alternative.rng +28 -0
  94. data/cockpit/themes/wellformed/rngs/call.rng +249 -0
  95. data/cockpit/themes/wellformed/rngs/callmanipulate.rng +281 -0
  96. data/cockpit/themes/wellformed/rngs/choose.rng +27 -0
  97. data/cockpit/themes/wellformed/rngs/closed_loop.rng +62 -0
  98. data/cockpit/themes/wellformed/rngs/closed_loop_cancel.rng +5 -0
  99. data/cockpit/themes/wellformed/rngs/closed_loop_control.rng +31 -0
  100. data/cockpit/themes/wellformed/rngs/closed_loop_measuring.rng +12 -0
  101. data/cockpit/themes/wellformed/rngs/critical.rng +8 -0
  102. data/cockpit/themes/wellformed/rngs/escape.rng +5 -0
  103. data/cockpit/themes/wellformed/rngs/group.rng +3 -0
  104. data/cockpit/themes/wellformed/rngs/loop.rng +40 -0
  105. data/cockpit/themes/wellformed/rngs/manipulate.rng +76 -0
  106. data/cockpit/themes/wellformed/rngs/otherwise.rng +25 -0
  107. data/cockpit/themes/wellformed/rngs/parallel.rng +24 -0
  108. data/cockpit/themes/wellformed/rngs/parallel_branch.rng +5 -0
  109. data/cockpit/themes/wellformed/rngs/scripts.rng +23 -0
  110. data/cockpit/themes/wellformed/rngs/start.rng +143 -0
  111. data/cockpit/themes/wellformed/rngs/stop.rng +5 -0
  112. data/cockpit/themes/wellformed/rngs/terminate.rng +8 -0
  113. data/cockpit/themes/wellformed/rngs/wait_for_signal.rng +8 -0
  114. data/cockpit/themes/wellformed/symbols/alternative.svg +1 -0
  115. data/cockpit/themes/wellformed/symbols/arrow.svg +1 -0
  116. data/cockpit/themes/wellformed/symbols/call.svg +1 -0
  117. data/cockpit/themes/wellformed/symbols/call_sensor.svg +1 -0
  118. data/cockpit/themes/wellformed/symbols/callmanipulate.svg +1 -0
  119. data/cockpit/themes/wellformed/symbols/callmanipulate_sensor.svg +1 -0
  120. data/cockpit/themes/wellformed/symbols/callmanipulate_sensor_signal.svg +1 -0
  121. data/cockpit/themes/wellformed/symbols/callmanipulate_signal.svg +1 -0
  122. data/cockpit/themes/wellformed/symbols/choose.svg +1 -0
  123. data/cockpit/themes/wellformed/symbols/choose_exclusive.svg +1 -0
  124. data/cockpit/themes/wellformed/symbols/choose_exclusive_finish.svg +1 -0
  125. data/cockpit/themes/wellformed/symbols/choose_inclusive.svg +1 -0
  126. data/cockpit/themes/wellformed/symbols/choose_inclusive_finish.svg +1 -0
  127. data/cockpit/themes/wellformed/symbols/closed_loop.svg +1 -0
  128. data/cockpit/themes/wellformed/symbols/closed_loop_cancel.svg +1 -0
  129. data/cockpit/themes/wellformed/symbols/closed_loop_control.svg +1 -0
  130. data/cockpit/themes/wellformed/symbols/closed_loop_measuring.svg +1 -0
  131. data/cockpit/themes/wellformed/symbols/complex.svg +1 -0
  132. data/cockpit/themes/wellformed/symbols/critical.svg +1 -0
  133. data/cockpit/themes/wellformed/symbols/delete.svg +1 -0
  134. data/cockpit/themes/wellformed/symbols/end.svg +1 -0
  135. data/cockpit/themes/wellformed/symbols/escape.svg +1 -0
  136. data/cockpit/themes/wellformed/symbols/event_end.svg +1 -0
  137. data/cockpit/themes/wellformed/symbols/event_start.svg +6 -0
  138. data/cockpit/themes/wellformed/symbols/loop.svg +1 -0
  139. data/cockpit/themes/wellformed/symbols/loop_end.svg +1 -0
  140. data/cockpit/themes/wellformed/symbols/manipulate.svg +1 -0
  141. data/cockpit/themes/wellformed/symbols/mark.svg +1 -0
  142. data/cockpit/themes/wellformed/symbols/otherwise.svg +1 -0
  143. data/cockpit/themes/wellformed/symbols/parallel.svg +1 -0
  144. data/cockpit/themes/wellformed/symbols/parallel_branch.svg +1 -0
  145. data/cockpit/themes/wellformed/symbols/parallel_branch_event.svg +1 -0
  146. data/cockpit/themes/wellformed/symbols/parallel_branch_event_rev.svg +11 -0
  147. data/cockpit/themes/wellformed/symbols/parallel_branch_normal.svg +1 -0
  148. data/cockpit/themes/wellformed/symbols/parallel_eventbased_exclusive.svg +1 -0
  149. data/cockpit/themes/wellformed/symbols/parallel_eventbased_parallel.svg +1 -0
  150. data/cockpit/themes/wellformed/symbols/scripts.svg +1 -0
  151. data/cockpit/themes/wellformed/symbols/start.svg +1 -0
  152. data/cockpit/themes/wellformed/symbols/start_event.svg +1 -0
  153. data/cockpit/themes/wellformed/symbols/stop.svg +1 -0
  154. data/cockpit/themes/wellformed/symbols/terminate.svg +1 -0
  155. data/cockpit/themes/wellformed/symbols/wait_for_signal.svg +1 -0
  156. data/cockpit/themes/wellformed/theme.js +32 -0
  157. data/cockpit/track.html +8 -8
  158. data/cpee.gemspec +2 -2
  159. data/lib/callbacks/callbacks.rng +4 -4
  160. data/lib/callbacks.xml +4 -4
  161. data/lib/cpee/constants.rb +4 -4
  162. data/lib/cpee/fail.rb +4 -4
  163. data/lib/cpee/implementation.rb +5 -4
  164. data/lib/cpee/implementation_callbacks.rb +4 -4
  165. data/lib/cpee/implementation_notifications.rb +4 -4
  166. data/lib/cpee/implementation_properties.rb +108 -12
  167. data/lib/cpee/message.rb +4 -4
  168. data/lib/cpee/persistence.rb +6 -4
  169. data/lib/cpee/redis.rb +4 -4
  170. data/lib/cpee/statemachine.rb +4 -4
  171. data/lib/cpee/value_helper.rb +4 -4
  172. data/lib/cpee.xml +4 -4
  173. data/lib/engine/executionhandler-list.rng +4 -4
  174. data/lib/engine/instance-info.rng +4 -4
  175. data/lib/engine/instances.rng +4 -4
  176. data/lib/engine.xml +4 -4
  177. data/lib/properties/t_dslx.rng +346 -0
  178. data/lib/properties/transformation.rng +14 -0
  179. data/lib/properties.xml +5 -4
  180. data/server/executionhandlers/eval/backend/opts.yaml +1 -1
  181. data/server/executionhandlers/eval/connection.rb +4 -4
  182. data/server/executionhandlers/eval/execution.rb +4 -4
  183. data/server/executionhandlers/ruby/backend/opts.yaml +1 -1
  184. data/server/executionhandlers/ruby/connection.rb +5 -6
  185. data/server/executionhandlers/ruby/controller.rb +4 -4
  186. data/server/executionhandlers/ruby/dsl_to_dslx.xsl +6 -2
  187. data/server/executionhandlers/ruby/execution.rb +4 -4
  188. data/server/resources/properties.empty +5 -4
  189. data/server/resources/properties.init +5 -4
  190. data/server/resources/topics.xml +4 -4
  191. data/server/routing/end.pid +1 -1
  192. data/server/routing/end.rb +4 -4
  193. data/server/routing/forward-events-00.pid +1 -1
  194. data/server/routing/forward-events.rb +4 -4
  195. data/server/routing/forward-votes.pid +1 -1
  196. data/server/routing/forward-votes.rb +4 -4
  197. data/server/routing/persist.pid +1 -1
  198. data/server/routing/persist.rb +6 -4
  199. data/tools/server/cpee +1 -1
  200. data/tools/server/resources/properties.init +4 -4
  201. metadata +136 -5
  202. data/cockpit/CPEE.xml +0 -8
  203. data/cockpit/Signavio.xml +0 -8
  204. data/cockpit/transformations.xml +0 -4
  205. /data/{COPYING → LICENSE} +0 -0
@@ -1,15 +1,15 @@
1
1
  # This file is part of CPEE.
2
2
  #
3
3
  # CPEE is free software: you can redistribute it and/or modify it under the terms
4
- # of the GNU General Public License as published by the Free Software Foundation,
4
+ # of the GNU Lesser General Public License as published by the Free Software Foundation,
5
5
  # either version 3 of the License, or (at your option) any later version.
6
6
  #
7
7
  # CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
8
8
  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
9
- # PARTICULAR PURPOSE. See the GNU General Public License for more details.
9
+ # PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
10
10
  #
11
- # You should have received a copy of the GNU General Public License along with
12
- # CPEE (file COPYING in the main directory). If not, see
11
+ # You should have received a copy of the GNU Lesser General Public License along with
12
+ # CPEE (file LICENSE in the main directory). If not, see
13
13
  # <http://www.gnu.org/licenses/>.
14
14
 
15
15
  require_relative 'fail'
@@ -139,6 +139,8 @@ module CPEE
139
139
  doc.find('/p:properties/p:transformation/p:description/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/description/@type')
140
140
  doc.find('/p:properties/p:transformation/p:dataelements/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/dataelements/@type')
141
141
  doc.find('/p:properties/p:transformation/p:endpoints/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/endpoints/@type')
142
+ doc.find('/p:properties/p:transformation/p:dslx').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/dslx') || ''
143
+ doc.find('/p:properties/p:transformation/p:dslx/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/dslx/@type') || 'copy' # instances from before dslx backtransformation
142
144
  Riddl::Parameter::Complex.new('properties','application/xml',doc.to_s)
143
145
  end
144
146
  end #}}}
@@ -164,14 +166,14 @@ module CPEE
164
166
  end
165
167
  end
166
168
 
167
- %w{dataelements documents endpoints documents}.each do |item|
169
+ %w{dataelements documents endpoints attributes}.each do |item|
168
170
  if (node = doc.find('/p:properties/p:' + item)).any?
169
171
  CPEE::Properties::PatchItems::set item, id, opts, node.first.dump
170
172
  end
171
173
  end
172
174
 
173
175
  if (node = doc.find('/p:properties/p:transformation')).any?
174
- CPEE::Properties::PutTransformation::set id, opts, node.first.dump
176
+ CPEE::Properties::PutTransformation::set id, opts, node.first.dump, doc.find('/p:properties/p:description/*').empty?
175
177
  end
176
178
  if (node = doc.find('/p:properties/p:description/*')).any?
177
179
  CPEE::Properties::PutDescription::set id, opts, node.first.dump
@@ -206,7 +208,7 @@ module CPEE
206
208
  end
207
209
 
208
210
  if (node = doc.find('/*/p:transformation')).any?
209
- CPEE::Properties::PutTransformation::set id, opts, node.first.dump
211
+ CPEE::Properties::PutTransformation::set id, opts, node.first.dump, doc.find('/*/p:description/*').empty?
210
212
  end
211
213
  if (node = doc.find('/*/p:description/*')).any?
212
214
  CPEE::Properties::PutDescription::set id, opts, node.first.dump
@@ -798,6 +800,32 @@ module CPEE
798
800
  [dslx, dsl, de, ep]
799
801
  end #}}}
800
802
 
803
+ def self::backtransform(xml,dslx,tdslx,tdslxtype) #{{{
804
+ # description from a directly set dslx, nil means keep the current description
805
+ case tdslxtype
806
+ when 'rest'
807
+ return nil if tdslx.nil? || tdslx.empty?
808
+ srv = Riddl::Client.new(tdslx)
809
+ status, res = srv.post [
810
+ Riddl::Parameter::Complex.new("description","text/xml",dslx), # the service distinguishes directions by path, e.g. /bpmn2/cpee/
811
+ Riddl::Parameter::Simple.new("type","description")
812
+ ]
813
+ if status >= 200 && status < 300
814
+ res[0].value.read
815
+ else
816
+ raise 'Could not backtransform dslx'
817
+ end
818
+ when 'xslt'
819
+ return nil if tdslx.nil? || tdslx.empty?
820
+ trans = XML::Smart::open_unprotected(tdslx)
821
+ XML::Smart::string(dslx).transform_with(trans).to_s
822
+ when 'none'
823
+ nil
824
+ else # copy, or instances from before dslx backtransformation
825
+ xml
826
+ end
827
+ end #}}}
828
+
801
829
  def self::set(id,opts,xml,exposition=[],copy=false)
802
830
  dslx, dsl, de, ep = if copy
803
831
  PutDescription::transform(
@@ -826,11 +854,28 @@ module CPEE
826
854
  opts
827
855
  )
828
856
  end
857
+ description = if copy
858
+ begin
859
+ PutDescription::backtransform(
860
+ xml,
861
+ dslx,
862
+ CPEE::Persistence::extract_item(id,opts,'transformation/dslx'),
863
+ CPEE::Persistence::extract_item(id,opts,'transformation/dslx/@type')
864
+ )
865
+ rescue => e # dslx is stored anyway, description stays as it is
866
+ puts e.message
867
+ puts e.backtrace
868
+ nil
869
+ end
870
+ else
871
+ xml
872
+ end
873
+ description ||= CPEE::Persistence::extract_item(id,opts,'description') || ''
829
874
  attrs = CPEE::Persistence::extract_list(id,opts,'attributes').to_h
830
875
  dos = CPEE::Persistence::extract_list(id,opts,'documents').to_h
831
876
  change_uuid = Digest::SHA1.hexdigest(dslx)
832
877
  CPEE::Persistence::set_item(id,opts,'description',
833
- :description => xml,
878
+ :description => description,
834
879
  :dslx => dslx,
835
880
  :change_uuid => change_uuid,
836
881
  :dsl => dsl,
@@ -851,6 +896,16 @@ module CPEE
851
896
  end
852
897
  end
853
898
 
899
+ def self::validate(xml,opts) # dslx against t_dslx.rng, returns the errors
900
+ errors = []
901
+ begin
902
+ XML::Smart::string(xml).validate_against(XML::Smart::open_unprotected(opts[:dslx_rng])) { |e| errors << e.message.strip }
903
+ rescue => e # not even well-formed
904
+ errors << e.message.strip
905
+ end
906
+ errors
907
+ end
908
+
854
909
  def response
855
910
  id = @a[0]
856
911
  opts = @a[1]
@@ -860,9 +915,17 @@ module CPEE
860
915
  elsif opts[:statemachine].final? id
861
916
  @status = 410
862
917
  else
918
+ # force-encoding because johannes managed to sneak in ascii special characters. why the browser is not sanitizing it is beyond me.
919
+ xml = @p[0].value.read.force_encoding('UTF-8')
920
+ errors = copy ? PutDescription::validate(xml,opts) : [] # copy: dslx, a description can be any model type
921
+ if errors.any?
922
+ attrs = CPEE::Persistence::extract_list(id,opts,'attributes').to_h
923
+ CPEE::Message::send(:event,'description/error',File.join(opts[:url],'/'),id,attrs['uuid'],attrs['info'],{ :message => errors.join("\n"), :errors => errors, :attributes => attrs },opts[:redis])
924
+ @status = 422
925
+ return Riddl::Parameter::Complex.new('error','text/plain',errors.join("\n"))
926
+ end
863
927
  begin
864
- # force-encoding because johannes managed to sneak in ascii special characters. why the browser is not sanitizing it is beyond me.
865
- PutDescription::set(id,opts,@p[0].value.read.force_encoding('UTF-8'),@p[1..-1],copy)
928
+ PutDescription::set(id,opts,xml,@p[1..-1],copy)
866
929
  rescue => e
867
930
  puts e.message
868
931
  puts e.backtrace
@@ -886,20 +949,53 @@ module CPEE
886
949
  des.find('p:description/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/description/@type')
887
950
  des.find('p:dataelements/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/dataelements/@type')
888
951
  des.find('p:endpoints/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/endpoints/@type')
952
+ des.find('p:dslx').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/dslx') || ''
953
+ des.find('p:dslx/@type').first.text = CPEE::Persistence::extract_item(id,opts,'transformation/dslx/@type') || 'copy' # instances from before dslx backtransformation
889
954
  Riddl::Parameter::Complex.new('status','text/xml',des.to_doc.to_s)
890
955
  end
891
956
  end #}}}
892
957
  class PutTransformation < Riddl::Implementation #{{{
893
- def self::set(id,opts,xml)
958
+ def self::set(id,opts,xml,backtrans=true)
894
959
  doc = XML::Smart::string(xml)
895
960
  doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
961
+ tdslx = doc.find('string(/p:transformation/p:dslx)')
962
+ tdslxtype = (t = doc.find('string(/p:transformation/p:dslx/@type)')).empty? ? 'copy' : t # optional, missing means copy
963
+ changed = tdslx != (CPEE::Persistence::extract_item(id,opts,'transformation/dslx') || '') ||
964
+ tdslxtype != (CPEE::Persistence::extract_item(id,opts,'transformation/dslx/@type') || 'copy')
896
965
  CPEE::Persistence::set_item(id,opts,'transformation',
897
966
  :description => doc.find('string(/p:transformation/p:description)'),
898
967
  :description_type => doc.find('string(/p:transformation/p:description/@type)'),
899
968
  :dataelements =>doc.find('string(/p:transformation/p:dataelements)'),
900
969
  :dataelements_type => doc.find('string(/p:transformation/p:dataelements/@type)'),
901
970
  :endpoints =>doc.find('string(/p:transformation/p:endpoints)'),
902
- :endpoints_type => doc.find('string(/p:transformation/p:endpoints/@type)')
971
+ :endpoints_type => doc.find('string(/p:transformation/p:endpoints/@type)'),
972
+ :dslx => tdslx,
973
+ :dslx_type => tdslxtype
974
+ )
975
+ PutTransformation::backtransform(id,opts,tdslx,tdslxtype) if backtrans && changed
976
+ end
977
+ def self::backtransform(id,opts,tdslx,tdslxtype)
978
+ # the description has to follow the new transformation. the new values are passed
979
+ # directly, as redis is only updated asynchronously by persist.rb
980
+ dslx = CPEE::Persistence::extract_item(id,opts,'dslx')
981
+ return if dslx.nil? || dslx.empty?
982
+ description = begin
983
+ PutDescription::backtransform(dslx,dslx,tdslx,tdslxtype)
984
+ rescue => e # description stays as it is
985
+ puts e.message
986
+ puts e.backtrace
987
+ nil
988
+ end
989
+ return if description.nil?
990
+ CPEE::Persistence::set_item(id,opts,'description',
991
+ :description => description,
992
+ :dslx => dslx,
993
+ :change_uuid => Digest::SHA1.hexdigest(dslx),
994
+ :dsl => CPEE::Persistence::extract_item(id,opts,'dsl'),
995
+ :dataelements => CPEE::Persistence::extract_list(id,opts,'dataelements').to_h,
996
+ :documents => CPEE::Persistence::extract_list(id,opts,'documents').to_h,
997
+ :endpoints => CPEE::Persistence::extract_list(id,opts,'endpoints').to_h,
998
+ :attributes => CPEE::Persistence::extract_list(id,opts,'attributes').to_h
903
999
  )
904
1000
  end
905
1001
  def response
data/lib/cpee/message.rb CHANGED
@@ -1,15 +1,15 @@
1
1
  # This file is part of CPEE.
2
2
  #
3
3
  # CPEE is free software: you can redistribute it and/or modify it under the terms
4
- # of the GNU General Public License as published by the Free Software Foundation,
4
+ # of the GNU Lesser General Public License as published by the Free Software Foundation,
5
5
  # either version 3 of the License, or (at your option) any later version.
6
6
  #
7
7
  # CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
8
8
  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
9
- # PARTICULAR PURPOSE. See the GNU General Public License for more details.
9
+ # PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
10
10
  #
11
- # You should have received a copy of the GNU General Public License along with
12
- # CPEE (file COPYING in the main directory). If not, see
11
+ # You should have received a copy of the GNU Lesser General Public License along with
12
+ # CPEE (file LICENSE in the main directory). If not, see
13
13
  # <http://www.gnu.org/licenses/>.
14
14
 
15
15
  module CPEE
@@ -1,15 +1,15 @@
1
1
  # This file is part of CPEE.
2
2
  #
3
3
  # CPEE is free software: you can redistribute it and/or modify it under the terms
4
- # of the GNU General Public License as published by the Free Software Foundation,
4
+ # of the GNU Lesser General Public License as published by the Free Software Foundation,
5
5
  # either version 3 of the License, or (at your option) any later version.
6
6
  #
7
7
  # CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
8
8
  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
9
- # PARTICULAR PURPOSE. See the GNU General Public License for more details.
9
+ # PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
10
10
  #
11
- # You should have received a copy of the GNU General Public License along with
12
- # CPEE (file COPYING in the main directory). If not, see
11
+ # You should have received a copy of the GNU Lesser General Public License along with
12
+ # CPEE (file LICENSE in the main directory). If not, see
13
13
  # <http://www.gnu.org/licenses/>.
14
14
 
15
15
  require 'msgpack'
@@ -209,6 +209,8 @@ module CPEE
209
209
  res += Persistence::keys_extract_name(opts,id,'transformation','description','@type')
210
210
  res += Persistence::keys_extract_name(opts,id,'transformation','dataelements')
211
211
  res += Persistence::keys_extract_name(opts,id,'transformation','dataelements','@type')
212
+ res += Persistence::keys_extract_name(opts,id,'transformation','dslx')
213
+ res += Persistence::keys_extract_name(opts,id,'transformation','dslx','@type')
212
214
  res
213
215
  end
214
216
 
data/lib/cpee/redis.rb CHANGED
@@ -1,15 +1,15 @@
1
1
  # This file is part of CPEE.
2
2
  #
3
3
  # CPEE is free software: you can redistribute it and/or modify it under the terms
4
- # of the GNU General Public License as published by the Free Software Foundation,
4
+ # of the GNU Lesser General Public License as published by the Free Software Foundation,
5
5
  # either version 3 of the License, or (at your option) any later version.
6
6
  #
7
7
  # CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
8
8
  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
9
- # PARTICULAR PURPOSE. See the GNU General Public License for more details.
9
+ # PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
10
10
  #
11
- # You should have received a copy of the GNU General Public License along with
12
- # CPEE (file COPYING in the main directory). If not, see
11
+ # You should have received a copy of the GNU Lesser General Public License along with
12
+ # CPEE (file LICENSE in the main directory). If not, see
13
13
  # <http://www.gnu.org/licenses/>.
14
14
 
15
15
  require 'redis'
@@ -1,15 +1,15 @@
1
1
  # This file is part of CPEE.
2
2
  #
3
3
  # CPEE is free software: you can redistribute it and/or modify it under the terms
4
- # of the GNU General Public License as published by the Free Software Foundation,
4
+ # of the GNU Lesser General Public License as published by the Free Software Foundation,
5
5
  # either version 3 of the License, or (at your option) any later version.
6
6
  #
7
7
  # CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
8
8
  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
9
- # PARTICULAR PURPOSE. See the GNU General Public License for more details.
9
+ # PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
10
10
  #
11
- # You should have received a copy of the GNU General Public License along with
12
- # CPEE (file COPYING in the main directory). If not, see
11
+ # You should have received a copy of the GNU Lesser General Public License along with
12
+ # CPEE (file LICENSE in the main directory). If not, see
13
13
  # <http://www.gnu.org/licenses/>.
14
14
 
15
15
  module CPEE
@@ -1,15 +1,15 @@
1
1
  # This file is part of CPEE.
2
2
  #
3
3
  # CPEE is free software: you can redistribute it and/or modify it under the terms
4
- # of the GNU General Public License as published by the Free Software Foundation,
4
+ # of the GNU Lesser General Public License as published by the Free Software Foundation,
5
5
  # either version 3 of the License, or (at your option) any later version.
6
6
  #
7
7
  # CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
8
8
  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
9
- # PARTICULAR PURPOSE. See the GNU General Public License for more details.
9
+ # PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
10
10
  #
11
- # You should have received a copy of the GNU General Public License along with
12
- # CPEE (file COPYING in the main directory). If not, see
11
+ # You should have received a copy of the GNU Lesser General Public License along with
12
+ # CPEE (file LICENSE in the main directory). If not, see
13
13
  # <http://www.gnu.org/licenses/>.
14
14
 
15
15
  require 'json'
data/lib/cpee.xml CHANGED
@@ -2,15 +2,15 @@
2
2
  This file is part of CPEE.
3
3
 
4
4
  CPEE is free software: you can redistribute it and/or modify it under the terms
5
- of the GNU General Public License as published by the Free Software Foundation,
5
+ of the GNU Lesser General Public License as published by the Free Software Foundation,
6
6
  either version 3 of the License, or (at your option) any later version.
7
7
 
8
8
  CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
9
9
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
10
- PARTICULAR PURPOSE. See the GNU General Public License for more details.
10
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
11
11
 
12
- You should have received a copy of the GNU General Public License along with
13
- CPEE (file COPYING in the main directory). If not, see
12
+ You should have received a copy of the GNU Lesser General Public License along with
13
+ CPEE (file LICENSE in the main directory). If not, see
14
14
  <http://www.gnu.org/licenses/>.
15
15
  -->
16
16
 
@@ -2,15 +2,15 @@
2
2
  This file is part of CPEE.
3
3
 
4
4
  CPEE is free software: you can redistribute it and/or modify it under the terms
5
- of the GNU General Public License as published by the Free Software Foundation,
5
+ of the GNU Lesser General Public License as published by the Free Software Foundation,
6
6
  either version 3 of the License, or (at your option) any later version.
7
7
 
8
8
  CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
9
9
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
10
- PARTICULAR PURPOSE. See the GNU General Public License for more details.
10
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
11
11
 
12
- You should have received a copy of the GNU General Public License along with
13
- CPEE (file COPYING in the main directory). If not, see
12
+ You should have received a copy of the GNU Lesser General Public License along with
13
+ CPEE (file LICENSE in the main directory). If not, see
14
14
  <http://www.gnu.org/licenses/>.
15
15
  -->
16
16
 
@@ -2,15 +2,15 @@
2
2
  This file is part of CPEE.
3
3
 
4
4
  CPEE is free software: you can redistribute it and/or modify it under the terms
5
- of the GNU General Public License as published by the Free Software Foundation,
5
+ of the GNU Lesser General Public License as published by the Free Software Foundation,
6
6
  either version 3 of the License, or (at your option) any later version.
7
7
 
8
8
  CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
9
9
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
10
- PARTICULAR PURPOSE. See the GNU General Public License for more details.
10
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
11
11
 
12
- You should have received a copy of the GNU General Public License along with
13
- CPEE (file COPYING in the main directory). If not, see
12
+ You should have received a copy of the GNU Lesser General Public License along with
13
+ CPEE (file LICENSE in the main directory). If not, see
14
14
  <http://www.gnu.org/licenses/>.
15
15
  -->
16
16
 
@@ -2,15 +2,15 @@
2
2
  This file is part of CPEE.
3
3
 
4
4
  CPEE is free software: you can redistribute it and/or modify it under the terms
5
- of the GNU General Public License as published by the Free Software Foundation,
5
+ of the GNU Lesser General Public License as published by the Free Software Foundation,
6
6
  either version 3 of the License, or (at your option) any later version.
7
7
 
8
8
  CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
9
9
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
10
- PARTICULAR PURPOSE. See the GNU General Public License for more details.
10
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
11
11
 
12
- You should have received a copy of the GNU General Public License along with
13
- CPEE (file COPYING in the main directory). If not, see
12
+ You should have received a copy of the GNU Lesser General Public License along with
13
+ CPEE (file LICENSE in the main directory). If not, see
14
14
  <http://www.gnu.org/licenses/>.
15
15
  -->
16
16
 
data/lib/engine.xml CHANGED
@@ -2,15 +2,15 @@
2
2
  This file is part of CPEE.
3
3
 
4
4
  CPEE is free software: you can redistribute it and/or modify it under the terms
5
- of the GNU General Public License as published by the Free Software Foundation,
5
+ of the GNU Lesser General Public License as published by the Free Software Foundation,
6
6
  either version 3 of the License, or (at your option) any later version.
7
7
 
8
8
  CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
9
9
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
10
- PARTICULAR PURPOSE. See the GNU General Public License for more details.
10
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
11
11
 
12
- You should have received a copy of the GNU General Public License along with
13
- CPEE (file COPYING in the main directory). If not, see
12
+ You should have received a copy of the GNU Lesser General Public License along with
13
+ CPEE (file LICENSE in the main directory). If not, see
14
14
  <http://www.gnu.org/licenses/>.
15
15
  -->
16
16