當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。