source: ruby/trunk/models/rm/common/archetyped.rb@ 7

Last change on this file since 7 was 7, checked in by KOBAYASHI, Shinji, 16 years ago

demographic class added

File size: 2.6 KB
Line 
1module OpenEHR
2 module RM
3 module Common
4 module Archetyped
5 module Locater_Constants
6 CURRENT_TRANSACTION_ID = "current"
7 FRAGMENT_SEPARATOR = "#"
8 CONTENT_PATH_SEPARATOR = "|"
9 ORGANIZER_PATH_SEPARATOR = "/"
10 MULTIPART_ID_DELIMITER = "::"
11 end
12 class Pathable
13 attr_reader :parent
14 def initialize(parent)
15 @parent = parent
16 end
17 def item_at_path(path)
18 raise NotImplementError, "item_at_path must be implemented"
19 end
20 def items_at_path(path)
21 raise NotImplementError, "items_at_path must be implemented"
22 end
23 def path_exists?(path)
24 raise NotImplementError, "path_exists? must be implemented"
25 end
26 def path_of_item(item)
27 raise NotImplementError, "path_of_item must be implemented"
28 end
29 def path_unique(path)
30 raise NotImplementError, "path_unique must be implemented"
31 end
32 end
33 class Locatable < Pathable
34 include Locater_Constants
35 attr_accessor :uid, :archetype_node_id, archetype_details
36 attr_accessor :feeder_audit, :links, :parent
37 def initialize(uid, archetype_node_id, name, archetype_details
38 feeder_audit, links, parent)
39 super(parent)
40 if archetype_node_id.nil?
41 raise ArgumentError, "null archetype_node_id"
42 end
43 if name.nil?
44 raise ArgumentError, "name is empty"
45 end
46 if links.nil?
47 raise ArgumentError, "links is empty"
48 end
49 @uid = uid
50 @archetype_node_id = archetype_node_id
51 @archetype_details = archetype_details
52 @feeder_audit = feeder_audit
53 @links = links
54 end
55 def item_at_path(path)
56 if !@path.nil?
57 if @path == ""
58 raise ArgumentError, "path is not valid"
59 end
60 end
61 end
62 def items_at_path(path)
63 raise NotImplementError, "items_at_path must be implemented"
64 end
65 def path_exists?
66 raise NotImplementError, "path_exists? must be implemented"
67 end
68 def path_unique
69 raise NotImplementError, "path_unique must be implemented"
70 end
71 def concept
72 end
73 def is_archetype_root?
74 !archetype_details.nil?
75 end
76 end
77 end # end of Archetyped
78 end # end of Common
79 end # end of RM
80end # end of OpenEHR
Note: See TracBrowser for help on using the repository browser.