本文整理匯總了Java中play.db.ebean.Model類的典型用法代碼示例。如果您正苦於以下問題:Java Model類的具體用法?Java Model怎麽用?Java Model使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Model類屬於play.db.ebean包,在下文中一共展示了Model類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: probeInit
import play.db.ebean.Model; //導入依賴的package包/類
/**
* Try to connect with current config.
* @return result of connect;
*/
public static Boolean probeInit() {
if (isGateReady) {
gate.closeGate();
isGateReady = false;
}
currConfig = (models.ServerConfig) new Model.Finder(String.class, models.ServerConfig.class).where().eq("curr_status", 2).findUnique();
initRun = true;
Boolean flag = internalInit();
if (!flag) {
currConfig.curr_status = models.ServerConfig.STATUS.INVALID;
currConfig.save();
currConfig = null;
}
initRun = false;
return flag;
}
示例2: save
import play.db.ebean.Model; //導入依賴的package包/類
@Override
public void save(Object obj)
{
if (obj instanceof Model)
{
Model m = (Model)obj;
m.save();
}
else
{
log("not an play.Model object. you must use a custom loader.");
}
}
示例3: getXMLList
import play.db.ebean.Model; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public static Result getXMLList() {
Model.Finder finder = new Model.Finder<Long, Exercise>(Long.class, Exercise.class);
StringBuilder sb = new StringBuilder();
sb.append("<exercises>\n");
for (Exercise exercise : (List<Exercise>) finder.all()) {
sb.append(String.format("<exercise name=\"%s\" minutes=\"%d\" />\n", exercise.getName(), exercise.getMinutes()));
}
sb.append("</exercises>");
return ok(new Xml(sb));
}
示例4: index
import play.db.ebean.Model; //導入依賴的package包/類
public static Result index() {
if (session("connected") != null) {
List<models.MessageProbe> probs = new Model.Finder(String.class, models.MessageProbe.class).where().eq("author", session("connected")).orderBy("id desc").findList();
return ok(post_list.render(probs));
} else {
flash("err_login", "Ви повинні зареєструватись!");
return redirect(routes.LoginController.index());
}
}
示例5: editForm
import play.db.ebean.Model; //導入依賴的package包/類
public static Result editForm(String id) {
if (session("connected") != null) {
models.MessageProbe editProbe = (models.MessageProbe) new Model.Finder(String.class, models.MessageProbe.class).byId(id);
if (editProbe.curr_status == models.MessageProbe.STATUS.ACCEPTED) {
return redirect(routes.SimpleReleaseContoller.index());
} else {
return ok(simple_release.render(models.PseudoDirectorySet.get(session("connected")), editProbe));
}
} else {
flash("err_login", "Ви повинні зареєструватись!");
return redirect(routes.LoginController.index());
}
}
示例6: edit
import play.db.ebean.Model; //導入依賴的package包/類
public static Result edit() {
models.MessageProbe editPost = Form.form(models.MessageProbe.class).bindFromRequest().get();
models.MessageProbe oldPost = (models.MessageProbe) new Model.Finder(String.class, models.MessageProbe.class).byId(editPost.id);
editPost.author = oldPost.author;
if (oldPost.curr_status == models.MessageProbe.STATUS.POSTED) {
editPost.curr_status = models.MessageProbe.STATUS.EDITED;
}
editPost.ribbon_index = oldPost.ribbon_index;
editPost.update();
if(MiniGate.sender != null) {
MiniGate.sender.interrupt();
}
return redirect(routes.SimpleReleaseContoller.index());
}
示例7: deletePost
import play.db.ebean.Model; //導入依賴的package包/類
public static Result deletePost(String id) {
models.MessageProbe probe = (models.MessageProbe) new Model.Finder(String.class, models.MessageProbe.class).byId(id);
probe.curr_status = models.MessageProbe.STATUS.DELETED;
probe.update();
if(MiniGate.sender != null) {
MiniGate.sender.interrupt();
}
return redirect(routes.SimpleReleaseContoller.index());
}
示例8: buildQuery
import play.db.ebean.Model; //導入依賴的package包/類
public static <T extends Model> ExpressionList<T> buildQuery(Class<T> clazz , ExpressionList<T> exp) {
return buildQuery(clazz,exp,false);
}
示例9: index
import play.db.ebean.Model; //導入依賴的package包/類
public static Result index() {
List<TodoItem> todos = new Model.Finder(String.class, TodoItem.class).all();
return ok(toJson(todos));
}
示例10: delete
import play.db.ebean.Model; //導入依賴的package包/類
public static Result delete(String id) {
TodoItem todo = (TodoItem) new Model.Finder(String.class, TodoItem.class).byId(id);
todo.delete();
return ok();
}
示例11: getList
import play.db.ebean.Model; //導入依賴的package包/類
@Cached(key = "exercise-list", duration = 60)
@SuppressWarnings("unchecked")
public static Result getList() {
Model.Finder finder = new Model.Finder<Long, Exercise>(Long.class, Exercise.class);
return ok(views.html.allexercises.render((List<Exercise>) finder.all()));
}
示例12: getJsonList
import play.db.ebean.Model; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public static Result getJsonList() throws JsonProcessingException {
Model.Finder finder = new Model.Finder<Long, Exercise>(Long.class, Exercise.class);
return ok(Json.toJson((List<Exercise>) finder.all()));
}
示例13: viewPost
import play.db.ebean.Model; //導入依賴的package包/類
public static Result viewPost(String id) {
models.MessageProbe probe = (models.MessageProbe) new Model.Finder(String.class, models.MessageProbe.class).byId(id);
return ok(post_view.render(probe));
}
示例14: getFinder
import play.db.ebean.Model; //導入依賴的package包/類
public Finder<Long, T> getFinder() {
return new Model.Finder(Long.class, this.getClass());
}