Package gaej2011.service

Source Code of gaej2011.service.GuestbookService

package gaej2011.service;

import gaej2011.meta.GuestbookMeta;
import gaej2011.model.Guestbook;

import java.util.Date;
import java.util.List;

import org.slim3.datastore.Datastore;

import com.google.appengine.api.datastore.Key;

public class GuestbookService {

    public static Key saveToDatastore(String string) {
        Guestbook guestbook = new Guestbook();
        guestbook.setMessage(string);
        guestbook.setCreatedAt(new Date());
        Datastore.put(guestbook);
        return guestbook.getKey();
    }

    static final GuestbookMeta meta = GuestbookMeta.get();

    public static List<Guestbook> queryFromDatastore() {
        return Datastore.query(meta).sort(meta.createdAt.desc).asList();
    }
}
TOP

Related Classes of gaej2011.service.GuestbookService

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.