List of usage examples for com.mongodb DBCursor hasNext
@Override public boolean hasNext()
From source file:com.fliker.Modal.GuidancePreview.java
public HashMap getGuidanceData(String guidanceid) { // TODO Auto-generated method stub HashMap guidanceinfomap = new HashMap(); MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("guidanceinfoid", guidanceid, "GuidanceInfo"); if (resultcursor.hasNext()) { DBObject theObj = resultcursor.next(); String guidancedescription = (String) theObj.get("guidancedescription"); String guidanceprice = (String) theObj.get("guidanceprice"); String guidancesubjectexperience = (String) theObj.get("guidancesubjectexperience"); BasicDBList guidanceendorebylist = (BasicDBList) theObj.get("guidanceendorseby"); BasicDBList guidanceachevements = (BasicDBList) theObj.get("guidanceachievements"); LinkedList companylist = new LinkedList(); if (guidanceendorebylist.size() > 0) { for (int m = 0; m < guidanceendorebylist.size(); m++) { DBCursor companycursor = mongocon.getDBObject("companyid", (String) guidanceendorebylist.get(m), "Company"); if (companycursor.hasNext()) { DBObject companyObj = companycursor.next(); HashMap companyinfo = new HashMap(); companyinfo.put("companyname", companyObj.get("companyname")); companyinfo.put("companylogo", companyObj.get("companylogoid")); companylist.add(companyinfo); }/*from w ww . ja v a 2 s . c om*/ } } LinkedList achievements = new LinkedList(); if (guidanceachevements.size() > 0) { for (int n = 0; n < guidanceachevements.size(); n++) { achievements.add((String) guidanceachevements.get(n)); } } guidanceinfomap.put("guidancedescription", guidancedescription); guidanceinfomap.put("guidanceprice", guidanceprice); guidanceinfomap.put("guidancesubjectexperience", guidancesubjectexperience); guidanceinfomap.put("guidanceendorebylist", companylist); guidanceinfomap.put("guidanceachevements", achievements); } return guidanceinfomap; }
From source file:com.fliker.Modal.GuidancePreview.java
public GuidanceContentShared getSharedInfo(String guidanceid) { // TODO Auto-generated method stub String shareids = ""; GuidanceContentShared guidshared = new GuidanceContentShared(); MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContent"); if (resultcursor.hasNext()) { DBObject theObj = resultcursor.next(); shareids = (String) theObj.get("sharetokenid"); MongoConnection mongotimecon = new MongoConnection(); DBCursor timecursor = mongotimecon.getDBObject("guidancesharedid", shareids, "GuidanceContentShare"); if (timecursor.hasNext()) { DBObject theObjtime = timecursor.next(); guidshared.setGuidancesharedid((String) theObjtime.get("guidancesharedid")); guidshared.setGuidancefilelistid((String[]) theObjtime.get("guidancefilelistid")); }/*from ww w.j a va2 s .c o m*/ } return guidshared; }
From source file:com.fliker.Modal.GuidancePreview.java
public GuidanceContentDashboard getDashBoardGuidance(String guidanceid) { // TODO Auto-generated method stub String dashboardid = ""; GuidanceContentDashboard guidancedash = new GuidanceContentDashboard(); MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContent"); if (resultcursor.hasNext()) { DBObject theObj = resultcursor.next(); dashboardid = (String) theObj.get("dashboardid"); MongoConnection mongotimecon = new MongoConnection(); DBCursor timecursor = mongotimecon.getDBObject("guidancecontentDashid", dashboardid, "GuidanceContentDash"); if (timecursor.hasNext()) { DBObject theObjtime = timecursor.next(); guidancedash.setGuidancecontentDashid((String) theObjtime.get("guidancecontentDashid")); guidancedash.setGuidancedashdataid((String[]) theObjtime.get("guidancedashdataid")); //guidancedash.setGuidancefilelistid((String[])theObjtime.get("guidancefilelistid")); }//from w w w . ja v a2s . co m } return guidancedash; }
From source file:com.fliker.Modal.GuidancePreview.java
public Blog getGuidanceBlogs(String guidanceid) { // TODO Auto-generated method stub String guidblogid = ""; Blog guidblog = new Blog(); MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContent"); if (resultcursor.hasNext()) { DBObject theObj = resultcursor.next(); guidblogid = (String) theObj.get("blogid"); MongoConnection mongotimecon = new MongoConnection(); DBCursor timecursor = mongotimecon.getDBObject("blogid", guidblogid, "Blog"); if (timecursor.hasNext()) { DBObject theObjtime = timecursor.next(); guidblog.setBlogid((String) theObjtime.get("blogid")); guidblog.setTopicid((String[]) theObjtime.get("topicid")); guidblog.setBlogaccessuserids((String[]) theObjtime.get("blogaccessuserids")); guidblog.setBlogactive((String) theObjtime.get("blogactive")); guidblog.setBlogname((String) theObjtime.get("blogname")); }//from w w w. j av a2 s . c o m } return guidblog; }
From source file:com.fliker.Modal.GuidancePreview.java
public HashMap getTimeTable(String guidanceid, String month) { // TODO Auto-generated method stub String available = "False"; HashMap eventmap = new HashMap(); MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContent"); if (resultcursor.hasNext()) { DBObject theObj = resultcursor.next(); String timetableid = (String) theObj.get("timetableid"); MongoConnection mongotimecon = new MongoConnection(); DBCursor timecursor = mongotimecon.getDBObject("timeableid", timetableid, "Timetable"); if (timecursor.hasNext()) { DBObject theObjtime = timecursor.next(); String[] events = (String[]) theObjtime.get("eventid"); for (int s = 0; s < events.length; s++) { MongoConnection mongoevencon = new MongoConnection(); DBCursor eventcursor = mongoevencon.getDBObjectSorted("eventid", events[s], "Event", "eventstarttime", 200); if (eventcursor.hasNext()) { DBObject theevent = timecursor.next(); HashMap eventHandle = new HashMap(); SimpleDateFormat formatter = new SimpleDateFormat("EEEE, MMM dd, yyyy HH:mm:ss a"); String dateInString = "Friday, Jun 7, 2013 12:10:56 PM"; String dateInStart = (String) theevent.get("eventstarttime"); String dateInEnd = (String) theevent.get("eventendtime"); String dateformstart = ""; String dateformend = ""; try { Date date1 = formatter.parse(dateInStart); Date date2 = formatter.parse(dateInEnd); Calendar cal = Calendar.getInstance(); cal.setTime(date1); int year1 = cal.get(Calendar.YEAR); int months1 = cal.get(Calendar.MONTH); int day1 = cal.get(Calendar.DAY_OF_MONTH); int hour1 = cal.get(Calendar.HOUR_OF_DAY); int minutes1 = cal.get(Calendar.MINUTE); dateformstart = "Year::" + year1 + " ,Month ::" + months1 + " ,Day::" + day1 + " ,Hour::" + hour1 + " ,Minutes::" + minutes1; cal.setTime(date2); int year2 = cal.get(Calendar.YEAR); int months2 = cal.get(Calendar.MONTH); int day2 = cal.get(Calendar.DAY_OF_MONTH); int hour2 = cal.get(Calendar.HOUR_OF_DAY); int minutes2 = cal.get(Calendar.MINUTE); dateformend = "Year::" + year2 + " ,Month ::" + months2 + " ,Day::" + day2 + " ,Hour::" + hour2 + " ,Minutes::" + minutes2; } catch (ParseException e) { e.printStackTrace(); }/*w w w .j a v a 2 s . c o m*/ eventHandle.put("Start Time", dateformstart); eventHandle.put("End Time", dateformend); eventHandle.put("Event Occurance", (String) theevent.get("eventoccurance")); eventHandle.put("Event Title", (String) theevent.get("eventtitle")); eventHandle.put("Event Description", (String) theevent.get("eventDescription")); eventHandle.put("Event Priority", (String) theevent.get("eventpriority")); eventHandle.put("Shared By", (String) theevent.get("evensharedbyuserid")); eventHandle.put("Event Shared To", (String[]) theevent.get("eventsharedtouserids")); eventmap.put((String) theevent.get("eventid"), eventHandle); } } } } return eventmap; }
From source file:com.fliker.Modal.GuidancePreview.java
public String nextMeeting(String guidanceid, String participantid) { // TODO Auto-generated method stub DateFormat dateFormat = new SimpleDateFormat("YYYY-mm-ddTHH:MM:ss"); Date date = new Date(); String currentdate = dateFormat.format(date); System.out.println(dateFormat.format(date)); String meetingtime = ""; MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContent"); if (resultcursor.hasNext()) { DBObject theObj = resultcursor.next(); String timetableid = (String) theObj.get("timetableid"); MongoConnection mongoconint = new MongoConnection(); DBCursor guidcursor = mongoconint.getDBObject("timeableid", timetableid, "Timetable"); if (guidcursor.hasNext()) { DBObject theObjgrid = guidcursor.next(); String[] events = (String[]) theObj.get("eventid"); MongoConnection mongocoevent = new MongoConnection(); DBCursor eventcursor = mongocoevent.getNextMeetingDBObject("eventstarttime", currentdate, "Event"); if (eventcursor.hasNext()) { DBObject eventObj = eventcursor.next(); meetingtime = (String) eventObj.get("eventstarttime"); }//w w w . j a v a 2 s .com } } return meetingtime; }
From source file:com.fliker.Modal.GuidancePreview.java
public String getnextMeeting(String timetableid) { // TODO Auto-generated method stub DateFormat dateFormat = new SimpleDateFormat("YYYY-mm-dd HH:MM:ss"); Date date = new Date(); String currentdate = dateFormat.format(date); System.out.println(dateFormat.format(date)); String meetingtime = ""; MongoConnection mongoconint = new MongoConnection(); DBCursor guidcursor = mongoconint.getDBObject("timeableid", timetableid, "Timetable"); if (guidcursor.hasNext()) { DBObject theObjgrid = guidcursor.next(); String[] events = (String[]) theObjgrid.get("eventid"); MongoConnection mongocoevent = new MongoConnection(); DBCursor eventcursor = mongocoevent.getNextMeetingDBObject("eventstarttime", currentdate, "Event"); if (eventcursor.hasNext()) { DBObject eventObj = eventcursor.next(); meetingtime = (String) eventObj.get("eventstarttime"); }/*from www .j a va2 s. c om*/ } return meetingtime; }
From source file:com.fliker.Modal.GuidancePreview.java
public String getNumberOfBlogsTopics(String blogid, String userid) { String topicnumber = ""; int topiccount = 0; MongoConnection mongoconint = new MongoConnection(); DBCursor blogcursor = mongoconint.getDBObject("blogid", blogid, "Blog"); if (blogcursor.hasNext()) { DBObject eventObj = blogcursor.next(); String[] topics = (String[]) eventObj.get("topicid"); for (int s = 0; s < topics.length; s++) { MongoConnection mongocontop = new MongoConnection(); DBCursor topiccursor = mongoconint.getDBObject("topicid", topics[s], "Topic"); if (topiccursor.hasNext()) { DBObject topicObj = blogcursor.next(); if (((String) topicObj.get("topiccreateduserid")).equalsIgnoreCase(userid)) { topiccount++;//from w ww . j a v a 2 s. c o m } } } } topicnumber = Integer.toString(topiccount); return topicnumber; }
From source file:com.fliker.Modal.GuidancePreview.java
public BasicDBList getGuidanceCosumeruserid(String guidanceid) { // TODO Auto-generated method stub BasicDBList useridlist = new BasicDBList(); MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContent"); if (resultcursor.hasNext()) { DBObject theObj = resultcursor.next(); useridlist = (BasicDBList) theObj.get("consumeruserid"); }//from w ww . j av a2 s. c om return useridlist; }
From source file:com.fliker.Modal.GuidancePreview.java
public String getGuidanceProvideruserid(String guidanceid) { // TODO Auto-generated method stub String userid = ""; MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContent"); if (resultcursor.hasNext()) { DBObject theObj = resultcursor.next(); userid = (String) theObj.get("provideruserid"); }//www .ja v a 2 s. com return userid; }