当前位置: 首页>>代码示例>>Java>>正文


Java Ebean.update方法代码示例

本文整理汇总了Java中com.avaje.ebean.Ebean.update方法的典型用法代码示例。如果您正苦于以下问题:Java Ebean.update方法的具体用法?Java Ebean.update怎么用?Java Ebean.update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.avaje.ebean.Ebean的用法示例。


在下文中一共展示了Ebean.update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: useCoupon

import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
public Result useCoupon(String couponId) {
   
    try {
        CouponRecord couponRecord = CouponRecord.find.where()
                .eq("coupon_id", couponId).findUnique();
        
        if (null != couponRecord) {
            couponRecord.is_used = true;
            
            Set<String> updateProps = new HashSet<String>();
            updateProps.add("is_used");
            Ebean.update(couponRecord, updateProps);
            
            return ok(Json.toJson(couponRecord));
        }            
    }
    catch (Throwable e) {
        Logger.info("error:" + e.getMessage());
    }

    return ok();
}
 
开发者ID:chengxp3,项目名称:galaxy,代码行数:23,代码来源:DrawController.java

示例2: update

import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
@AccessLevel(level=2)
public Result update() {
	Form<ProgramContent> contentForm = 
			Form.form(ProgramContent.class).bindFromRequest();
	
	if (contentForm.hasErrors()) { 
		return status(ErrDefinition.E_PROGRAM_CONTENT_FORM_HASERROR, 
				Messages.get("programcontent.failure"));			
	}
	
	try {
		ProgramContent content = contentForm.get();
		
		Ebean.update(content);
		
		return ok(Json.toJson(content));
	}
	catch (Throwable e) {
		return status(ErrDefinition.E_PROGRAM_CONTENT_UPDATE_FAILED,
				Messages.get("programcontent.failure"));
	}
}
 
开发者ID:chengxp3,项目名称:galaxy,代码行数:23,代码来源:ProgramContentController.java

示例3: collectionGet

import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
public Result collectionGet(int pageNumber, int sizePerPage) {	
  try { 
  	List<Collections> listConnections = Collections.find.where()
		.eq("user_id", session("userId"))
		.setFirstRow(pageNumber*sizePerPage)
		.setMaxRows(sizePerPage)
		.findList();
  	
  	for(Collections itera:listConnections) {
         if (itera.article_name == null) {
             itera.article_name = Article.find.where().eq("article_id", itera.article_id).findUnique().article_name;
             Ebean.update(itera);
         }
      }
	
  return ok(Json.toJson(listConnections));
 }
 catch (Throwable e) {
  System.err.println(e.toString());
  return status(ErrDefinition.E_COLLECTIONS_GET_ERROR,
		  Messages.get("collectionsget.failure"));
 }	
}
 
开发者ID:chengxp3,项目名称:galaxy,代码行数:24,代码来源:ArticleController.java

示例4: update

import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
public Result update() {
    Form<UserAddress> addressForm = 
            Form.form(UserAddress.class).bindFromRequest();
    
    if (addressForm.hasErrors()) {
        return status(ErrDefinition.E_USER_ADDRESS_FORM_ERROR);
    }
    
    try {
        UserAddress address = addressForm.get();
        
        address.id = new AccountAppId(session("userId"), session("appId"));
        
        Ebean.update(address);
        
        return ok(Json.toJson(address));
    }
    catch (Throwable e) {
        return status(ErrDefinition.E_USER_ADDRESS_UPDATE_ERROR);
    }
}
 
开发者ID:chengxp3,项目名称:galaxy,代码行数:22,代码来源:UserAddressController.java

示例5: update

import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
@AccessLevel(level=2)
public Result update() {
	Form<Application> appForm = 
			Form.form(Application.class).bindFromRequest();
	
	if (appForm.hasErrors()) {
		return status(ErrDefinition.E_APP_FORM_HASERROR, 
				Messages.get("application.actionfailed"));			
	}
	
	try {
		Application app = appForm.get();			
		Ebean.update(app);
	}
	catch (Throwable e) {
		return status(ErrDefinition.E_APP_EXCEPTION_FOUND,
				Messages.get("application.actionfailed"));
	}
	
	return ok();
}
 
开发者ID:chengxp3,项目名称:galaxy,代码行数:22,代码来源:ApplicationController.java

示例6: updateFcwm

import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
public Result updateFcwm() {
	Form<Activity> activityForm = 
			Form.form(Activity.class).bindFromRequest();
	
	if (activityForm.hasErrors()) {
		return status(ErrDefinition.E_ACTIVITY_FORM_HASERROR, 
				Messages.get("activity.failure"));
	}
	
	try {
		Activity activity = activityForm.get();
		
           activity.app_id=session("appId");
					
		Ebean.update(activity);
		
		return ok(Json.toJson(activity));
	}
	catch (Exception e) {
		return status(ErrDefinition.E_ACTIVITY_UPDATE_FAILED,
				Messages.get("activity.failure"));
	}
}
 
开发者ID:chengxp3,项目名称:galaxy,代码行数:24,代码来源:ActController.java

示例7: update

import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
public Result update() {
	Form<Gift> gift = 
			Form.form(Gift.class).bindFromRequest();
	
	if (gift.hasErrors()) {
		return status (ErrDefinition.E_GIFT_READ_FAILED,
				Messages.get("giftUpdate.failure"));
	}
	
	try{
		String appId=session("appId");
		Gift gif = gift.get();
		gif.app_id=appId;
		Ebean.update(gif);
	}
	catch (Throwable e) {
		return status(ErrDefinition.E_GIFT_READ_FAILED,
				Messages.get("giftUpdate.failure"));
	}
	return ok();
}
 
开发者ID:chengxp3,项目名称:galaxy,代码行数:22,代码来源:GiftController.java

示例8: update

import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
@AccessLevel(level=2)
public Result update() {
	Form<Program> programForm = 
			Form.form(Program.class).bindFromRequest();
	
	if (programForm.hasErrors()) {
		return status(ErrDefinition.E_PROGRAM_FORM_HASERROR,
				Messages.get("program.failure"));
	}
	
	try {
		Program program = programForm.get();
		Ebean.update(program);
		
		return ok(Json.toJson(program));
	}
	catch (Throwable e) {
		return status(ErrDefinition.E_PROGRAM_UPDATE_FAILED,
				Messages.get("program.failure"));
	}		
}
 
开发者ID:chengxp3,项目名称:galaxy,代码行数:22,代码来源:ProgramController.java

示例9: update

import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
@AccessLevel(level=2)
public Result update() {
	Form<Shop> shopForm = 
			Form.form(Shop.class).bindFromRequest();
	
	if (shopForm.hasErrors()) {
		return status(ErrDefinition.E_SHOP_FORM_ERROR,
				Messages.get("shop.failure"));
	}
	
	try {
		Shop shop = shopForm.get();
           Shop shopToUpdate = Shop.find.byId(shop.id);
           shop.app = shopToUpdate.app;
		
		Ebean.update(shop);
		
		return ok(Json.toJson(shop));
		
	}
	catch (Throwable e) {
	    Logger.info(e.getMessage());
		return status(ErrDefinition.E_SHOP_UPDATE_ERROR,
				Messages.get("shop.failure"));
	}
}
 
开发者ID:chengxp3,项目名称:galaxy,代码行数:27,代码来源:ShopController.java

示例10: onHandleQuit

import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
private void onHandleQuit(ChatRoom.Quit quit) {

        if(m_members.containsKey(quit.userId)){
            m_members.remove(quit.userId);
        }
        else {
            return;
        }
        
        if (quit.userId.compareToIgnoreCase(m_hostId) == 0) {
            onHostQuit(quit);
        }
        else {
            onGuestQuit(quit);
        }
        
        
        try {
            ChatRoomTime joinTime = ChatRoomTime.find.where()
                    .eq("account_id", quit.userId)
                    .findUnique();
            if (joinTime != null) {
                joinTime.action = "exit";
                joinTime.action_time = new Date();
                joinTime.room_id = m_hostId;
                joinTime.send_gift_number = CharmValue.find.where()
                      .eq("sender_id", quit.userId).findRowCount();
                Ebean.update(joinTime);
            }                    
        }
        catch (Throwable e) {
            Logger.info(e.getMessage());
        }
    }
 
开发者ID:chengxp3,项目名称:galaxy,代码行数:35,代码来源:RaceChatModel.java

示例11: update

import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
public Result update() {
		Form<Article> ArticleForm = 
				Form.form(Article.class).bindFromRequest();
		
		if (ArticleForm.hasErrors()) {
			return status(ErrDefinition.E_ARTICLE_FORM_ERROR,
					Messages.get("article.failure"));
		}
		
		try { 
			Article updateArticle = ArticleForm.get();
			// Check the updated article is done by author
			Article originArticle = Article.find.where()
					.eq("article_id", updateArticle.article_id )
					.findUnique();
			AccountAppId id = new AccountAppId(session("userId"), session("appId"));
			
//			if (Account.find.where().eq("id", (session("userId"))).findUnique().role==2) { // administrator may update the article
//				updateArticle.author = originArticle.author;
//			} else 
				
			if (AppProfile.find.byId(id).name != originArticle.author_name && Account.find.where().eq("id", (session("userId"))).findUnique().role!=2) {
				return status(ErrDefinition.E_ARTICLE_UPDATE_ERROR,
						Messages.get("articleupdate.failure"));
			}
			
		    Date updateTime = new Date();
		    updateArticle.update_time = updateTime;
			
			Ebean.update(updateArticle);
			
			return ok(Json.toJson(updateArticle));
		}
		catch (Throwable e) {
			return status(ErrDefinition.E_ARTICLE_UPDATE_ERROR,
					Messages.get("articleupdate.failure"));
		}		
	}
 
开发者ID:chengxp3,项目名称:galaxy,代码行数:39,代码来源:ArticleController.java

示例12: onHandleJoin

import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
private void onHandleJoin(ChatRoom.Join join) {
    
    //add the member
    if (!m_members.containsKey(join.userId)) {
        m_members.put(join.userId, join.channel);
    }
    else {
        return;
    }
    
    for (History history : recordList) {
        sendHistoryMessage(join.channel, history);
    }
    
    if (join.userId.compareToIgnoreCase(m_hostId) == 0) {
        onHostJoin(join);
    }
    else {
        onGuestJoin(join);
    }
    
    try {
        ChatRoomTime joinTime = ChatRoomTime.find.where()
                .eq("account_id", join.userId)
                .findUnique();
        if (joinTime == null) {
            joinTime = new ChatRoomTime();
            joinTime.id = CodeGenerator.GenerateUUId();
            joinTime.room_id = m_hostId;
            joinTime.action = "join";
            joinTime.action_time = new Date();
            joinTime.account =  Account.find.byId(join.userId);
            //joinTime.send_gift_number = CharmValue.find.where()
            //      .eq("sender_id", join.userId).findRowCount();
            Ebean.save(joinTime);
        } else {
            joinTime.action = "join";
            joinTime.action_time = new Date();
            joinTime.room_id = m_hostId;
            //joinTime.send_gift_number = CharmValue.find.where()
            //      .eq("sender_id", join.userId).findRowCount();
            Ebean.update(joinTime);
        }
    }
    catch (Throwable e) {
        Logger.info(e.getMessage());
    }
}
 
开发者ID:chengxp3,项目名称:galaxy,代码行数:49,代码来源:RaceChatModel.java

示例13: post

import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
public Result post() {
	Form<Comments> CommentForm = 
			Form.form(Comments.class).bindFromRequest();
	
	if (CommentForm.hasErrors()) {
		return status(ErrDefinition.E_COMMENT_FORM_ERROR,
				Messages.get("comment.failure"));
	}
	
	try {
		Comments comment = CommentForm.get();
		
		AccountAppId id = new AccountAppId(session("userId"), session("appId"));
		
		Article article = Article.find.where()
				.eq("article_id", comment.article_id)
				.findUnique();
		
		if (article == null) {
			return status(ErrDefinition.E_COMMENT_POST_ERROR,
					Messages.get("commentcreate.failure"));
		} else {
			article.last_reply = new Date();
			if (article.last_reply.getTime() > article.update_time.getTime())
				article.is_new_comments = true;
			if (article.comments_number == null)
				article.comments_number = 1;
			else
				article.comments_number += 1;
			Ebean.update(article);
		}

		comment.id = CodeGenerator.GenerateUUId();
		comment.comments = CodeGenerator.GenerateUUId();
		comment.author = Account.find.byId(session("userId"));
		comment.user_id = session("userId");
		comment.author_name = AppProfile.find.byId(id).name;
		comment.author_image = AppProfile.find.byId(id).head_image;
	    Date createTime = new Date();
		comment.create_time = createTime;
	    comment.update_time = createTime;
	    comment.last_reply = createTime;
	    comment.is_top = false;
	    comment.is_hidden = false;
	    Ebean.save(comment);
	    if(session("appId").equals("34536418-d6b2-451f-a400-4f0e284c9497")){
			Sign signItem = Sign.find.where().eq("account_id", session("userId")).eq("app_id", session("appId")).findUnique();
			if(signItem==null){
				signItem = new Sign();
				signItem.id = CodeGenerator.GenerateUUId();
				signItem.application = Application.find.where().eq("id", session("appId")).findUnique();
				signItem.user = Account.find.where().eq("id", session("userId")).findUnique();
				signItem.last_visit = new Date();
				signItem.sign_charm = 1;
				Ebean.save(signItem);
			}
			else {
				signItem.sign_charm += 1;	
				Ebean.update(signItem);
			}
		}
		
		return ok(Json.toJson(comment));
	}
	catch (Throwable e) {
		return status(ErrDefinition.E_COMMENT_POST_ERROR,
				Messages.get("commentcreate.failure"));
	}
}
 
开发者ID:chengxp3,项目名称:galaxy,代码行数:70,代码来源:CommentController.java

示例14: post

import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
public Result post() {
	Form<CommentsLevel2> CommentForm = 
			Form.form(CommentsLevel2.class).bindFromRequest();
	
	if (CommentForm.hasErrors()) {
		return status(ErrDefinition.E_COMMENT_FORM_ERROR,
				Messages.get("comment.failure"));
	}
	
	try {
		CommentsLevel2 comment = CommentForm.get();
		
		AccountAppId id = new AccountAppId(session("userId"), session("appId"));
		
		Comments comments = Comments.find.where()
				.eq("comments", comment.comments)
				.findUnique();
		
		if (comments == null) {
			return status(ErrDefinition.E_COMMENT_POST_ERROR,
					Messages.get("commentcreate.failure"));
		}
	    Article article = Article.find.where()
			  	.eq("article_id", comments.article_id)
				.findUnique();
		
		if (article == null) {
			return status(ErrDefinition.E_COMMENT_POST_ERROR,
					Messages.get("commentcreate.failure"));
		} else {
			article.last_reply = new Date();
			if (article.last_reply.getTime() > article.update_time.getTime())
				article.is_new_comments = true;
			if (article.comments_number == null)
				article.comments_number = 1;
			else
				article.comments_number += 1;
			Ebean.update(article);
		}

		comment.id = CodeGenerator.GenerateUUId();
		comment.comments = comments.comments;
		comment.author = Account.find.byId(session("userId"));
		comment.user_id = session("userId");
		comment.author_name = AppProfile.find.byId(id).name;
		comment.author_image = AppProfile.find.byId(id).head_image;
	    Date createTime = new Date();
		comment.create_time = createTime;
	    comment.update_time = createTime;
	    comment.last_reply = createTime;
	    comment.is_top = false;
	    comment.is_hidden = false;
	    if(session("appId").equals("34536418-d6b2-451f-a400-4f0e284c9497")){
			Sign signItem = Sign.find.where().eq("account_id", session("userId")).eq("app_id", session("appId")).findUnique();
			if(signItem==null){
				signItem = new Sign();
				signItem.id = CodeGenerator.GenerateUUId();
				signItem.application = Application.find.where().eq("id", session("appId")).findUnique();
				signItem.user = Account.find.where().eq("id", session("userId")).findUnique();
				signItem.last_visit = new Date();
				signItem.sign_charm = 1;
				Ebean.save(signItem);
			}
			else {
				signItem.sign_charm += 1;	
				Ebean.update(signItem);
			}
		}
		Ebean.save(comment);
		
		return ok(Json.toJson(comment));
	}
	catch (Throwable e) {
		return status(ErrDefinition.E_COMMENT_POST_ERROR,
				Messages.get("commentcreate.failure"));
	}
}
 
开发者ID:chengxp3,项目名称:galaxy,代码行数:78,代码来源:CommentLevel2Controller.java

示例15: post

import com.avaje.ebean.Ebean; //导入方法依赖的package包/类
public Result post() {
		Form<Article> ArticleForm = 
				Form.form(Article.class).bindFromRequest();
		
		if (ArticleForm.hasErrors()) {
			return status(ErrDefinition.E_ARTICLE_FORM_ERROR,
					Messages.get("article.failure"));
		}
		
		try {
			Article article = ArticleForm.get();
			if(article.theme_id == null) article.theme_id = "stockDefault"; 
			Theme theme = Theme.find.where()
					.eq("id", article.theme_id)
					.findUnique();
			
			if (theme==null) {
				return status(ErrDefinition.E_ARTICLE_NO_THEME_ERROR,
						Messages.get("articlepost.failure"));
			}
			
			AccountAppId id = new AccountAppId(session("userId"), session("appId"));
			AppProfile appProfile = AppProfile.find.byId(id);
			if(session("appId").equals("34536418-d6b2-451f-a400-4f0e284c9497")){
				Sign signItem = Sign.find.where().eq("account_id", session("userId")).eq("app_id", session("appId")).findUnique();
				signItem.sign_charm += 1;	
				Ebean.update(signItem);
			}
			
			article.id = CodeGenerator.GenerateUUId();
			article.article_id = CodeGenerator.GenerateUUId();
			article.author = Account.find.where().eq("id", (session("userId"))).findUnique();
			article.user_id = session("userId");
			article.application = Application.find.where().eq("id", (session("appId"))).findUnique();
			article.author_name = appProfile.name;
			article.author_image = appProfile.head_image;
//			article.author_image_base64 = appProfile.head_imgbase64;
			article.is_verified = appProfile.is_verified;
		    Date createTime = new Date();
			article.create_time = createTime;
		    article.update_time = createTime;
		    article.last_reply = createTime;
		    article.theme_name = theme.theme_name;
		    article.theme_image = theme.theme_image;
		    article.theme_class = theme.theme_class;
		    article.is_top = false;
		    article.is_elite = false;
		    article.is_public = false;
		    article.is_new_comments = false;
		    article.isSpecial = false;
		    article.thumbs_number = 0;
		    article.thumbs_number2 = 0;
		    article.comments_number = 0;
		    
		    theme.last_update = new Date();  //update theme latest time
		    
		    // Only administrator can send is_top flag
//		    UserGroup authorGroup = UserGroup.find.where()
//		    		.eq("account_id", article.author)
//		    		.findUnique();
		    
//		    if (authorGroup != null) {
//		    	if (authorGroup.group_name == "admin") {
//		    	}
//		    	else {
//		    		article.is_top = false;
//		    	}
//		    } else {
//		    	article.is_top = false;
//		    }
		    	
			Ebean.save(article);
			
			return ok(Json.toJson(article));
		}
		catch (Throwable e) {
			return status(ErrDefinition.E_ARTICLE_POST_ERROR,
					Messages.get("articlepost.failure"));
		}
	}
 
开发者ID:chengxp3,项目名称:galaxy,代码行数:81,代码来源:ArticleController.java


注:本文中的com.avaje.ebean.Ebean.update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。