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

{{{



626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
# File 'lib/cpee/implementation_properties.rb', line 626

def response
  id = @a[0]
  opts = @a[1]
  if opts[:statemachine].readonly? id
    @status = 423
  elsif opts[:statemachine].final? id
    @status = 410
  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