Subversion Repositories SmartDukaan

Rev

Rev 73 | Rev 1362 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

def contentModel2Struct(expslide) :
    struct = {}
    
    # Set children slide structures
    if expslide.hasChildrenSlides() :
        expchildrenslides = expslide.getExpandedChildrenSlides()
        childrenstructs = {}
        for expchildslide in expchildrenslides :
            childstruct = contentModel2Struct(expchildslide) 
            
            # REVISIT - ID in place to label
            slidelabel = expchildslide.getSlideDefinition().getLabel() 
            print "slidelabel=" + slidelabel
            childrenstructs[slidelabel] = childstruct
            
        struct['childrenslides'] = childrenstructs
    
    # Set feature structures
    if expslide.hasFeatures() :
        expfeatures = expslide.getExpandedFeatures()
        featurestructs = {}
        for expfeature in expfeatures :
            
            # REVISIT - ID in place to label
            featurelabel = expfeature.getFeatureDefinition().getLabel()
            print "featurelabel=" + featurelabel 
            if expfeature.hasBullets() :
                bulletsstruct = []
                expbullets = expfeature.getExpandedBullets()
                for expbullet in expbullets :
                    if expbullet.isComposite() :
                        primitivedataobjects = expbullet.getDataObject().getPrimitiveDataObjects()
                        for primitivedataobject in primitivedataobjects :
                            bulletvalue = primitivedataobject.getValue()
                            print "bulletvalue=" + bulletvalue
                            bulletsstruct.append(bulletvalue)
                         
                    elif expbullet.isEnumerated() :
                        bulletvalue = expbullet.getExpandedEnumDataObject().getEnumValue().getValue()
                        print "bulletvalue=" + bulletvalue
                        bulletsstruct.append(bulletvalue)
                    
                    else :
                        bulletvalue = expbullet.getDataObject().getValue()
                        print "bulletvalue=" + bulletvalue
                        bulletsstruct.append(bulletvalue)
                        
                featurestructs[featurelabel] = bulletsstruct
            else :
                # Set to empty list, this is to accomodate bullet-less features
                featurestructs[featurelabel] = []
    
        struct['features'] = featurestructs
    
    return struct