Subversion Repositories SmartDukaan

Rev

Rev 1153 | Rev 2768 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1153 Rev 2275
Line 1... Line 1...
1
package in.shop2020.storage.bdb;
1
package in.shop2020.storage.bdb;
2
 
2
 
3
import in.shop2020.metamodel.core.Entity;
3
import in.shop2020.metamodel.core.Entity;
4
import in.shop2020.metamodel.core.EntityState;
4
import in.shop2020.metamodel.core.EntityState;
-
 
5
import in.shop2020.metamodel.core.Helpdoc;
5
 
6
 
6
import com.sleepycat.bind.EntryBinding;
7
import com.sleepycat.bind.EntryBinding;
7
import com.sleepycat.bind.serial.ClassCatalog;
8
import com.sleepycat.bind.serial.ClassCatalog;
8
import com.sleepycat.bind.serial.SerialBinding;
9
import com.sleepycat.bind.serial.SerialBinding;
9
import com.sleepycat.collections.StoredEntrySet;
10
import com.sleepycat.collections.StoredEntrySet;
Line 11... Line 12...
11
 
12
 
12
public class ContentViews {
13
public class ContentViews {
13
 
14
 
14
    private StoredMap entityMap;
15
    private StoredMap entityMap;
15
    private StoredMap entityMetadataMap;
16
    private StoredMap entityMetadataMap;
-
 
17
    private StoredMap helpdocMap;
16
    private StoredMap dataObjectMap;
18
    private StoredMap dataObjectMap;
17
    private StoredMap definitionMap;
19
    private StoredMap definitionMap;
18
 
20
 
19
    private StoredMap entityByCategoryMap;
21
    private StoredMap entityByCategoryMap;
20
    
22
    
Line 32... Line 34...
32
        EntryBinding entityDataBinding =  new SerialBinding(catalog, Entity.class);
34
        EntryBinding entityDataBinding =  new SerialBinding(catalog, Entity.class);
33
        
35
        
34
        EntryBinding entityMetadataKeyBinding = new SerialBinding(catalog, Long.class);
36
        EntryBinding entityMetadataKeyBinding = new SerialBinding(catalog, Long.class);
35
        EntryBinding entityMetadataDataBinding =  new SerialBinding(catalog, EntityState.class);
37
        EntryBinding entityMetadataDataBinding =  new SerialBinding(catalog, EntityState.class);
36
 
38
 
-
 
39
        EntryBinding helpdocKeyBinding = new SerialBinding(catalog, Long.class);
-
 
40
        EntryBinding helpdocDataBinding =  new SerialBinding(catalog, Helpdoc.class);
-
 
41
 
37
        EntryBinding commonKeyBinding =   new SerialBinding(catalog, String.class);
42
        EntryBinding commonKeyBinding =   new SerialBinding(catalog, String.class);
38
        EntryBinding commonDataBinding =   new SerialBinding(catalog, Object.class);
43
        EntryBinding commonDataBinding =   new SerialBinding(catalog, Object.class);
39
        
44
        
40
        EntryBinding definitionKeyBinding =   new SerialBinding(catalog, String.class);
45
        EntryBinding definitionKeyBinding =   new SerialBinding(catalog, String.class);
41
        EntryBinding definitionDataBinding =   new SerialBinding(catalog, Object.class);
46
        EntryBinding definitionDataBinding =   new SerialBinding(catalog, Object.class);
Line 50... Line 55...
50
        //
55
        //
51
        entityMap = new StoredMap(db.getEntityDatabase(),entityKeyBinding, entityDataBinding, true);
56
        entityMap = new StoredMap(db.getEntityDatabase(),entityKeyBinding, entityDataBinding, true);
52
        
57
        
53
        entityMetadataMap = new StoredMap(db.getEntityMetadataDatabase(),entityMetadataKeyBinding, entityMetadataDataBinding, true);
58
        entityMetadataMap = new StoredMap(db.getEntityMetadataDatabase(),entityMetadataKeyBinding, entityMetadataDataBinding, true);
54
        
59
        
-
 
60
        helpdocMap = new StoredMap(db.getHelpdocDatabase(), helpdocKeyBinding, helpdocDataBinding, true);
-
 
61
        
55
        dataObjectMap = new StoredMap(db.getDataObjectDatabase(), commonKeyBinding, commonDataBinding, true);
62
        dataObjectMap = new StoredMap(db.getDataObjectDatabase(), commonKeyBinding, commonDataBinding, true);
56
        
63
        
57
        definitionMap = new StoredMap(db.getDefinitionDatabase(), definitionKeyBinding, definitionDataBinding, true);
64
        definitionMap = new StoredMap(db.getDefinitionDatabase(), definitionKeyBinding, definitionDataBinding, true);
58
        
65
        
59
        entityByCategoryMap = new StoredMap(db.getCategoryByCategoryDatabase(), entityByCategoryKeyBinding, entityDataBinding, true);
66
        entityByCategoryMap = new StoredMap(db.getCategoryByCategoryDatabase(), entityByCategoryKeyBinding, entityDataBinding, true);
Line 91... Line 98...
91
 
98
 
92
        return entityMetadataMap;
99
        return entityMetadataMap;
93
    }
100
    }
94
 
101
 
95
    /**
102
    /**
-
 
103
     * Return a map view of the helpdoc storage container.
-
 
104
     */
-
 
105
    public final StoredMap getHelpdocMap() {
-
 
106
 
-
 
107
        return helpdocMap;
-
 
108
    }
-
 
109
    
-
 
110
    /**
96
     * Return a map view of the definition storage container.
111
     * Return a map view of the definition storage container.
97
     */
112
     */
98
    public final StoredMap getDefinitionMap() {
113
    public final StoredMap getDefinitionMap() {
99
 
114
 
100
        return definitionMap;
115
        return definitionMap;
Line 123... Line 138...
123
 
138
 
124
        return (StoredEntrySet) entityMetadataMap.entrySet();
139
        return (StoredEntrySet) entityMetadataMap.entrySet();
125
    }
140
    }
126
 
141
 
127
    /**
142
    /**
-
 
143
     * Return an entry set view of the helpdoc storage container.
-
 
144
     */
-
 
145
    public final StoredEntrySet getHelpdocEntrySet() {
-
 
146
 
-
 
147
        return (StoredEntrySet) helpdocMap.entrySet();
-
 
148
    }
-
 
149
 
-
 
150
    
-
 
151
    /**
128
     * Return an entry set view of the definitions storage container.
152
     * Return an entry set view of the definitions storage container.
129
     */
153
     */
130
    public final StoredEntrySet getDefinitionEntrySet() {
154
    public final StoredEntrySet getDefinitionEntrySet() {
131
    	
155
    	
132
        return (StoredEntrySet) definitionMap.entrySet();
156
        return (StoredEntrySet) definitionMap.entrySet();