Package org.sonatype.nexus.capability.support.validator

Examples of org.sonatype.nexus.capability.support.validator.DefaultValidationResult


    if (serverId != null) {
      try {
        ldapConfigurationManager.getLdapServerConfiguration(serverId);
      }
      catch (LdapServerNotFoundException e) {
        return new DefaultValidationResult().add(key, messages.invalidValue(serverId));
      }
      catch (InvalidConfigurationException ignore) {
        //ignore as we do not expect an invalid configuration on get
      }
    }
View Full Code Here


    try {
      new AliasMappings(properties.get(key));
      return ValidationResult.VALID;
    }
    catch (IllegalArgumentException e) {
      return new DefaultValidationResult().add(key, e.getMessage());
    }
  }
View Full Code Here

  @Override
  public ValidationResult validate(final Map<String, String> properties) {
    if (properties != null) {
      final String value = properties.get(key);
      if (value == null || value.trim().length() == 0) {
        return new DefaultValidationResult().add(key, label + " is required");
      }
    }
    return ValidationResult.VALID;
  }
View Full Code Here

    String value = properties.get(key);
    if (StringUtils.isNotEmpty(value)) {
      try {
        Integer integerValue = Integer.valueOf(value);
        if (integerValue < 0) {
          return new DefaultValidationResult().add(key, messages.invalidReasonLTZero(label));
        }
      }
      catch (NumberFormatException e) {
        return new DefaultValidationResult().add(key, messages.invalidReason(label, e.getMessage()));
      }
    }
    return ValidationResult.VALID;
  }
View Full Code Here

    }
  }

  @Override
  public ValidationResult validate(final Map<String, String> properties) {
    final DefaultValidationResult result = new DefaultValidationResult();
    for (final Validator validator : validators) {
      final ValidationResult validationResult = validator.validate(properties);
      if (!validationResult.isValid()) {
        result.add(validationResult.violations());
      }
    }
    if(result.isValid())
    {
      return ValidationResult.VALID;
    }
    return result;
  }
View Full Code Here

    if (StringUtils.isNotEmpty(value)) {
      try {
        new URL(value);
      }
      catch (MalformedURLException e) {
        return new DefaultValidationResult().add(key, messages.invalidReason(label, e.getMessage()));
      }
    }
    return ValidationResult.VALID;
  }
View Full Code Here

    String repositoryId = properties.get(propertyKey);
    if (repositoryId != null) {
      try {
        final Repository repository = repositoryRegistry.getRepository(repositoryId);
        if (!repository.getRepositoryKind().isFacetAvailable(facet)) {
          return new DefaultValidationResult().add(propertyKey, buildMessage(repository));
        }
      }
      catch (NoSuchRepositoryException ignore) {
        // ignore
      }
View Full Code Here

    if (StringUtils.isNotEmpty(value)) {
      try {
        new URI(value);
      }
      catch (URISyntaxException e) {
        return new DefaultValidationResult().add(key, messages.invalidReason(label, e.getMessage()));
      }
    }
    return ValidationResult.VALID;
  }
View Full Code Here

    if (references == null
        || references.isEmpty()
        || (references.size() == 1 && references.iterator().next().context().id().equals(excludeId))) {
      return ValidationResult.VALID;
    }
    return new DefaultValidationResult().add(buildMessage(properties));
  }
View Full Code Here

    if (StringUtils.isNotEmpty(value)) {
      try {
        Integer.valueOf(value);
      }
      catch (NumberFormatException e) {
        return new DefaultValidationResult().add(key, messages.invalidReason(label, e.getMessage()));
      }
    }
    return ValidationResult.VALID;
  }
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.capability.support.validator.DefaultValidationResult

Copyright © 2018 www.massapicom. 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.