List of usage examples for com.mongodb DBCursor hasNext
@Override public boolean hasNext()
From source file:com.fliker.Modal.OSMPreview.java
public ArrayList getAllExistingOSMModels(String ownerid) { // TODO Auto-generated method stub ArrayList osmmodellist = new ArrayList(); MongoConnection mongoconinner = new MongoConnection(); DBCursor resultcursor = mongoconinner.getDBObject("ownerid", ownerid, "OSMOwner"); if (resultcursor.hasNext()) { DBObject theObjosm = resultcursor.next(); String[] osmmodels = (String[]) theObjosm.get("osmmodelid"); for (int d = 0; d < osmmodels.length; d++) { MongoConnection mongoconosms = new MongoConnection(); DBCursor resultosms = mongoconosms.getDBObject("osmmodelid", osmmodels[d], "OSMProjectInfo"); while (resultosms.hasNext()) { DBObject osmprojObj = resultosms.next(); OSMProjectInfo osmprojinfo = new OSMProjectInfo(); osmprojinfo.setProjectname((String) osmprojObj.get("projectname")); osmprojinfo.setProjectdemandchart((String) osmprojObj.get("projectdemandchart")); osmmodellist.add(osmprojinfo); }/*from w ww . j a v a2 s .c om*/ } } return osmmodellist; }
From source file:com.fliker.Modal.OSMPreview.java
public void saveExistingOSMModelsDoc(String tokenid, String userid) { // TODO Auto-generated method stub MongoConnection mongoconosms = new MongoConnection(); DBCursor resultosms = mongoconosms.getDBObject("tempid", tokenid, "FileUnionTimeFrame"); while (resultosms.hasNext()) { DBObject osmprojObj = resultosms.next(); FileUnionTimeFrame fileunion = new FileUnionTimeFrame(); if (((String) osmprojObj.get("userid")).equalsIgnoreCase(userid)) { if (((String) osmprojObj.get("context")).contains("OSMProjectDoc")) { String projectdoc = (String) osmprojObj.get("fileid"); MongoConnection mongoconn = new MongoConnection(); mongoconn.updateObject(new BasicDBObject("osmmodelid", tokenid), new BasicDBObject("$push", new BasicDBObject("projectdocs", projectdoc)), "OSMProjectInfo"); } else if (((String) osmprojObj.get("context")).contains("OSMProjectMarkettingDoc")) { String projectdoc = (String) osmprojObj.get("fileid"); MongoConnection mongoconn = new MongoConnection(); mongoconn.updateObject(new BasicDBObject("osmmodelid", tokenid), new BasicDBObject("$set", new BasicDBObject("projectmarkettingdoc", projectdoc)), "OSMProjectInfo"); }//w w w . ja v a 2 s.c om } } }
From source file:com.fliker.Modal.OSMPreview.java
public HashMap opensubscriptionAs(String userid, String subscriptiontype, String token) { // TODO Auto-generated method stub HashMap<String, ArrayList> holdinglist = new HashMap<String, ArrayList>(); ArrayList subscribelist = new ArrayList(); String subscribelink = ""; if (subscriptiontype.equalsIgnoreCase("Investor")) { MongoConnection mongoconinner = new MongoConnection(); DBCursor resultcursor = mongoconinner.getDBObject("osmmodelid", token, "OSMProjectInvestment"); if (resultcursor.hasNext()) { DBObject osmprojObj = resultcursor.next(); OSMProjectInvestment osmprojinvest = new OSMProjectInvestment(); osmprojinvest.setOsminvestmentdoc((String[]) osmprojObj.get("osminvestmentdoc")); osmprojinvest.setOsminvestorslink((String) osmprojObj.get("osminvestorslink")); osmprojinvest.setOsmstakeholdingid((String) osmprojObj.get("osmstakeholdingid")); osmprojinvest.setOsmmodelid((String) osmprojObj.get("osmmodelid")); osmprojinvest.setOsminvestmentdescription((String) osmprojObj.get("osminvestmentdescription")); osmprojinvest.setOsminvestmenttermsandcondition( (String) osmprojObj.get("osminvestmenttermsandcondition")); subscribelist.add(osmprojinvest); }/*from w w w . j a v a2 s. c o m*/ holdinglist.put("/OSMProjectInvestor", subscribelist); } else if (subscriptiontype.equalsIgnoreCase("Buyer")) { MongoConnection mongoconinner = new MongoConnection(); DBCursor resultcursor = mongoconinner.getDBObject("osmmodelid", token, "OSMProjectSeller"); if (resultcursor.hasNext()) { DBObject osmprojObj = resultcursor.next(); OSMProjectSeller osmprojsell = new OSMProjectSeller(); osmprojsell.setProjectsellerid((String) osmprojObj.get("projectsellerid")); osmprojsell.setOsmmodelid((String) osmprojObj.get("osmmodelid")); osmprojsell.setSellerdescription((String) osmprojObj.get("sellerdescription")); osmprojsell.setSellingmarketdoc((String) osmprojObj.get("sellingmarketdoc")); subscribelist.add(osmprojsell); } holdinglist.put("/OSMProjectBuying", subscribelist); } else if (subscriptiontype.equalsIgnoreCase("Developer")) { MongoConnection mongoconinner = new MongoConnection(); DBCursor resultcursor = mongoconinner.getDBObject("osmmodelid", token, "OSMProjectDevelopment"); if (resultcursor.hasNext()) { DBObject osmprojObj = resultcursor.next(); OSMProjectDevelopment osmprojdevelop = new OSMProjectDevelopment(); osmprojdevelop.setOsmmodelid((String) osmprojObj.get("osmmodelid")); osmprojdevelop.setOsmprojectdevelopmentid((String) osmprojObj.get("osmprojectdevelopmentid")); osmprojdevelop.setOsmresourceid((String[]) osmprojObj.get("osmresourceid")); osmprojdevelop.setProjectflodocs((String[]) osmprojObj.get("projectflodocs")); osmprojdevelop.setProjectidlink((String) osmprojObj.get("projectidlink")); osmprojdevelop.setProjectlinkaccess((String) osmprojObj.get("projectlinkaccess")); osmprojdevelop.setProjectslidesid((String) osmprojObj.get("projectslidesid")); subscribelist.add(osmprojdevelop); } holdinglist.put("/OSMProjectResource", subscribelist); } return holdinglist; }
From source file:com.fliker.Modal.OSMPreview.java
public void saveOSMModelInvest(String token, String ownerid) { // TODO Auto-generated method stub MongoConnection mongoconosms = new MongoConnection(); DBCursor resultosms = mongoconosms.getDBObject("osmmodelid", token, "OSMProjectInfo"); if (resultosms.hasNext()) { DBObject osmprojObj = resultosms.next(); MongoConnection mongoconn = new MongoConnection(); mongoconn.updateObject(new BasicDBObject("osmmodelid", token), new BasicDBObject("$push", new BasicDBObject("projectinvestors", ownerid)), "OSMProjectInfo"); mongoconn.updateObject(new BasicDBObject("osmmodelid", token), new BasicDBObject("$push", new BasicDBObject("osminvestors", ownerid)), "OSM"); mongoconn.updateObject(new BasicDBObject("userid", ownerid), new BasicDBObject("$push", new BasicDBObject("oldinvestments", token)), "OSMOperator"); mongoconn.updateObject(new BasicDBObject("userid", ownerid), new BasicDBObject("$push", new BasicDBObject("osmmodelid", token)), "OSMOperator"); /*/*from w w w . j a v a 2 s . c o m*/ * TradePreview tradeprev = new TradePreview(); * tradeprev.stockchangeonInvesting(token); */ } TradePreview tradeprev = new TradePreview(); tradeprev.stockchangeonSubscription(token, ownerid); }
From source file:com.fliker.Modal.OSMPreview.java
public void saveOSMModelBuying(String token, String ownerid) { // TODO Auto-generated method stub MongoConnection mongoconosms = new MongoConnection(); DBCursor resultosms = mongoconosms.getDBObject("osmmodelid", token, "OSMProjectInfo"); if (resultosms.hasNext()) { DBObject osmprojObj = resultosms.next(); MongoConnection mongoconn = new MongoConnection(); mongoconn.updateObject(new BasicDBObject("osmmodelid", token), new BasicDBObject("$push", new BasicDBObject("projectbuyers", ownerid)), "OSMProjectInfo"); mongoconn.updateObject(new BasicDBObject("osmmodelid", token), new BasicDBObject("$push", new BasicDBObject("osmbuyerids", ownerid)), "OSM"); mongoconn.updateObject(new BasicDBObject("userid", ownerid), new BasicDBObject("$push", new BasicDBObject("oldbuyings", token)), "OSMOperator"); mongoconn.updateObject(new BasicDBObject("userid", ownerid), new BasicDBObject("$push", new BasicDBObject("osmmodelid", token)), "OSMOperator"); TradePreview tradeprev = new TradePreview(); tradeprev.stockchangeonBuying(token); }//from www . ja v a 2s . co m }
From source file:com.fliker.Modal.OSMPreview.java
public ArrayList getRelatedOSMModels(String ownerid) { // TODO Auto-generated method stub ArrayList projectlist = new ArrayList(); MongoConnection mongoconosms = new MongoConnection(); DBCursor resultosms = mongoconosms.getDBObject("userid", ownerid, "OSMOperator"); while (resultosms.hasNext()) { DBObject osmprojObj = resultosms.next(); String[] osmmodelids = (String[]) osmprojObj.get("osmmodelid"); for (int d = 0; d < osmmodelids.length; d++) { MongoConnection mongoconinner = new MongoConnection(); DBCursor resultcursor = mongoconinner.getDBObject("osmmodelid", osmmodelids[d], "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); }// ww w . j a v a 2 s . co m } } return null; }
From source file:com.fliker.Modal.OSMPreview.java
public void saveOSMModelDevloping(String token, String ownerid) { // TODO Auto-generated method stub MongoConnection mongoconosms = new MongoConnection(); DBCursor resultosms = mongoconosms.getDBObject("osmmodelid", token, "OSMProjectInfo"); if (resultosms.hasNext()) { DBObject osmprojObj = resultosms.next(); MongoConnection mongoconn = new MongoConnection(); mongoconn.updateObject(new BasicDBObject("osmmodelid", token), new BasicDBObject("$push", new BasicDBObject("projectrequestors", ownerid)), "OSMProjectInfo"); mongoconn.updateObject(new BasicDBObject("userid", ownerid), new BasicDBObject("$push", new BasicDBObject("olddevelopments", token)), "OSMOperator"); mongoconn.updateObject(new BasicDBObject("userid", ownerid), new BasicDBObject("$push", new BasicDBObject("osmmodelid", token)), "OSMOperator"); }//w ww .j av a 2s. c om TradePreview tradeprev = new TradePreview(); tradeprev.stockchangeonSubscription(token, ownerid); }
From source file:com.fliker.Modal.OSMPreview.java
public void saveOSMModelDevloplist(String osmmodelid, String developerid) { // TODO Auto-generated method stub MongoConnection mongoconosms = new MongoConnection(); DBCursor resultosms = mongoconosms.getDBObject("osmmodelid", osmmodelid, "OSMProjectInfo"); if (resultosms.hasNext()) { DBObject osmprojObj = resultosms.next(); MongoConnection mongoconn = new MongoConnection(); mongoconn.updateObject(new BasicDBObject("osmmodelid", osmmodelid), new BasicDBObject("$push", new BasicDBObject("projectresources", developerid)), "OSMProjectInfo"); /*// w w w . j a va2 s. co m * mongoconn.updateObject(new BasicDBObject("userid", developerid), * new BasicDBObject("$push", new BasicDBObject("olddevelopments", * osmmodelid)), "OSMOperator"); mongoconn.updateObject(new * BasicDBObject("userid", developerid), new BasicDBObject("$push", * new BasicDBObject("osmmodelid", osmmodelid)), "OSMOperator"); */ } }
From source file:com.fliker.Modal.OSMPreview.java
public void createOSMModelInvestSet(String osmmodelid, String stakeamount, String stakedivision, String ownerid, String projectinvestlink) { // TODO Auto-generated method stub OSMProjectInvestment osmprojinvest = new OSMProjectInvestment(); osmprojinvest.setOsmmodelid(osmmodelid); osmprojinvest.setOsmstakedivision(stakedivision); osmprojinvest.setOsminvestorslink(projectinvestlink); OSMFileUtility osmfileutility = new OSMFileUtility(); String uniqueid = ""; try {//from w w w . ja v a 2 s. com uniqueid = osmfileutility.makeSHA1Hash(osmmodelid); } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } osmprojinvest.setOsmstakeholdingid(uniqueid); StringBuffer projectinvestdoc = new StringBuffer(); MongoConnection mongoconosms = new MongoConnection(); DBCursor resultosms = mongoconosms.getDBObject("tempid", osmmodelid, "FileUnionTimeFrame"); while (resultosms.hasNext()) { DBObject osmprojObj = resultosms.next(); FileUnionTimeFrame fileunion = new FileUnionTimeFrame(); if (((String) osmprojObj.get("userid")).equalsIgnoreCase(ownerid)) { if (((String) osmprojObj.get("context")).contains("OSMProjectInvestDoc")) { String projectdoc = (String) osmprojObj.get("fileid"); projectinvestdoc.append(projectdoc); projectinvestdoc.append(","); } } } String[] projectinvestdocarr = (projectinvestdoc.substring(0, projectinvestdoc.length() - 1)).split(","); osmprojinvest.setOsminvestmentdoc(projectinvestdocarr); MongoConnection mongoconproj = new MongoConnection(); BasicDBObject basicreqobjproj = osmfileutility.formOSMProjectInvestDBObject(osmprojinvest); mongoconproj.saveObject(basicreqobjproj, "OSMProjectInvestment"); // lots of operation needed to do here /* * * * SearchContent searchcontent = new SearchContent(); * searchcontent.setSearchid(uniqueid); * searchcontent.setContentDescription("Project Name ::"+projectname+ * "Project Description ::"+projectdescription+"Project Investors ::" * +projectinvestors.split(",")+"Project Buyers::" * +projectbuyers.split(",")+"Location ::"+locationaddress); * searchcontent.setContentLink(""); * searchcontent.setContentType("OSM"); * * MongoConnection mongoconsearch = new MongoConnection(); SearchPreview * searchprev = new SearchPreview(); BasicDBObject basicreqobjsearch = * searchprev.formDBObject(searchcontent); * * mongoconsearch.saveObject(basicreqobjsearch, "Content"); */ }
From source file:com.fliker.Modal.OSMPreview.java
public void saveOSMModelInvestDocSave(String token, String stakeamount, String stakedivision, String ownerid, String projectinvestlink) { // TODO Auto-generated method stub StringBuffer projectdocbuff = new StringBuffer(); String[] filearr = null;//from ww w. j a va 2 s . c o m MongoConnection mongoconcheck = new MongoConnection(); DBCursor resultcheck = mongoconcheck.getDBObject("osmmodelid", token, "OSMProjectInvestment"); if (resultcheck.hasNext()) { DBObject osmprojObj = resultcheck.next(); filearr = (String[]) osmprojObj.get("osminvestmentdoc"); } MongoConnection mongoconosms = new MongoConnection(); DBCursor resultosms = mongoconosms.getDBObject("tempid", token, "FileUnionTimeFrame"); while (resultosms.hasNext()) { DBObject osmprojObj = resultosms.next(); FileUnionTimeFrame fileunion = new FileUnionTimeFrame(); if (((String) osmprojObj.get("userid")).equalsIgnoreCase(ownerid)) { if (((String) osmprojObj.get("context")).contains("OSMProjectInvestDoc")) { String projectdoc = (String) osmprojObj.get("fileid"); if (filearr != null) { for (int s = 0; s < filearr.length; s++) { if (!filearr[s].equalsIgnoreCase(projectdoc)) { projectdocbuff.append(projectdoc); projectdocbuff.append(","); } } } else { projectdocbuff.append(projectdoc); projectdocbuff.append(","); } } } } String[] projectdocarr = (projectdocbuff.substring(0, projectdocbuff.length() - 1)).split(","); MongoConnection mongoconn = new MongoConnection(); mongoconn.updateObject(new BasicDBObject("osmmodelid", token), new BasicDBObject("$push", new BasicDBObject("osminvestmentdoc", projectdocarr)), "OSMProjectInvestment"); mongoconn.updateObject(new BasicDBObject("osmmodelid", token), new BasicDBObject("$set", new BasicDBObject("osmstakedivision", stakedivision)), "OSMProjectInvestment"); mongoconn.updateObject(new BasicDBObject("osmmodelid", token), new BasicDBObject("$set", new BasicDBObject("osminvestorslink", projectinvestlink)), "OSMProjectInvestment"); }