當前位置: 首頁>>代碼示例>>Java>>正文


Java Model類代碼示例

本文整理匯總了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;
}
 
開發者ID:spoilt-exile,項目名稱:RibbonWeb,代碼行數:21,代碼來源:MiniGate.java

示例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.");
	}
}
 
開發者ID:ianrae,項目名稱:play-sprig,代碼行數:14,代碼來源:DefaultSprigLoader.java

示例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));
}
 
開發者ID:dhinojosa,項目名稱:play-workshop,代碼行數:12,代碼來源:FitnessController.java

示例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());
    }
}
 
開發者ID:spoilt-exile,項目名稱:RibbonWeb,代碼行數:10,代碼來源:SimpleReleaseContoller.java

示例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());
    }
}
 
開發者ID:spoilt-exile,項目名稱:RibbonWeb,代碼行數:14,代碼來源:SimpleReleaseContoller.java

示例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());
}
 
開發者ID:spoilt-exile,項目名稱:RibbonWeb,代碼行數:15,代碼來源:SimpleReleaseContoller.java

示例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());
}
 
開發者ID:spoilt-exile,項目名稱:RibbonWeb,代碼行數:10,代碼來源:SimpleReleaseContoller.java

示例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);
}
 
開發者ID:ugent-cros,項目名稱:cros-core,代碼行數:4,代碼來源:QueryHelper.java

示例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));
}
 
開發者ID:ankurp,項目名稱:JavaPlayTodoList,代碼行數:5,代碼來源:TodoController.java

示例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();
}
 
開發者ID:ankurp,項目名稱:JavaPlayTodoList,代碼行數:6,代碼來源:TodoController.java

示例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()));
}
 
開發者ID:dhinojosa,項目名稱:play-workshop,代碼行數:7,代碼來源:FitnessController.java

示例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()));
}
 
開發者ID:dhinojosa,項目名稱:play-workshop,代碼行數:6,代碼來源:FitnessController.java

示例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));
}
 
開發者ID:spoilt-exile,項目名稱:RibbonWeb,代碼行數:5,代碼來源:SimpleReleaseContoller.java

示例14: getFinder

import play.db.ebean.Model; //導入依賴的package包/類
public Finder<Long, T> getFinder() {
    return new Model.Finder(Long.class, this.getClass());
}
 
開發者ID:jsmadja,項目名稱:shmuphiscores,代碼行數:4,代碼來源:BaseModel.java


注:本文中的play.db.ebean.Model類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。