コード例 #1
0
  @Override
  public List<String> getInvalidityInfo() {
    // id is allowed to be null when the student is not registered
    Assumption.assertTrue(team != null);
    Assumption.assertTrue(comments != null);

    FieldValidator validator = new FieldValidator();
    List<String> errors = new ArrayList<String>();
    String error;

    if (isRegistered()) {
      error = validator.getInvalidityInfoForGoogleId(googleId);

      if (!error.isEmpty()) {
        errors.add(error);
      }
    }

    error = validator.getInvalidityInfoForCourseId(course);

    if (!error.isEmpty()) {
      errors.add(error);
    }

    error = validator.getInvalidityInfoForEmail(email);

    if (!error.isEmpty()) {
      errors.add(error);
    }

    error = validator.getInvalidityInfoForTeamName(team);

    if (!error.isEmpty()) {
      errors.add(error);
    }

    error = validator.getInvalidityInfoForSectionName(section);

    if (!error.isEmpty()) {
      errors.add(error);
    }

    error = validator.getInvalidityInfoForStudentRoleComments(comments);

    if (!error.isEmpty()) {
      errors.add(error);
    }

    error = validator.getInvalidityInfoForPersonName(name);

    if (!error.isEmpty()) {
      errors.add(error);
    }

    return errors;
  }
コード例 #2
0
  @Override
  public List<String> getInvalidityInfo() {
    FieldValidator validator = new FieldValidator();
    List<String> errors = new ArrayList<String>();
    String error;

    error = validator.getInvalidityInfoForGoogleId(googleId);
    if (!error.isEmpty()) {
      errors.add(error);
    }

    // accept empty string values as it means the user has not specified anything yet.

    if (!shortName.isEmpty()) {
      error = validator.getInvalidityInfoForPersonName(shortName);
      if (!error.isEmpty()) {
        errors.add(error);
      }
    }

    if (!email.isEmpty()) {
      error = validator.getInvalidityInfoForEmail(email);
      if (!error.isEmpty()) {
        errors.add(error);
      }
    }

    if (!institute.isEmpty()) {
      error = validator.getInvalidityInfoForInstituteName(institute);
      if (!error.isEmpty()) {
        errors.add(error);
      }
    }

    if (!nationality.isEmpty()) {
      error = validator.getInvalidityInfoForNationality(nationality);
      if (!error.isEmpty()) {
        errors.add(error);
      }
    }

    error = validator.getInvalidityInfoForGender(gender);
    if (!error.isEmpty()) {
      errors.add(error);
    }

    Assumption.assertNotNull(this.pictureKey);

    // No validation for modified date as it is determined by the system.
    // No validation for More Info. It will properly sanitized.

    return errors;
  }