Class: CPEE::Properties::PutExecutionHandler

Inherits:
Riddl::Implementation
  • Object
show all
Defined in:
lib/cpee/implementation_properties.rb

Overview

}}}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.set(id, opts, hw, transform = true) ⇒ Object

{{{



349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/cpee/implementation_properties.rb', line 349

def self::set(id,opts,hw,transform=true)
  CPEE::Persistence::set_item(id,opts,'executionhandler',:executionhandler => hw)
  if transform
    desc = CPEE::Persistence::extract_item(id,opts,'description')
    dslx = CPEE::Persistence::extract_item(id,opts,'dslx')
    endpoints = CPEE::Persistence::extract_list(id,opts,'endpoints')
    xml = XML::Smart::string(dslx)
    xml.register_namespace 'd', 'http://cpee.org/ns/description/1.0'
    dsl = Object.const_get('CPEE::ExecutionHandler::' + hw.capitalize)::dslx_to_dsl(xml,endpoints)
    CPEE::Persistence::set_item(id,opts,'description',
      :description => xml,
      :dslx => dslx,
      :dsl => dsl
    )
  end
end

Instance Method Details

#responseObject



365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/cpee/implementation_properties.rb', line 365

def response
  id = @a[0]
  opts = @a[1]
  if opts[:statemachine].readonly? id
    @status = 423
  elsif opts[:statemachine].final? id
    @status = 410
  else
    PutExecutionHandler::set(id,opts,@p[0].value)
  end
  nil
end