Changeset 353 for ruby


Ignore:
Timestamp:
Nov 17, 2009, 7:49:58 PM (14 years ago)
Author:
KOBAYASHI, Shinji
Message:

refs #57 entry class implementation

Location:
ruby/branches/0.5
Files:
3 added
1 edited

Legend:

Unmodified
Added
Removed
  • ruby/branches/0.5/lib/open_ehr/rm/composition/content/entry.rb

    r216 r353  
     1# rm::composition::content::entry
     2# entry module
     3# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109264528523_312165_346Report.html
     4# refs #56
     5include OpenEHR::RM::Composition::Content
     6
    17module OpenEHR
    28  module RM
    3     module Content
    4       module Entry
    5         class Entry < Content_Item
    6         end
    7         class CareEntry < Entry
    8         end
    9         class Action < CareEntry
    10           attr_accessor :description, :time
    11           attr_accessor :ism_transition, :instruction_details
    12           def initialize(description, time, ism_transition, instruction_details)
    13             raise Exception.new("invalid argument") if description == nil || time == nil || ism_transition == nil
    14             @description = description
    15             @time = time
    16             @ism_transition = ism_transition
    17             @instruction_details = instruction_details if instruction_details != nil
     9    module Composition
     10      module Content
     11        module Entry
     12          class Entry < ContentItem
     13            attr_reader :language, :encoding, :subject
     14            attr_accessor :provider, :other_participations, :workflow_id
     15            def initialize(args = { })
     16              super(args)
     17              self.language = args[:language]
     18              self.encoding = args[:encoding]
     19              self.subject = args[:subject]
     20              self.provider = args[:provider]
     21              self.other_participations = args[:other_participations]
     22              self.workflow_id = args[:workflow_id]
     23            end
     24
     25            def language=(language)
     26              raise ArgumentError, 'language is mandatory' if language.nil?
     27              @language = language
     28            end
     29
     30            def encoding=(encoding)
     31              raise ArgumentError, 'encoding is mandatory' if encoding.nil?
     32              @encoding = encoding
     33            end
     34
     35            def subject=(subject)
     36              raise ArgumentError, 'subject is mandatory' if subject.nil?
     37              @subject = subject
     38            end
     39
     40            def subject_is_self?
     41              return @subject.instance_of? PartySelf
     42            end
    1843          end
    19         end # end of Action
    20       end # end of Entry
    21     end # end of Content
    22   end # end of RM
    23 end # end of OpenEHR
     44         
     45          class CareEntry < Entry
     46           
     47          end
     48         
     49          class Action < CareEntry
     50            attr_accessor :description, :time
     51            attr_accessor :ism_transition, :instruction_details
     52           
     53            def initialize(description, time, ism_transition, instruction_details)
     54              raise Exception.new("invalid argument") if description == nil || time == nil || ism_transition == nil
     55              @description = description
     56              @time = time
     57              @ism_transition = ism_transition
     58              @instruction_details = instruction_details if instruction_details != nil
     59            end
     60          end # of Action
     61        end # of Entry
     62      end # of Content
     63    end # of Composition
     64  end # of RM
     65end # of OpenEHR
Note: See TracChangeset for help on using the changeset viewer.