xmlutils 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +77 -0
- data/bin/xmltogdl +88 -0
- data/docs/README.txt +20 -0
- data/lib/xmlutils/contextlistener.rb +432 -0
- data/lib/xmlutils/contextparser.rb +111 -0
- data/lib/xmlutils/dumplistener.rb +57 -0
- data/lib/xmlutils/gdlcontext.rb +305 -0
- data/lib/xmlutils/gdlcontextobjs.rb +286 -0
- data/lib/xmlutils/gdldoc.rb +547 -0
- data/lib/xmlutils/gdldocbuilder.rb +181 -0
- data/lib/xmlutils/gdllistener.rb +265 -0
- data/lib/xmlutils/gdltemplate.rb +488 -0
- data/lib/xmlutils/lineparser.rb +193 -0
- data/lib/xmlutils/listener.rb +459 -0
- data/lib/xmlutils/rulelistener.rb +414 -0
- data/lib/xmlutils/ruleparser.rb +112 -0
- data/lib/xmlutils/varlistener.rb +86 -0
- data/lib/xmlutils/version.rb +5 -0
- data/lib/xmlutils/xmlrulevisitor.rb +704 -0
- data/lib/xmlutils/xmltogdlcontroller.rb +93 -0
- data/lib/xmlutils/xmltogdltask.rb +23 -0
- data/lib/xmlutils/xmlvisitor.rb +690 -0
- data/lib/xmlutils.rb +40 -0
- data/rakefile.rb +34 -0
- data/unittests/2830.xml +1 -0
- data/unittests/chunks.rb +31 -0
- data/unittests/curDirTest.rb +2 -0
- data/unittests/data/2830-GENERATED.gdl +309 -0
- data/unittests/data/2830-GENERATED.xml +1 -0
- data/unittests/data/AUGuideline.xml +12 -0
- data/unittests/data/AUGuideline.xml.gdl +19190 -0
- data/unittests/data/BAKUP.DCTEST1.xml +1 -0
- data/unittests/data/DCTEST.xml +1 -0
- data/unittests/data/DCTEST1.xml +1 -0
- data/unittests/data/DCTEST1.xml.gdl +14890 -0
- data/unittests/data/DCTEST1.xml.rename.csv +180 -0
- data/unittests/data/DCTEST1wLookups.xml +174 -0
- data/unittests/data/DCTEST1wLookups.xml.gdl +127 -0
- data/unittests/data/GENERATED.gdl.xml +1 -0
- data/unittests/data/Message.xml +1 -0
- data/unittests/data/Message.xml.gdl +142 -0
- data/unittests/data/Pricing2ndGuideline.xml +1 -0
- data/unittests/data/Pricing2ndGuideline.xml.gdl +52670 -0
- data/unittests/data/Z-TEMP-Jeff.xml +1 -0
- data/unittests/data/Z-TEMP-Jeff.xml.gdl +288 -0
- data/unittests/tc_convert_xml_to_gdl.rb +23 -0
- data/unittests/ts_allTests.rb +2 -0
- data/xmlutils.gemspec +25 -0
- metadata +139 -0
@@ -0,0 +1,286 @@
|
|
1
|
+
#
|
2
|
+
# File: gdlContextObjs.rb
|
3
|
+
#
|
4
|
+
# These are guideline context objects
|
5
|
+
#
|
6
|
+
#
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
#################################################
|
11
|
+
#
|
12
|
+
# class Dpm
|
13
|
+
#
|
14
|
+
#################################################
|
15
|
+
class Dpm
|
16
|
+
|
17
|
+
attr_accessor :name
|
18
|
+
attr_accessor :alias
|
19
|
+
attr_accessor :varType
|
20
|
+
attr_accessor :dataType
|
21
|
+
attr_accessor :prodType
|
22
|
+
|
23
|
+
def initialize(name, attributes)
|
24
|
+
@name = name
|
25
|
+
@alias = attributes["Name"]
|
26
|
+
@varType = attributes["Type"]
|
27
|
+
@dataType = attributes["DataType"] if attributes.has_key?("DataType")
|
28
|
+
@prodType = attributes["ProductType"]
|
29
|
+
|
30
|
+
@dataType = @prodType if (nil == @dataType)
|
31
|
+
|
32
|
+
case @prodType
|
33
|
+
when '1'
|
34
|
+
@prodType = "boolean"
|
35
|
+
|
36
|
+
when '2'
|
37
|
+
@prodType = "date"
|
38
|
+
|
39
|
+
when '3'
|
40
|
+
@prodType = "money"
|
41
|
+
|
42
|
+
when '4'
|
43
|
+
@prodType = "numeric"
|
44
|
+
|
45
|
+
when '5'
|
46
|
+
@prodType = "percentage"
|
47
|
+
|
48
|
+
when '6'
|
49
|
+
@prodType = "text"
|
50
|
+
|
51
|
+
end # prodType
|
52
|
+
end # initialize
|
53
|
+
end # class Dpm
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
#################################################
|
59
|
+
#
|
60
|
+
# class Ppm
|
61
|
+
#
|
62
|
+
#################################################
|
63
|
+
class Ppm
|
64
|
+
|
65
|
+
attr_accessor :name
|
66
|
+
attr_accessor :alias
|
67
|
+
attr_accessor :varType
|
68
|
+
attr_accessor :dataType
|
69
|
+
|
70
|
+
# def initialize(name, als, varType, dataType)
|
71
|
+
# @name = name
|
72
|
+
# @alias = als
|
73
|
+
# @varType = varType
|
74
|
+
# @dataType = dataType
|
75
|
+
#
|
76
|
+
# end # initialize
|
77
|
+
def initialize(name, attributes)
|
78
|
+
@name = name
|
79
|
+
@alias = attributes["Name"]
|
80
|
+
@varType = attributes["Type"]
|
81
|
+
@dataType = "UNKNOWN"
|
82
|
+
@dataType = attributes["DataType"] if attributes.has_key?("DataType")
|
83
|
+
|
84
|
+
|
85
|
+
case @varType
|
86
|
+
when 'APM'
|
87
|
+
@varType = "app"
|
88
|
+
|
89
|
+
when 'CRP'
|
90
|
+
@varType = "crd"
|
91
|
+
|
92
|
+
when 'PRD'
|
93
|
+
@varType = "prd"
|
94
|
+
|
95
|
+
end # varType
|
96
|
+
|
97
|
+
|
98
|
+
case @dataType
|
99
|
+
when 'Boolean'
|
100
|
+
@dataType = "boolean"
|
101
|
+
|
102
|
+
when 'Date'
|
103
|
+
@dataType = "date"
|
104
|
+
|
105
|
+
when 'Money'
|
106
|
+
@dataType = "money"
|
107
|
+
|
108
|
+
when 'Numeric'
|
109
|
+
@dataType = "numeric"
|
110
|
+
|
111
|
+
when 'Percentage'
|
112
|
+
@dataType = "percentage"
|
113
|
+
|
114
|
+
when 'Text'
|
115
|
+
@dataType = "text"
|
116
|
+
end # dataType
|
117
|
+
end # initialize
|
118
|
+
end # class Ppm
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
#################################################
|
124
|
+
#
|
125
|
+
# class Rule
|
126
|
+
#
|
127
|
+
#################################################
|
128
|
+
class Rule
|
129
|
+
|
130
|
+
attr_accessor :name
|
131
|
+
attr_accessor :alias
|
132
|
+
attr_accessor :src
|
133
|
+
attr_accessor :xml
|
134
|
+
attr_accessor :ifMsgs
|
135
|
+
attr_accessor :elseMsgs
|
136
|
+
|
137
|
+
|
138
|
+
def initialize(name, als)
|
139
|
+
@name = name
|
140
|
+
@alias = als
|
141
|
+
@src = nil
|
142
|
+
@xml = nil
|
143
|
+
@ifMsgs = Array.new
|
144
|
+
@elseMsgs = Array.new
|
145
|
+
end # initialize
|
146
|
+
end # class Rule
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
#################################################
|
152
|
+
#
|
153
|
+
# class Lookup
|
154
|
+
#
|
155
|
+
#################################################
|
156
|
+
class Lookup
|
157
|
+
|
158
|
+
attr_accessor :name
|
159
|
+
attr_accessor :xParam
|
160
|
+
attr_accessor :yParam
|
161
|
+
|
162
|
+
def initialize(attributes)
|
163
|
+
lkName = attributes["Name"]
|
164
|
+
|
165
|
+
@name = lkName
|
166
|
+
end # initialize
|
167
|
+
end # class Lookup
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
#################################################
|
173
|
+
#
|
174
|
+
# class Ruleset
|
175
|
+
#
|
176
|
+
#################################################
|
177
|
+
class Ruleset
|
178
|
+
|
179
|
+
attr_accessor :name
|
180
|
+
attr_accessor :alias
|
181
|
+
attr_accessor :rules # rule aliases
|
182
|
+
attr_accessor :type # This indicates the ruleset type (Normal, PL)
|
183
|
+
attr_accessor :execType # This indicated the execute type (TRUE, FALSE, CONTINUE)
|
184
|
+
|
185
|
+
|
186
|
+
def initialize(attributes)
|
187
|
+
rsAlias = attributes["Name"]
|
188
|
+
|
189
|
+
# Parse out the exit type
|
190
|
+
case attributes["Type"]
|
191
|
+
when "0"
|
192
|
+
rsType = "Normal"
|
193
|
+
|
194
|
+
when "1"
|
195
|
+
rsType = "PL"
|
196
|
+
|
197
|
+
else
|
198
|
+
rsType = "*** UNKNOWN ***"
|
199
|
+
end
|
200
|
+
|
201
|
+
# Parse out the execute type
|
202
|
+
case attributes["ExecuteType"]
|
203
|
+
when "1"
|
204
|
+
rsExecType = "true"
|
205
|
+
|
206
|
+
when "2"
|
207
|
+
rsExecType = "false"
|
208
|
+
|
209
|
+
when "3"
|
210
|
+
rsExecType = "continue"
|
211
|
+
|
212
|
+
else
|
213
|
+
rsExecType = "*** UNKNOWN ***"
|
214
|
+
end
|
215
|
+
|
216
|
+
# Store the results
|
217
|
+
@name = rsAlias
|
218
|
+
@alias = rsAlias
|
219
|
+
@type = rsType
|
220
|
+
@execType = rsExecType
|
221
|
+
@rules = Array.new
|
222
|
+
end # initialize
|
223
|
+
|
224
|
+
def addRule(als)
|
225
|
+
@rules << als
|
226
|
+
end # addRule
|
227
|
+
end # class Ruleset
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
#################################################
|
233
|
+
#
|
234
|
+
# class Guideline
|
235
|
+
#
|
236
|
+
#################################################
|
237
|
+
class Guideline
|
238
|
+
|
239
|
+
attr_accessor :id
|
240
|
+
attr_accessor :name
|
241
|
+
attr_accessor :version
|
242
|
+
attr_accessor :startDate
|
243
|
+
attr_accessor :items
|
244
|
+
|
245
|
+
|
246
|
+
def initialize(attributes)
|
247
|
+
@id = attributes["GuidelineID"]
|
248
|
+
@name = attributes["Name"]
|
249
|
+
@version = attributes["Version"]
|
250
|
+
@startDate = attributes["StartDate"]
|
251
|
+
@items = Array.new
|
252
|
+
end # initialize
|
253
|
+
|
254
|
+
def addItem(itemAry)
|
255
|
+
if (itemAry[0] == "rule" || itemAry[0] == "ruleset")
|
256
|
+
items.push(itemAry)
|
257
|
+
else
|
258
|
+
raise "Invalid arg: expected rule or ruleset type"
|
259
|
+
end # if
|
260
|
+
end # addItem
|
261
|
+
end # class Guideline
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
#################################################
|
266
|
+
#
|
267
|
+
# class Message
|
268
|
+
#
|
269
|
+
#################################################
|
270
|
+
class Message
|
271
|
+
|
272
|
+
attr_accessor :type
|
273
|
+
attr_accessor :exceptionType
|
274
|
+
attr_accessor :category
|
275
|
+
attr_accessor :priorTo
|
276
|
+
attr_accessor :msg
|
277
|
+
|
278
|
+
|
279
|
+
def initialize(attributes)
|
280
|
+
@type = attributes["Type"] # Exceptions, Observation, Condition
|
281
|
+
@exceptionType = attributes["ExceptionType"] # Exceptions
|
282
|
+
@category = attributes["Category"] # 1 => ,
|
283
|
+
@priorTo = attributes["PriorTo"] # 1 => ,
|
284
|
+
@msg = String.new
|
285
|
+
end # initialize
|
286
|
+
end # class Message
|