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


Java NotBlank类代码示例

本文整理汇总了Java中org.hibernate.validator.constraints.NotBlank的典型用法代码示例。如果您正苦于以下问题:Java NotBlank类的具体用法?Java NotBlank怎么用?Java NotBlank使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: defendantResponseCopy

import org.hibernate.validator.constraints.NotBlank; //导入依赖的package包/类
@ApiOperation("Returns a Defendant Response copy for a given claim external id")
@GetMapping(
    value = "/defendantResponseCopy/{externalId}",
    produces = MediaType.APPLICATION_PDF_VALUE
)
public ResponseEntity<ByteArrayResource> defendantResponseCopy(
    @ApiParam("Claim external id")
    @PathVariable("externalId") @NotBlank String externalId
) {
    byte[] pdfDocument = documentsService.generateDefendantResponseCopy(externalId);

    return ResponseEntity
        .ok()
        .contentLength(pdfDocument.length)
        .body(new ByteArrayResource(pdfDocument));
}
 
开发者ID:hmcts,项目名称:cmc-claim-store,代码行数:17,代码来源:DocumentsController.java

示例2: claimIssueReceipt

import org.hibernate.validator.constraints.NotBlank; //导入依赖的package包/类
@ApiOperation("Returns a Claim Issue receipt for a given claim external id")
@GetMapping(
    value = "/claimIssueReceipt/{externalId}",
    produces = MediaType.APPLICATION_PDF_VALUE
)
public ResponseEntity<ByteArrayResource> claimIssueReceipt(
    @ApiParam("Claim external id")
    @PathVariable("externalId") @NotBlank String externalId
) {
    byte[] pdfDocument = documentsService.generateClaimIssueReceipt(externalId);

    return ResponseEntity
        .ok()
        .contentLength(pdfDocument.length)
        .body(new ByteArrayResource(pdfDocument));
}
 
开发者ID:hmcts,项目名称:cmc-claim-store,代码行数:17,代码来源:DocumentsController.java

示例3: createMessage

import org.hibernate.validator.constraints.NotBlank; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public String createMessage(
        @NotBlank final String senderId,
        @NotNull @Valid SendMessageDTO sendMessageDTO
) throws ResourceNotFoundException, ResourceConflictException {
    log.info("Called with senderId {}, sendMessageDTO {}", senderId, sendMessageDTO);

    final UserEntity user = this.findUser(senderId);
    final MessageEntity message = this.sendMessageDtoToMessageEntity(sendMessageDTO);

    message.setSender(user);

    if(message.getRecipient().getUniqueId().equals(senderId)) {
        throw new ResourceConflictException("The recipient's ID can't be the same as the sender's ID");
    }

    user.getSentMessages().add(message);

    this.userRepository.save(user);
    return Iterables.getLast(user.getSentMessages()).getUniqueId();
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:25,代码来源:MessagePersistenceServiceImpl.java

示例4: deleteMessageSent

import org.hibernate.validator.constraints.NotBlank; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void deleteMessageSent(
        @NotBlank final String messageId,
        @NotBlank final String userId
) throws ResourceNotFoundException {
    log.info("Called with messageId {}, userId {}", messageId, userId);

    final UserEntity user = this.findUser(userId);
    final MessageEntity message
            = this.messageRepository.findByUniqueIdAndSenderAndIsVisibleForSenderTrue(messageId, user)
                     .orElseThrow(() -> new ResourceNotFoundException("No message sent found with id " + messageId));

    message.setVisibleForSender(false);

    this.messageRepository.save(message);
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:20,代码来源:MessagePersistenceServiceImpl.java

示例5: deleteMessageReceived

import org.hibernate.validator.constraints.NotBlank; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void deleteMessageReceived(
        @NotBlank final String messageId,
        @NotBlank final String userId
) throws ResourceNotFoundException {
    log.info("Called with messageId {}, userId {}", messageId, userId);

    final UserEntity user = this.findUser(userId);
    final MessageEntity message
            = this.messageRepository.findByUniqueIdAndRecipientAndIsVisibleForRecipientTrue(messageId, user)
                     .orElseThrow(() -> new ResourceNotFoundException("No message received found with id " + messageId));

    message.setVisibleForRecipient(false);

    this.messageRepository.save(message);
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:20,代码来源:MessagePersistenceServiceImpl.java

示例6: addUser

import org.hibernate.validator.constraints.NotBlank; //导入依赖的package包/类
/**
 * 添加用户
 *
 * @param userName
 * @param userPassword
 * @return
 */
@PostMapping(PathRoute.USER_ADD)
public Object addUser(@RequestParam("userName") @NotBlank(message = "用户名不能为空") String userName,
                      @RequestParam("userPassword") @NotBlank(message = "用户密码不能为空") String userPassword) {
    try {
        User user = new User();
        user.setUserName(userName);
        user.setUserPassword(userPassword);
        user.setCreateTime(new Date());
        user.setUpdateTime(new Date());
        user.setIsdelete(0);
        userService.insertAllColumn(user);
        return ResultResponse.success("添加用户成功", user.getId());
    } catch (Exception e) {
        logger.error("添加用户失败", e);
    }
    return ResultResponse.error("添加用户失败");
}
 
开发者ID:timtu,项目名称:spring-boot-wechat,代码行数:25,代码来源:UserController.java

示例7: getMessageReceived

import org.hibernate.validator.constraints.NotBlank; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
@Transactional(readOnly = false)
public MessageReceived getMessageReceived(
        @NotBlank final String messageId,
        @NotBlank final String userId
) throws ResourceNotFoundException {
    log.info("Called with messageId {}, userId {}", messageId, userId);

    final UserEntity user = this.findUser(userId);

    final MessageEntity message
            = this.messageRepository.findByUniqueIdAndRecipientAndIsVisibleForRecipientTrue(messageId, user)
            .orElseThrow(() -> new ResourceNotFoundException("No message found with id " + messageId));

    if(message.getDateOfRead() == null) {
        message.setDateOfRead(new Date());
    }

    return ServiceUtils.toMessageReceivedDto(message);
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:24,代码来源:MessageSearchServiceImpl.java

示例8: getMessagesReceived

import org.hibernate.validator.constraints.NotBlank; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public List<MessageReceived> getMessagesReceived(
        @NotBlank final String userId,
        @Nullable final String content
) throws ResourceNotFoundException {
    log.info("Called with userId {}, content {}", userId, content);

    @SuppressWarnings("unchecked") final List<MessageEntity> messageEntities = this.messageRepository.findAll(
            MessageSpecs.findReceivedMessagesForUser(
                    this.findUser(userId),
                    content,
                    content)
    );

    final List<MessageReceived> collect = messageEntities
            .stream()
            .map(ServiceUtils::toMessageReceivedDto)
            .sorted(Comparator.comparing(Message::getDate))
            .collect(Collectors.toList());

    Collections.reverse(collect);

    return collect;
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:28,代码来源:MessageSearchServiceImpl.java

示例9: updateNewEmail

import org.hibernate.validator.constraints.NotBlank; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void updateNewEmail(
        @NotBlank final String id,
        @NotNull @Valid final ChangeEmailDTO changeEmailDTO
) throws ResourceNotFoundException, ResourceConflictException {
    log.info("Called with id {}, changeEmailDTO {}", id, changeEmailDTO);

    final UserEntity user = this.findUser(id);

    if(this.userRepository.existsByEmailIgnoreCase(changeEmailDTO.getEmail())) {
        throw new ResourceConflictException("The e-mail " + changeEmailDTO.getEmail() + " exists");
    }

    user.setEmailChangeToken(RandomUtils.randomToken());
    user.setNewEmail(changeEmailDTO.getEmail());

    this.mailService.sendMailWithEmailChangeToken(user.getEmail(), user.getEmailChangeToken());
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:22,代码来源:UserPersistenceServiceImpl.java

示例10: updatePassword

import org.hibernate.validator.constraints.NotBlank; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void updatePassword(
        @NotBlank final String id,
        @NotNull @Valid final ChangePasswordDTO changePasswordDTO
) throws ResourceNotFoundException, ResourceBadRequestException {
    log.info("Called with id {}, changePasswordDTO {}", id, changePasswordDTO);

    final UserEntity user = this.findUser(id);

    if(!EncryptUtils.matches(changePasswordDTO.getOldPassword(), user.getPassword())) {
        throw new ResourceBadRequestException("The entered password doesn't match the old password");
    }

    user.setPassword(EncryptUtils.encrypt(changePasswordDTO.getNewPassword()));
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:19,代码来源:UserPersistenceServiceImpl.java

示例11: addInvitation

import org.hibernate.validator.constraints.NotBlank; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void addInvitation(
        @NotBlank final String fromId,
        @NotBlank final String toId
) throws ResourceNotFoundException, ResourceConflictException {
    log.info("Called with fromId {}, toId {}", fromId, toId);

    final UserEntity fromUser = this.findUser(fromId);
    final UserEntity toUser = this.findUser(toId);

    if(toUser.getSentInvitations().contains(fromUser)) {
        throw new ResourceConflictException("There is an invitation from the user with ID " + toUser.getUniqueId());
    }

    fromUser.addSentInvitation(toUser);
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:20,代码来源:UserPersistenceServiceImpl.java

示例12: createMovie

import org.hibernate.validator.constraints.NotBlank; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void createMovie(
        @NotNull @Valid final MovieDTO movieDTO,
        @NotBlank final String userId
) throws ResourceNotFoundException {
    log.info("Called with {}, userId {}", movieDTO, userId);

    final UserEntity user = this.findUser(userId);

    final MovieEntity movie = new MovieEntity();

    movie.setTitle(movieDTO.getTitle());
    movie.setType(movieDTO.getType());

    this.movieRepository.save(movie);
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:20,代码来源:MoviePersistenceServiceImpl.java

示例13: updateMovieStatus

import org.hibernate.validator.constraints.NotBlank; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void updateMovieStatus(
        @Min(1) final Long movieId,
        @NotBlank final String userId,
        @NotNull final VerificationStatus status
) throws ResourceForbiddenException, ResourceNotFoundException {
    log.info("Called with movieId {}, userId {}, status {}", movieId, userId, status);

    final UserEntity user = this.findUser(userId);
    final MovieEntity movie = this.findMovie(movieId, DataStatus.WAITING);

    if(!user.getPermissions().contains(UserMoviePermission.ALL)
            && !user.getPermissions().contains(UserMoviePermission.NEW_MOVIE)) {
        throw new ResourceForbiddenException("No permissions");
    }

    movie.setStatus(status.getDataStatus());
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:22,代码来源:MoviePersistenceServiceImpl.java

示例14: countyCourtJudgement

import org.hibernate.validator.constraints.NotBlank; //导入依赖的package包/类
@ApiOperation("Returns a County Court Judgement for a given claim external id")
@GetMapping(
    value = "/ccj/{externalId}",
    produces = MediaType.APPLICATION_PDF_VALUE
)
public ResponseEntity<ByteArrayResource> countyCourtJudgement(
    @ApiParam("Claim external id")
    @PathVariable("externalId") @NotBlank String externalId
) {
    byte[] pdfDocument = documentsService.generateCountyCourtJudgement(externalId);

    return ResponseEntity
        .ok()
        .contentLength(pdfDocument.length)
        .body(new ByteArrayResource(pdfDocument));
}
 
开发者ID:hmcts,项目名称:cmc-claim-store,代码行数:17,代码来源:DocumentsController.java

示例15: getInvitations

import org.hibernate.validator.constraints.NotBlank; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public List<User> getInvitations(
        @NotBlank final String id,
        @NotNull final Boolean outgoing
) throws ResourceNotFoundException {
    log.info("Called with id {}, outgoing {}", id, outgoing);

    if(outgoing) {
        return this.findUser(id).getSentInvitations()
                .stream()
                .map(ServiceUtils::toUserDto)
                .collect(Collectors.toList());
    } else {
        return this.findUser(id).getReceivedInvitations()
                .stream()
                .map(ServiceUtils::toUserDto)
                .collect(Collectors.toList());
    }
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:23,代码来源:UserSearchServiceImpl.java


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