List of usage examples for com.mongodb DBCursor next
@Override
public DBObject next()
From source file:com.fliker.Modal.GuidancePreview.java
public ArrayList getNextSetGuidanceResources(String pageno, String subject) { ArrayList guidancelist = new ArrayList<Post>(); MongoConnection mongoconn = new MongoConnection(); DBCollection collection = mongoconn.getDBConnection("GuidanceSelection"); DBCursor cursor; int pagenos = Integer.parseInt(pageno); cursor = collection.find().skip(20 * pagenos).limit(20).sort(new BasicDBObject("guidanceid", -1)); while (cursor.hasNext()) { DBObject dbj = cursor.next(); HashMap totalSet = new HashMap(); if ((dbj.get("guidanceflag").toString()).equalsIgnoreCase(subject)) { totalSet.put("guidanceid", dbj.get("guidanceid")); totalSet.put("guidanceSubject", dbj.get("guidanceSubject")); totalSet.put("guidanceflag", dbj.get("guidanceflag")); totalSet.put("guidencetype", dbj.get("guidencetype")); }/*from w w w . j a v a2s .com*/ guidancelist.add(totalSet); } return guidancelist; }
From source file:com.fliker.Modal.GuidancePreview.java
public HashMap getDashBoardData(String guidanceid) { HashMap dashboarddata = new HashMap(); HashMap assignmentdata = new HashMap(); HashMap actualdata = new HashMap(); HashMap truedata = new HashMap(); HashMap assignmentperprogress = new HashMap(); MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContent"); if (resultcursor.hasNext()) { DBObject theObj = resultcursor.next(); String dashboardid = (String) theObj.get("dashboardid"); MongoConnection mongoconint = new MongoConnection(); DBCursor guidcursor = mongoconint.getDBObject("guidancecontentDashid", guidanceid, "GuidanceContentDash"); if (guidcursor.hasNext()) { DBObject theObjgrid = guidcursor.next(); String[] dashboardids = (String[]) theObjgrid.get("guidancedashdataid"); for (int m = 0; m < dashboardids.length; m++) { MongoConnection mongocondash = new MongoConnection(); DBCursor dashcursor = mongocondash.getDBObject("dashdataid", dashboardids[m], "DashBoardData"); if (dashcursor.hasNext()) { DBObject theObjdash = dashcursor.next(); if (((String) theObjdash.get("dashdatatype")).equalsIgnoreCase("assignment")) { assignmentdata.put((String) theObjdash.get("dashXdata"), (String) theObjdash.get("dashYdata")); } else if (((String) theObjdash.get("dashdatatype")).equalsIgnoreCase("truedata")) { truedata.put((String) theObjdash.get("dashXdata"), (String) theObjdash.get("dashYdata")); } else if (((String) theObjdash.get("dashdatatype")).equalsIgnoreCase("actualdata")) { actualdata.put((String) theObjdash.get("dashXdata"), (String) theObjdash.get("dashYdata")); }/*ww w . ja v a 2 s. c o m*/ } } } if (!assignmentdata.isEmpty()) { dashboarddata.put("assignment", assignmentdata); } if (!truedata.isEmpty()) { dashboarddata.put("truedata", truedata); } if (!actualdata.isEmpty()) { dashboarddata.put("actualdata", actualdata); } } return dashboarddata; }
From source file:com.fliker.Modal.GuidancePreview.java
public Timetable getTimeTableInfo(String guidanceid) { // TODO Auto-generated method stub String timelineids = ""; Timetable timetable = new Timetable(); MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContent"); if (resultcursor.hasNext()) { DBObject theObj = resultcursor.next(); timelineids = (String) theObj.get("timetableid"); MongoConnection mongotimecon = new MongoConnection(); DBCursor timecursor = mongotimecon.getDBObject("timeableid", timelineids, "Timetable"); if (timecursor.hasNext()) { DBObject theObjtime = timecursor.next(); timetable.setTimeableid((String) theObjtime.get("timetableid")); timetable.setEventid((String[]) theObjtime.get("eventid")); }// www .j av a 2 s . com } return timetable; }
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); }/* www . j a v a 2 s . c o m*/ } } 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 w w w. jav a 2s . co 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 a2 s . com*/ } 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 ww .j ava 2s . 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(); }/*from w w w . ja 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"); }//from ww w. java 2 s.c om } } 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 w w w. java2s . c om } return meetingtime; }