source: ruby/trunk/lib/open_ehr/am/archetype.rb@ 396

Last change on this file since 396 was 396, checked in by KOBAYASHI, Shinji, 14 years ago

refs #71, #71

File size: 3.0 KB
Line 
1include OpenEHR::RM::Common::Resource
2
3module OpenEHR
4 module AM
5 module Archetype
6 module ADLDefinition
7 include OpenEHR::RM::Support::Terminology
8# include OpenEHR::RM::Support::Terminology::OpenEHR_Code_Set_Identifier
9 CURRENT_ADL_VERSION = "1.4"
10 end
11
12 class Archetype < AuthoredResource
13 include ADLDefinition
14 attr_reader :archetype_id, :concept, :definition, :ontology
15 attr_accessor :uid, :adl_version, :parent_archetype_id, :invariants
16
17 def initialize(args = {})
18 super(args)
19 self.adl_version = args[:adl_version]
20 self.archetype_id = args[:archetype_id]
21 self.uid = args[:uid]
22 self.concept = args[:concept]
23 self.parent_archetype_id = args[:parent_archetype_id]
24 self.definition = args[:definition]
25 self.ontology = args[:ontology]
26 self.invariants = args[:invariants]
27 end
28
29 def archetype_id=(archetype_id)
30 if archetype_id.nil?
31 raise ArgumentError, 'archetype_id is mandatory'
32 end
33 @archetype_id = archetype_id
34 end
35
36 def concept=(concept)
37 if concept.nil?
38 raise ArgumentError, 'concept is mandatory'
39 end
40 @concept = concept
41 end
42
43 def definition=(definition)
44 if definition.nil?
45 raise ArgumentError, 'definition is mandatory'
46 end
47 @definition = definition
48 end
49
50 def ontology=(ontology)
51 if ontology.nil?
52 raise ArgumentError, 'ontology is mandatory'
53 end
54 @ontology = ontology
55 end
56
57 def version
58 return @archetype_id.version_id
59 end
60
61 def short_concept_name
62 return @archetype_id.concept_name
63 end
64
65 def concept_name(a_lang)
66
67 end
68
69 def constraint_references_valid?
70 end
71
72 def internal_references_valid?
73 end
74
75 def is_specialised?
76 end
77
78 def is_valid?
79 end
80
81 def logical_paths(a_lang)
82 end
83
84 def node_ids_vaild?
85 end
86
87 def physical_paths
88 end
89
90 def previous_version
91 end
92
93 def specialisation_depth
94 end
95
96 def self.create(args ={}, &block)
97 archetype = new(args)
98 if block_given?
99 yield archetype
100 end
101 return archetype
102 end
103
104 end # end of Archetype
105 # original file:
106 # ref_imple_eiffel/components/adl_parser/src/interface/adl_definition.e
107
108 class ValidityKind
109 attr_reader :value
110
111 MANDATORY = 1001
112 OPTIONAL = 1002
113 DISALLOWED = 1003
114
115 def initialize(args = { })
116 self.value = args[:value]
117 end
118
119 def value=(value)
120 unless [MANDATORY, OPTIONAL, DISALLOWED].include? value
121 raise ArgumentError, 'invalid value'
122 end
123 @value = value
124 end
125
126 end
127 end
128 end # of AM
129end # of OpenEHR
Note: See TracBrowser for help on using the repository browser.