Package models

Examples of models.Marker


     */
    public static void upload(File Filedata, String userId, String markerId) throws Exception {
        String fileName = System.currentTimeMillis() + "_" + Filedata.getName();
        User user = User.filter("_id", new ObjectId(userId)).first();
        // 存储到数据库
        Marker marker = Marker.filter("_id", new ObjectId(markerId)).first();
        if (marker != null && user != null) {
            Photo photo = new Photo(marker, fileName);
            photo.save();
            // 存储文件
            File file = new File(FileUtils.getApplicationPath("data") + fileName);
View Full Code Here


        }
    }

    @Secure(login = true)
    public static void delete(String name, String markerId) {
        Marker m = Marker.filter("_id", new ObjectId(markerId)).first();
        Photo p = Photo.filter("name", name).first();
        new File(FileUtils.getApplicationPath("data") + name).delete();
        String nextImage = "";
        Photo next = Photo.filter("marker", m).filter("name > ", name).order("name").first();
        Photo prev = Photo.filter("marker", m).filter("name < ", name).order("-name").first();
View Full Code Here

        p.delete();
        renderJSON("{\"name\":\"" + nextImage + "\"}");
    }

    public static void prev(String name, String markerId) {
        Marker m = Marker.filter("_id", new ObjectId(markerId)).first();
        Photo prev = Photo.filter("marker", m).filter("name < ", name).order("-name").first();
        if (prev == null) {
            renderJSON("{\"name\":\"" + name + "\"}");
        } else {
            renderJSON("{\"name\":\"" + prev.name + "\"}");
View Full Code Here

            renderJSON("{\"name\":\"" + prev.name + "\"}");
        }
    }

    public static void next(String name, String markerId) {
        Marker m = Marker.filter("_id", new ObjectId(markerId)).first();
        Photo next = Photo.filter("marker", m).filter("name > ", name).order("name").first();
        if (next == null) {
            renderJSON("{\"name\":\"" + name + "\"}");
        } else {
            renderJSON("{\"name\":\"" + next.name + "\"}");
View Full Code Here

public class Markers extends Application {
    @Secure(login = true)
    public static void add(String lng, String lat) {
        Logger.info(lng + " " + lat);
        Marker marker = new Marker(lng, lat);
        marker.save();
    }
View Full Code Here

        builder.append("]");
        renderJSON(builder.toString().replace("},]", "}]"));
    }

    public static void open(String lng, String lat) {
        Marker m = Marker.filter("lng", lng).filter("lat", lat).first();
        Photo photo = Photo.filter("marker", m).first();
        String markerId = "\"id\":\"" + m.getId() + "\"";
        String photoName = photo == null ? "" : photo.name;
        String data =
                "{" + markerId + ",\"photo\":\"" + photoName + "\",\"title\":\"" + m.title + "\"}";
        Logger.info(data);
        renderJSON(data);
View Full Code Here

        renderJSON(data);
    }

    @Secure(login = true)
    public static void saveTitle(String title, String markerId) {
        Marker m = Marker.filter("_id", new ObjectId(markerId)).first();
        m.title = title;
        m.save();
    }
View Full Code Here

TOP

Related Classes of models.Marker

Copyright © 2018 www.massapicom. 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.