Example usage for com.mongodb DBCursor next

List of usage examples for com.mongodb DBCursor next

Introduction

In this page you can find the example usage for com.mongodb DBCursor next.

Prototype

@Override
public DBObject next() 

Source Link

Document

Returns the object the cursor is at and moves the cursor ahead by one.

Usage

From source file:com.fliker.Modal.GuidancePreview.java

public ArrayList getAllSpecifications(String guidanceid, String userid) {
    // TODO Auto-generated method stub

    MongoConnection mongocon = new MongoConnection();
    DBCursor resultcursor = mongocon.getDBObject("guidanceid", guidanceid, "GuidanceContent");
    ArrayList specificlist = new ArrayList();
    if (resultcursor.hasNext()) {
        DBObject dbj = resultcursor.next();

        BasicDBList specificationlist = (BasicDBList) dbj.get("specification");

        for (int j = 0; j < specificationlist.size(); j++) {
            HashMap specificatiomap = new HashMap();
            DBCursor specificcursor = mongocon.getDBObject("specificationid", (String) specificationlist.get(j),
                    "GuidanceSpecificationData");
            while (specificcursor.hasNext()) {
                DBObject specificdbj = specificcursor.next();

                specificatiomap.put("specificationid", (String) specificdbj.get("specificationid"));
                specificatiomap.put("specificationname", (String) specificdbj.get("specificationname"));
                specificatiomap.put("specificationdetails", (String) specificdbj.get("specificationdetails"));
                specificatiomap.put("specificationpercentage", "5");

            }/*w  w w .j ava 2  s.  co m*/
            specificlist.add(specificatiomap);

        }

    }

    return specificlist;
}

From source file:com.fliker.Modal.OSMPreview.java

public ArrayList getProjectInfoList() {

    ArrayList projectlist = new ArrayList();
    MongoConnection mongoconn = new MongoConnection();
    DBCollection collection = mongoconn.getDBConnection("OSMOwner");
    DBCursor cursor;

    cursor = collection.find().sort(new BasicDBObject("osmmodelid", -1));
    while (cursor.hasNext()) {
        DBObject currentItem = cursor.next();
        String osmmodelid = (String) currentItem.get("osmmodelid");

        MongoConnection mongoconinner = new MongoConnection();
        DBCursor resultcursor = mongoconinner.getDBObject("osmmodelid", osmmodelid, "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);

        }/*from w ww  .ja  v  a2s  .c om*/

    }

    return projectlist;
}

From source file:com.fliker.Modal.OSMPreview.java

public ArrayList getAllCompanyList() {
    // TODO Auto-generated method stub

    ArrayList companylist = new ArrayList();

    MongoConnection mongoconn = new MongoConnection();
    DBCollection collection = mongoconn.getDBConnection("OSMOwner");
    DBCursor cursor;

    cursor = collection.find().sort(new BasicDBObject("osmmodelid", -1));
    while (cursor.hasNext()) {
        DBObject currentItem = cursor.next();

        Company comapny = new Company();
        comapny.setCompanyid((String) currentItem.get("companyid"));
        comapny.setAboutUs((String) currentItem.get("AboutUs"));
        comapny.setAboutvideoid((String) currentItem.get("aboutvideoid"));
        comapny.setCompanyImageid((String) currentItem.get("companyImageid"));
        comapny.setCompanyIndustry((String) currentItem.get("companyIndustry"));
        comapny.setCompanylogoid((String) currentItem.get("companylogoid"));
        comapny.setCompanyname((String) currentItem.get("companyname"));
        comapny.setCompanyWebsite((String) currentItem.get("companyWebsite"));

        companylist.add(comapny);/*from  w  w w  . jav  a  2  s  .co m*/

    }

    return companylist;
}

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  w w.  j a va  2  s. co m
        }

    }

    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");

            }//from   www .j  a va2s .com

        }

    }

}

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);

        }// w w  w.j  av a 2 s. co  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");

        /*// w w  w . j  av a 2  s. co  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 w  ww .  j  av  a 2 s.c  o  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);

            }/*from   ww w. j a v a 2  s.  c o 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");
    }/*from  w w w  . j av a2  s. co  m*/

    TradePreview tradeprev = new TradePreview();
    tradeprev.stockchangeonSubscription(token, ownerid);

}