Package com.github.jmkgreen.morphia

Examples of com.github.jmkgreen.morphia.Datastore.find()


        DBCollection dbColl = dsi.getCollection(c);
        if (!dbColl.getName().equals(dbRef.getRef()))
            log.warning("Class " + c.getName() + " is stored in the '" + dbColl.getName()
                    + "' collection but a reference was found for this type to another collection, '" + dbRef.getRef()
                    + "'. The reference will be loaded using the class anyway. " + dbRef);
        boolean exists = (dsi.find(dbRef.getRef(), c).disableValidation().filter("_id", dbRef.getId()).asKeyList()
                .size() == 1);
        cache.notifyExists(key, exists);
        return exists;
    }
View Full Code Here


                final String s[] = (String[]) params.get("order");
                order = s[0];
            }
           
            final Datastore ds = MongoConnectionHelper.ds;
            final List<Meteolog> meteoLogList = ds.find(Meteolog.class).order(order).offset(start).limit(limit).asList();
            final GsonBuilder gsonBuilder = new GsonBuilder();
            gsonBuilder.setDateFormat("yyyyMMddHHmm");
            final Gson gson = gsonBuilder.create();
            final HashMap endMap = new HashMap();
            endMap.put("data", meteoLogList);
View Full Code Here

            final GsonBuilder gsonBuilder = new GsonBuilder();
            gsonBuilder.setDateFormat("yyyyMMddHHmm");
            final Gson gson = gsonBuilder.create();
            final HashMap endMap = new HashMap();
            endMap.put("data", meteoLogList);
            endMap.put("totalCount", ds.find(Meteolog.class).countAll());

            response.setContentType("application/json");
            response.setHeader("Content-Disposition", "attachment; filename=\"result.json\"");

            out.println(gson.toJson(endMap));
View Full Code Here

    protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        log.debug("start : " + this.getClass().getName());

        final Datastore ds = MongoConnectionHelper.ds;
        final List<Meteolog> meteoLogList = ds.find(Meteolog.class).asList();

        final Map params = request.getParameterMap();

        String format = "csv";
        if (params.containsKey("format")) {
View Full Code Here

        final ServletContext application = getServletConfig().getServletContext();

        final Datastore ds = MongoConnectionHelper.ds;

        //Get History Values
        final MapReduceHistoryMinMax datesHisotry = ds.find(MapReduceHistoryMinMax.class).get();
        if (datesHisotry != null) {
            application.setAttribute("history", datesHisotry);
        }

        final List<Date> datesResult = ds.getDB().getCollection("Meteolog").distinct("time");
View Full Code Here

            application.setAttribute("history", datesHisotry);
        }

        final List<Date> datesResult = ds.getDB().getCollection("Meteolog").distinct("time");

        application.setAttribute("totRecord", ds.find(Meteolog.class).countAll());
       
        if (datesResult == null || datesResult.isEmpty()) {
            application.setAttribute("from", DateTimeUtil.getDate("yyyy-MM-dd", "1970-01-01"));
            application.setAttribute("to", DateTimeUtil.getDate("yyyy-MM-dd", "2030-01-01"));
            application.setAttribute("lastUpdate", DateTimeUtil.getDate("yyyy-MM-dd", "1970-01-01"));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.