List of usage examples for com.mongodb DBCursor hasNext
@Override public boolean hasNext()
From source file:com.fliker.Modal.GuidancePreview.java
public ArrayList getGuidanceEntryData(String guidanceid, String userid) { // TODO Auto-generated method stub ArrayList dashdatalist = new ArrayList(); GuidancePreview guidprev = new GuidancePreview(); MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceEntryDashboard"); while (resultcursor.hasNext()) { DBObject dbj = resultcursor.next(); HashMap specificationmap = new HashMap(); BasicDBList guidancedashdata = (BasicDBList) dbj.get("specificationset"); if (guidancedashdata != null) { for (int x = 0; x < guidancedashdata.size(); x++) { DBCursor dashdatacursor = mongocon.getDBObject("guidancespecificationid", (String) guidancedashdata.get(x), "GuidanceEntrySpecification"); while (dashdatacursor.hasNext()) { DBObject dashdatadbj = dashdatacursor.next(); if (guidanceid.equalsIgnoreCase((String) dashdatadbj.get("guidanceid"))) { if (userid.equalsIgnoreCase((String) dashdatadbj.get("userid"))) { BasicDBList specificationlist = (BasicDBList) dashdatadbj.get("specifications"); for (int i = 0; i < specificationlist.size(); i++) { DBCursor specdatacursor = mongocon.getDBObject("specificationid", (String) specificationlist.get(i), "GuidanceSpecificationData"); while (specdatacursor.hasNext()) { DBObject specdatadbj = specdatacursor.next(); specificationmap.put( (String) specdatadbj.get("specificationname") + ":" + (String) specdatadbj.get("specificationdetails"), (BasicDBList) specdatadbj.get("specificationremarks")); }// www . j a v a 2 s . co m } } } } } } BasicDBList helpremarks = (BasicDBList) dbj.get("helpremark"); BasicDBList levelremark = (BasicDBList) dbj.get("levelremark"); specificationmap.put("helpremark", helpremarks); specificationmap.put("levelremark", levelremark); dashdatalist.add(specificationmap); } return dashdatalist; }
From source file:com.fliker.Modal.GuidancePreview.java
public ArrayList getSpecificationData(String guidanceid) { // TODO Auto-generated method stub MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContent"); if (resultcursor.hasNext()) { DBObject dbj = resultcursor.next(); HashMap specificationdata = new HashMap(); BasicDBList specificids = (BasicDBList) dbj.get("specification"); for (int k = 0; k < specificids.size(); k++) { DBCursor specifcursor = mongocon.getDBObject("specificationid", (String) specificids.get(k), "GuidanceSpecificationData"); while (specifcursor.hasNext()) { DBObject specificdbj = specifcursor.next(); }/* ww w. j a v a2 s . c om*/ } } return null; }
From source file:com.fliker.Modal.GuidancePreview.java
public ArrayList getGuidanceAssignmentData(String guidanceid) { // TODO Auto-generated method stub ArrayList guidanceassignlist = new ArrayList(); MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContent"); if (resultcursor.hasNext()) { DBObject dbj = resultcursor.next(); BasicDBList assignmentids = (BasicDBList) dbj.get("assignmentids"); for (int k = 0; k < assignmentids.size(); k++) { HashMap assignmap = new HashMap(); DBCursor assigndatacursor = mongocon.getDBObject("assignmentid", (String) assignmentids.get(k), "GuidanceAssignmentSet"); while (assigndatacursor.hasNext()) { DBObject assigndatadbj = assigndatacursor.next(); assignmap.put("assignmentname", (String) assigndatadbj.get("assignmentname")); }// ww w. j av a 2s .co m DBCursor assigncursor = mongocon.getDBObject("assignmentid", (String) assignmentids.get(k), "GuidanceEntryAssignment"); while (assigncursor.hasNext()) { DBObject assigndbj = assigncursor.next(); assignmap.put("entryassignmentid", (String) assigndbj.get("guidanceentryassignid")); assignmap.put("userid", (String) assigndbj.get("userid")); assignmap.put("feedbackid", (String) assigndbj.get("feedbackid")); assignmap.put("remarkid", (String) assigndbj.get("remarkid")); ArrayList feedbacklist = new ArrayList(); DBCursor feedbackcursor = mongocon.getDBObject("feedbackid", (String) assigndbj.get("feedbackid"), "GuidanceFeedback"); while (feedbackcursor.hasNext()) { DBObject feedbackdbj = feedbackcursor.next(); feedbacklist.add(feedbackdbj.get("feedback")); } assignmap.put("feedback", feedbacklist); ArrayList remarklist = new ArrayList(); DBCursor remarkcursor = mongocon.getDBObject("remarkid", (String) assigndbj.get("remarkid"), "GuidanceRemarks"); while (remarkcursor.hasNext()) { DBObject remarkdbj = remarkcursor.next(); remarklist.add((BasicDBList) remarkdbj.get("remarks")); } assignmap.put("remarks", remarklist); } guidanceassignlist.add(assignmap); } } return guidanceassignlist; }
From source file:com.fliker.Modal.GuidancePreview.java
public HashMap getGuidanceQuizData(String guidanceid) { // TODO Auto-generated method stub ArrayList guidancequizlist = new ArrayList(); MongoConnection mongocon = new MongoConnection(); HashMap quizlistmap = new HashMap(); DBCursor resultcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContent"); if (resultcursor.hasNext()) { DBObject dbj = resultcursor.next(); BasicDBList quizlist = (BasicDBList) dbj.get("quizids"); for (int k = 0; k < quizlist.size(); k++) { HashMap quizmap = new HashMap(); DBCursor quizlinkcursor = mongocon.getDBObject("quizid", (String) quizlist.get(k), "GuidanceQuizLink"); while (quizlinkcursor.hasNext()) { DBObject quizdbj = quizlinkcursor.next(); quizmap.put("quizid", quizdbj.get("quizid")); DBCursor quizdatcursor = mongocon.getDBObject("quizid", (String) quizdbj.get("quizid"), "GuidanceContentQuiz"); if (quizdatcursor.hasNext()) { DBObject quizdatdbj = quizdatcursor.next(); quizmap.put("quizname", quizdbj.get("quizname")); quizmap.put("quizdescription", quizdbj.get("quizdescription")); quizmap.put("quizdatetime", quizdbj.get("quizdatetime")); }/*from w w w . ja v a2 s . c o m*/ quizmap.put("shareduserids", (BasicDBList) quizdbj.get("shareduserids")); /*ArrayList feedbacklist = new ArrayList(); BasicDBList feedbcklist = (BasicDBList)quizdbj.get("guidancefeedbackid"); for(int x=0;x<feedbcklist.size();x++){ DBCursor feedbackcursor = mongocon.getDBObject("feedbackid", (String)feedbcklist.get(x), "GuidanceFeedback"); while(feedbackcursor.hasNext()){ DBObject feedbackdbj = feedbackcursor.next(); feedbacklist.add(feedbackdbj.get("feedback")); } } quizmap.put("feedback", feedbacklist); ArrayList remarklist = new ArrayList(); BasicDBList remrklst = (BasicDBList)quizdbj.get("guidanceremarkid"); for(int h=0;h<remrklst.size();h++){ DBCursor remarkcursor = mongocon.getDBObject("remarkid", (String)remrklst.get(h), "GuidanceRemarks"); while(remarkcursor.hasNext()){ DBObject remarkdbj = remarkcursor.next(); remarklist.add((BasicDBList)remarkdbj.get("remarks")); } } quizmap.put("remarks", remarklist);*/ } quizlistmap.put((String) quizlist.get(k), quizmap); } } return quizlistmap; }
From source file:com.fliker.Modal.GuidancePreview.java
public ArrayList getTempSaveAssignments(String guidanceid, String accessuserid) { // TODO Auto-generated method stub MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceTempContentAssignment"); ArrayList tempsaveassignlist = new ArrayList(); while (resultcursor.hasNext()) { DBObject dbj = resultcursor.next(); HashMap tempassignmap = new HashMap(); if (((String) dbj.get("userid")).equalsIgnoreCase(accessuserid)) { tempassignmap.put("tempassignmentid", (String) dbj.get("tempcontentassignmentid")); tempassignmap.put("assignquestionset", (BasicDBList) dbj.get("assingmentquestionset")); tempassignmap.put("savedatetime", (String) dbj.get("savedatetime")); tempassignmap.put("createdatetime", (String) dbj.get("creationdate")); tempsaveassignlist.add(tempassignmap); }/* w w w . j a va 2 s .co m*/ } return tempsaveassignlist; }
From source file:com.fliker.Modal.GuidancePreview.java
public ArrayList getTempSaveQuiz(String guidanceid, String accessuserid) { // TODO Auto-generated method stub MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContentTempQuiz"); ArrayList tempsavequizlist = new ArrayList(); while (resultcursor.hasNext()) { DBObject dbj = resultcursor.next(); if (((String) dbj.get("userid")).equalsIgnoreCase(accessuserid)) { HashMap tempquizmap = new HashMap(); tempquizmap.put("quizname", (String) dbj.get("quizname")); tempquizmap.put("quizdescription", (String) dbj.get("quizdescription")); tempquizmap.put("tempquizid", (String) dbj.get("tempquizid")); tempquizmap.put("quizid", (String) dbj.get("quizid"));//savedatetime tempquizmap.put("savetime", (String) dbj.get("savedatetime")); //tempquizmap.put("questionset", (BasicDBList)dbj.get("questionset")); tempsavequizlist.add(tempquizmap); }/* www . j a v a 2s. co m*/ } return tempsavequizlist; }
From source file:com.fliker.Modal.GuidancePreview.java
public String createTempQuizContent(String quizname, String quizdesc, String quiztoken, String guidanceid, String userid) {/* ww w .j a va 2 s .com*/ // TODO Auto-generated method stub MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("tempquizid", quiztoken, "GuidanceContentTempQuiz"); ArrayList tempsavequizlist = new ArrayList(); if (resultcursor.hasNext()) { DBObject dbj = resultcursor.next(); String quizid = (String) dbj.get("quizid"); return quizid; } else { GuidanceContentTempQuiz guidconttempquiz = new GuidanceContentTempQuiz(); guidconttempquiz.setGuidanceid(guidanceid); guidconttempquiz.setQuizdescription(quizdesc); guidconttempquiz.setQuizname(quizname); guidconttempquiz.setTempquizid(quiztoken); guidconttempquiz.setUserid(userid); SimpleDateFormat formatter = new SimpleDateFormat("EEEE, MMM dd, yyyy HH:mm:ss a"); //String dateInString = "Friday, Jun 7, 2013 12:10:56 PM";//example Date datepack = new Date(); DateFunctionality datefunc = new DateFunctionality(); String savedatetime = formatter.format(datepack); guidconttempquiz.setSavedatetime(savedatetime); String[] questionset = new String[0]; guidconttempquiz.setQuestionset(questionset); GuidancePreview guidprev = new GuidancePreview(); String uniqueid = ""; try { uniqueid = guidprev.makeSHA1Hash(quizname + quizdesc); } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } guidconttempquiz.setQuizid(uniqueid); MongoConnection mongoconsearch = new MongoConnection(); BasicDBObject basicguishareobj = guidprev.formGuidTempContQuizDBObject(guidconttempquiz); mongoconsearch.saveObject(basicguishareobj, "GuidanceContentTempQuiz"); return uniqueid; } }
From source file:com.fliker.Modal.GuidancePreview.java
public ArrayList getAllSpecifications(String guidanceid, String userid) { // TODO Auto-generated method stub MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContent"); ArrayList specificlist = new ArrayList(); if (resultcursor.hasNext()) { DBObject dbj = resultcursor.next(); BasicDBList specificationlist = (BasicDBList) dbj.get("specification"); for (int j = 0; j < specificationlist.size(); j++) { HashMap specificatiomap = new HashMap(); DBCursor specificcursor = mongocon.getDBObject("specificationid", (String) specificationlist.get(j), "GuidanceSpecificationData"); while (specificcursor.hasNext()) { DBObject specificdbj = specificcursor.next(); specificatiomap.put("specificationid", (String) specificdbj.get("specificationid")); specificatiomap.put("specificationname", (String) specificdbj.get("specificationname")); specificatiomap.put("specificationdetails", (String) specificdbj.get("specificationdetails")); specificatiomap.put("specificationpercentage", "5"); }/*from w w w . j av a 2s . c om*/ specificlist.add(specificatiomap); } } return specificlist; }
From source file:com.fliker.Modal.OSMPreview.java
public ArrayList getProjectInfoList() { ArrayList projectlist = new ArrayList(); MongoConnection mongoconn = new MongoConnection(); DBCollection collection = mongoconn.getDBConnection("OSMOwner"); DBCursor cursor; cursor = collection.find().sort(new BasicDBObject("osmmodelid", -1)); while (cursor.hasNext()) { DBObject currentItem = cursor.next(); String osmmodelid = (String) currentItem.get("osmmodelid"); MongoConnection mongoconinner = new MongoConnection(); DBCursor resultcursor = mongoconinner.getDBObject("osmmodelid", osmmodelid, "OSMProjectInfo"); if (resultcursor.hasNext()) { DBObject theObjosm = resultcursor.next(); OSMProjectInfo osmprojinf = new OSMProjectInfo(); osmprojinf.setOsmmodelid((String) theObjosm.get("osmmodelid")); osmprojinf.setProjectbuyers((String[]) theObjosm.get("projectbuyers")); osmprojinf.setProjectdemandchart((String) theObjosm.get("projectdemandchart")); osmprojinf.setProjectdescription((String) theObjosm.get("projectdescription")); osmprojinf.setProjectdocs((String[]) theObjosm.get("projectdocs")); osmprojinf.setProjectinfoid((String) theObjosm.get("projectinfoid")); osmprojinf.setProjectinvestors((String[]) theObjosm.get("projectinvestors")); osmprojinf.setProjectmarkettingdoc((String) theObjosm.get("projectmarkettingdoc")); osmprojinf.setProjectname((String) theObjosm.get("projectname")); osmprojinf.setProjectresources((String[]) theObjosm.get("projectresources")); osmprojinf.setProjectstockprice((String) theObjosm.get("projectstockprice")); osmprojinf.setProjectrequestors((String[]) theObjosm.get("projectrequestors")); projectlist.add(osmprojinf); }//from w ww . j a v a2 s. co m } return projectlist; }
From source file:com.fliker.Modal.OSMPreview.java
public ArrayList getAllCompanyList() { // TODO Auto-generated method stub ArrayList companylist = new ArrayList(); MongoConnection mongoconn = new MongoConnection(); DBCollection collection = mongoconn.getDBConnection("OSMOwner"); DBCursor cursor; cursor = collection.find().sort(new BasicDBObject("osmmodelid", -1)); while (cursor.hasNext()) { DBObject currentItem = cursor.next(); Company comapny = new Company(); comapny.setCompanyid((String) currentItem.get("companyid")); comapny.setAboutUs((String) currentItem.get("AboutUs")); comapny.setAboutvideoid((String) currentItem.get("aboutvideoid")); comapny.setCompanyImageid((String) currentItem.get("companyImageid")); comapny.setCompanyIndustry((String) currentItem.get("companyIndustry")); comapny.setCompanylogoid((String) currentItem.get("companylogoid")); comapny.setCompanyname((String) currentItem.get("companyname")); comapny.setCompanyWebsite((String) currentItem.get("companyWebsite")); companylist.add(comapny);/*from w ww.j av a 2 s. c o m*/ } return companylist; }