Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
73 naveen 1
def contentModel2Struct(expslide) :
2
    struct = {}
69 naveen 3
 
73 naveen 4
    # Set children slide structures
5
    if expslide.hasChildrenSlides() :
6
        expchildrenslides = expslide.getExpandedChildrenSlides()
7
        childrenstructs = {}
8
        for expchildslide in expchildrenslides :
9
            childstruct = contentModel2Struct(expchildslide) 
10
 
11
            # REVISIT - ID in place to label
12
            slidelabel = expchildslide.getSlideDefinition().getLabel() 
13
            print "slidelabel=" + slidelabel
14
            childrenstructs[slidelabel] = childstruct
15
 
16
        struct['childrenslides'] = childrenstructs
17
 
18
    # Set feature structures
19
    if expslide.hasFeatures() :
20
        expfeatures = expslide.getExpandedFeatures()
21
        featurestructs = {}
22
        for expfeature in expfeatures :
23
 
24
            # REVISIT - ID in place to label
25
            featurelabel = expfeature.getFeatureDefinition().getLabel()
26
            print "featurelabel=" + featurelabel 
27
            if expfeature.hasBullets() :
28
                bulletsstruct = []
29
                expbullets = expfeature.getExpandedBullets()
30
                for expbullet in expbullets :
31
                    if expbullet.isComposite() :
32
                        primitivedataobjects = expbullet.getDataObject().getPrimitiveDataObjects()
33
                        for primitivedataobject in primitivedataobjects :
34
                            bulletvalue = primitivedataobject.getValue()
35
                            print "bulletvalue=" + bulletvalue
36
                            bulletsstruct.append(bulletvalue)
37
 
38
                    elif expbullet.isEnumerated() :
39
                        bulletvalue = expbullet.getExpandedEnumDataObject().getEnumValue().getValue()
40
                        print "bulletvalue=" + bulletvalue
41
                        bulletsstruct.append(bulletvalue)
42
 
43
                    else :
44
                        bulletvalue = expbullet.getDataObject().getValue()
45
                        print "bulletvalue=" + bulletvalue
46
                        bulletsstruct.append(bulletvalue)
47
 
48
                featurestructs[featurelabel] = bulletsstruct
49
            else :
50
                # Set to empty list, this is to accomodate bullet-less features
51
                featurestructs[featurelabel] = []
52
 
53
        struct['features'] = featurestructs
54
 
55
    return struct
56
 
57