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


Java Status.SUCCESS_OK属性代码示例

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


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

示例1: updateScore

@Put
public Status updateScore(UpdateScoreEntity entity) throws SQLException {
	if (entity == null) throw new BadEntityException("ENTITY_NOT_FOUND");

	if (mEvents.getEvent(mEventId) == null) throw new NotFoundException("EVENT_NOT_FOUND");
	if (!mEvents.roundExists(mEventId, mRoundId)) throw new NotFoundException("ROUND_NOT_FOUND");
	if (mEvents.getRegistered(mEventId, mUserId) == null) throw new NotFoundException("USER_NOT_REGISTERED");
	
	if (mEvents.getScore(mRoundId, mUserId) != null) mEvents.updateScore(mRoundId, mUserId, entity.score);
	else mEvents.addScore(mRoundId, mUserId, entity.score);
	
	try {
		mRabbitMQManager.basicPublish("Pub", "", null, new TopicPacket("event-score-v1." + mEventId, new UpdateScoreMessage(mEventId, mRoundId, mUserId, entity.score)));
	} catch (IOException e) {
		Server.LOGGER.log(Level.SEVERE, "Cannot send publish to RabbitMQ", e);
	}

	return Status.SUCCESS_OK;
}
 
开发者ID:FightForSub,项目名称:FFS-Api,代码行数:19,代码来源:EventRoundUserScoreResource.java

示例2: updateEvent

@Put
public Status updateEvent(UpdateEventEntity entity) throws SQLException {
	ValidationUtils.verifyGroup(getRequest(), ApiV1.ADMIN);
	ValidationErrors err = new ValidationErrors();
	
	if (entity == null) throw new BadEntityException("ENTITY_NOT_FOUND");
	
	err.verifyFieldEmptyness("name", entity.name, 3, 200);
	err.verifyFieldEmptyness("description", entity.description, 3, 2048);
	
	err.checkErrors("EVENT_UPDATE_ERROR");
	
	EventBean bean = mEvents.getEvent(mEventId);
	if (bean == null) throw new NotFoundException("EVENT_NOT_FOUND");
	bean.setCurrent(entity.current);
	bean.setDescription(entity.description);
	bean.setName(entity.name);
	bean.setReservedToAffiliates(entity.reserved_to_affiliates);
	bean.setReservedToPartners(entity.reserved_to_partners);
	bean.setStatus(entity.status);
	bean.setMinimumViews(entity.minimum_views);
	bean.setMinimumFollowers(entity.minimum_followers);
	mEvents.update(bean);
	return Status.SUCCESS_OK;
}
 
开发者ID:FightForSub,项目名称:FFS-Api,代码行数:25,代码来源:EventResource.java

示例3: updatePariticipationStatus

@Put
public Status updatePariticipationStatus(EmailValidationBean bean) throws SQLException {
	if (bean == null) throw new BadEntityException("EVENT_NOT_FOUND");
	ValidationErrors err = new ValidationErrors();
	
	err.verifyFieldEmptyness("key", bean.key, 5, 36);
	
	err.checkErrors("INVALID_KEY");

	AccountBean acc = (AccountBean) getRequest().getAttributes().get("account");
	UserStatus status = mEvents.getUserStatusFromEmailKey(mEventId, acc.getTwitchId(), bean.key);
	if (status == null) throw new NotFoundException("UNKNOWN_KEY");
	if (status != UserStatus.AWAITING_FOR_EMAIL_VALIDATION) throw new ConflictException("BAD_STATUS");
	
	mEvents.updateUser(mEventId, acc.getTwitchId(), UserStatus.VALIDATED);
	try {
		EventBean event = mEvents.getEvent(mEventId);
		MimeMessage message = mEmailsService.generateMime("Validez votre compte!",
				mValidatedEmail.replaceAll("\\{EVENT_NAME\\}", event.getName())
				.replaceAll("\\{EVENT_ID\\}", event.getId() + ""), "text/html", acc.getEmail());
		mEmailsService.sendEmail(message);
	} catch (MessagingException e) {
		Main.LOGGER.log(Level.SEVERE, "Cannot send email.", e);
	}
	return Status.SUCCESS_OK;
}
 
开发者ID:FightForSub,项目名称:FFS-Api,代码行数:26,代码来源:EventRegisterResource.java

示例4: deleteRound

@Delete
public Status deleteRound() throws SQLException {
	ValidationUtils.verifyGroup(getRequest(), ApiV1.ADMIN);
	if (!mEvents.roundExists(mEventId, mRoundId)) throw new NotFoundException("ROUND_NOT_FOUND");
	mEvents.deleteRound(mEventId, mRoundId);
	return Status.SUCCESS_OK;
}
 
开发者ID:FightForSub,项目名称:FFS-Api,代码行数:7,代码来源:EventRoundResource.java

示例5: deleteUser

@Delete
public Status deleteUser() throws SQLException {
	ValidationUtils.verifyGroup(getRequest(), ApiV1.MODERATOR);

	AccountStatusBean bean = mEvents.getRegistered(mEventId, mUserId);
	if (bean == null) throw new NotFoundException("USER_NOT_REGISTERED");
	
	mEvents.removeUser(mEventId, mUserId);
	return Status.SUCCESS_OK;
}
 
开发者ID:FightForSub,项目名称:FFS-Api,代码行数:10,代码来源:EventUserResource.java

示例6: validateEmail

@Get
public Status validateEmail() throws SQLException {
	String code = getQuery().getValues("code");
	if (code == null) throw new BadEntityException("CODE_NOT_FOUND");
	AccountBean bean = mAccounts.getFromValidationCode(code);
	if (bean != null) {
		if (bean.getGrade() != 0) throw new ConflictException("CODE_ALREADY_VALIDATED");
		bean.setGrade(ApiV1.USER);
		mAccounts.update(bean);
	} else throw new NotFoundException("CODE_UNKNOWN");
	return Status.SUCCESS_OK;
}
 
开发者ID:FightForSub,项目名称:FFS-Api,代码行数:12,代码来源:LoginResource.java

示例7: deleteEvent

@Delete
public Status deleteEvent() throws SQLException {
  		ValidationUtils.verifyGroup(getRequest(), ApiV1.ADMIN);
	mEvents.delete(mEventId);
	return Status.SUCCESS_OK;
}
 
开发者ID:FightForSub,项目名称:FFS-Api,代码行数:6,代码来源:EventResource.java


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