示例#1
0
  @Override
  public void validateConcreteScmMaterial() {
    if (url == null || StringUtil.isBlank(url.forDisplay())) {
      errors().add(URL, "URL cannot be blank");
    }
    if (StringUtil.isBlank(userName)) {
      errors().add(USERNAME, "Username cannot be blank");
    }
    if (StringUtil.isBlank(projectPath)) {
      errors().add(PROJECT_PATH, "Project Path cannot be blank");
    }
    if (isNotEmpty(this.password) && isNotEmpty(this.encryptedPassword)) {
      addError("password", "You may only specify `password` or `encrypted_password`, not both!");
      addError(
          "encryptedPassword",
          "You may only specify `password` or `encrypted_password`, not both!");
    }

    if (isNotEmpty(this.encryptedPassword)) {
      try {
        goCipher.decrypt(encryptedPassword);
      } catch (Exception e) {
        addError(
            "encryptedPassword",
            format(
                "Encrypted password value for TFS material with url '%s' is invalid. This usually happens when the cipher text is modified to have an invalid value.",
                this.getUriForDisplay()));
      }
    }
  }
示例#2
0
 @Override
 protected String getLocation() {
   return url == null ? null : url.forDisplay();
 }
示例#3
0
 @Override
 public String getLongDescription() {
   return String.format(
       "URL: %s, Username: %s, Domain: %s, ProjectPath: %s",
       url.forDisplay(), userName, domain, projectPath);
 }