1 | # rm::composition
|
---|
2 | # composition module
|
---|
3 | # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109005072243_448526_217Report.html
|
---|
4 | # refs #79
|
---|
5 | include OpenEHR::RM::Common::Archetyped
|
---|
6 | module OpenEHR
|
---|
7 | module RM
|
---|
8 | module Composition
|
---|
9 | class Composition < Locatable
|
---|
10 | attr_reader :language, :category, :territory, :composer
|
---|
11 | attr_accessor :content, :context
|
---|
12 |
|
---|
13 | def initialize(args = { })
|
---|
14 | super(args)
|
---|
15 | self.language = args[:language]
|
---|
16 | self.category = args[:category]
|
---|
17 | self.territory = args[:territory]
|
---|
18 | self.composer = args[:composer]
|
---|
19 | self.content = args[:content]
|
---|
20 | self.context = args[:context]
|
---|
21 | end
|
---|
22 |
|
---|
23 | def language=(language)
|
---|
24 | if language.nil?
|
---|
25 | raise ArgumentError, 'language is mandatory'
|
---|
26 | end
|
---|
27 | @language = language
|
---|
28 | end
|
---|
29 |
|
---|
30 | def category=(category)
|
---|
31 | if category.nil?
|
---|
32 | raise ArgumentError, 'category is mandatory'
|
---|
33 | end
|
---|
34 | @category = category
|
---|
35 | end
|
---|
36 |
|
---|
37 | def territory=(territory)
|
---|
38 | if territory.nil?
|
---|
39 | raise ArgumentError, 'territory is mandatory'
|
---|
40 | end
|
---|
41 | @territory = territory
|
---|
42 | end
|
---|
43 |
|
---|
44 | def composer=(composer)
|
---|
45 | if composer.nil?
|
---|
46 | raise ArgumentError, 'composer is mandatory'
|
---|
47 | end
|
---|
48 | @composer = composer
|
---|
49 | end
|
---|
50 |
|
---|
51 | def is_persistent?
|
---|
52 | return category.value == 'persistent'
|
---|
53 | end
|
---|
54 | end
|
---|
55 |
|
---|
56 | class EventContext < Pathable
|
---|
57 | attr_reader :start_time, :setting, :participations, :location
|
---|
58 | attr_accessor :end_time, :other_context
|
---|
59 |
|
---|
60 | def initialize(args = { })
|
---|
61 | super(args)
|
---|
62 | self.start_time = args[:start_time]
|
---|
63 | self.setting = args[:setting]
|
---|
64 | self.end_time = args[:end_time]
|
---|
65 | self.participations = args[:participations]
|
---|
66 | self.location = args[:location]
|
---|
67 | self.other_context = args[:other_context]
|
---|
68 | end
|
---|
69 |
|
---|
70 | def start_time=(start_time)
|
---|
71 | if start_time.nil?
|
---|
72 | raise ArgumentError, 'start_time is mandatory'
|
---|
73 | end
|
---|
74 | @start_time = start_time
|
---|
75 | end
|
---|
76 |
|
---|
77 | def setting=(setting)
|
---|
78 | if setting.nil?
|
---|
79 | raise ArgumentError, 'setting is mandatory'
|
---|
80 | end
|
---|
81 | @setting = setting
|
---|
82 | end
|
---|
83 |
|
---|
84 | def participations=(participations)
|
---|
85 | if !participations.nil? and participations.empty?
|
---|
86 | raise ArgumentError, 'participations should not be empty'
|
---|
87 | end
|
---|
88 | @participations = participations
|
---|
89 | end
|
---|
90 |
|
---|
91 | def location=(location)
|
---|
92 | if !location.nil? and location.empty?
|
---|
93 | raise ArgumentError, 'location should not be empty'
|
---|
94 | end
|
---|
95 | @location = location
|
---|
96 | end
|
---|
97 | end
|
---|
98 | end # end of Composition
|
---|
99 | end # end of RM
|
---|
100 | end # end of OpenEHR
|
---|