| Line 7... |
Line 7... |
| 7 |
import in.shop2020.metamodel.core.ExpertReviewSource;
|
7 |
import in.shop2020.metamodel.core.ExpertReviewSource;
|
| 8 |
import in.shop2020.metamodel.core.Helpdoc;
|
8 |
import in.shop2020.metamodel.core.Helpdoc;
|
| 9 |
import in.shop2020.metamodel.core.SpecialPage;
|
9 |
import in.shop2020.metamodel.core.SpecialPage;
|
| 10 |
import in.shop2020.metamodel.util.ExpandedBullet;
|
10 |
import in.shop2020.metamodel.util.ExpandedBullet;
|
| 11 |
import in.shop2020.storage.mongo.adapters.BDOAdapter;
|
11 |
import in.shop2020.storage.mongo.adapters.BDOAdapter;
|
| - |
|
12 |
import in.shop2020.util.ContentGenerationUtility;
|
| 12 |
|
13 |
|
| 13 |
import java.lang.reflect.Type;
|
14 |
import java.lang.reflect.Type;
|
| 14 |
import java.util.ArrayList;
|
15 |
import java.util.ArrayList;
|
| 15 |
import java.util.Collection;
|
16 |
import java.util.Collection;
|
| 16 |
import java.util.HashMap;
|
17 |
import java.util.HashMap;
|
| Line 19... |
Line 20... |
| 19 |
import java.util.List;
|
20 |
import java.util.List;
|
| 20 |
import java.util.Map;
|
21 |
import java.util.Map;
|
| 21 |
import java.util.Set;
|
22 |
import java.util.Set;
|
| 22 |
import java.util.TreeMap;
|
23 |
import java.util.TreeMap;
|
| 23 |
|
24 |
|
| - |
|
25 |
import org.apache.commons.logging.Log;
|
| - |
|
26 |
import org.apache.commons.logging.LogFactory;
|
| - |
|
27 |
|
| 24 |
import com.google.gson.Gson;
|
28 |
import com.google.gson.Gson;
|
| 25 |
import com.google.gson.GsonBuilder;
|
29 |
import com.google.gson.GsonBuilder;
|
| 26 |
import com.google.gson.reflect.TypeToken;
|
30 |
import com.google.gson.reflect.TypeToken;
|
| 27 |
import com.mongodb.BasicDBObject;
|
31 |
import com.mongodb.BasicDBObject;
|
| 28 |
import com.mongodb.DB;
|
32 |
import com.mongodb.DB;
|
| Line 35... |
Line 39... |
| 35 |
* Entry point for storing everything in berkley database. Singleton class which initialises the berkley database.
|
39 |
* Entry point for storing everything in berkley database. Singleton class which initialises the berkley database.
|
| 36 |
* @author rajveer
|
40 |
* @author rajveer
|
| 37 |
*
|
41 |
*
|
| 38 |
*/
|
42 |
*/
|
| 39 |
public class StorageManager {
|
43 |
public class StorageManager {
|
| - |
|
44 |
private static Log log = LogFactory.getLog(StorageManager.class);
|
| 40 |
private static DB db;
|
45 |
private static DB db;
|
| 41 |
private static ContentViews views;
|
46 |
private static ContentViews views;
|
| 42 |
private static StorageManager storageUtils;
|
47 |
private static StorageManager storageUtils;
|
| 43 |
private static final Gson gs = new GsonBuilder().
|
48 |
private static final Gson gs = new GsonBuilder().
|
| 44 |
registerTypeAdapter(BulletDataObject.class, new BDOAdapter()).
|
49 |
registerTypeAdapter(BulletDataObject.class, new BDOAdapter()).
|
| Line 193... |
Line 198... |
| 193 |
public Map<Long, Entity> getEntities() throws Exception{
|
198 |
public Map<Long, Entity> getEntities() throws Exception{
|
| 194 |
Map<Long,Entity> map = new TreeMap<Long, Entity>();
|
199 |
Map<Long,Entity> map = new TreeMap<Long, Entity>();
|
| 195 |
Iterator<DBObject> iterator = views.entity.find().iterator();
|
200 |
Iterator<DBObject> iterator = views.entity.find().iterator();
|
| 196 |
while(iterator.hasNext()){
|
201 |
while(iterator.hasNext()){
|
| 197 |
DBObject dbo = iterator.next();
|
202 |
DBObject dbo = iterator.next();
|
| 198 |
System.out.println("Entity IDD :" + (Long)dbo.get("_id"));
|
203 |
log.info("Entity IDD :" + (Long)dbo.get("_id"));
|
| 199 |
map.put((Long)dbo.get("_id"), (Entity)toObject(dbo, Entity.class));
|
204 |
map.put((Long)dbo.get("_id"), (Entity)toObject(dbo, Entity.class));
|
| 200 |
}
|
205 |
}
|
| 201 |
return map;
|
206 |
return map;
|
| 202 |
}
|
207 |
}
|
| 203 |
|
208 |
|