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

io.camunda.tasklist.webapp.graphql.entity.UserDTO Maven / Gradle / Ivy

/*
 * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under
 * one or more contributor license agreements. See the NOTICE file distributed
 * with this work for additional information regarding copyright ownership.
 * Licensed under the Camunda License 1.0. You may not use this file
 * except in compliance with the Camunda License 1.0.
 */
package io.camunda.tasklist.webapp.graphql.entity;

import graphql.annotations.annotationTypes.GraphQLField;
import graphql.annotations.annotationTypes.GraphQLNonNull;
import io.camunda.tasklist.webapp.security.Permission;
import io.camunda.tasklist.webapp.security.tenant.TasklistTenant;
import java.util.List;
import java.util.Objects;
import org.springframework.util.StringUtils;

public class UserDTO {

  @GraphQLField @GraphQLNonNull private String userId;
  @GraphQLField private String displayName;
  private boolean apiUser;
  @GraphQLField private List permissions;
  @GraphQLField private List roles;
  @GraphQLField private String salesPlanType;
  @GraphQLField private List c8Links = List.of();
  private List tenants = List.of();
  private List groups = List.of();

  public String getUserId() {
    return userId;
  }

  public UserDTO setUserId(final String userId) {
    this.userId = userId;
    return this;
  }

  public String getDisplayName() {
    if (!StringUtils.hasText(displayName)) {
      return userId;
    }
    return displayName;
  }

  public UserDTO setDisplayName(final String displayName) {
    this.displayName = displayName;
    return this;
  }

  public boolean isApiUser() {
    return apiUser;
  }

  public UserDTO setApiUser(boolean apiUser) {
    this.apiUser = apiUser;
    return this;
  }

  public List getPermissions() {
    return permissions;
  }

  public UserDTO setPermissions(final List permissions) {
    this.permissions = permissions;
    return this;
  }

  public List getRoles() {
    return roles;
  }

  public UserDTO setRoles(final List roles) {
    this.roles = roles;
    return this;
  }

  public UserDTO setSalesPlanType(final String salesPlanType) {
    this.salesPlanType = salesPlanType;
    return this;
  }

  public String getSalesPlanType() {
    return salesPlanType;
  }

  public List getC8Links() {
    return c8Links;
  }

  public UserDTO setC8Links(final List c8Links) {
    if (c8Links != null) {
      this.c8Links = c8Links;
    }
    return this;
  }

  public List getTenants() {
    return tenants;
  }

  public UserDTO setTenants(List tenants) {
    if (tenants != null) {
      this.tenants = tenants;
    }
    return this;
  }

  public List getGroups() {
    return groups;
  }

  public UserDTO setGroups(List groups) {
    this.groups = groups;
    return this;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    final UserDTO userDTO = (UserDTO) o;
    return apiUser == userDTO.apiUser
        && Objects.equals(userId, userDTO.userId)
        && Objects.equals(displayName, userDTO.displayName)
        && Objects.equals(permissions, userDTO.permissions)
        && Objects.equals(roles, userDTO.roles)
        && Objects.equals(salesPlanType, userDTO.salesPlanType)
        && Objects.equals(c8Links, userDTO.c8Links)
        && Objects.equals(tenants, userDTO.tenants)
        && Objects.equals(groups, userDTO.groups);
  }

  @Override
  public int hashCode() {
    return Objects.hash(
        userId, displayName, apiUser, permissions, roles, salesPlanType, c8Links, tenants, groups);
  }

  @Override
  public String toString() {
    return "UserDTO{"
        + "userId='"
        + userId
        + '\''
        + ", displayName='"
        + displayName
        + '\''
        + ", apiUser="
        + apiUser
        + ", permissions="
        + permissions
        + ", roles="
        + roles
        + ", salesPlanType='"
        + salesPlanType
        + '\''
        + ", c8Links="
        + c8Links
        + ", tenants="
        + tenants
        + ", groups="
        + groups
        + '}';
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy