List of usage examples for com.mongodb DBCursor next
@Override
public DBObject next()
From source file:com.fliker.Modal.GuidancePreview.java
public void saveGuidanceAchievementInfo(String achievementdesc, String achievementname, String token, String userid, String guidanceid) { // TODO Auto-generated method stub String fileid = ""; MongoConnection mongocon = new MongoConnection(); DBCursor resultcursor = mongocon.getDBObject("tempid", token, "FileUnionTimeFrame"); while (resultcursor.hasNext()) { DBObject dbj = resultcursor.next(); String userids = (String) dbj.get("userid"); if (userids.equalsIgnoreCase(userid)) { fileid = (String) dbj.get("fileid"); }// w ww. j a v a 2 s . co m } JSONObject jsonobj = new JSONObject(); jsonobj.put("achievement", achievementname); jsonobj.put("achievementdescription", achievementdesc); jsonobj.put("achievementtoken", token); jsonobj.put("achievementfile", fileid); String jsonstr = jsonobj.toJSONString(); System.out.println("jsonstr >>" + jsonstr); mongocon.updateObject(new BasicDBObject("guidanceinfoid", guidanceid), new BasicDBObject("$push", new BasicDBObject("guidanceachievements", jsonstr)), "GuidanceInfo"); }
From source file:com.fliker.Modal.GuidancePreview.java
public void saveFileToStudentsShare(String userids, String fileid, String guidanceid) { // TODO Auto-generated method stub GuidancePreview guidprev = new GuidancePreview(); if (userids.equalsIgnoreCase("All")) { MongoConnection mongocon = new MongoConnection(); DBCursor profilecursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContent"); while (profilecursor.hasNext()) { DBObject basicdbj = profilecursor.next(); BasicDBList userlist = (BasicDBList) basicdbj.get("consumeruserid"); for (int k = 0; k < userlist.size(); k++) { DBCursor profileusercursor = mongocon.getDBObject("userid", (String) userlist.get(k), "Profile"); while (profileusercursor.hasNext()) { DBObject basicprofdbj = profileusercursor.next(); BasicDBList guidancelist = (BasicDBList) basicprofdbj.get("guidanceids"); for (int g = 0; g < guidancelist.size(); g++) { DBCursor resultcursor = mongocon.getDBObject("guidanceid", (String) guidancelist.get(g), "GuidanceEntry"); while (resultcursor.hasNext()) { DBObject dbj = resultcursor.next(); String consumeguidanceid = (String) dbj.get("consumeguidanceid"); if (consumeguidanceid.equalsIgnoreCase(guidanceid)) { String sharetokenid = (String) dbj.get("sharetokenid"); mongocon.updateObject(new BasicDBObject("guidanceshareid", sharetokenid), new BasicDBObject("$push", new BasicDBObject("guidancefileids", fileid)), "GuidanceEntryShare"); }//w ww.j a v a 2s. c o m } } } } } } else { String[] useridrow = userids.split(","); for (int i = 0; i < useridrow.length; i++) { MongoConnection mongocon = new MongoConnection(); DBCursor profilecursor = mongocon.getDBObject("userid", useridrow[i], "Profile"); while (profilecursor.hasNext()) { DBObject basicdbj = profilecursor.next(); BasicDBList guidancelist = (BasicDBList) basicdbj.get("guidanceids"); for (int g = 0; g < guidancelist.size(); g++) { DBCursor resultcursor = mongocon.getDBObject("guidanceid", (String) guidancelist.get(g), "GuidanceEntry"); while (resultcursor.hasNext()) { DBObject dbj = resultcursor.next(); String consumeguidanceid = (String) dbj.get("consumeguidanceid"); if (consumeguidanceid.equalsIgnoreCase(guidanceid)) { String sharetokenid = (String) dbj.get("sharetokenid"); mongocon.updateObject(new BasicDBObject("guidanceshareid", sharetokenid), new BasicDBObject("$push", new BasicDBObject("guidancefileids", fileid)), "GuidanceEntryShare"); } } } } } } GuidanceFileShare guidfileshare = new GuidanceFileShare(); if (userids.equalsIgnoreCase("All")) { String[] AllUser = { "All" }; guidfileshare.setConsumerids(AllUser); } else { String[] useridnew = userids.split(","); guidfileshare.setConsumerids(useridnew); } guidfileshare.setGuidancefileid(fileid); guidfileshare.setGuidanceid(guidanceid); MongoConnection mongocon = new MongoConnection(); BasicDBObject basicreqobjsearch = guidprev.formGuidShareDBObject(guidfileshare); mongocon.saveObject(basicreqobjsearch, "GuidanceDashFileShare"); }
From source file:com.fliker.Modal.GuidancePreview.java
public String getFileInfoId(String tokenui, String userid) { // TODO Auto-generated method stub String fileid = ""; MongoConnection mongocon = new MongoConnection(); DBCursor filecursor = mongocon.getDBObject("tempid", tokenui, "FileUnionTimeFrame"); while (filecursor.hasNext()) { DBObject basicdbj = filecursor.next(); String user = (String) basicdbj.get("userid"); if (user.equalsIgnoreCase(fileid)) { String context = (String) basicdbj.get("context"); if (context.contains("GuidanceID ::" + tokenui)) { fileid = (String) basicdbj.get("fileid"); }// www.j a v a2 s. com } } return fileid; }
From source file:com.fliker.Modal.GuidancePreview.java
public ArrayList getAllGuidanceFiles(String guidanceid) { // TODO Auto-generated method stub ArrayList existingfiles = new ArrayList(); MongoConnection mongocon = new MongoConnection(); DBCursor filecursor = mongocon.getDBObject("guidancesharedid", guidanceid, "GuidanceContentShare"); while (filecursor.hasNext()) { DBObject basicdbj = filecursor.next(); BasicDBList filelist = (BasicDBList) basicdbj.get("guidancefilelistid"); for (int t = 0; t < filelist.size(); t++) { String filename = ""; String filesize = ""; DBCursor filenamecursor = mongocon.getDBObject("fileid", (String) filelist.get(t), "fileupload"); if (filenamecursor.hasNext()) { DBObject filedbj = filenamecursor.next(); existingfiles.add((String) filelist.get(t) + ":" + (String) filedbj.get("name") + ":" + (String) filedbj.get("size") + ":" + (String) filedbj.get("type")); }//from w ww .j a v a 2 s . co m } } return existingfiles; }
From source file:com.fliker.Modal.GuidancePreview.java
public ArrayList fileExisting(String guidanceid) { // TODO Auto-generated method stub ArrayList filelst = new ArrayList(); FileUpload fileupload = new FileUpload(); MongoConnection mongocon = new MongoConnection(); DBCursor filecursor = mongocon.getDBObject("guidancesharedid", guidanceid, "GuidanceContentShare"); while (filecursor.hasNext()) { DBObject basicdbj = filecursor.next(); BasicDBList filelist = (BasicDBList) basicdbj.get("guidancefilelistid"); for (int t = 0; t < filelist.size(); t++) { DBCursor fileitemcursor = mongocon.getDBObject("id", (String) filelist.get(t), "fileupload"); while (fileitemcursor.hasNext()) { DBObject filedbj = fileitemcursor.next(); fileupload.setFileid((String) filedbj.get("id")); fileupload.setName((String) filedbj.get("name")); fileupload.setType((String) filedbj.get("type")); fileupload.setSize((Long) filedbj.get("size")); filelst.add(fileupload); }//w w w. j ava 2s .c o m } } return filelst; }
From source file:com.fliker.Modal.GuidancePreview.java
public ArrayList getUnSharedConsumers(String fileid, String guidanceid) { // TODO Auto-generated method stub ArrayList consumerlist = new ArrayList(); ArrayList totaluserlst = new ArrayList(); ArrayList shareduserlst = new ArrayList(); MongoConnection mongocon = new MongoConnection(); DBCursor filecursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContent"); while (filecursor.hasNext()) { DBObject basicdbj = filecursor.next(); BasicDBList consumerlst = (BasicDBList) basicdbj.get("consumeruserid"); for (int m = 0; m < consumerlst.size(); m++) { totaluserlst.add((String) consumerlst.get(m)); }//from w w w . j av a 2 s . co m } DBCursor usercursor = mongocon.getDBObject("guidancefileid", fileid, "GuidanceDashFileShare"); while (usercursor.hasNext()) { DBObject userdbj = usercursor.next(); BasicDBList sharedconsumerlst = (BasicDBList) userdbj.get("consumerids"); for (int n = 0; n < sharedconsumerlst.size(); n++) { shareduserlst.add((String) sharedconsumerlst.get(n)); } } for (int t = 0; t < totaluserlst.size(); t++) { boolean isnotexist = false; String consumer = (String) totaluserlst.get(t); for (int i = 0; i < shareduserlst.size(); i++) { String sharedconsumer = (String) shareduserlst.get(i); if (consumer.equalsIgnoreCase(sharedconsumer)) { isnotexist = true; } } shareduserlst.add(consumer); } return shareduserlst; }
From source file:com.fliker.Modal.GuidancePreview.java
public ArrayList getAllEvent(String guidanceid) { // TODO Auto-generated method stub ArrayList alleventlist = new ArrayList(); MongoConnection mongocon = new MongoConnection(); DBCursor filecursor = mongocon.getDBObject("guidancecalendarid", guidanceid, "GuidanceContentCalendar"); while (filecursor.hasNext()) { DBObject basicdbj = filecursor.next(); BasicDBList eventobj = (BasicDBList) basicdbj.get("guidancecalendareventid"); for (int i = 0; i < eventobj.size(); i++) { DBCursor eventcursor = mongocon.getDBObject("eventid", (String) eventobj.get(i), "Event"); while (eventcursor.hasNext()) { DBObject eventdbj = eventcursor.next(); Events events = new Events(); events.setEvensharedbyuserid((String) eventdbj.get("evensharedbyuserid")); events.setEventDescription((String) eventdbj.get("eventDescription")); events.setEventendtime((String) eventdbj.get("eventendtime")); events.setEvententryid((String) eventdbj.get("evententryid")); events.setEventid((String) eventdbj.get("eventid")); events.setEventMonth((String) eventdbj.get("eventMonth")); events.setEventoccurance((String) eventdbj.get("eventoccurance")); events.setEventpriority((String) eventdbj.get("eventpriority")); BasicDBList eventsharedtouserids = (BasicDBList) eventdbj.get("eventsharedtouserids"); ArrayList eventlist = new ArrayList(); for (int m = 0; m < eventsharedtouserids.size(); m++) { eventlist.add((String) eventsharedtouserids.get(m)); }//from ww w. j a v a 2s. co m events.setEventsharedtouserids((String[]) eventlist.toArray(new String[eventlist.size()])); events.setEventstarttime((String) eventdbj.get("eventstarttime")); events.setEventtitle((String) eventdbj.get("eventtitle")); events.setEventWeekDay((String) eventdbj.get("eventWeekDay")); events.setEventYear((String) eventdbj.get("eventYear")); alleventlist.add(events); } } } return alleventlist; }
From source file:com.fliker.Modal.GuidancePreview.java
public HashMap getAvailableTime(String guidanceid, String entrydatetime, String entryendtime) { // TODO Auto-generated method stub HashMap profileavailable = new HashMap(); MongoConnection mongocon = new MongoConnection(); DBCursor guidecursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContent"); while (guidecursor.hasNext()) { DBObject guidedbj = guidecursor.next(); BasicDBList consumerlist = (BasicDBList) guidedbj.get("consumeruserid"); for (int m = 0; m < consumerlist.size(); m++) { ProfilePreview profprev = new ProfilePreview(); String eventAvail = profprev.getProfileEventList((String) consumerlist.get(m), entrydatetime, entryendtime);/*from ww w. j ava 2 s .com*/ if (eventAvail.equalsIgnoreCase("true")) { Profile profileinfo = profprev.getProfileData((String) consumerlist.get(m)); profileavailable.put("true", profileinfo); } else { Profile profileinfo = profprev.getProfileData((String) consumerlist.get(m)); profileavailable.put("false", profileinfo); } } } return profileavailable; }
From source file:com.fliker.Modal.GuidancePreview.java
public HashMap getGuidanceInfo(String guidanceid) { // TODO Auto-generated method stub HashMap guidaninfomap = new HashMap(); MongoConnection mongocon = new MongoConnection(); DBCursor guidecursor = mongocon.getDBObject("guidanceinfoid", guidanceid, "GuidanceInfo"); while (guidecursor.hasNext()) { DBObject guidedbj = guidecursor.next(); guidaninfomap.put("Description", (String) guidedbj.get("guidancedescription")); guidaninfomap.put("Price", (String) guidedbj.get("guidanceprice")); guidaninfomap.put("Experience", (String) guidedbj.get("guidancesubjectexperience")); ArrayList endorsementlist = new ArrayList(); BasicDBList endorsebylist = (BasicDBList) guidedbj.get("guidanceendorseby"); for (int m = 0; m < endorsebylist.size(); m++) { DBCursor endorsecursor = mongocon.getDBObject("companyid", (String) endorsebylist.get(m), "Company"); while (endorsecursor.hasNext()) { DBObject companydbj = endorsecursor.next(); endorsementlist.add((String) companydbj.get("companylogoid")); }/* w ww . j a v a 2s .c o m*/ } guidaninfomap.put("Endorsement", endorsementlist); BasicDBList achievementlist = (BasicDBList) guidedbj.get("guidanceachievements"); guidaninfomap.put("Achievement", achievementlist); DBCursor dashcursor = mongocon.getDBObject("guidancecontentDashid", guidanceid, "GuidanceContentDash"); if (dashcursor.hasNext()) { DBObject dashdbj = dashcursor.next(); BasicDBList dashdatalist = (BasicDBList) guidedbj.get("guidancedashdataid"); int remarkavg = 0; if (dashdatalist != null) { int totaldash = dashdatalist.size(); int dashcount = 0; for (int j = 0; j < dashdatalist.size(); j++) { DBCursor dashdatacursor = mongocon.getDBObject("guidancedashdataid", guidanceid, "GuidanceContentDashData"); while (dashdatacursor.hasNext()) { DBObject dashdatadbj = dashdatacursor.next(); String levelrem = (String) dashdatadbj.get("guidancedashlevelremark"); String helpremark = (String) dashdatadbj.get("guidancedashhelpremark"); dashcount = dashcount + (Integer.parseInt(levelrem) + Integer.parseInt(helpremark)) / 2; } } if (totaldash > 0 && dashcount > 0) { remarkavg = dashcount / totaldash; } } guidaninfomap.put("Remarks", remarkavg); BasicDBList locationlist = (BasicDBList) guidedbj.get("guidancelocationids"); guidaninfomap.put("Locations", locationlist); } DBCursor guidrstcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceSelection"); while (guidrstcursor.hasNext()) { DBObject guiderstdbj = guidrstcursor.next(); guidaninfomap.put("Subject", (String) guiderstdbj.get("guidanceSubject")); guidaninfomap.put("GuidanceType", (String) guiderstdbj.get("guidencetype")); guidaninfomap.put("GuidanceDuration", (String) guiderstdbj.get("guidanceduration")); BasicDBList guidinterlist = (BasicDBList) guidedbj.get("guidanceinterest"); guidaninfomap.put("GuidanceInterest", guidinterlist); guidaninfomap.put("Userid", (String) guiderstdbj.get("userid")); } } return guidaninfomap; }
From source file:com.fliker.Modal.GuidancePreview.java
public HashMap getBillDetail(String billid) { // TODO Auto-generated method stub HashMap billmap = new HashMap(); MongoConnection mongocon = new MongoConnection(); DBCursor guidecursor = mongocon.getDBObject("billid", billid, "Bill"); if (guidecursor.hasNext()) { DBObject guidedbj = guidecursor.next(); billmap.put("billid", (String) guidedbj.get("billid")); billmap.put("contractid", (String) guidedbj.get("contractid")); billmap.put("planid", (String) guidedbj.get("planid")); billmap.put("licenseid", (String) guidedbj.get("licenseid")); billmap.put("invoiceid", (String) guidedbj.get("invoiceid")); billmap.put("payfromid", (String) guidedbj.get("payfromid")); billmap.put("paytoid", (String) guidedbj.get("paytoid")); billmap.put("totalamount", (String) guidedbj.get("totalamount")); billmap.put("item", (String) guidedbj.get("item")); billmap.put("paymentmethods", (String) guidedbj.get("paymentmethods")); billmap.put("billdate", (String) guidedbj.get("billdate")); billmap.put("billlocaldate", (String) guidedbj.get("billlocaldate")); }/*ww w. j a v a2s . c o m*/ return billmap; }