Rev 2655 | Rev 5173 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
def contentModel2Struct(expslide, categoryObj) :struct = {}struct['category'] = categoryObj.getLabel()# Set children slide structuresif expslide.hasChildrenSlides() :expchildrenslides = expslide.getExpandedChildrenSlides()childrenstructs = {}for expchildslide in expchildrenslides :childstruct = contentModel2Struct(expchildslide, categoryObj)# REVISIT - ID in place to labelslidelabel = expchildslide.getSlideDefinition().getLabel()#print "slidelabel=" + slidelabelchildrenstructs[slidelabel] = childstructstruct['childrenslides'] = childrenstructs# Set feature structuresif expslide.hasFeatures() :expfeatures = expslide.getExpandedFeatures()featurestructs = {}for expfeature in expfeatures :# REVISIT - ID in place to labelfeaturelabel = expfeature.getFeatureDefinition().getLabel()#print "featurelabel=" + featurelabelif expfeature.hasBullets() :bulletsstruct = []expbullets = expfeature.getExpandedBullets()for expbullet in expbullets :if expbullet.isComposite() :primitivedataobjects = expbullet.getDataObject().getPrimitiveDataObjects()unit = expbullet.getUnit()for primitivedataobject in primitivedataobjects :bulletvalue = primitivedataobject.getValue()print "unit is" + `unit`if unit is not None:print "unit is not none"if unit.getShortForm() == "GB":print "GB is" + `bulletvalue`#if(bulletvalue.endswith('L')):# bulletvalue=bulletvalue[0:len(bulletvalue)-2]#bulletvalue = bulletvalue * 1024 * 1024#print "KB is" + `bulletvalue`#convert to kbif unit.getShortForm() == "MB":print "GB is" + `bulletvalue`#if(bulletvalue.endswith('L')):# bulletvalue=bulletvalue[0:len(bulletvalue)-2]#bulletvalue = bulletvalue * 1024#print "KB is" + `bulletvalue`#convert to kb#print "bulletvalue=" + bulletvaluebulletsstruct.append(bulletvalue)elif expbullet.isEnumerated() :bulletvalue = expbullet.getExpandedEnumDataObject().getEnumValue().getValue()#print "bulletvalue=" + bulletvaluebulletsstruct.append(bulletvalue)else :bulletvalue = expbullet.getDataObject().getValue()#print "bulletvalue=" + bulletvalueunit = expbullet.getUnit()print "unit is" + `unit`if unit is not None:print "unit is not none"if unit.getShortForm() == "GB":print "GB is" + `bulletvalue`value = float(bulletvalue)#if(bulletvalue.endswith('L')):# bulletvalue=bulletvalue[0:len(bulletvalue)-2]newvalue = value * 1024 * 1024print "KB is" + `newvalue`bulletvalue = str(newvalue)#convert to kbif unit.getShortForm() == "MB":print "MB is" + `bulletvalue`value = float(bulletvalue)#if(bulletvalue.endswith('L')):#bulletvalue=bulletvalue[0:len(bulletvalue)-2]newvalue = value * 1024print "KB is" + `newvalue`bulletvalue = str(newvalue)#convert to kbbulletsstruct.append(bulletvalue)featurestructs[featurelabel] = bulletsstructelse :# Set to empty list, this is to accomodate bullet-less featuresfeaturestructs[featurelabel] = []struct['features'] = featurestructsreturn struct