Subversion Repositories SmartDukaan

Rev

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

Rev 22125 Rev 22155
Line 122... Line 122...
122
		DBCollection collection = db.getCollection(FOFO_FORM_COLLECTION);
122
		DBCollection collection = db.getCollection(FOFO_FORM_COLLECTION);
123
		DBObject fofoDbOject = collection.findOne(filter);
123
		DBObject fofoDbOject = collection.findOne(filter);
124
		return fofoDbOject.toString();
124
		return fofoDbOject.toString();
125
	}
125
	}
126
	
126
	
-
 
127
	public static String getFofoFormJsonStringByEmail(String email){
-
 
128
		DB db = mongo_dtr.getDB(FOFO_DB);
-
 
129
		BasicDBObject filter = new BasicDBObject();
-
 
130
		filter.append("registeredEmail1", email);
-
 
131
		DBCollection collection = db.getCollection(FOFO_FORM_COLLECTION);
-
 
132
		DBObject fofoDbOject = collection.findOne(filter);
-
 
133
		return fofoDbOject.toString();
-
 
134
	}
-
 
135
	
127
	public static String getFofoFormsJsonString(){
136
	public static String getFofoFormsJsonString(){
128
		DB db = mongo_dtr.getDB(FOFO_DB);
137
		DB db = mongo_dtr.getDB(FOFO_DB);
129
		DBCollection collection = db.getCollection(FOFO_FORM_COLLECTION);
138
		DBCollection collection = db.getCollection(FOFO_FORM_COLLECTION);
130
		DBCursor cursor = collection.find();
139
		DBCursor cursor = collection.find();
131
		StringBuilder fofoFormsJsonString = new StringBuilder();
140
		StringBuilder fofoFormsJsonString = new StringBuilder();
Line 145... Line 154...
145
		System.out.println(fofoFormJsonString);
154
		System.out.println(fofoFormJsonString);
146
		return new Gson().fromJson(fofoFormJsonString, FofoForm.class);
155
		return new Gson().fromJson(fofoFormJsonString, FofoForm.class);
147
		//return convertJSONToPojo(fofoDbOject.toString());
156
		//return convertJSONToPojo(fofoDbOject.toString());
148
	}
157
	}
149
	
158
	
-
 
159
	public static FofoForm getFofoForm(String email) {
-
 
160
		String fofoFormJsonString = getFofoFormJsonStringByEmail(email);
-
 
161
		System.out.println(fofoFormJsonString);
-
 
162
		return new Gson().fromJson(fofoFormJsonString, FofoForm.class);
-
 
163
		//return convertJSONToPojo(fofoDbOject.toString());
-
 
164
	}
-
 
165
	
150
	private static FofoForm convertJSONToPojo(String json){
166
	private static FofoForm convertJSONToPojo(String json){
151
 
167
 
152
	    Type type = new TypeToken< FofoForm >(){}.getType();
168
	    Type type = new TypeToken< FofoForm >(){}.getType();
153
 
169
 
154
	    return new Gson().fromJson(json, type);
170
	    return new Gson().fromJson(json, type);