| 2657 |
rajveer |
1 |
def contentModel2Struct(expslide, categoryObj) :
|
| 73 |
naveen |
2 |
struct = {}
|
| 69 |
naveen |
3 |
|
| 2657 |
rajveer |
4 |
struct['category'] = categoryObj.getLabel()
|
| 2655 |
rajveer |
5 |
|
| 73 |
naveen |
6 |
# Set children slide structures
|
|
|
7 |
if expslide.hasChildrenSlides() :
|
|
|
8 |
expchildrenslides = expslide.getExpandedChildrenSlides()
|
|
|
9 |
childrenstructs = {}
|
|
|
10 |
for expchildslide in expchildrenslides :
|
| 2657 |
rajveer |
11 |
childstruct = contentModel2Struct(expchildslide, categoryObj)
|
| 73 |
naveen |
12 |
|
|
|
13 |
# REVISIT - ID in place to label
|
|
|
14 |
slidelabel = expchildslide.getSlideDefinition().getLabel()
|
| 1362 |
rajveer |
15 |
#print "slidelabel=" + slidelabel
|
| 73 |
naveen |
16 |
childrenstructs[slidelabel] = childstruct
|
|
|
17 |
|
|
|
18 |
struct['childrenslides'] = childrenstructs
|
|
|
19 |
|
|
|
20 |
# Set feature structures
|
|
|
21 |
if expslide.hasFeatures() :
|
|
|
22 |
expfeatures = expslide.getExpandedFeatures()
|
|
|
23 |
featurestructs = {}
|
|
|
24 |
for expfeature in expfeatures :
|
|
|
25 |
|
|
|
26 |
# REVISIT - ID in place to label
|
|
|
27 |
featurelabel = expfeature.getFeatureDefinition().getLabel()
|
| 1362 |
rajveer |
28 |
#print "featurelabel=" + featurelabel
|
| 73 |
naveen |
29 |
if expfeature.hasBullets() :
|
|
|
30 |
bulletsstruct = []
|
|
|
31 |
expbullets = expfeature.getExpandedBullets()
|
|
|
32 |
for expbullet in expbullets :
|
|
|
33 |
if expbullet.isComposite() :
|
|
|
34 |
primitivedataobjects = expbullet.getDataObject().getPrimitiveDataObjects()
|
| 1936 |
rajveer |
35 |
unit = expbullet.getUnit()
|
| 73 |
naveen |
36 |
for primitivedataobject in primitivedataobjects :
|
|
|
37 |
bulletvalue = primitivedataobject.getValue()
|
| 1936 |
rajveer |
38 |
print "unit is" + `unit`
|
|
|
39 |
if unit is not None:
|
|
|
40 |
print "unit is not none"
|
|
|
41 |
if unit.getShortForm() == "GB":
|
|
|
42 |
print "GB is" + `bulletvalue`
|
|
|
43 |
#if(bulletvalue.endswith('L')):
|
|
|
44 |
# bulletvalue=bulletvalue[0:len(bulletvalue)-2]
|
|
|
45 |
#bulletvalue = bulletvalue * 1024 * 1024
|
|
|
46 |
#print "KB is" + `bulletvalue`
|
|
|
47 |
#convert to kb
|
|
|
48 |
if unit.getShortForm() == "MB":
|
|
|
49 |
print "GB is" + `bulletvalue`
|
|
|
50 |
#if(bulletvalue.endswith('L')):
|
|
|
51 |
# bulletvalue=bulletvalue[0:len(bulletvalue)-2]
|
|
|
52 |
#bulletvalue = bulletvalue * 1024
|
|
|
53 |
#print "KB is" + `bulletvalue`
|
|
|
54 |
#convert to kb
|
|
|
55 |
|
| 1362 |
rajveer |
56 |
#print "bulletvalue=" + bulletvalue
|
| 73 |
naveen |
57 |
bulletsstruct.append(bulletvalue)
|
|
|
58 |
|
|
|
59 |
elif expbullet.isEnumerated() :
|
|
|
60 |
bulletvalue = expbullet.getExpandedEnumDataObject().getEnumValue().getValue()
|
| 1362 |
rajveer |
61 |
#print "bulletvalue=" + bulletvalue
|
| 73 |
naveen |
62 |
bulletsstruct.append(bulletvalue)
|
|
|
63 |
|
|
|
64 |
else :
|
|
|
65 |
bulletvalue = expbullet.getDataObject().getValue()
|
| 1362 |
rajveer |
66 |
#print "bulletvalue=" + bulletvalue
|
| 1936 |
rajveer |
67 |
unit = expbullet.getUnit()
|
|
|
68 |
print "unit is" + `unit`
|
|
|
69 |
if unit is not None:
|
|
|
70 |
print "unit is not none"
|
| 5173 |
amit.gupta |
71 |
if unit.getShortForm() == "TB":
|
|
|
72 |
print "TB is" + `bulletvalue`
|
|
|
73 |
value = float(bulletvalue)
|
|
|
74 |
#if(bulletvalue.endswith('L')):
|
|
|
75 |
# bulletvalue=bulletvalue[0:len(bulletvalue)-2]
|
|
|
76 |
newvalue = value * 1024 * 1024 * 1024
|
|
|
77 |
print "KB is" + `newvalue`
|
|
|
78 |
bulletvalue = str(newvalue)
|
|
|
79 |
#convert to kb
|
| 1936 |
rajveer |
80 |
if unit.getShortForm() == "GB":
|
|
|
81 |
print "GB is" + `bulletvalue`
|
|
|
82 |
value = float(bulletvalue)
|
|
|
83 |
#if(bulletvalue.endswith('L')):
|
|
|
84 |
# bulletvalue=bulletvalue[0:len(bulletvalue)-2]
|
|
|
85 |
newvalue = value * 1024 * 1024
|
|
|
86 |
print "KB is" + `newvalue`
|
|
|
87 |
bulletvalue = str(newvalue)
|
|
|
88 |
#convert to kb
|
|
|
89 |
if unit.getShortForm() == "MB":
|
|
|
90 |
print "MB is" + `bulletvalue`
|
|
|
91 |
value = float(bulletvalue)
|
|
|
92 |
#if(bulletvalue.endswith('L')):
|
|
|
93 |
#bulletvalue=bulletvalue[0:len(bulletvalue)-2]
|
|
|
94 |
newvalue = value * 1024
|
|
|
95 |
print "KB is" + `newvalue`
|
|
|
96 |
bulletvalue = str(newvalue)
|
|
|
97 |
#convert to kb
|
| 73 |
naveen |
98 |
bulletsstruct.append(bulletvalue)
|
|
|
99 |
|
|
|
100 |
featurestructs[featurelabel] = bulletsstruct
|
|
|
101 |
else :
|
|
|
102 |
# Set to empty list, this is to accomodate bullet-less features
|
|
|
103 |
featurestructs[featurelabel] = []
|
| 5173 |
amit.gupta |
104 |
freeFormStruct = []
|
|
|
105 |
if expfeature.getFreeformContent() is not None:
|
|
|
106 |
if expfeature.getFreeformContent().getFreeformTexts() is not None:
|
|
|
107 |
for freeformText in expfeature.getFreeformContent().getFreeformTexts():
|
|
|
108 |
freeFormStruct.append(freeformText)
|
|
|
109 |
if len(freeFormStruct) > 0:
|
|
|
110 |
if(len(freeFormStruct[0])>0):
|
|
|
111 |
featurestructs[featurelabel + '_fft'] = freeFormStruct
|
| 73 |
naveen |
112 |
struct['features'] = featurestructs
|
|
|
113 |
|
|
|
114 |
return struct
|
|
|
115 |
|
|
|
116 |
|