Пример #1
0
  public static PlayerUserDto mapToAdminDto(PlayerUser playerUser) {
    PlayerUserDto dto = mapToDto(playerUser);
    dto.setEmail(playerUser.getEmail());

    dto.setEmailNotification(playerUser.getEmailNotification());
    return dto;
  }
Пример #2
0
  @Post(value = "json")
  public ValidatePlayerDto validate(ValidatePlayerDto dto) {
    log.info("Validating player: " + dto.getValue());
    PlayerUser playerToClaim =
        ofy().load().type(PlayerUser.class).filter("player", dto.getValue()).first().now();
    if (playerToClaim == null) {
      log.info("No player found. This player can be created");
      dto.setIsValid(true);
    } else if (playerToClaim != null && Strings.isNullOrEmpty(playerToClaim.getAppUserId())) {
      log.info("Found player: " + playerToClaim.getPlayer() + ", " + playerToClaim.getAppUserId());
      dto.setIsValid(true);
    } else {
      dto.setIsValid(false);
    }

    return dto;
  }
Пример #3
0
 public static PlayerUser mapFromAdminDto(PlayerUserDto dto) {
   PlayerUser playerUser = new PlayerUser();
   playerUser.setPlayer(dto.getPlayer());
   playerUser.setEmail(dto.getEmail());
   playerUser.setImageUrl(dto.getImageUrl());
   playerUser.setEmailNotification(dto.getEmailNotification());
   dto.setMeetingPointNotification(playerUser.getMeetingPointNotification());
   dto.setPushBulletApiKey(playerUser.getPushBulletApiKey());
   return playerUser;
 }
Пример #4
0
 public static PlayerUserDto mapToDto(PlayerUser playerUser) {
   PlayerUserDto dto = new PlayerUserDto();
   dto.setPlayer(playerUser.getPlayer());
   dto.setEmail(playerUser.getEmail());
   dto.setAppUserEmail(playerUser.getAppUserEmail());
   dto.setImageUrl(playerUser.getImageUrl());
   dto.setEmailNotification(playerUser.getEmailNotification());
   dto.setMeetingPointNotification(playerUser.getMeetingPointNotification());
   dto.setPushBulletApiKey(playerUser.getPushBulletApiKey());
   return dto;
 }
Пример #5
0
 public static void savePlayerUser(PlayerUserDto playerUserDto, String player) {
   PlayerUser playerUser =
       ofy().load().type(PlayerUser.class).filter("player == ", player).first().now();
   if (playerUser == null) {
     playerUser = new PlayerUser();
     playerUser.setPlayer(player);
   }
   playerUser.setEmail(playerUserDto.getEmail());
   playerUser.setImageUrl(playerUserDto.getImageUrl());
   playerUser.setEmailNotification(playerUserDto.getEmailNotification());
   playerUser.setMeetingPointNotification(playerUserDto.getMeetingPointNotification());
   playerUser.setPushBulletApiKey(playerUserDto.getPushBulletApiKey());
   ofy().save().entities(playerUser).now();
 }