Ejemplo n.º 1
0
  @Override
  public void populate(XMLParser xmlParser) throws ValidationException {

    List<ValidationError> errors = new ArrayList<ValidationError>();

    description =
        XMLValidationUtils.validateParameter(
            "description", xmlParser, false, 1, 65535, StringPopulator.getPopulator(), errors);
    helpText =
        XMLValidationUtils.validateParameter(
            "helpText", xmlParser, false, 1, 65535, StringPopulator.getPopulator(), errors);

    XMLParser serviceParser = xmlParser.getNode("AllowedSearchServices");

    if (serviceParser != null) {

      allowedSearchServices =
          XMLValidationUtils.validateParameters(
              "allowedSearchService",
              serviceParser,
              false,
              PUDQueryCRUD.SEARCH_SERVICE_POPULATOR,
              errors);
    }

    if (!errors.isEmpty()) {

      throw new ValidationException(errors);
    }
  }
  @Override
  public void populate(XMLParser xmlParser) throws ValidationException {

    List<ValidationError> errors = new ArrayList<ValidationError>();

    description =
        XMLValidationUtils.validateParameter(
            "description", xmlParser, false, 1, 65535, StringPopulator.getPopulator(), errors);
    helpText =
        XMLValidationUtils.validateParameter(
            "helpText", xmlParser, false, 1, 65535, StringPopulator.getPopulator(), errors);
    maxParties = xmlParser.getInteger("maxParties");

    if (!errors.isEmpty()) {

      throw new ValidationException(errors);
    }
  }
Ejemplo n.º 3
0
  public static String validateParameter(
      String fieldName,
      HttpServletRequest req,
      boolean required,
      Integer minLength,
      Integer maxLength,
      Collection<ValidationError> errors) {

    return validateParameter(
        fieldName, req, required, minLength, maxLength, StringPopulator.getPopulator(), errors);
  }