[4] | 1 |
|
---|
| 2 | module OpenEHR
|
---|
| 3 | module AM
|
---|
| 4 | module Archetype
|
---|
| 5 | module Constraint_Model
|
---|
[21] | 6 | class ARCHETYPE_CONSTRAINT
|
---|
[4] | 7 |
|
---|
| 8 | end
|
---|
[21] | 9 |
|
---|
[23] | 10 | class CARDINALITY
|
---|
[21] | 11 |
|
---|
| 12 | end
|
---|
| 13 |
|
---|
[23] | 14 | class C_OBJECT < ARCHETYPE_CONSTRAINT
|
---|
| 15 | attr_accessor :node_id, :occurrences, :rm_type_name
|
---|
| 16 |
|
---|
| 17 | def initialize(args = { })
|
---|
| 18 | @node_id = args[:node_id] if args[:node_id]
|
---|
| 19 | @occurrences = args[:occurrences] if args[:occurrences]
|
---|
| 20 | @rm_type_name = args[:rm_type_name] if args[:rm_type_name]
|
---|
| 21 | end
|
---|
[32] | 22 |
|
---|
| 23 | def self.create(args = { }, &block)
|
---|
| 24 | c_object = new(args)
|
---|
| 25 | if block_given?
|
---|
| 26 | yield c_object
|
---|
| 27 | end
|
---|
| 28 | return c_object
|
---|
| 29 | end
|
---|
[23] | 30 | end
|
---|
| 31 |
|
---|
[21] | 32 | class C_ATTRIBUTE < ARCHETYPE_CONSTRAINT
|
---|
[23] | 33 | attr_accessor :rm_attribute_name, :existence, :children
|
---|
| 34 |
|
---|
| 35 | def initialize(args = { })
|
---|
| 36 | @rm_attribute_name = args[:rm_attribute_name] if args[:rm_attribute_name]
|
---|
| 37 | @existence = args[:existence] if args[:existence]
|
---|
| 38 | @children = args[:children] ? args[:children] : []
|
---|
| 39 |
|
---|
| 40 | end
|
---|
[21] | 41 | end
|
---|
| 42 |
|
---|
| 43 | class C_DEFINED_OBJECT < C_OBJECT
|
---|
[23] | 44 | attr_accessor :assumed_value
|
---|
[21] | 45 |
|
---|
[23] | 46 | def initialize(args = { })
|
---|
| 47 | @assumed_value = args[:assumed_value] if args[:assumed_value]
|
---|
| 48 | super
|
---|
| 49 | end
|
---|
[21] | 50 | end
|
---|
| 51 |
|
---|
| 52 | class C_PRIMITIVE_OBJECT < C_DEFINED_OBJECT
|
---|
[23] | 53 | attr_accessor :item
|
---|
[32] | 54 |
|
---|
[23] | 55 | def initialize(args = { })
|
---|
| 56 | @attributes = args[:item] if args[:item]
|
---|
| 57 | super
|
---|
| 58 | end
|
---|
[21] | 59 | end
|
---|
| 60 |
|
---|
| 61 | class C_COMPLEX_OBJECT < C_DEFINED_OBJECT
|
---|
| 62 | attr_accessor :attributes, :attributes_valid
|
---|
[32] | 63 |
|
---|
[23] | 64 | def initialize(args = { })
|
---|
| 65 | @attributes = args[:attributes] ? args[:attributes] : []
|
---|
| 66 | super
|
---|
| 67 | end
|
---|
| 68 |
|
---|
| 69 | def self.create(args = { }, &block)
|
---|
| 70 | c_complex_object = new(args)
|
---|
| 71 | if block_given?
|
---|
| 72 | yield c_complex_object
|
---|
| 73 | end
|
---|
| 74 | return c_complex_object
|
---|
| 75 | end
|
---|
[21] | 76 | end
|
---|
| 77 |
|
---|
| 78 | class C_DOMAIN_TYPE < C_DEFINED_OBJECT
|
---|
| 79 |
|
---|
| 80 | end
|
---|
| 81 |
|
---|
| 82 | class C_REFERENCE_OBJECT < C_OBJECT
|
---|
| 83 | end
|
---|
| 84 |
|
---|
| 85 | class ARCHETYPE_INTERNAL_REF < C_REFERENCE_OBJECT
|
---|
[32] | 86 | attr_accessor :target_path
|
---|
[21] | 87 | end
|
---|
| 88 |
|
---|
| 89 | class ARCHETYPE_SLOT < C_REFERENCE_OBJECT
|
---|
[32] | 90 | attr_accessor :includes, :excludes
|
---|
| 91 |
|
---|
| 92 | def self.create(args = { }, &block)
|
---|
| 93 | archetype_slot = new(args)
|
---|
| 94 | archetype_slot.includes = args[:includes]
|
---|
| 95 | archetype_slot.excludes = args[:excludes]
|
---|
| 96 | if block_given?
|
---|
| 97 | yield archetype_slot
|
---|
| 98 | end
|
---|
| 99 | return archetype_slot
|
---|
| 100 | end
|
---|
[21] | 101 | end
|
---|
| 102 |
|
---|
| 103 | class CONSTRAINT_REF < C_REFERENCE_OBJECT
|
---|
[32] | 104 | attr_accessor :reference
|
---|
| 105 |
|
---|
| 106 | def self.create(args = { }, &block)
|
---|
| 107 | constraint_ref = new(args)
|
---|
| 108 | constraint_ref.reference = args[:reference]
|
---|
| 109 | if block_given?
|
---|
| 110 | yield constraint_ref
|
---|
| 111 | end
|
---|
| 112 | return constraint_ref
|
---|
| 113 | end
|
---|
[21] | 114 | end
|
---|
| 115 |
|
---|
[23] | 116 | class C_SINGLE_ATTRIBUTE < C_ATTRIBUTE
|
---|
| 117 | attr_accessor :alternatives
|
---|
| 118 |
|
---|
| 119 | def initialize(args = { })
|
---|
| 120 | @alternatives = args[:alternatives] ? args[:alternatives] : []
|
---|
| 121 | super
|
---|
| 122 | end
|
---|
| 123 | end
|
---|
| 124 |
|
---|
| 125 | class C_MULTIPLE_ATTRIBUTE < C_ATTRIBUTE
|
---|
| 126 | attr_accessor :members, :cardinality
|
---|
| 127 |
|
---|
| 128 | def initialize(args = { })
|
---|
| 129 | @members = args[:members] ? args[:members] : []
|
---|
| 130 | @cardinality = args[:cardinality] if args[:cardinality]
|
---|
| 131 | super
|
---|
| 132 | end
|
---|
| 133 | end
|
---|
[4] | 134 | end
|
---|
| 135 | end
|
---|
| 136 | end
|
---|
| 137 | end
|
---|
| 138 |
|
---|