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

com.atlan.model.admin.AbstractPurposePolicy Maven / Gradle / Ivy

There is a newer version: 4.2.1
Show newest version
// Generated by delombok at Tue Nov 26 17:04:58 UTC 2024
/* SPDX-License-Identifier: Apache-2.0
   Copyright 2022 Atlan Pte. Ltd. */
package com.atlan.model.admin;

import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.SortedSet;

public abstract class AbstractPurposePolicy extends AbstractPolicy {
    private static final long serialVersionUID = 2L;
    /**
     * Whether this policy applies to all users (true) or not (false).
     */
    Boolean allUsers;
    /**
     * All groups' names to whom the policy will apply.
     * Note that these are the internal names of the groups, typically in all lowercase and without spaces.
     * @see AtlanGroup#name
     */
    @JsonInclude(JsonInclude.Include.ALWAYS)
    SortedSet groups;
    /**
     * All users' names to whom the policy will apply.
     * @see AtlanUser#username
     */
    @JsonInclude(JsonInclude.Include.ALWAYS)
    SortedSet users;


    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public static abstract class AbstractPurposePolicyBuilder> extends AbstractPolicy.AbstractPolicyBuilder {
        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        private Boolean allUsers;
        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        private java.util.ArrayList groups;
        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        private java.util.ArrayList users;

        @java.lang.Override
        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        protected B $fillValuesFrom(final C instance) {
            super.$fillValuesFrom(instance);
            AbstractPurposePolicy.AbstractPurposePolicyBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
            return self();
        }

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        private static void $fillValuesFromInstanceIntoBuilder(final AbstractPurposePolicy instance, final AbstractPurposePolicy.AbstractPurposePolicyBuilder b) {
            b.allUsers(instance.allUsers);
            b.groups(instance.groups == null ? java.util.Collections.emptySortedSet() : instance.groups);
            b.users(instance.users == null ? java.util.Collections.emptySortedSet() : instance.users);
        }

        /**
         * Whether this policy applies to all users (true) or not (false).
         * @return {@code this}.
         */
        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        public B allUsers(final Boolean allUsers) {
            this.allUsers = allUsers;
            return self();
        }

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        public B group(final String group) {
            if (this.groups == null) this.groups = new java.util.ArrayList();
            this.groups.add(group);
            return self();
        }

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        public B groups(final java.util.Collection groups) {
            if (groups == null) {
                throw new java.lang.NullPointerException("groups cannot be null");
            }
            if (this.groups == null) this.groups = new java.util.ArrayList();
            this.groups.addAll(groups);
            return self();
        }

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        public B clearGroups() {
            if (this.groups != null) this.groups.clear();
            return self();
        }

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        public B user(final String user) {
            if (this.users == null) this.users = new java.util.ArrayList();
            this.users.add(user);
            return self();
        }

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        public B users(final java.util.Collection users) {
            if (users == null) {
                throw new java.lang.NullPointerException("users cannot be null");
            }
            if (this.users == null) this.users = new java.util.ArrayList();
            this.users.addAll(users);
            return self();
        }

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        public B clearUsers() {
            if (this.users != null) this.users.clear();
            return self();
        }

        @java.lang.Override
        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        protected abstract B self();

        @java.lang.Override
        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        public abstract C build();

        @java.lang.Override
        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        public java.lang.String toString() {
            return "AbstractPurposePolicy.AbstractPurposePolicyBuilder(super=" + super.toString() + ", allUsers=" + this.allUsers + ", groups=" + this.groups + ", users=" + this.users + ")";
        }
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    protected AbstractPurposePolicy(final AbstractPurposePolicy.AbstractPurposePolicyBuilder b) {
        super(b);
        this.allUsers = b.allUsers;
        java.util.SortedSet groups = new java.util.TreeSet();
        if (b.groups != null) groups.addAll(b.groups);
        groups = java.util.Collections.unmodifiableSortedSet(groups);
        this.groups = groups;
        java.util.SortedSet users = new java.util.TreeSet();
        if (b.users != null) users.addAll(b.users);
        users = java.util.Collections.unmodifiableSortedSet(users);
        this.users = users;
    }

    /**
     * Whether this policy applies to all users (true) or not (false).
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public Boolean getAllUsers() {
        return this.allUsers;
    }

    /**
     * All groups' names to whom the policy will apply.
     * Note that these are the internal names of the groups, typically in all lowercase and without spaces.
     * @see AtlanGroup#name
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public SortedSet getGroups() {
        return this.groups;
    }

    /**
     * All users' names to whom the policy will apply.
     * @see AtlanUser#username
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public SortedSet getUsers() {
        return this.users;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public boolean equals(final java.lang.Object o) {
        if (o == this) return true;
        if (!(o instanceof AbstractPurposePolicy)) return false;
        final AbstractPurposePolicy other = (AbstractPurposePolicy) o;
        if (!other.canEqual((java.lang.Object) this)) return false;
        if (!super.equals(o)) return false;
        final java.lang.Object this$allUsers = this.getAllUsers();
        final java.lang.Object other$allUsers = other.getAllUsers();
        if (this$allUsers == null ? other$allUsers != null : !this$allUsers.equals(other$allUsers)) return false;
        final java.lang.Object this$groups = this.getGroups();
        final java.lang.Object other$groups = other.getGroups();
        if (this$groups == null ? other$groups != null : !this$groups.equals(other$groups)) return false;
        final java.lang.Object this$users = this.getUsers();
        final java.lang.Object other$users = other.getUsers();
        if (this$users == null ? other$users != null : !this$users.equals(other$users)) return false;
        return true;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    protected boolean canEqual(final java.lang.Object other) {
        return other instanceof AbstractPurposePolicy;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int hashCode() {
        final int PRIME = 59;
        int result = super.hashCode();
        final java.lang.Object $allUsers = this.getAllUsers();
        result = result * PRIME + ($allUsers == null ? 43 : $allUsers.hashCode());
        final java.lang.Object $groups = this.getGroups();
        result = result * PRIME + ($groups == null ? 43 : $groups.hashCode());
        final java.lang.Object $users = this.getUsers();
        result = result * PRIME + ($users == null ? 43 : $users.hashCode());
        return result;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public java.lang.String toString() {
        return "AbstractPurposePolicy(super=" + super.toString() + ", allUsers=" + this.getAllUsers() + ", groups=" + this.getGroups() + ", users=" + this.getUsers() + ")";
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy