List of usage examples for com.mongodb DBCursor next
@Override
public DBObject next()
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"); /*//ww w .j a va2s .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 www . ja va 2 s. co m 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 w ww. j ava 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"); }
From source file:com.fliker.Modal.OSMPreview.java
public void saveOSMModelSellerDocSave(String token, String ownerid) { // TODO Auto-generated method stub 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("OSMProjectSellerDoc")) { String projectdoc = (String) osmprojObj.get("fileid"); MongoConnection mongoconn = new MongoConnection(); mongoconn.updateObject(new BasicDBObject("osmmodelid", token), new BasicDBObject("$set", new BasicDBObject("sellingmarketdoc", projectdoc)), "OSMProjectSeller"); }// www.j ava 2s . com } } }
From source file:com.fliker.Modal.OSMPreview.java
public OSMProjectInvestment getInvestDataDetails(String osmmodelid) { // TODO Auto-generated method stub OSMProjectInvestment osminvestment = new OSMProjectInvestment(); MongoConnection mongoconosms = new MongoConnection(); DBCursor resultosms = mongoconosms.getDBObject("osmmodelid", osmmodelid, "OSMProjectInvestment"); if (resultosms.hasNext()) { DBObject osmprojObj = resultosms.next(); osminvestment.setOsminvestmentdoc((String[]) osmprojObj.get("osminvestmentdoc")); osminvestment.setOsminvestorslink((String) osmprojObj.get("osminvestorslink")); osminvestment.setOsmstakedivision((String) osmprojObj.get("osmstakedivision")); osminvestment.setOsmstakeholdingid((String) osmprojObj.get("osmstakeholdingid")); }/*from w ww. j a v a2 s .c om*/ return osminvestment; }
From source file:com.fliker.Modal.OSMPreview.java
public ArrayList getProjectInvestors(String osmmodelid) { // TODO Auto-generated method stub ArrayList investorlist = new ArrayList(); MongoConnection mongoconosms = new MongoConnection(); DBCursor resultosms = mongoconosms.getDBObject("osmid", osmmodelid, "OSM"); while (resultosms.hasNext()) { DBObject osmprojObj = resultosms.next(); String[] stakeholdersid = (String[]) osmprojObj.get("osmstakeholdingid"); for (int m = 0; m < stakeholdersid.length; m++) { HashMap stakeholderinfo = new HashMap(); MongoConnection mongoconstake = new MongoConnection(); DBCursor resultstake = mongoconstake.getDBObject("stakeholdingid", stakeholdersid[m], "OSMStakeHold"); while (resultstake.hasNext()) { DBObject osmstake = resultstake.next(); stakeholderinfo.put("stakeamount", osmstake.get("stakeamount")); stakeholderinfo.put("stakeholderlocation", osmstake.get("stakeholderlocation")); stakeholderinfo.put("stakepercentage", osmstake.get("stakepercentage")); String stakeowner = (String) osmstake.get("stakeownerid"); MongoConnection mongoconstakeowner = new MongoConnection(); DBCursor resultstakeowner = mongoconstakeowner.getDBObject("userid", stakeowner, "OSMOperator"); if (resultstakeowner.hasNext()) { DBObject osmstakeowner = resultstakeowner.next(); String activecompany = (String) osmstakeowner.get("activeCompany"); MongoConnection mongoconstakeownercompany = new MongoConnection(); DBCursor resultstakeownercompany = mongoconstakeownercompany.getDBObject("companyid", activecompany, "Company"); if (resultstakeownercompany.hasNext()) { DBObject osmstakeownercompany = resultstakeownercompany.next(); stakeholderinfo.put("Company Name", osmstakeownercompany.get("companyname")); stakeholderinfo.put("Company Image", osmstakeownercompany.get("companyImageid")); stakeholderinfo.put("Company Logo", osmstakeownercompany.get("companylogoid")); stakeholderinfo.put("Company Website", osmstakeownercompany.get("companyWebsite")); }// w w w . j a v a 2 s .c o m } } investorlist.add(stakeholderinfo); } } return investorlist; }
From source file:com.fliker.Modal.OSMPreview.java
private String saveStakeHoldings(String ownerid, String investamount, String investpercentage, String stockprice, String enabletrading) { // TODO Auto-generated method stub OSMStakeHolding stakeholding = new OSMStakeHolding(); stakeholding.setStakeamount(investamount); stakeholding.setStakeownerid(ownerid); stakeholding.setStakepercentage(investpercentage); stakeholding.setStarstokprice(stockprice); OSMFileUtility osmfileutility = new OSMFileUtility(); String uniquestockid = ""; if (enabletrading.equalsIgnoreCase("true")) { Stock stock = new Stock(); stock.setStockamount(investamount); stock.setStockprice(stockprice); String comapnyid = ""; MongoConnection mongoconstakeowner = new MongoConnection(); DBCursor resultstakeowner = mongoconstakeowner.getDBObject("userid", ownerid, "OSMOperator"); if (resultstakeowner.hasNext()) { DBObject osmstakeowner = resultstakeowner.next(); comapnyid = (String) osmstakeowner.get("activeCompany"); }//from w w w .j ava 2s. c o m stock.setCompanyid(comapnyid); try { uniquestockid = osmfileutility.makeSHA1Hash(ownerid + stockprice); } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } stock.setStockid(uniquestockid); MongoConnection mongoconsearch = new MongoConnection(); // SearchPreview searchprev = new SearchPreview(); BasicDBObject basicreqobjsearch = osmfileutility.formOSMStockDBObject(stock); mongoconsearch.saveObject(basicreqobjsearch, "Stock"); } stakeholding.setStakestokpriceid(uniquestockid); String uniqueid = ""; try { uniqueid = osmfileutility.makeSHA1Hash(ownerid + investpercentage); } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } stakeholding.setStakeholdingid(uniqueid); MongoConnection mongoconsearch = new MongoConnection(); // SearchPreview searchprev = new SearchPreview(); BasicDBObject basicreqobjsearch = osmfileutility.formOSMStakeHoldingDBObject(stakeholding); mongoconsearch.saveObject(basicreqobjsearch, "OSMStakeHold"); return uniqueid; }
From source file:com.fliker.Modal.OSMPreview.java
public void saveDemandChart(String ownerid, String osmmodelid) { // TODO Auto-generated method stub // OSMDemand osmdemand = new OSMDemand(); MongoConnection mongoconn = new MongoConnection(); mongoconn.updateObject(new BasicDBObject("osmid", osmmodelid), new BasicDBObject("$push", new BasicDBObject("osmsubscriptionid", ownerid)), "OSMDemand"); MongoConnection mongocondemand = new MongoConnection(); DBCursor resultdemand = mongocondemand.getDBObject("osmmodelid", osmmodelid, "OSMDemand"); if (resultdemand.hasNext()) { DBObject osmdemand = resultdemand.next(); String currentdemandstockprice = (String) osmdemand.get("osmstockpricevariation"); int currentstock = Integer.parseInt(currentdemandstockprice); }/* w w w .j a v a 2 s. c o m*/ mongoconn.updateObject(new BasicDBObject("osmid", osmmodelid), new BasicDBObject("$push", new BasicDBObject("osmstakeholdingid", ownerid)), "OSMStakeHold"); }
From source file:com.fliker.Modal.OSMPreview.java
public ArrayList getOSMOperatorID(String osmmodelid) { String osmowner = ""; String company = ""; ArrayList companyinfo = new ArrayList(); MongoConnection mongocondemand = new MongoConnection(); DBCursor resultdemand = mongocondemand.getDBObject("osmid", osmmodelid, "OSM"); if (resultdemand.hasNext()) { DBObject osmdemand = resultdemand.next(); osmowner = (String) osmdemand.get("osmowner"); MongoConnection mongoconcompany = new MongoConnection(); DBCursor resultcompany = mongoconcompany.getDBObject("userid", osmowner, "OSMOperator"); if (resultcompany.hasNext()) { DBObject osmcompany = resultcompany.next(); company = (String) osmcompany.get("activeCompany"); MongoConnection mongoconcompan = new MongoConnection(); DBCursor resultcompan = mongoconcompan.getDBObject("userid", osmowner, "OSMOperator"); if (resultcompan.hasNext()) { DBObject osmcompan = resultcompan.next(); Company compinfo = new Company(); compinfo.setCompanyid((String) osmcompan.get("companyid")); compinfo.setCompanyImageid((String) osmcompan.get("companyImageid")); compinfo.setCompanylogoid((String) osmcompan.get("companylogoid")); companyinfo.add(compinfo); }/* w w w.j a v a 2 s .c o m*/ } } return companyinfo; }
From source file:com.fliker.Modal.OSMPreview.java
public String getOSMOperatorCompanyLogo(String osmmodelid) { String osmowner = ""; String company = ""; String companyname = ""; MongoConnection mongocondemand = new MongoConnection(); DBCursor resultdemand = mongocondemand.getDBObject("osmid", osmmodelid, "OSM"); if (resultdemand.hasNext()) { DBObject osmdemand = resultdemand.next(); osmowner = (String) osmdemand.get("osmowner"); MongoConnection mongoconcompany = new MongoConnection(); DBCursor resultcompany = mongoconcompany.getDBObject("userid", osmowner, "OSMOperator"); if (resultcompany.hasNext()) { DBObject osmcompany = resultcompany.next(); company = (String) osmcompany.get("activeCompany"); MongoConnection mongoconcompan = new MongoConnection(); DBCursor resultcompan = mongoconcompan.getDBObject("userid", osmowner, "OSMOperator"); if (resultcompan.hasNext()) { DBObject osmcompan = resultcompan.next(); /*Company compinfo = new Company(); compinfo.setCompanyid((String)osmcompan.get("companyid")); compinfo.setCompanyImageid((String)osmcompan.get("companyImageid")); compinfo.setCompanylogoid((String)osmcompan.get("companylogoid"));*/ companyname = (String) osmcompan.get("companylogoid"); }// ww w . j av a2s.c o m } } return companyname; }