Class: CPEE::Properties::PutDescription

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, xml) ⇒ Object

{{{



633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
# File 'lib/cpee/implementation_properties.rb', line 633

def self::set(id,opts,xml)
  dslx, dsl, de, ep = transform(
    xml,
    CPEE::Persistence::extract_item(id,opts,'transformation/description'),
    CPEE::Persistence::extract_item(id,opts,'transformation/description/@type'),
    CPEE::Persistence::extract_item(id,opts,'transformation/dataelements'),
    CPEE::Persistence::extract_item(id,opts,'transformation/dataelements/@type'),
    CPEE::Persistence::extract_item(id,opts,'transformation/endpoints'),
    CPEE::Persistence::extract_item(id,opts,'transformation/endpoints/@type'),
    opts
  )
  CPEE::Persistence::set_item(id,opts,'description',
    :description => xml,
    :dslx => dslx,
    :dsl => dsl
  )
  PatchItems::set_hash('dataelements',id,opts,de) unless de.empty?
  PatchItems::set_hash('dataelements',id,opts,ep) unless ep.empty?
end

Instance Method Details

#responseObject



653
654
655
656
657
658
659
660
661
662
663
664
665
666
# File 'lib/cpee/implementation_properties.rb', line 653

def response
  id = @a[0]
  opts = @a[1]
  if opts[:statemachine].readonly? id
    @status = 422 # semantic error
  else
    begin
      PutDescription::set(id,opts,@p[0].value.read)
    rescue
      @status = 400
    end
  end
  nil
end