Package org.sonatype.configuration.validation

Examples of org.sonatype.configuration.validation.ValidationResponse.addValidationError()


      try {
        new URL(config.getBaseUrl());
      }
      catch (MalformedURLException e) {
        ValidationMessage msg = new ValidationMessage("baseUrl", "Base Url is not valid: " + e.getMessage());
        response.addValidationError(msg);
      }
    }

    if (StringUtils.isEmpty(config.getEmailDomain())) {
      ValidationMessage msg = new ValidationMessage("emailDomain", "Email domain cannot be empty.");
View Full Code Here


      }
    }

    if (StringUtils.isEmpty(config.getEmailDomain())) {
      ValidationMessage msg = new ValidationMessage("emailDomain", "Email domain cannot be empty.");
      response.addValidationError(msg);
    }

    if (StringUtils.isEmpty(config.getDefaultRole())) {
      ValidationMessage msg = new ValidationMessage("defaultRole", "Default role cannot be empty.");
      response.addValidationError(msg);
View Full Code Here

      response.addValidationError(msg);
    }

    if (StringUtils.isEmpty(config.getDefaultRole())) {
      ValidationMessage msg = new ValidationMessage("defaultRole", "Default role cannot be empty.");
      response.addValidationError(msg);
    }
    else {
      // check that this is a valid role
      try {
        this.securitySystem.getAuthorizationManager("default").getRole(config.getDefaultRole());
View Full Code Here

        this.securitySystem.getAuthorizationManager("default").getRole(config.getDefaultRole());
      }
      catch (Exception e) {
        log.debug("Failed to find role {} during validation.", config.getDefaultRole(), e);
        ValidationMessage msg = new ValidationMessage("defaultRole", "Failed to find role.");
        response.addValidationError(msg);
      }
    }

    return response;
  }
View Full Code Here

      throws InvalidConfigurationException
  {
    final ValidationResponse vr = new ValidationResponse();

    if (type == null) {
      vr.addValidationError(new ValidationMessage("typeId", "Type must be provided"));
    }
    else {
      if (capabilityFactoryRegistry.get(type) == null || capabilityDescriptorRegistry.get(type) == null) {
        vr.addValidationError(new ValidationMessage("typeId", "Type '" + type + "' is not supported"));
      }
View Full Code Here

    if (type == null) {
      vr.addValidationError(new ValidationMessage("typeId", "Type must be provided"));
    }
    else {
      if (capabilityFactoryRegistry.get(type) == null || capabilityDescriptorRegistry.get(type) == null) {
        vr.addValidationError(new ValidationMessage("typeId", "Type '" + type + "' is not supported"));
      }
    }

    if (!vr.getValidationErrors().isEmpty()) {
      throw new InvalidConfigurationException(vr);
View Full Code Here

      for (final Validator validator : validators) {
        final ValidationResult validationResult = validator.validate(properties);
        if (!validationResult.isValid()) {
          for (final ValidationResult.Violation violation : validationResult.violations()) {
            vr.addValidationError(new ValidationMessage(
                violation.key(),
                violation.message()
            ));
          }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.