Пример #1
0
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    if (!super.equals(o)) {
      return false;
    }

    TfsMaterialConfig material = (TfsMaterialConfig) o;

    if (projectPath != null
        ? !projectPath.equals(material.projectPath)
        : material.projectPath != null) {
      return false;
    }
    if (url != null ? !url.equals(material.url) : material.url != null) {
      return false;
    }
    if (userName != null ? !userName.equals(material.userName) : material.userName != null) {
      return false;
    }
    if (domain != null ? !domain.equals(material.domain) : material.domain != null) {
      return false;
    }
    return true;
  }
Пример #2
0
 @Override
 protected void appendCriteria(Map<String, Object> parameters) {
   parameters.put(ScmMaterialConfig.URL, url.forCommandline());
   parameters.put(ScmMaterialConfig.USERNAME, userName);
   parameters.put(DOMAIN, domain);
   parameters.put(PROJECT_PATH, projectPath);
 }
Пример #3
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()));
      }
    }
  }
Пример #4
0
 @Override
 public int hashCode() {
   int result = super.hashCode();
   result = 31 * result + (url != null ? url.hashCode() : 0);
   result = 31 * result + (userName != null ? userName.hashCode() : 0);
   result = 31 * result + (domain != null ? domain.hashCode() : 0);
   result = 31 * result + (projectPath != null ? projectPath.hashCode() : 0);
   return result;
 }
Пример #5
0
 @Override
 protected String getLocation() {
   return url == null ? null : url.forDisplay();
 }
Пример #6
0
 @Override
 public String getLongDescription() {
   return String.format(
       "URL: %s, Username: %s, Domain: %s, ProjectPath: %s",
       url.forDisplay(), userName, domain, projectPath);
 }
Пример #7
0
 @Override
 public String getUrl() {
   return url != null ? url.forCommandline() : null;
 }