Class: CPEE::Worklist::ShowTasks
- Inherits:
-
Riddl::Implementation
- Object
- Riddl::Implementation
- CPEE::Worklist::ShowTasks
- Defined in:
- lib/cpee-worklist/implementation.rb
Overview
}}}
Instance Method Summary collapse
-
#response ⇒ Object
{{{.
Instance Method Details
#response ⇒ Object
{{{
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/cpee-worklist/implementation.rb', line 190 def response out = XML::Smart.string('<tasks/>') umodels = @a[0].orgmodels.map do |fname| doc = XML::Smart.open_unprotected(File.join(@a[0].opts[:top],'orgmodels',fname)) doc.register_namespace 'o', 'http://cpee.org/ns/organisation/1.0' doc end @a[0].activities.each do |activity| x = out.root.add "task", :callback_id => activity['id'], :cpee_callback => activity['url'], :cpee_instance => activity['cpee_instance'], :cpee_base => activity['cpee_base'], :instance_uuid => activity['uuid'], :cpee_label => activity['label'], :cpee_activity => activity['cpee_activity_id'], :orgmodel => activity['orgmodel'] x.add "process" , activity['process'] x.add "label" , activity['label'] x.add "role" , activity['role'] x.add "unit" , activity['unit'] if activity['user'].any? umodels.each do |doc| activity['user'].each do |user| if user = doc.find("/o:organisation/o:subjects/o:subject[@uid='#{user}']").first x.add "user", user.attributes['id'], :uid => user.attributes['uid'] break end end end else xpath = '' xpath = "[@role='#{activity['role']}' and @unit='#{activity['unit']}']" if (activity['unit'] != '*' && activity['role'] != '*' ) xpath = "[@role='#{activity['role']}']" if (activity['unit'] == '*' && activity['role'] != '*' ) xpath = "[@unit='#{activity['unit']}']" if (activity['unit'] != '*' && activity['role'] == '*' ) umodels.each do |doc| if (tmp = doc.find("/o:organisation/o:subjects/o:subject[o:relation#{xpath}]")).length > 0 tmp.each{|e| x.add "user", e.attributes['id'], :uid => e.attributes['uid'] } end end end end Riddl::Parameter::Complex.new("tasks","text/xml", out.to_s) end |