All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.graylog2.users.AutoValue_UserOverviewDTO Maven / Gradle / Ivy

There is a newer version: 6.0.1
Show newest version
package org.graylog2.users;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
import java.util.Optional;
import java.util.Set;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import org.graylog2.plugin.database.users.User;
import org.mongojack.Id;
import org.mongojack.ObjectId;

@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_UserOverviewDTO extends UserOverviewDTO {

  private final String id;

  private final Optional authServiceId;

  private final Optional authServiceUid;

  private final String username;

  private final String email;

  private final Optional firstName;

  private final Optional lastName;

  private final Optional fullName;

  private final Boolean externalUser;

  private final Set roles;

  private final Boolean readOnly;

  private final Boolean sessionActive;

  private final Date lastActivity;

  private final String clientAddress;

  private final User.AccountStatus accountStatus;

  private final boolean serviceAccount;

  private AutoValue_UserOverviewDTO(
      @Nullable String id,
      Optional authServiceId,
      Optional authServiceUid,
      String username,
      String email,
      Optional firstName,
      Optional lastName,
      Optional fullName,
      @Nullable Boolean externalUser,
      Set roles,
      @Nullable Boolean readOnly,
      @Nullable Boolean sessionActive,
      @Nullable Date lastActivity,
      @Nullable String clientAddress,
      User.AccountStatus accountStatus,
      boolean serviceAccount) {
    this.id = id;
    this.authServiceId = authServiceId;
    this.authServiceUid = authServiceUid;
    this.username = username;
    this.email = email;
    this.firstName = firstName;
    this.lastName = lastName;
    this.fullName = fullName;
    this.externalUser = externalUser;
    this.roles = roles;
    this.readOnly = readOnly;
    this.sessionActive = sessionActive;
    this.lastActivity = lastActivity;
    this.clientAddress = clientAddress;
    this.accountStatus = accountStatus;
    this.serviceAccount = serviceAccount;
  }

  @Id
  @ObjectId
  @Nullable
  @JsonProperty("id")
  @Override
  public String id() {
    return id;
  }

  @JsonProperty("auth_service_id")
  @Override
  public Optional authServiceId() {
    return authServiceId;
  }

  @JsonProperty("auth_service_uid")
  @Override
  public Optional authServiceUid() {
    return authServiceUid;
  }

  @JsonProperty("username")
  @Override
  public String username() {
    return username;
  }

  @JsonProperty("email")
  @Override
  public String email() {
    return email;
  }

  @JsonProperty("first_name")
  @Override
  public Optional firstName() {
    return firstName;
  }

  @JsonProperty("last_name")
  @Override
  public Optional lastName() {
    return lastName;
  }

  @JsonProperty("full_name")
  @Override
  public Optional fullName() {
    return fullName;
  }

  @Nullable
  @JsonProperty("external_user")
  @Override
  public Boolean externalUser() {
    return externalUser;
  }

  @ObjectId
  @JsonProperty("roles")
  @Override
  public Set roles() {
    return roles;
  }

  @Nullable
  @JsonProperty("read_only")
  @Override
  public Boolean readOnly() {
    return readOnly;
  }

  @Nullable
  @JsonProperty("session_active")
  @Override
  public Boolean sessionActive() {
    return sessionActive;
  }

  @Nullable
  @JsonProperty("last_activity")
  @Override
  public Date lastActivity() {
    return lastActivity;
  }

  @Nullable
  @JsonProperty("client_address")
  @Override
  public String clientAddress() {
    return clientAddress;
  }

  @JsonProperty("account_status")
  @Override
  public User.AccountStatus accountStatus() {
    return accountStatus;
  }

  @JsonProperty("service_account")
  @Override
  public boolean serviceAccount() {
    return serviceAccount;
  }

  @Override
  public String toString() {
    return "UserOverviewDTO{"
        + "id=" + id + ", "
        + "authServiceId=" + authServiceId + ", "
        + "authServiceUid=" + authServiceUid + ", "
        + "username=" + username + ", "
        + "email=" + email + ", "
        + "firstName=" + firstName + ", "
        + "lastName=" + lastName + ", "
        + "fullName=" + fullName + ", "
        + "externalUser=" + externalUser + ", "
        + "roles=" + roles + ", "
        + "readOnly=" + readOnly + ", "
        + "sessionActive=" + sessionActive + ", "
        + "lastActivity=" + lastActivity + ", "
        + "clientAddress=" + clientAddress + ", "
        + "accountStatus=" + accountStatus + ", "
        + "serviceAccount=" + serviceAccount
        + "}";
  }

  @Override
  public boolean equals(Object o) {
    if (o == this) {
      return true;
    }
    if (o instanceof UserOverviewDTO) {
      UserOverviewDTO that = (UserOverviewDTO) o;
      return (this.id == null ? that.id() == null : this.id.equals(that.id()))
          && this.authServiceId.equals(that.authServiceId())
          && this.authServiceUid.equals(that.authServiceUid())
          && this.username.equals(that.username())
          && this.email.equals(that.email())
          && this.firstName.equals(that.firstName())
          && this.lastName.equals(that.lastName())
          && this.fullName.equals(that.fullName())
          && (this.externalUser == null ? that.externalUser() == null : this.externalUser.equals(that.externalUser()))
          && this.roles.equals(that.roles())
          && (this.readOnly == null ? that.readOnly() == null : this.readOnly.equals(that.readOnly()))
          && (this.sessionActive == null ? that.sessionActive() == null : this.sessionActive.equals(that.sessionActive()))
          && (this.lastActivity == null ? that.lastActivity() == null : this.lastActivity.equals(that.lastActivity()))
          && (this.clientAddress == null ? that.clientAddress() == null : this.clientAddress.equals(that.clientAddress()))
          && this.accountStatus.equals(that.accountStatus())
          && this.serviceAccount == that.serviceAccount();
    }
    return false;
  }

  @Override
  public int hashCode() {
    int h$ = 1;
    h$ *= 1000003;
    h$ ^= (id == null) ? 0 : id.hashCode();
    h$ *= 1000003;
    h$ ^= authServiceId.hashCode();
    h$ *= 1000003;
    h$ ^= authServiceUid.hashCode();
    h$ *= 1000003;
    h$ ^= username.hashCode();
    h$ *= 1000003;
    h$ ^= email.hashCode();
    h$ *= 1000003;
    h$ ^= firstName.hashCode();
    h$ *= 1000003;
    h$ ^= lastName.hashCode();
    h$ *= 1000003;
    h$ ^= fullName.hashCode();
    h$ *= 1000003;
    h$ ^= (externalUser == null) ? 0 : externalUser.hashCode();
    h$ *= 1000003;
    h$ ^= roles.hashCode();
    h$ *= 1000003;
    h$ ^= (readOnly == null) ? 0 : readOnly.hashCode();
    h$ *= 1000003;
    h$ ^= (sessionActive == null) ? 0 : sessionActive.hashCode();
    h$ *= 1000003;
    h$ ^= (lastActivity == null) ? 0 : lastActivity.hashCode();
    h$ *= 1000003;
    h$ ^= (clientAddress == null) ? 0 : clientAddress.hashCode();
    h$ *= 1000003;
    h$ ^= accountStatus.hashCode();
    h$ *= 1000003;
    h$ ^= serviceAccount ? 1231 : 1237;
    return h$;
  }

  @Override
  public UserOverviewDTO.Builder toBuilder() {
    return new Builder(this);
  }

  static final class Builder extends UserOverviewDTO.Builder {
    private String id;
    private Optional authServiceId = Optional.empty();
    private Optional authServiceUid = Optional.empty();
    private String username;
    private String email;
    private Optional firstName = Optional.empty();
    private Optional lastName = Optional.empty();
    private Optional fullName = Optional.empty();
    private Boolean externalUser;
    private Set roles;
    private Boolean readOnly;
    private Boolean sessionActive;
    private Date lastActivity;
    private String clientAddress;
    private User.AccountStatus accountStatus;
    private Boolean serviceAccount;
    Builder() {
    }
    private Builder(UserOverviewDTO source) {
      this.id = source.id();
      this.authServiceId = source.authServiceId();
      this.authServiceUid = source.authServiceUid();
      this.username = source.username();
      this.email = source.email();
      this.firstName = source.firstName();
      this.lastName = source.lastName();
      this.fullName = source.fullName();
      this.externalUser = source.externalUser();
      this.roles = source.roles();
      this.readOnly = source.readOnly();
      this.sessionActive = source.sessionActive();
      this.lastActivity = source.lastActivity();
      this.clientAddress = source.clientAddress();
      this.accountStatus = source.accountStatus();
      this.serviceAccount = source.serviceAccount();
    }
    @Override
    public UserOverviewDTO.Builder id(String id) {
      this.id = id;
      return this;
    }
    @Override
    public UserOverviewDTO.Builder authServiceId(@Nullable String authServiceId) {
      this.authServiceId = Optional.ofNullable(authServiceId);
      return this;
    }
    @Override
    public UserOverviewDTO.Builder authServiceUid(@Nullable String authServiceUid) {
      this.authServiceUid = Optional.ofNullable(authServiceUid);
      return this;
    }
    @Override
    public UserOverviewDTO.Builder username(String username) {
      if (username == null) {
        throw new NullPointerException("Null username");
      }
      this.username = username;
      return this;
    }
    @Override
    public UserOverviewDTO.Builder email(String email) {
      if (email == null) {
        throw new NullPointerException("Null email");
      }
      this.email = email;
      return this;
    }
    @Override
    public UserOverviewDTO.Builder firstName(@Nullable String firstName) {
      this.firstName = Optional.ofNullable(firstName);
      return this;
    }
    @Override
    public UserOverviewDTO.Builder lastName(@Nullable String lastName) {
      this.lastName = Optional.ofNullable(lastName);
      return this;
    }
    @Override
    public UserOverviewDTO.Builder fullName(@Nullable String fullName) {
      this.fullName = Optional.ofNullable(fullName);
      return this;
    }
    @Override
    public UserOverviewDTO.Builder externalUser(@Nullable Boolean externalUser) {
      this.externalUser = externalUser;
      return this;
    }
    @Override
    public UserOverviewDTO.Builder roles(Set roles) {
      if (roles == null) {
        throw new NullPointerException("Null roles");
      }
      this.roles = roles;
      return this;
    }
    @Override
    public UserOverviewDTO.Builder readOnly(@Nullable Boolean readOnly) {
      this.readOnly = readOnly;
      return this;
    }
    @Override
    public UserOverviewDTO.Builder sessionActive(@Nullable Boolean sessionActive) {
      this.sessionActive = sessionActive;
      return this;
    }
    @Override
    public UserOverviewDTO.Builder lastActivity(@Nullable Date lastActivity) {
      this.lastActivity = lastActivity;
      return this;
    }
    @Override
    public UserOverviewDTO.Builder clientAddress(@Nullable String clientAddress) {
      this.clientAddress = clientAddress;
      return this;
    }
    @Override
    public UserOverviewDTO.Builder accountStatus(User.AccountStatus accountStatus) {
      if (accountStatus == null) {
        throw new NullPointerException("Null accountStatus");
      }
      this.accountStatus = accountStatus;
      return this;
    }
    @Override
    public UserOverviewDTO.Builder serviceAccount(boolean serviceAccount) {
      this.serviceAccount = serviceAccount;
      return this;
    }
    @Override
    public UserOverviewDTO build() {
      String missing = "";
      if (this.username == null) {
        missing += " username";
      }
      if (this.email == null) {
        missing += " email";
      }
      if (this.roles == null) {
        missing += " roles";
      }
      if (this.accountStatus == null) {
        missing += " accountStatus";
      }
      if (this.serviceAccount == null) {
        missing += " serviceAccount";
      }
      if (!missing.isEmpty()) {
        throw new IllegalStateException("Missing required properties:" + missing);
      }
      return new AutoValue_UserOverviewDTO(
          this.id,
          this.authServiceId,
          this.authServiceUid,
          this.username,
          this.email,
          this.firstName,
          this.lastName,
          this.fullName,
          this.externalUser,
          this.roles,
          this.readOnly,
          this.sessionActive,
          this.lastActivity,
          this.clientAddress,
          this.accountStatus,
          this.serviceAccount);
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy