List of usage examples for com.mongodb DBObject get
Object get(String key);
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 2 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. j a va 2 s . c o 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 www .j a v a2 s .c om*/ } 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 ww w. j a va2 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 . ja va 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. ja v a 2 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++;/*w ww . j a v a 2s . c om*/ } } } } 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 w w. j a v a2 s. co m*/ 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"); }//w w w . java2 s . c o m return userid; }
From source file:com.fliker.Modal.GuidancePreview.java
public String getGuidanceType(String guidanceid, String accessuserid) { // TODO Auto-generated method stub String guidancetype = ""; MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContent"); if (resultcursor.hasNext()) { DBObject theObj = resultcursor.next(); if (((String) theObj.get("consumeruserid")).equalsIgnoreCase(accessuserid)) { guidancetype = "consumer"; } else if (((String) theObj.get("provideruserid")).equalsIgnoreCase(accessuserid)) { guidancetype = "provider"; }//from w w w. j a v a2 s .com } return guidancetype; }