73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
# File 'lib/rtm/revision.rb', line 73
def self.topic_or_association_context(revision)
type = revision.changeset_type
changeset = revision.changeset
case type
when Type::ASSOCIATION_ADDED
context = changeset.first.new_value when Type::ASSOCIATION_REMOVED
context = changeset.last.old_value when Type::DATATYPE_SET
datatype_aware = changeset.first.context
if datatype_aware.is_a?(RTM::Occurrence)
context = datatype_aware.parent else
context = datatype_aware.parent.parent end
when Type::ID_MODIFIED
return nil
when Type::ITEM_IDENTIFIER_ADDED
context = changeset.first.context when Type::ITEM_IDENTIFIER_REMOVED
context = changeset.first.context when Type::MERGE
return nil
when Type::NAME_ADDED
context = changeset.first.context when Type::NAME_REMOVED
context = changeset.last.context when Type::OCCURRENCE_ADDED
context = changeset.first.context when Type::OCCURRENCE_REMOVED
context = changeset.last.context when Type::PLAYER_MODIFIED
context = changeset.first.context.parent when Type::REIFIER_SET
return nil
when Type::REMOVE_DUPLICATES
return nil
when Type::ROLE_ADDED
context = changeset.first.context when Type::ROLE_REMOVED
context = changeset.last.context when Type::SCOPE_MODIFIED
typed = changeset.first.context
if typed.is_a?(RTM::Variant)
context = typed.parent.parent elsif typed.is_a?(RTM::Occurrence)
context = typed.parent elsif typed.is_a?(RTM::Name)
context = typed.parent else
context = typed end
when Type::SUBJECT_IDENTIFIER_ADDED
context = changeset.first.context when Type::SUBJECT_IDENTIFIER_REMOVED
context = changeset.first.context when Type::SUBJECT_LOCATOR_ADDED
context = changeset.first.context when Type::SUBJECT_LOCATOR_REMOVED
context = changeset.first.context when Type::TOPIC_ADDED
context = changeset.first.new_value when Type::TOPIC_REMOVED
context = changeset.last.old_value when Type::TYPE_ADDED
context = changeset.first.context when Type::TYPE_REMOVED
context = changeset.first.context when Type::TYPE_SET
typed = changeset.first.context
if typed.is_a?(RTM::Role)
context = typed.parent elsif typed.is_a?(RTM::Association)
context = typed else
context = typed.parent end
when Type::VALUE_MODIFIED
valued = changeset.first.context
if valued.is_a?(RTM::Variant)
context = valued.parent.parent else
context = valued.parent end
when Type::VARIANT_ADDED
context = changeset.first.context.parent when Type::VARIANT_REMOVED
context = changeset.last.context.parent else
return nil
end
return context
end
|