Class: CPEE::Properties::PostPositions

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

Overview

}}}

Instance Method Summary collapse

Instance Method Details

#responseObject

{{{



582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
# File 'lib/cpee/implementation_properties.rb', line 582

def response
  id = @a[0]
  opts = @a[1]
  if opts[:statemachine].readonly? id
    @status = 423
  else
    begin
      doc = XML::Smart::string(@p[0].value.read)
      if not CPEE::Persistence::extract_item(id,opts,File.join('positions',doc.root.qname.name))
        content = {}
        content[doc.root.text] = [{ 'position' => doc.root.qname.name }]
        content[doc.root.text][0]['passthrough'] = doc.root.attributes['passthrough'] if doc.root.attributes['passthrough']
        CPEE::Persistence::set_item(id,opts,'position',content)
      else
        @status= 409
      end
      Riddl::Parameter::Simple.new('id',doc.root.qname.name)
    rescue => e
      @status = 400
    end
  end
  nil
end