|
1 |
#There are 223 defined entities.
|
|
2 |
import string
|
|
3 |
import xml.dom.minidom
|
|
4 |
from random import choice
|
|
5 |
from django.db import models
|
|
6 |
|
|
7 |
def getRandom(length=8, chars=string.letters + string.digits):
|
|
8 |
return ''.join([choice(chars) for i in range(length)])
|
|
9 |
|
|
10 |
def getRandomString():
|
|
11 |
return getRandom(45)
|
|
12 |
|
|
13 |
def getRandomText():
|
|
14 |
return getRandom(450)
|
|
15 |
|
|
16 |
def getRandomInt():
|
|
17 |
return int(getRandom(4,string.digits))
|
|
18 |
|
|
19 |
def getRandomFloat():
|
|
20 |
return float(getRandom(4,string.digits))
|
|
21 |
|
|
22 |
def getRandomBool():
|
|
23 |
return choice(['true','false'])
|
|
24 |
|
|
25 |
#Not actually random, but not worth the time
|
|
26 |
def getRandomDate():
|
|
27 |
return '2007-07-16'
|
|
28 |
|
|
29 |
def getRandomTime():
|
|
30 |
return '08:30:00'
|
|
31 |
|
|
32 |
class eml_access(models.Model):
|
|
33 |
access = models.ForeignKey('AccessType', unique=True,related_name='eml_access_access', null=True, blank=True)
|
|
34 |
|
|
35 |
def exportVegX(self,myNode,doc):
|
|
36 |
if self.access != None:
|
|
37 |
newEl = doc.createElement('access')
|
|
38 |
myNode.appendChild(self.access.exportVegX(newEl,doc))
|
|
39 |
|
|
40 |
return myNode
|
|
41 |
|
|
42 |
def importVegX(self,node):
|
|
43 |
self.save()
|
|
44 |
#members & relationships
|
|
45 |
for child in node.childNodes:
|
|
46 |
cName = child.nodeName
|
|
47 |
if cName == 'access':
|
|
48 |
newEl = AccessType()
|
|
49 |
newEl.importVegX(child)
|
|
50 |
self.access = newEl
|
|
51 |
|
|
52 |
self.save()
|
|
53 |
|
|
54 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack):
|
|
55 |
if 'AccessType' not in usedObjectsStack:
|
|
56 |
usedObjectsStack.append('AccessType')
|
|
57 |
newEl = doc.createElement('access')
|
|
58 |
newElObj = AccessType()
|
|
59 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
60 |
usedObjectsStack.pop()
|
|
61 |
|
|
62 |
return myNode
|
|
63 |
|
|
64 |
|
|
65 |
class AccessType(models.Model):
|
|
66 |
ReferencesGroup = models.ForeignKey('ReferencesGroup', unique=True,related_name='AccessType_ReferencesGroup', null=True, blank=True)
|
|
67 |
allow = models.ManyToManyField('AccessRule',related_name='AccessType_allow')
|
|
68 |
deny = models.ManyToManyField('AccessRule',related_name='AccessType_deny')
|
|
69 |
attr_id = models.CharField(max_length=255, null=True, blank=True)
|
|
70 |
attr_system = models.CharField(max_length=255, null=True, blank=True)
|
|
71 |
attr_scope = models.CharField(max_length=255, null=True, blank=True, default = 'document')
|
|
72 |
attr_order = models.CharField(max_length=255, null=True, blank=True, default = 'allowFirst')
|
|
73 |
attr_authSystem = models.CharField(max_length=255)
|
|
74 |
|
|
75 |
def exportVegX(self,myNode,doc):
|
|
76 |
if self.attr_id != None:
|
|
77 |
newAttr = doc.createAttribute('id')
|
|
78 |
newAttr.value = str(self.attr_id)
|
|
79 |
myNode.setAttributeNode(newAttr)
|
|
80 |
|
|
81 |
if self.attr_system != None:
|
|
82 |
newAttr = doc.createAttribute('system')
|
|
83 |
newAttr.value = str(self.attr_system)
|
|
84 |
myNode.setAttributeNode(newAttr)
|
|
85 |
|
|
86 |
if self.attr_scope != None:
|
|
87 |
newAttr = doc.createAttribute('scope')
|
|
88 |
newAttr.value = str(self.attr_scope)
|
|
89 |
myNode.setAttributeNode(newAttr)
|
|
90 |
|
|
91 |
if self.attr_order != None:
|
|
92 |
newAttr = doc.createAttribute('order')
|
|
93 |
newAttr.value = str(self.attr_order)
|
|
94 |
myNode.setAttributeNode(newAttr)
|
|
95 |
|
|
96 |
if self.attr_authSystem != None:
|
|
97 |
newAttr = doc.createAttribute('authSystem')
|
|
98 |
newAttr.value = str(self.attr_authSystem)
|
|
99 |
myNode.setAttributeNode(newAttr)
|
|
100 |
|
|
101 |
if self.ReferencesGroup != None:
|
|
102 |
newEl = doc.createElement('ReferencesGroup')
|
|
103 |
myNode.appendChild(self.ReferencesGroup.exportVegX(newEl,doc))
|
|
104 |
|
|
105 |
for childRef in self.allow.all():
|
|
106 |
newEl = doc.createElement('allow')
|
|
107 |
myNode.appendChild(childRef.exportVegX(newEl,doc))
|
|
108 |
|
|
109 |
for childRef in self.deny.all():
|
|
110 |
newEl = doc.createElement('deny')
|
|
111 |
myNode.appendChild(childRef.exportVegX(newEl,doc))
|
|
112 |
|
|
113 |
return myNode
|
|
114 |
|
|
115 |
def importVegX(self,node):
|
|
116 |
self.save()
|
|
117 |
#attributes
|
|
118 |
for attr in node.attributes.keys():
|
|
119 |
aName = 'attr_' + attr
|
|
120 |
aVal = node.attributes[attr].nodeValue
|
|
121 |
if aName == 'attr_id':
|
|
122 |
self.attr_id = aVal
|
|
123 |
elif aName == 'attr_system':
|
|
124 |
self.attr_system = aVal
|
|
125 |
elif aName == 'attr_scope':
|
|
126 |
self.attr_scope = aVal
|
|
127 |
elif aName == 'attr_order':
|
|
128 |
self.attr_order = aVal
|
|
129 |
elif aName == 'attr_authSystem':
|
|
130 |
self.attr_authSystem = aVal
|
|
131 |
#members & relationships
|
|
132 |
for child in node.childNodes:
|
|
133 |
cName = child.nodeName
|
|
134 |
if cName == 'ReferencesGroup':
|
|
135 |
newEl = ReferencesGroup()
|
|
136 |
newEl.importVegX(child)
|
|
137 |
self.ReferencesGroup = newEl
|
|
138 |
elif cName == 'allow':
|
|
139 |
newEl = AccessRule()
|
|
140 |
newEl.importVegX(child)
|
|
141 |
self.allow.add(newEl)
|
|
142 |
elif cName == 'deny':
|
|
143 |
newEl = AccessRule()
|
|
144 |
newEl.importVegX(child)
|
|
145 |
self.deny.add(newEl)
|
|
146 |
|
|
147 |
self.save()
|
|
148 |
|
|
149 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack):
|
|
150 |
newAttr = doc.createAttribute('id')
|
|
151 |
newAttr.value = str(getRandomString())
|
|
152 |
myNode.setAttributeNode(newAttr)
|
|
153 |
|
|
154 |
newAttr = doc.createAttribute('system')
|
|
155 |
newAttr.value = str(getRandomString())
|
|
156 |
myNode.setAttributeNode(newAttr)
|
|
157 |
|
|
158 |
newAttr = doc.createAttribute('scope')
|
|
159 |
newAttr.value = str(getRandomString())
|
|
160 |
myNode.setAttributeNode(newAttr)
|
|
161 |
|
|
162 |
newAttr = doc.createAttribute('order')
|
|
163 |
newAttr.value = str(getRandomString())
|
|
164 |
myNode.setAttributeNode(newAttr)
|
|
165 |
|
|
166 |
newAttr = doc.createAttribute('authSystem')
|
|
167 |
newAttr.value = str(getRandomString())
|
|
168 |
myNode.setAttributeNode(newAttr)
|
|
169 |
|
|
170 |
if 'ReferencesGroup' not in usedObjectsStack:
|
|
171 |
usedObjectsStack.append('ReferencesGroup')
|
|
172 |
newEl = doc.createElement('ReferencesGroup')
|
|
173 |
newElObj = ReferencesGroup()
|
|
174 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
175 |
usedObjectsStack.pop()
|
|
176 |
|
|
177 |
if 'AccessRule' not in usedObjectsStack:
|
|
178 |
usedObjectsStack.append('AccessRule')
|
|
179 |
newEl = doc.createElement('allow')
|
|
180 |
newElObj = AccessRule()
|
|
181 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
182 |
usedObjectsStack.pop()
|
|
183 |
|
|
184 |
if 'AccessRule' not in usedObjectsStack:
|
|
185 |
usedObjectsStack.append('AccessRule')
|
|
186 |
newEl = doc.createElement('deny')
|
|
187 |
newElObj = AccessRule()
|
|
188 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
189 |
usedObjectsStack.pop()
|
|
190 |
|
|
191 |
return myNode
|
|
192 |
|
|
193 |
|
|
194 |
class ReferencesGroup(models.Model):
|
|
195 |
references = models.CharField(max_length=255, null=True, blank=True)
|
|
196 |
|
|
197 |
def exportVegX(self,myNode,doc):
|
|
198 |
if self.references != None:
|
|
199 |
newEl = doc.createElement('references')
|
|
200 |
newElText = doc.createTextNode(str(self.references))
|
|
201 |
newEl.appendChild(newElText)
|
|
202 |
myNode.appendChild(newEl)
|
|
203 |
|
|
204 |
return myNode
|
|
205 |
|
|
206 |
def importVegX(self,node):
|
|
207 |
self.save()
|
|
208 |
#members & relationships
|
|
209 |
for child in node.childNodes:
|
|
210 |
cName = child.nodeName
|
|
211 |
if cName == 'references':
|
|
212 |
cVal = child.childNodes[0].nodeValue
|
|
213 |
self.references = cVal
|
|
214 |
|
|
215 |
self.save()
|
|
216 |
|
|
217 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack):
|
|
218 |
newEl = doc.createElement('references')
|
|
219 |
newElText = doc.createTextNode(str(getRandomString()))
|
|
220 |
newEl.appendChild(newElText)
|
|
221 |
myNode.appendChild(newEl)
|
|
222 |
|
|
223 |
return myNode
|
|
224 |
|
|
225 |
|
|
226 |
class AccessRule(models.Model):
|
|
227 |
id = models.AutoField(primary_key=True)
|
|
228 |
def exportVegX(self,myNode,doc):
|
|
229 |
for childRef in self.AccessRule_principal_AccessRule_id.all():
|
|
230 |
newEl = doc.createElement('principal')
|
|
231 |
myNode.appendChild(childRef.exportVegX(newEl,doc))
|
|
232 |
|
|
233 |
for childRef in self.AccessRule_permission_AccessRule_id.all():
|
|
234 |
newEl = doc.createElement('permission')
|
|
235 |
myNode.appendChild(childRef.exportVegX(newEl,doc))
|
|
236 |
|
|
237 |
return myNode
|
|
238 |
|
|
239 |
def importVegX(self,node):
|
|
240 |
self.save()
|
|
241 |
#members & relationships
|
|
242 |
for child in node.childNodes:
|
|
243 |
cName = child.nodeName
|
|
244 |
#These are the elements that refer to this one
|
|
245 |
if cName == 'principal':
|
|
246 |
newEl = AccessRule_principal()
|
|
247 |
newEl.AccessRule_id = self
|
|
248 |
newEl.importVegX(child)
|
|
249 |
elif cName == 'permission':
|
|
250 |
newEl = AccessRule_permission()
|
|
251 |
newEl.AccessRule_id = self
|
|
252 |
newEl.importVegX(child)
|
|
253 |
|
|
254 |
self.save()
|
|
255 |
|
|
256 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack):
|
|
257 |
if 'AccessRule_principal' not in usedObjectsStack:
|
|
258 |
usedObjectsStack.append('AccessRule_principal')
|
|
259 |
|
|
260 |
newEl = doc.createElement('principal')
|
|
261 |
childRef = AccessRule_principal()
|
|
262 |
myNode.appendChild(childRef.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
263 |
usedObjectsStack.pop()
|
|
264 |
|
|
265 |
if 'AccessRule_permission' not in usedObjectsStack:
|
|
266 |
usedObjectsStack.append('AccessRule_permission')
|
|
267 |
|
|
268 |
newEl = doc.createElement('permission')
|
|
269 |
childRef = AccessRule_permission()
|
|
270 |
myNode.appendChild(childRef.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
271 |
usedObjectsStack.pop()
|
|
272 |
|
|
273 |
return myNode
|
|
274 |
|
|
275 |
|
|
276 |
class AccessRule_principal(models.Model):
|
|
277 |
AccessRule_id = models.ForeignKey('AccessRule',related_name='AccessRule_principal_AccessRule_id')
|
|
278 |
primitive_type_value = models.CharField(max_length=255, null=True, blank=True)
|
|
279 |
|
|
280 |
def exportVegX(self,myNode,doc):
|
|
281 |
if self.primitive_type_value != None:
|
|
282 |
newElText = doc.createTextNode(self.primitive_type_value)
|
|
283 |
myNode.appendChild(newElText)
|
|
284 |
|
|
285 |
return myNode
|
|
286 |
|
|
287 |
def importVegX(self,node):
|
|
288 |
self.save()
|
|
289 |
#members & relationships
|
|
290 |
for child in node.childNodes:
|
|
291 |
cName = child.nodeName
|
|
292 |
cVal = node.childNodes[0].nodeValue
|
|
293 |
self.primitive_type_value = cVal
|
|
294 |
|
|
295 |
self.save()
|
|
296 |
|
|
297 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack):
|
|
298 |
newElText = doc.createTextNode(str(getRandomString()))
|
|
299 |
myNode.appendChild(newElText)
|
|
300 |
|
|
301 |
return myNode
|
|
302 |
|
|
303 |
|
|
304 |
class AccessRule_permission(models.Model):
|
|
305 |
AccessRule_id = models.ForeignKey('AccessRule',related_name='AccessRule_permission_AccessRule_id')
|
|
306 |
primitive_type_value = models.CharField(max_length=255, null=True, blank=True)
|
|
307 |
|
|
308 |
def exportVegX(self,myNode,doc):
|
|
309 |
if self.primitive_type_value != None:
|
|
310 |
newElText = doc.createTextNode(self.primitive_type_value)
|
|
311 |
myNode.appendChild(newElText)
|
|
312 |
|
|
313 |
return myNode
|
|
314 |
|
|
315 |
def importVegX(self,node):
|
|
316 |
self.save()
|
|
317 |
#members & relationships
|
|
318 |
for child in node.childNodes:
|
|
319 |
cName = child.nodeName
|
|
320 |
cVal = node.childNodes[0].nodeValue
|
|
321 |
self.primitive_type_value = cVal
|
|
322 |
|
|
323 |
self.save()
|
|
324 |
|
|
325 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack):
|
|
326 |
newElText = doc.createTextNode(str(getRandomString()))
|
|
327 |
myNode.appendChild(newElText)
|
|
328 |
|
|
329 |
return myNode
|
|
330 |
|
|
331 |
|
|
332 |
class GeographicCoverage(models.Model):
|
|
333 |
ReferencesGroup = models.ForeignKey('ReferencesGroup', unique=True,related_name='GeographicCoverage_ReferencesGroup', null=True, blank=True)
|
|
334 |
boundingCoordinates = models.ForeignKey('boundingCoordinates', unique=True,related_name='GeographicCoverage_boundingCoordinates', null=True, blank=True)
|
|
335 |
datasetGPolygon = models.ManyToManyField('datasetGPolygon',related_name='GeographicCoverage_datasetGPolygon')
|
|
336 |
attr_id = models.CharField(max_length=255, null=True, blank=True)
|
|
337 |
attr_system = models.CharField(max_length=255, null=True, blank=True)
|
|
338 |
attr_scope = models.CharField(max_length=255, null=True, blank=True, default = 'document')
|
|
339 |
geographicDescription = models.CharField(max_length=255, null=True, blank=True)
|
|
340 |
|
|
341 |
def exportVegX(self,myNode,doc):
|
|
342 |
if self.attr_id != None:
|
|
343 |
newAttr = doc.createAttribute('id')
|
|
344 |
newAttr.value = str(self.attr_id)
|
|
345 |
myNode.setAttributeNode(newAttr)
|
|
346 |
|
|
347 |
if self.attr_system != None:
|
|
348 |
newAttr = doc.createAttribute('system')
|
|
349 |
newAttr.value = str(self.attr_system)
|
|
350 |
myNode.setAttributeNode(newAttr)
|
|
351 |
|
|
352 |
if self.attr_scope != None:
|
|
353 |
newAttr = doc.createAttribute('scope')
|
|
354 |
newAttr.value = str(self.attr_scope)
|
|
355 |
myNode.setAttributeNode(newAttr)
|
|
356 |
|
|
357 |
if self.geographicDescription != None:
|
|
358 |
newEl = doc.createElement('geographicDescription')
|
|
359 |
newElText = doc.createTextNode(str(self.geographicDescription))
|
|
360 |
newEl.appendChild(newElText)
|
|
361 |
myNode.appendChild(newEl)
|
|
362 |
|
|
363 |
if self.ReferencesGroup != None:
|
|
364 |
newEl = doc.createElement('ReferencesGroup')
|
|
365 |
myNode.appendChild(self.ReferencesGroup.exportVegX(newEl,doc))
|
|
366 |
|
|
367 |
if self.boundingCoordinates != None:
|
|
368 |
newEl = doc.createElement('boundingCoordinates')
|
|
369 |
myNode.appendChild(self.boundingCoordinates.exportVegX(newEl,doc))
|
|
370 |
|
|
371 |
for childRef in self.datasetGPolygon.all():
|
|
372 |
newEl = doc.createElement('datasetGPolygon')
|
|
373 |
myNode.appendChild(childRef.exportVegX(newEl,doc))
|
|
374 |
|
|
375 |
return myNode
|
|
376 |
|
|
377 |
def importVegX(self,node):
|
|
378 |
self.save()
|
|
379 |
#attributes
|
|
380 |
for attr in node.attributes.keys():
|
|
381 |
aName = 'attr_' + attr
|
|
382 |
aVal = node.attributes[attr].nodeValue
|
|
383 |
if aName == 'attr_id':
|
|
384 |
self.attr_id = aVal
|
|
385 |
elif aName == 'attr_system':
|
|
386 |
self.attr_system = aVal
|
|
387 |
elif aName == 'attr_scope':
|
|
388 |
self.attr_scope = aVal
|
|
389 |
#members & relationships
|
|
390 |
for child in node.childNodes:
|
|
391 |
cName = child.nodeName
|
|
392 |
if cName == 'geographicDescription':
|
|
393 |
cVal = child.childNodes[0].nodeValue
|
|
394 |
self.geographicDescription = cVal
|
|
395 |
elif cName == 'ReferencesGroup':
|
|
396 |
newEl = ReferencesGroup()
|
|
397 |
newEl.importVegX(child)
|
|
398 |
self.ReferencesGroup = newEl
|
|
399 |
elif cName == 'boundingCoordinates':
|
|
400 |
newEl = boundingCoordinates()
|
|
401 |
newEl.importVegX(child)
|
|
402 |
self.boundingCoordinates = newEl
|
|
403 |
elif cName == 'datasetGPolygon':
|
|
404 |
newEl = datasetGPolygon()
|
|
405 |
newEl.importVegX(child)
|
|
406 |
self.datasetGPolygon.add(newEl)
|
|
407 |
|
|
408 |
self.save()
|
|
409 |
|
|
410 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack):
|
|
411 |
newAttr = doc.createAttribute('id')
|
|
412 |
newAttr.value = str(getRandomString())
|
|
413 |
myNode.setAttributeNode(newAttr)
|
|
414 |
|
|
415 |
newAttr = doc.createAttribute('system')
|
|
416 |
newAttr.value = str(getRandomString())
|
|
417 |
myNode.setAttributeNode(newAttr)
|
|
418 |
|
|
419 |
newAttr = doc.createAttribute('scope')
|
|
420 |
newAttr.value = str(getRandomString())
|
|
421 |
myNode.setAttributeNode(newAttr)
|
|
422 |
|
|
423 |
newEl = doc.createElement('geographicDescription')
|
|
424 |
newElText = doc.createTextNode(str(getRandomString()))
|
|
425 |
newEl.appendChild(newElText)
|
|
426 |
myNode.appendChild(newEl)
|
|
427 |
|
|
428 |
if 'ReferencesGroup' not in usedObjectsStack:
|
|
429 |
usedObjectsStack.append('ReferencesGroup')
|
|
430 |
newEl = doc.createElement('ReferencesGroup')
|
|
431 |
newElObj = ReferencesGroup()
|
|
432 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
433 |
usedObjectsStack.pop()
|
|
434 |
|
|
435 |
if 'boundingCoordinates' not in usedObjectsStack:
|
|
436 |
usedObjectsStack.append('boundingCoordinates')
|
|
437 |
newEl = doc.createElement('boundingCoordinates')
|
|
438 |
newElObj = boundingCoordinates()
|
|
439 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
440 |
usedObjectsStack.pop()
|
|
441 |
|
|
442 |
if 'datasetGPolygon' not in usedObjectsStack:
|
|
443 |
usedObjectsStack.append('datasetGPolygon')
|
|
444 |
newEl = doc.createElement('datasetGPolygon')
|
|
445 |
newElObj = datasetGPolygon()
|
|
446 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
447 |
usedObjectsStack.pop()
|
|
448 |
|
|
449 |
return myNode
|
|
450 |
|
|
451 |
|
|
452 |
class TemporalCoverage(models.Model):
|
|
453 |
ReferencesGroup = models.ForeignKey('ReferencesGroup', unique=True,related_name='TemporalCoverage_ReferencesGroup', null=True, blank=True)
|
|
454 |
singleDateTime = models.ManyToManyField('SingleDateTimeType',related_name='TemporalCoverage_singleDateTime')
|
|
455 |
rangeOfDates = models.ForeignKey('rangeOfDates', unique=True,related_name='TemporalCoverage_rangeOfDates', null=True, blank=True)
|
|
456 |
attr_id = models.CharField(max_length=255, null=True, blank=True)
|
|
457 |
|
|
458 |
def exportVegX(self,myNode,doc):
|
|
459 |
if self.attr_id != None:
|
|
460 |
newAttr = doc.createAttribute('id')
|
|
461 |
newAttr.value = str(self.attr_id)
|
|
462 |
myNode.setAttributeNode(newAttr)
|
|
463 |
|
|
464 |
if self.ReferencesGroup != None:
|
|
465 |
newEl = doc.createElement('ReferencesGroup')
|
|
466 |
myNode.appendChild(self.ReferencesGroup.exportVegX(newEl,doc))
|
|
467 |
|
|
468 |
for childRef in self.singleDateTime.all():
|
|
469 |
newEl = doc.createElement('singleDateTime')
|
|
470 |
myNode.appendChild(childRef.exportVegX(newEl,doc))
|
|
471 |
|
|
472 |
if self.rangeOfDates != None:
|
|
473 |
newEl = doc.createElement('rangeOfDates')
|
|
474 |
myNode.appendChild(self.rangeOfDates.exportVegX(newEl,doc))
|
|
475 |
|
|
476 |
return myNode
|
|
477 |
|
|
478 |
def importVegX(self,node):
|
|
479 |
self.save()
|
|
480 |
#attributes
|
|
481 |
for attr in node.attributes.keys():
|
|
482 |
aName = 'attr_' + attr
|
|
483 |
aVal = node.attributes[attr].nodeValue
|
|
484 |
if aName == 'attr_id':
|
|
485 |
self.attr_id = aVal
|
|
486 |
#members & relationships
|
|
487 |
for child in node.childNodes:
|
|
488 |
cName = child.nodeName
|
|
489 |
if cName == 'ReferencesGroup':
|
|
490 |
newEl = ReferencesGroup()
|
|
491 |
newEl.importVegX(child)
|
|
492 |
self.ReferencesGroup = newEl
|
|
493 |
elif cName == 'singleDateTime':
|
|
494 |
newEl = SingleDateTimeType()
|
|
495 |
newEl.importVegX(child)
|
|
496 |
self.singleDateTime.add(newEl)
|
|
497 |
elif cName == 'rangeOfDates':
|
|
498 |
newEl = rangeOfDates()
|
|
499 |
newEl.importVegX(child)
|
|
500 |
self.rangeOfDates = newEl
|
|
501 |
|
|
502 |
self.save()
|
|
503 |
|
|
504 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack):
|
|
505 |
newAttr = doc.createAttribute('id')
|
|
506 |
newAttr.value = str(getRandomString())
|
|
507 |
myNode.setAttributeNode(newAttr)
|
|
508 |
|
|
509 |
if 'ReferencesGroup' not in usedObjectsStack:
|
|
510 |
usedObjectsStack.append('ReferencesGroup')
|
|
511 |
newEl = doc.createElement('ReferencesGroup')
|
|
512 |
newElObj = ReferencesGroup()
|
|
513 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
514 |
usedObjectsStack.pop()
|
|
515 |
|
|
516 |
if 'SingleDateTimeType' not in usedObjectsStack:
|
|
517 |
usedObjectsStack.append('SingleDateTimeType')
|
|
518 |
newEl = doc.createElement('singleDateTime')
|
|
519 |
newElObj = SingleDateTimeType()
|
|
520 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
521 |
usedObjectsStack.pop()
|
|
522 |
|
|
523 |
if 'rangeOfDates' not in usedObjectsStack:
|
|
524 |
usedObjectsStack.append('rangeOfDates')
|
|
525 |
newEl = doc.createElement('rangeOfDates')
|
|
526 |
newElObj = rangeOfDates()
|
|
527 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
528 |
usedObjectsStack.pop()
|
|
529 |
|
|
530 |
return myNode
|
|
531 |
|
|
532 |
|
|
533 |
class temporalCoverage(models.Model):
|
|
534 |
TemporalCoverage_extend = models.ForeignKey('TemporalCoverage', unique=True,related_name='temporalCoverage_TemporalCoverage_extend')
|
|
535 |
attr_system = models.CharField(max_length=255, null=True, blank=True)
|
|
536 |
attr_scope = models.CharField(max_length=255, null=True, blank=True, default = 'document')
|
|
537 |
|
|
538 |
def exportVegX(self,myNode,doc):
|
|
539 |
if self.attr_system != None:
|
|
540 |
newAttr = doc.createAttribute('system')
|
|
541 |
newAttr.value = str(self.attr_system)
|
|
542 |
myNode.setAttributeNode(newAttr)
|
|
543 |
|
|
544 |
if self.attr_scope != None:
|
|
545 |
newAttr = doc.createAttribute('scope')
|
|
546 |
newAttr.value = str(self.attr_scope)
|
|
547 |
myNode.setAttributeNode(newAttr)
|
|
548 |
|
|
549 |
if self.TemporalCoverage_extend != None:
|
|
550 |
myNode = self.TemporalCoverage_extend.exportVegX(myNode,doc)
|
|
551 |
|
|
552 |
return myNode
|
|
553 |
|
|
554 |
def importVegX(self,node):
|
|
555 |
extendedEl = TemporalCoverage()
|
|
556 |
extendedEl.importVegX(node)
|
|
557 |
self.TemporalCoverage_extend = extendedEl
|
|
558 |
|
|
559 |
self.save()
|
|
560 |
#attributes
|
|
561 |
for attr in node.attributes.keys():
|
|
562 |
aName = 'attr_' + attr
|
|
563 |
aVal = node.attributes[attr].nodeValue
|
|
564 |
if aName == 'attr_system':
|
|
565 |
self.attr_system = aVal
|
|
566 |
elif aName == 'attr_scope':
|
|
567 |
self.attr_scope = aVal
|
|
568 |
#members & relationships
|
|
569 |
for child in node.childNodes:
|
|
570 |
cName = child.nodeName
|
|
571 |
|
|
572 |
self.save()
|
|
573 |
|
|
574 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack):
|
|
575 |
newAttr = doc.createAttribute('system')
|
|
576 |
newAttr.value = str(getRandomString())
|
|
577 |
myNode.setAttributeNode(newAttr)
|
|
578 |
|
|
579 |
newAttr = doc.createAttribute('scope')
|
|
580 |
newAttr.value = str(getRandomString())
|
|
581 |
myNode.setAttributeNode(newAttr)
|
|
582 |
|
|
583 |
if 'TemporalCoverage' not in usedObjectsStack:
|
|
584 |
usedObjectsStack.append('TemporalCoverage')
|
|
585 |
newElObj = TemporalCoverage()
|
|
586 |
myNode = newElObj.exportDummyVegX(myNode,doc,usedObjectsStack)
|
|
587 |
usedObjectsStack.pop()
|
|
588 |
|
|
589 |
return myNode
|
|
590 |
|
|
591 |
|
|
592 |
class TaxonomicCoverage(models.Model):
|
|
593 |
ReferencesGroup = models.ForeignKey('ReferencesGroup', unique=True,related_name='TaxonomicCoverage_ReferencesGroup', null=True, blank=True)
|
|
594 |
taxonomicSystem = models.ForeignKey('taxonomicSystem', unique=True,related_name='TaxonomicCoverage_taxonomicSystem', null=True, blank=True)
|
|
595 |
taxonomicClassification = models.ManyToManyField('TaxonomicClassificationType',related_name='TaxonomicCoverage_taxonomicClassification',db_table = 'v_TaxonomicCoverage_TaxonomicClassificationType_taxonomi')
|
|
596 |
attr_id = models.CharField(max_length=255, null=True, blank=True)
|
|
597 |
generalTaxonomicCoverage = models.CharField(max_length=255, null=True, blank=True)
|
|
598 |
|
|
599 |
def exportVegX(self,myNode,doc):
|
|
600 |
if self.attr_id != None:
|
|
601 |
newAttr = doc.createAttribute('id')
|
|
602 |
newAttr.value = str(self.attr_id)
|
|
603 |
myNode.setAttributeNode(newAttr)
|
|
604 |
|
|
605 |
if self.generalTaxonomicCoverage != None:
|
|
606 |
newEl = doc.createElement('generalTaxonomicCoverage')
|
|
607 |
newElText = doc.createTextNode(str(self.generalTaxonomicCoverage))
|
|
608 |
newEl.appendChild(newElText)
|
|
609 |
myNode.appendChild(newEl)
|
|
610 |
|
|
611 |
if self.ReferencesGroup != None:
|
|
612 |
newEl = doc.createElement('ReferencesGroup')
|
|
613 |
myNode.appendChild(self.ReferencesGroup.exportVegX(newEl,doc))
|
|
614 |
|
|
615 |
if self.taxonomicSystem != None:
|
|
616 |
newEl = doc.createElement('taxonomicSystem')
|
|
617 |
myNode.appendChild(self.taxonomicSystem.exportVegX(newEl,doc))
|
|
618 |
|
|
619 |
for childRef in self.taxonomicClassification.all():
|
|
620 |
newEl = doc.createElement('taxonomicClassification')
|
|
621 |
myNode.appendChild(childRef.exportVegX(newEl,doc))
|
|
622 |
|
|
623 |
return myNode
|
|
624 |
|
|
625 |
def importVegX(self,node):
|
|
626 |
self.save()
|
|
627 |
#attributes
|
|
628 |
for attr in node.attributes.keys():
|
|
629 |
aName = 'attr_' + attr
|
|
630 |
aVal = node.attributes[attr].nodeValue
|
|
631 |
if aName == 'attr_id':
|
|
632 |
self.attr_id = aVal
|
|
633 |
#members & relationships
|
|
634 |
for child in node.childNodes:
|
|
635 |
cName = child.nodeName
|
|
636 |
if cName == 'generalTaxonomicCoverage':
|
|
637 |
cVal = child.childNodes[0].nodeValue
|
|
638 |
self.generalTaxonomicCoverage = cVal
|
|
639 |
elif cName == 'ReferencesGroup':
|
|
640 |
newEl = ReferencesGroup()
|
|
641 |
newEl.importVegX(child)
|
|
642 |
self.ReferencesGroup = newEl
|
|
643 |
elif cName == 'taxonomicSystem':
|
|
644 |
newEl = taxonomicSystem()
|
|
645 |
newEl.importVegX(child)
|
|
646 |
self.taxonomicSystem = newEl
|
|
647 |
elif cName == 'taxonomicClassification':
|
|
648 |
newEl = TaxonomicClassificationType()
|
|
649 |
newEl.importVegX(child)
|
|
650 |
self.taxonomicClassification.add(newEl)
|
|
651 |
|
|
652 |
self.save()
|
|
653 |
|
|
654 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack):
|
|
655 |
newAttr = doc.createAttribute('id')
|
|
656 |
newAttr.value = str(getRandomString())
|
|
657 |
myNode.setAttributeNode(newAttr)
|
|
658 |
|
|
659 |
newEl = doc.createElement('generalTaxonomicCoverage')
|
|
660 |
newElText = doc.createTextNode(str(getRandomString()))
|
|
661 |
newEl.appendChild(newElText)
|
|
662 |
myNode.appendChild(newEl)
|
|
663 |
|
|
664 |
if 'ReferencesGroup' not in usedObjectsStack:
|
|
665 |
usedObjectsStack.append('ReferencesGroup')
|
|
666 |
newEl = doc.createElement('ReferencesGroup')
|
|
667 |
newElObj = ReferencesGroup()
|
|
668 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
669 |
usedObjectsStack.pop()
|
|
670 |
|
|
671 |
if 'taxonomicSystem' not in usedObjectsStack:
|
|
672 |
usedObjectsStack.append('taxonomicSystem')
|
|
673 |
newEl = doc.createElement('taxonomicSystem')
|
|
674 |
newElObj = taxonomicSystem()
|
|
675 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
676 |
usedObjectsStack.pop()
|
|
677 |
|
|
678 |
if 'TaxonomicClassificationType' not in usedObjectsStack:
|
|
679 |
usedObjectsStack.append('TaxonomicClassificationType')
|
|
680 |
newEl = doc.createElement('taxonomicClassification')
|
|
681 |
newElObj = TaxonomicClassificationType()
|
|
682 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
683 |
usedObjectsStack.pop()
|
|
684 |
|
|
685 |
return myNode
|
|
686 |
|
|
687 |
|
|
688 |
class taxonomicCoverage(models.Model):
|
|
689 |
TaxonomicCoverage_extend = models.ForeignKey('TaxonomicCoverage', unique=True,related_name='taxonomicCoverage_TaxonomicCoverage_extend')
|
|
690 |
attr_system = models.CharField(max_length=255, null=True, blank=True)
|
|
691 |
attr_scope = models.CharField(max_length=255, null=True, blank=True, default = 'document')
|
|
692 |
|
|
693 |
def exportVegX(self,myNode,doc):
|
|
694 |
if self.attr_system != None:
|
|
695 |
newAttr = doc.createAttribute('system')
|
|
696 |
newAttr.value = str(self.attr_system)
|
|
697 |
myNode.setAttributeNode(newAttr)
|
|
698 |
|
|
699 |
if self.attr_scope != None:
|
|
700 |
newAttr = doc.createAttribute('scope')
|
|
701 |
newAttr.value = str(self.attr_scope)
|
|
702 |
myNode.setAttributeNode(newAttr)
|
|
703 |
|
|
704 |
if self.TaxonomicCoverage_extend != None:
|
|
705 |
myNode = self.TaxonomicCoverage_extend.exportVegX(myNode,doc)
|
|
706 |
|
|
707 |
return myNode
|
|
708 |
|
|
709 |
def importVegX(self,node):
|
|
710 |
extendedEl = TaxonomicCoverage()
|
|
711 |
extendedEl.importVegX(node)
|
|
712 |
self.TaxonomicCoverage_extend = extendedEl
|
|
713 |
|
|
714 |
self.save()
|
|
715 |
#attributes
|
|
716 |
for attr in node.attributes.keys():
|
|
717 |
aName = 'attr_' + attr
|
|
718 |
aVal = node.attributes[attr].nodeValue
|
|
719 |
if aName == 'attr_system':
|
|
720 |
self.attr_system = aVal
|
|
721 |
elif aName == 'attr_scope':
|
|
722 |
self.attr_scope = aVal
|
|
723 |
#members & relationships
|
|
724 |
for child in node.childNodes:
|
|
725 |
cName = child.nodeName
|
|
726 |
|
|
727 |
self.save()
|
|
728 |
|
|
729 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack):
|
|
730 |
newAttr = doc.createAttribute('system')
|
|
731 |
newAttr.value = str(getRandomString())
|
|
732 |
myNode.setAttributeNode(newAttr)
|
|
733 |
|
|
734 |
newAttr = doc.createAttribute('scope')
|
|
735 |
newAttr.value = str(getRandomString())
|
|
736 |
myNode.setAttributeNode(newAttr)
|
|
737 |
|
|
738 |
if 'TaxonomicCoverage' not in usedObjectsStack:
|
|
739 |
usedObjectsStack.append('TaxonomicCoverage')
|
|
740 |
newElObj = TaxonomicCoverage()
|
|
741 |
myNode = newElObj.exportDummyVegX(myNode,doc,usedObjectsStack)
|
|
742 |
usedObjectsStack.pop()
|
|
743 |
|
|
744 |
return myNode
|
|
745 |
|
|
746 |
|
|
747 |
class Coverage(models.Model):
|
|
748 |
ReferencesGroup = models.ForeignKey('ReferencesGroup', unique=True,related_name='Coverage_ReferencesGroup', null=True, blank=True)
|
|
749 |
geographicCoverage = models.ManyToManyField('GeographicCoverage',related_name='Coverage_geographicCoverage')
|
|
750 |
temporalCoverage = models.ManyToManyField('temporalCoverage',related_name='Coverage_temporalCoverage')
|
|
751 |
taxonomicCoverage = models.ManyToManyField('taxonomicCoverage',related_name='Coverage_taxonomicCoverage')
|
|
752 |
attr_id = models.CharField(max_length=255, null=True, blank=True)
|
|
753 |
attr_system = models.CharField(max_length=255, null=True, blank=True)
|
|
754 |
attr_scope = models.CharField(max_length=255, null=True, blank=True, default = 'document')
|
|
755 |
|
|
756 |
def exportVegX(self,myNode,doc):
|
|
757 |
if self.attr_id != None:
|
|
758 |
newAttr = doc.createAttribute('id')
|
|
759 |
newAttr.value = str(self.attr_id)
|
|
760 |
myNode.setAttributeNode(newAttr)
|
|
761 |
|
|
762 |
if self.attr_system != None:
|
|
763 |
newAttr = doc.createAttribute('system')
|
|
764 |
newAttr.value = str(self.attr_system)
|
|
765 |
myNode.setAttributeNode(newAttr)
|
|
766 |
|
|
767 |
if self.attr_scope != None:
|
|
768 |
newAttr = doc.createAttribute('scope')
|
|
769 |
newAttr.value = str(self.attr_scope)
|
|
770 |
myNode.setAttributeNode(newAttr)
|
|
771 |
|
|
772 |
if self.ReferencesGroup != None:
|
|
773 |
newEl = doc.createElement('ReferencesGroup')
|
|
774 |
myNode.appendChild(self.ReferencesGroup.exportVegX(newEl,doc))
|
|
775 |
|
|
776 |
for childRef in self.geographicCoverage.all():
|
|
777 |
newEl = doc.createElement('geographicCoverage')
|
|
778 |
myNode.appendChild(childRef.exportVegX(newEl,doc))
|
|
779 |
|
|
780 |
for childRef in self.temporalCoverage.all():
|
|
781 |
newEl = doc.createElement('temporalCoverage')
|
|
782 |
myNode.appendChild(childRef.exportVegX(newEl,doc))
|
|
783 |
|
|
784 |
for childRef in self.taxonomicCoverage.all():
|
|
785 |
newEl = doc.createElement('taxonomicCoverage')
|
|
786 |
myNode.appendChild(childRef.exportVegX(newEl,doc))
|
|
787 |
|
|
788 |
return myNode
|
|
789 |
|
|
790 |
def importVegX(self,node):
|
|
791 |
self.save()
|
|
792 |
#attributes
|
|
793 |
for attr in node.attributes.keys():
|
|
794 |
aName = 'attr_' + attr
|
|
795 |
aVal = node.attributes[attr].nodeValue
|
|
796 |
if aName == 'attr_id':
|
|
797 |
self.attr_id = aVal
|
|
798 |
elif aName == 'attr_system':
|
|
799 |
self.attr_system = aVal
|
|
800 |
elif aName == 'attr_scope':
|
|
801 |
self.attr_scope = aVal
|
|
802 |
#members & relationships
|
|
803 |
for child in node.childNodes:
|
|
804 |
cName = child.nodeName
|
|
805 |
if cName == 'ReferencesGroup':
|
|
806 |
newEl = ReferencesGroup()
|
|
807 |
newEl.importVegX(child)
|
|
808 |
self.ReferencesGroup = newEl
|
|
809 |
elif cName == 'geographicCoverage':
|
|
810 |
newEl = GeographicCoverage()
|
|
811 |
newEl.importVegX(child)
|
|
812 |
self.geographicCoverage.add(newEl)
|
|
813 |
elif cName == 'temporalCoverage':
|
|
814 |
newEl = temporalCoverage()
|
|
815 |
newEl.importVegX(child)
|
|
816 |
self.temporalCoverage.add(newEl)
|
|
817 |
elif cName == 'taxonomicCoverage':
|
|
818 |
newEl = taxonomicCoverage()
|
|
819 |
newEl.importVegX(child)
|
|
820 |
self.taxonomicCoverage.add(newEl)
|
|
821 |
|
|
822 |
self.save()
|
|
823 |
|
|
824 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack):
|
|
825 |
newAttr = doc.createAttribute('id')
|
|
826 |
newAttr.value = str(getRandomString())
|
|
827 |
myNode.setAttributeNode(newAttr)
|
|
828 |
|
|
829 |
newAttr = doc.createAttribute('system')
|
|
830 |
newAttr.value = str(getRandomString())
|
|
831 |
myNode.setAttributeNode(newAttr)
|
|
832 |
|
|
833 |
newAttr = doc.createAttribute('scope')
|
|
834 |
newAttr.value = str(getRandomString())
|
|
835 |
myNode.setAttributeNode(newAttr)
|
|
836 |
|
|
837 |
if 'ReferencesGroup' not in usedObjectsStack:
|
|
838 |
usedObjectsStack.append('ReferencesGroup')
|
|
839 |
newEl = doc.createElement('ReferencesGroup')
|
|
840 |
newElObj = ReferencesGroup()
|
|
841 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
842 |
usedObjectsStack.pop()
|
|
843 |
|
|
844 |
if 'GeographicCoverage' not in usedObjectsStack:
|
|
845 |
usedObjectsStack.append('GeographicCoverage')
|
|
846 |
newEl = doc.createElement('geographicCoverage')
|
|
847 |
newElObj = GeographicCoverage()
|
|
848 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
849 |
usedObjectsStack.pop()
|
|
850 |
|
|
851 |
if 'temporalCoverage' not in usedObjectsStack:
|
|
852 |
usedObjectsStack.append('temporalCoverage')
|
|
853 |
newEl = doc.createElement('temporalCoverage')
|
|
854 |
newElObj = temporalCoverage()
|
|
855 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
856 |
usedObjectsStack.pop()
|
|
857 |
|
|
858 |
if 'taxonomicCoverage' not in usedObjectsStack:
|
|
859 |
usedObjectsStack.append('taxonomicCoverage')
|
|
860 |
newEl = doc.createElement('taxonomicCoverage')
|
|
861 |
newElObj = taxonomicCoverage()
|
|
862 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
863 |
usedObjectsStack.pop()
|
|
864 |
|
|
865 |
return myNode
|
|
866 |
|
|
867 |
|
|
868 |
class SingleDateTimeType(models.Model):
|
|
869 |
alternativeTimeScale = models.ForeignKey('alternativeTimeScale', unique=True,related_name='SingleDateTimeType_alternativeTimeScale', null=True, blank=True)
|
|
870 |
calendarDate = models.DateField(null=True, blank=True)
|
|
871 |
time = models.TimeField(null=True, blank=True)
|
|
872 |
|
|
873 |
def exportVegX(self,myNode,doc):
|
|
874 |
if self.calendarDate != None:
|
|
875 |
newEl = doc.createElement('calendarDate')
|
|
876 |
newElText = doc.createTextNode(str(self.calendarDate))
|
|
877 |
newEl.appendChild(newElText)
|
|
878 |
myNode.appendChild(newEl)
|
|
879 |
|
|
880 |
if self.time != None:
|
|
881 |
newEl = doc.createElement('time')
|
|
882 |
newElText = doc.createTextNode(str(self.time))
|
|
883 |
newEl.appendChild(newElText)
|
|
884 |
myNode.appendChild(newEl)
|
|
885 |
|
|
886 |
if self.alternativeTimeScale != None:
|
|
887 |
newEl = doc.createElement('alternativeTimeScale')
|
|
888 |
myNode.appendChild(self.alternativeTimeScale.exportVegX(newEl,doc))
|
|
889 |
|
|
890 |
return myNode
|
|
891 |
|
|
892 |
def importVegX(self,node):
|
|
893 |
self.save()
|
|
894 |
#members & relationships
|
|
895 |
for child in node.childNodes:
|
|
896 |
cName = child.nodeName
|
|
897 |
if cName == 'calendarDate':
|
|
898 |
cVal = child.childNodes[0].nodeValue
|
|
899 |
self.calendarDate = cVal
|
|
900 |
elif cName == 'time':
|
|
901 |
cVal = child.childNodes[0].nodeValue
|
|
902 |
self.time = cVal
|
|
903 |
elif cName == 'alternativeTimeScale':
|
|
904 |
newEl = alternativeTimeScale()
|
|
905 |
newEl.importVegX(child)
|
|
906 |
self.alternativeTimeScale = newEl
|
|
907 |
|
|
908 |
self.save()
|
|
909 |
|
|
910 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack):
|
|
911 |
newEl = doc.createElement('calendarDate')
|
|
912 |
newElText = doc.createTextNode(str(getRandomDate()))
|
|
913 |
newEl.appendChild(newElText)
|
|
914 |
myNode.appendChild(newEl)
|
|
915 |
|
|
916 |
newEl = doc.createElement('time')
|
|
917 |
newElText = doc.createTextNode(str(getRandomTime()))
|
|
918 |
newEl.appendChild(newElText)
|
|
919 |
myNode.appendChild(newEl)
|
|
920 |
|
|
921 |
if 'alternativeTimeScale' not in usedObjectsStack:
|
|
922 |
usedObjectsStack.append('alternativeTimeScale')
|
|
923 |
newEl = doc.createElement('alternativeTimeScale')
|
|
924 |
newElObj = alternativeTimeScale()
|
|
925 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
926 |
usedObjectsStack.pop()
|
|
927 |
|
|
928 |
return myNode
|
|
929 |
|
|
930 |
|
|
931 |
class rangeOfDates(models.Model):
|
|
932 |
beginDate = models.ForeignKey('SingleDateTimeType', unique=True,related_name='rangeOfDates_beginDate', null=True, blank=True)
|
|
933 |
endDate = models.ForeignKey('SingleDateTimeType', unique=True,related_name='rangeOfDates_endDate', null=True, blank=True)
|
|
934 |
|
|
935 |
def exportVegX(self,myNode,doc):
|
|
936 |
if self.beginDate != None:
|
|
937 |
newEl = doc.createElement('beginDate')
|
|
938 |
myNode.appendChild(self.beginDate.exportVegX(newEl,doc))
|
|
939 |
|
|
940 |
if self.endDate != None:
|
|
941 |
newEl = doc.createElement('endDate')
|
|
942 |
myNode.appendChild(self.endDate.exportVegX(newEl,doc))
|
|
943 |
|
|
944 |
return myNode
|
|
945 |
|
|
946 |
def importVegX(self,node):
|
|
947 |
self.save()
|
|
948 |
#members & relationships
|
|
949 |
for child in node.childNodes:
|
|
950 |
cName = child.nodeName
|
|
951 |
if cName == 'beginDate':
|
|
952 |
newEl = SingleDateTimeType()
|
|
953 |
newEl.importVegX(child)
|
|
954 |
self.beginDate = newEl
|
|
955 |
elif cName == 'endDate':
|
|
956 |
newEl = SingleDateTimeType()
|
|
957 |
newEl.importVegX(child)
|
|
958 |
self.endDate = newEl
|
|
959 |
|
|
960 |
self.save()
|
|
961 |
|
|
962 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack):
|
|
963 |
if 'SingleDateTimeType' not in usedObjectsStack:
|
|
964 |
usedObjectsStack.append('SingleDateTimeType')
|
|
965 |
newEl = doc.createElement('beginDate')
|
|
966 |
newElObj = SingleDateTimeType()
|
|
967 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
968 |
usedObjectsStack.pop()
|
|
969 |
|
|
970 |
if 'SingleDateTimeType' not in usedObjectsStack:
|
|
971 |
usedObjectsStack.append('SingleDateTimeType')
|
|
972 |
newEl = doc.createElement('endDate')
|
|
973 |
newElObj = SingleDateTimeType()
|
|
974 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
975 |
usedObjectsStack.pop()
|
|
976 |
|
|
977 |
return myNode
|
|
978 |
|
|
979 |
|
|
980 |
class CitationType(models.Model):
|
|
981 |
ReferencesGroup = models.ForeignKey('ReferencesGroup', unique=True,related_name='CitationType_ReferencesGroup', null=True, blank=True)
|
|
982 |
ResourceGroup = models.ForeignKey('ResourceGroup', unique=True,related_name='CitationType_ResourceGroup', null=True, blank=True)
|
|
983 |
access = models.ForeignKey('AccessType', unique=True,related_name='CitationType_access', null=True, blank=True)
|
|
984 |
article = models.ForeignKey('Article', unique=True,related_name='CitationType_article', null=True, blank=True)
|
|
985 |
book = models.ForeignKey('Book', unique=True,related_name='CitationType_book', null=True, blank=True)
|
|
986 |
chapter = models.ForeignKey('Chapter', unique=True,related_name='CitationType_chapter', null=True, blank=True)
|
|
987 |
editedBook = models.ForeignKey('Book', unique=True,related_name='CitationType_editedBook', null=True, blank=True)
|
|
988 |
manuscript = models.ForeignKey('Manuscript', unique=True,related_name='CitationType_manuscript', null=True, blank=True)
|
|
989 |
report = models.ForeignKey('Report', unique=True,related_name='CitationType_report', null=True, blank=True)
|
|
990 |
thesis = models.ForeignKey('Thesis', unique=True,related_name='CitationType_thesis', null=True, blank=True)
|
|
991 |
conferenceProceedings = models.ForeignKey('ConferenceProceedings', unique=True,related_name='CitationType_conferenceProceedings', null=True, blank=True)
|
|
992 |
personalCommunication = models.ForeignKey('PersonalCommunication', unique=True,related_name='CitationType_personalCommunication', null=True, blank=True)
|
|
993 |
map = models.ForeignKey('Map', unique=True,related_name='CitationType_map', null=True, blank=True)
|
|
994 |
generic = models.ForeignKey('Generic', unique=True,related_name='CitationType_generic', null=True, blank=True)
|
|
995 |
audioVisual = models.ForeignKey('AudioVisual', unique=True,related_name='CitationType_audioVisual', null=True, blank=True)
|
|
996 |
presentation = models.ForeignKey('Presentation', unique=True,related_name='CitationType_presentation', null=True, blank=True)
|
|
997 |
attr_id = models.CharField(max_length=255, null=True, blank=True)
|
|
998 |
attr_system = models.CharField(max_length=255, null=True, blank=True)
|
|
999 |
attr_scope = models.CharField(max_length=255, null=True, blank=True, default = 'document')
|
|
1000 |
|
|
1001 |
def exportVegX(self,myNode,doc):
|
|
1002 |
if self.attr_id != None:
|
|
1003 |
newAttr = doc.createAttribute('id')
|
|
1004 |
newAttr.value = str(self.attr_id)
|
|
1005 |
myNode.setAttributeNode(newAttr)
|
|
1006 |
|
|
1007 |
if self.attr_system != None:
|
|
1008 |
newAttr = doc.createAttribute('system')
|
|
1009 |
newAttr.value = str(self.attr_system)
|
|
1010 |
myNode.setAttributeNode(newAttr)
|
|
1011 |
|
|
1012 |
if self.attr_scope != None:
|
|
1013 |
newAttr = doc.createAttribute('scope')
|
|
1014 |
newAttr.value = str(self.attr_scope)
|
|
1015 |
myNode.setAttributeNode(newAttr)
|
|
1016 |
|
|
1017 |
if self.ReferencesGroup != None:
|
|
1018 |
newEl = doc.createElement('ReferencesGroup')
|
|
1019 |
myNode.appendChild(self.ReferencesGroup.exportVegX(newEl,doc))
|
|
1020 |
|
|
1021 |
if self.ResourceGroup != None:
|
|
1022 |
newEl = doc.createElement('ResourceGroup')
|
|
1023 |
myNode.appendChild(self.ResourceGroup.exportVegX(newEl,doc))
|
|
1024 |
|
|
1025 |
if self.access != None:
|
|
1026 |
newEl = doc.createElement('access')
|
|
1027 |
myNode.appendChild(self.access.exportVegX(newEl,doc))
|
|
1028 |
|
|
1029 |
if self.article != None:
|
|
1030 |
newEl = doc.createElement('article')
|
|
1031 |
myNode.appendChild(self.article.exportVegX(newEl,doc))
|
|
1032 |
|
|
1033 |
if self.book != None:
|
|
1034 |
newEl = doc.createElement('book')
|
|
1035 |
myNode.appendChild(self.book.exportVegX(newEl,doc))
|
|
1036 |
|
|
1037 |
if self.chapter != None:
|
|
1038 |
newEl = doc.createElement('chapter')
|
|
1039 |
myNode.appendChild(self.chapter.exportVegX(newEl,doc))
|
|
1040 |
|
|
1041 |
if self.editedBook != None:
|
|
1042 |
newEl = doc.createElement('editedBook')
|
|
1043 |
myNode.appendChild(self.editedBook.exportVegX(newEl,doc))
|
|
1044 |
|
|
1045 |
if self.manuscript != None:
|
|
1046 |
newEl = doc.createElement('manuscript')
|
|
1047 |
myNode.appendChild(self.manuscript.exportVegX(newEl,doc))
|
|
1048 |
|
|
1049 |
if self.report != None:
|
|
1050 |
newEl = doc.createElement('report')
|
|
1051 |
myNode.appendChild(self.report.exportVegX(newEl,doc))
|
|
1052 |
|
|
1053 |
if self.thesis != None:
|
|
1054 |
newEl = doc.createElement('thesis')
|
|
1055 |
myNode.appendChild(self.thesis.exportVegX(newEl,doc))
|
|
1056 |
|
|
1057 |
if self.conferenceProceedings != None:
|
|
1058 |
newEl = doc.createElement('conferenceProceedings')
|
|
1059 |
myNode.appendChild(self.conferenceProceedings.exportVegX(newEl,doc))
|
|
1060 |
|
|
1061 |
if self.personalCommunication != None:
|
|
1062 |
newEl = doc.createElement('personalCommunication')
|
|
1063 |
myNode.appendChild(self.personalCommunication.exportVegX(newEl,doc))
|
|
1064 |
|
|
1065 |
if self.map != None:
|
|
1066 |
newEl = doc.createElement('map')
|
|
1067 |
myNode.appendChild(self.map.exportVegX(newEl,doc))
|
|
1068 |
|
|
1069 |
if self.generic != None:
|
|
1070 |
newEl = doc.createElement('generic')
|
|
1071 |
myNode.appendChild(self.generic.exportVegX(newEl,doc))
|
|
1072 |
|
|
1073 |
if self.audioVisual != None:
|
|
1074 |
newEl = doc.createElement('audioVisual')
|
|
1075 |
myNode.appendChild(self.audioVisual.exportVegX(newEl,doc))
|
|
1076 |
|
|
1077 |
if self.presentation != None:
|
|
1078 |
newEl = doc.createElement('presentation')
|
|
1079 |
myNode.appendChild(self.presentation.exportVegX(newEl,doc))
|
|
1080 |
|
|
1081 |
return myNode
|
|
1082 |
|
|
1083 |
def importVegX(self,node):
|
|
1084 |
self.save()
|
|
1085 |
#attributes
|
|
1086 |
for attr in node.attributes.keys():
|
|
1087 |
aName = 'attr_' + attr
|
|
1088 |
aVal = node.attributes[attr].nodeValue
|
|
1089 |
if aName == 'attr_id':
|
|
1090 |
self.attr_id = aVal
|
|
1091 |
elif aName == 'attr_system':
|
|
1092 |
self.attr_system = aVal
|
|
1093 |
elif aName == 'attr_scope':
|
|
1094 |
self.attr_scope = aVal
|
|
1095 |
#members & relationships
|
|
1096 |
for child in node.childNodes:
|
|
1097 |
cName = child.nodeName
|
|
1098 |
if cName == 'ReferencesGroup':
|
|
1099 |
newEl = ReferencesGroup()
|
|
1100 |
newEl.importVegX(child)
|
|
1101 |
self.ReferencesGroup = newEl
|
|
1102 |
elif cName == 'ResourceGroup':
|
|
1103 |
newEl = ResourceGroup()
|
|
1104 |
newEl.importVegX(child)
|
|
1105 |
self.ResourceGroup = newEl
|
|
1106 |
elif cName == 'access':
|
|
1107 |
newEl = AccessType()
|
|
1108 |
newEl.importVegX(child)
|
|
1109 |
self.access = newEl
|
|
1110 |
elif cName == 'article':
|
|
1111 |
newEl = Article()
|
|
1112 |
newEl.importVegX(child)
|
|
1113 |
self.article = newEl
|
|
1114 |
elif cName == 'book':
|
|
1115 |
newEl = Book()
|
|
1116 |
newEl.importVegX(child)
|
|
1117 |
self.book = newEl
|
|
1118 |
elif cName == 'chapter':
|
|
1119 |
newEl = Chapter()
|
|
1120 |
newEl.importVegX(child)
|
|
1121 |
self.chapter = newEl
|
|
1122 |
elif cName == 'editedBook':
|
|
1123 |
newEl = Book()
|
|
1124 |
newEl.importVegX(child)
|
|
1125 |
self.editedBook = newEl
|
|
1126 |
elif cName == 'manuscript':
|
|
1127 |
newEl = Manuscript()
|
|
1128 |
newEl.importVegX(child)
|
|
1129 |
self.manuscript = newEl
|
|
1130 |
elif cName == 'report':
|
|
1131 |
newEl = Report()
|
|
1132 |
newEl.importVegX(child)
|
|
1133 |
self.report = newEl
|
|
1134 |
elif cName == 'thesis':
|
|
1135 |
newEl = Thesis()
|
|
1136 |
newEl.importVegX(child)
|
|
1137 |
self.thesis = newEl
|
|
1138 |
elif cName == 'conferenceProceedings':
|
|
1139 |
newEl = ConferenceProceedings()
|
|
1140 |
newEl.importVegX(child)
|
|
1141 |
self.conferenceProceedings = newEl
|
|
1142 |
elif cName == 'personalCommunication':
|
|
1143 |
newEl = PersonalCommunication()
|
|
1144 |
newEl.importVegX(child)
|
|
1145 |
self.personalCommunication = newEl
|
|
1146 |
elif cName == 'map':
|
|
1147 |
newEl = Map()
|
|
1148 |
newEl.importVegX(child)
|
|
1149 |
self.map = newEl
|
|
1150 |
elif cName == 'generic':
|
|
1151 |
newEl = Generic()
|
|
1152 |
newEl.importVegX(child)
|
|
1153 |
self.generic = newEl
|
|
1154 |
elif cName == 'audioVisual':
|
|
1155 |
newEl = AudioVisual()
|
|
1156 |
newEl.importVegX(child)
|
|
1157 |
self.audioVisual = newEl
|
|
1158 |
elif cName == 'presentation':
|
|
1159 |
newEl = Presentation()
|
|
1160 |
newEl.importVegX(child)
|
|
1161 |
self.presentation = newEl
|
|
1162 |
|
|
1163 |
self.save()
|
|
1164 |
|
|
1165 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack):
|
|
1166 |
newAttr = doc.createAttribute('id')
|
|
1167 |
newAttr.value = str(getRandomString())
|
|
1168 |
myNode.setAttributeNode(newAttr)
|
|
1169 |
|
|
1170 |
newAttr = doc.createAttribute('system')
|
|
1171 |
newAttr.value = str(getRandomString())
|
|
1172 |
myNode.setAttributeNode(newAttr)
|
|
1173 |
|
|
1174 |
newAttr = doc.createAttribute('scope')
|
|
1175 |
newAttr.value = str(getRandomString())
|
|
1176 |
myNode.setAttributeNode(newAttr)
|
|
1177 |
|
|
1178 |
if 'ReferencesGroup' not in usedObjectsStack:
|
|
1179 |
usedObjectsStack.append('ReferencesGroup')
|
|
1180 |
newEl = doc.createElement('ReferencesGroup')
|
|
1181 |
newElObj = ReferencesGroup()
|
|
1182 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
1183 |
usedObjectsStack.pop()
|
|
1184 |
|
|
1185 |
if 'ResourceGroup' not in usedObjectsStack:
|
|
1186 |
usedObjectsStack.append('ResourceGroup')
|
|
1187 |
newEl = doc.createElement('ResourceGroup')
|
|
1188 |
newElObj = ResourceGroup()
|
|
1189 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
1190 |
usedObjectsStack.pop()
|
|
1191 |
|
|
1192 |
if 'AccessType' not in usedObjectsStack:
|
|
1193 |
usedObjectsStack.append('AccessType')
|
|
1194 |
newEl = doc.createElement('access')
|
|
1195 |
newElObj = AccessType()
|
|
1196 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
1197 |
usedObjectsStack.pop()
|
|
1198 |
|
|
1199 |
if 'Article' not in usedObjectsStack:
|
|
1200 |
usedObjectsStack.append('Article')
|
|
1201 |
newEl = doc.createElement('article')
|
|
1202 |
newElObj = Article()
|
|
1203 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
1204 |
usedObjectsStack.pop()
|
|
1205 |
|
|
1206 |
if 'Book' not in usedObjectsStack:
|
|
1207 |
usedObjectsStack.append('Book')
|
|
1208 |
newEl = doc.createElement('book')
|
|
1209 |
newElObj = Book()
|
|
1210 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
1211 |
usedObjectsStack.pop()
|
|
1212 |
|
|
1213 |
if 'Chapter' not in usedObjectsStack:
|
|
1214 |
usedObjectsStack.append('Chapter')
|
|
1215 |
newEl = doc.createElement('chapter')
|
|
1216 |
newElObj = Chapter()
|
|
1217 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
1218 |
usedObjectsStack.pop()
|
|
1219 |
|
|
1220 |
if 'Book' not in usedObjectsStack:
|
|
1221 |
usedObjectsStack.append('Book')
|
|
1222 |
newEl = doc.createElement('editedBook')
|
|
1223 |
newElObj = Book()
|
|
1224 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
1225 |
usedObjectsStack.pop()
|
|
1226 |
|
|
1227 |
if 'Manuscript' not in usedObjectsStack:
|
|
1228 |
usedObjectsStack.append('Manuscript')
|
|
1229 |
newEl = doc.createElement('manuscript')
|
|
1230 |
newElObj = Manuscript()
|
|
1231 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
1232 |
usedObjectsStack.pop()
|
|
1233 |
|
|
1234 |
if 'Report' not in usedObjectsStack:
|
|
1235 |
usedObjectsStack.append('Report')
|
|
1236 |
newEl = doc.createElement('report')
|
|
1237 |
newElObj = Report()
|
|
1238 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
1239 |
usedObjectsStack.pop()
|
|
1240 |
|
|
1241 |
if 'Thesis' not in usedObjectsStack:
|
|
1242 |
usedObjectsStack.append('Thesis')
|
|
1243 |
newEl = doc.createElement('thesis')
|
|
1244 |
newElObj = Thesis()
|
|
1245 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
1246 |
usedObjectsStack.pop()
|
|
1247 |
|
|
1248 |
if 'ConferenceProceedings' not in usedObjectsStack:
|
|
1249 |
usedObjectsStack.append('ConferenceProceedings')
|
|
1250 |
newEl = doc.createElement('conferenceProceedings')
|
|
1251 |
newElObj = ConferenceProceedings()
|
|
1252 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
1253 |
usedObjectsStack.pop()
|
|
1254 |
|
|
1255 |
if 'PersonalCommunication' not in usedObjectsStack:
|
|
1256 |
usedObjectsStack.append('PersonalCommunication')
|
|
1257 |
newEl = doc.createElement('personalCommunication')
|
|
1258 |
newElObj = PersonalCommunication()
|
|
1259 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
1260 |
usedObjectsStack.pop()
|
|
1261 |
|
|
1262 |
if 'Map' not in usedObjectsStack:
|
|
1263 |
usedObjectsStack.append('Map')
|
|
1264 |
newEl = doc.createElement('map')
|
|
1265 |
newElObj = Map()
|
|
1266 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
1267 |
usedObjectsStack.pop()
|
|
1268 |
|
|
1269 |
if 'Generic' not in usedObjectsStack:
|
|
1270 |
usedObjectsStack.append('Generic')
|
|
1271 |
newEl = doc.createElement('generic')
|
|
1272 |
newElObj = Generic()
|
|
1273 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
1274 |
usedObjectsStack.pop()
|
|
1275 |
|
|
1276 |
if 'AudioVisual' not in usedObjectsStack:
|
|
1277 |
usedObjectsStack.append('AudioVisual')
|
|
1278 |
newEl = doc.createElement('audioVisual')
|
|
1279 |
newElObj = AudioVisual()
|
|
1280 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
1281 |
usedObjectsStack.pop()
|
|
1282 |
|
|
1283 |
if 'Presentation' not in usedObjectsStack:
|
|
1284 |
usedObjectsStack.append('Presentation')
|
|
1285 |
newEl = doc.createElement('presentation')
|
|
1286 |
newElObj = Presentation()
|
|
1287 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
1288 |
usedObjectsStack.pop()
|
|
1289 |
|
|
1290 |
return myNode
|
|
1291 |
|
|
1292 |
|
|
1293 |
class alternativeTimeScale(models.Model):
|
|
1294 |
timeScaleCitation = models.ManyToManyField('CitationType',related_name='alternativeTimeScale_timeScaleCitation')
|
|
1295 |
timeScaleName = models.CharField(max_length=255, null=True, blank=True)
|
|
1296 |
timeScaleAgeEstimate = models.CharField(max_length=255, null=True, blank=True)
|
|
1297 |
timeScaleAgeUncertainty = models.CharField(max_length=255, null=True, blank=True)
|
|
1298 |
timeScaleAgeExplanation = models.CharField(max_length=255, null=True, blank=True)
|
|
1299 |
|
|
1300 |
def exportVegX(self,myNode,doc):
|
|
1301 |
if self.timeScaleName != None:
|
|
1302 |
newEl = doc.createElement('timeScaleName')
|
|
1303 |
newElText = doc.createTextNode(str(self.timeScaleName))
|
|
1304 |
newEl.appendChild(newElText)
|
|
1305 |
myNode.appendChild(newEl)
|
|
1306 |
|
|
1307 |
if self.timeScaleAgeEstimate != None:
|
|
1308 |
newEl = doc.createElement('timeScaleAgeEstimate')
|
|
1309 |
newElText = doc.createTextNode(str(self.timeScaleAgeEstimate))
|
|
1310 |
newEl.appendChild(newElText)
|
|
1311 |
myNode.appendChild(newEl)
|
|
1312 |
|
|
1313 |
if self.timeScaleAgeUncertainty != None:
|
|
1314 |
newEl = doc.createElement('timeScaleAgeUncertainty')
|
|
1315 |
newElText = doc.createTextNode(str(self.timeScaleAgeUncertainty))
|
|
1316 |
newEl.appendChild(newElText)
|
|
1317 |
myNode.appendChild(newEl)
|
|
1318 |
|
|
1319 |
if self.timeScaleAgeExplanation != None:
|
|
1320 |
newEl = doc.createElement('timeScaleAgeExplanation')
|
|
1321 |
newElText = doc.createTextNode(str(self.timeScaleAgeExplanation))
|
|
1322 |
newEl.appendChild(newElText)
|
|
1323 |
myNode.appendChild(newEl)
|
|
1324 |
|
|
1325 |
for childRef in self.timeScaleCitation.all():
|
|
1326 |
newEl = doc.createElement('timeScaleCitation')
|
|
1327 |
myNode.appendChild(childRef.exportVegX(newEl,doc))
|
|
1328 |
|
|
1329 |
return myNode
|
|
1330 |
|
|
1331 |
def importVegX(self,node):
|
|
1332 |
self.save()
|
|
1333 |
#members & relationships
|
|
1334 |
for child in node.childNodes:
|
|
1335 |
cName = child.nodeName
|
|
1336 |
if cName == 'timeScaleName':
|
|
1337 |
cVal = child.childNodes[0].nodeValue
|
|
1338 |
self.timeScaleName = cVal
|
|
1339 |
elif cName == 'timeScaleAgeEstimate':
|
|
1340 |
cVal = child.childNodes[0].nodeValue
|
|
1341 |
self.timeScaleAgeEstimate = cVal
|
|
1342 |
elif cName == 'timeScaleAgeUncertainty':
|
|
1343 |
cVal = child.childNodes[0].nodeValue
|
|
1344 |
self.timeScaleAgeUncertainty = cVal
|
|
1345 |
elif cName == 'timeScaleAgeExplanation':
|
|
1346 |
cVal = child.childNodes[0].nodeValue
|
|
1347 |
self.timeScaleAgeExplanation = cVal
|
|
1348 |
elif cName == 'timeScaleCitation':
|
|
1349 |
newEl = CitationType()
|
|
1350 |
newEl.importVegX(child)
|
|
1351 |
self.timeScaleCitation.add(newEl)
|
|
1352 |
|
|
1353 |
self.save()
|
|
1354 |
|
|
1355 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack):
|
|
1356 |
newEl = doc.createElement('timeScaleName')
|
|
1357 |
newElText = doc.createTextNode(str(getRandomString()))
|
|
1358 |
newEl.appendChild(newElText)
|
|
1359 |
myNode.appendChild(newEl)
|
|
1360 |
|
|
1361 |
newEl = doc.createElement('timeScaleAgeEstimate')
|
|
1362 |
newElText = doc.createTextNode(str(getRandomString()))
|
|
1363 |
newEl.appendChild(newElText)
|
|
1364 |
myNode.appendChild(newEl)
|
|
1365 |
|
|
1366 |
newEl = doc.createElement('timeScaleAgeUncertainty')
|
|
1367 |
newElText = doc.createTextNode(str(getRandomString()))
|
|
1368 |
newEl.appendChild(newElText)
|
|
1369 |
myNode.appendChild(newEl)
|
|
1370 |
|
|
1371 |
newEl = doc.createElement('timeScaleAgeExplanation')
|
|
1372 |
newElText = doc.createTextNode(str(getRandomString()))
|
|
1373 |
newEl.appendChild(newElText)
|
|
1374 |
myNode.appendChild(newEl)
|
|
1375 |
|
|
1376 |
if 'CitationType' not in usedObjectsStack:
|
|
1377 |
usedObjectsStack.append('CitationType')
|
|
1378 |
newEl = doc.createElement('timeScaleCitation')
|
|
1379 |
newElObj = CitationType()
|
|
1380 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack))
|
|
1381 |
usedObjectsStack.pop()
|
|
1382 |
|
|
1383 |
return myNode
|
|
1384 |
|
|
1385 |
|
|
1386 |
class boundingAltitudes(models.Model):
|
|
1387 |
altitudeMinimum = models.CharField(max_length=255, null=True, blank=True)
|
|
1388 |
altitudeMaximum = models.CharField(max_length=255, null=True, blank=True)
|
|
1389 |
altitudeUnits = models.CharField(max_length=255, null=True, blank=True)
|
|
1390 |
|
|
1391 |
def exportVegX(self,myNode,doc):
|
|
1392 |
if self.altitudeMinimum != None:
|
|
1393 |
newEl = doc.createElement('altitudeMinimum')
|
|
1394 |
newElText = doc.createTextNode(str(self.altitudeMinimum))
|
|
1395 |
newEl.appendChild(newElText)
|
|
1396 |
myNode.appendChild(newEl)
|
Initial import of Django version of BIEN