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

com.atlan.model.graph.ModelEntityGraph Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
// Generated by delombok at Wed Oct 16 22:16:04 UTC 2024
/* SPDX-License-Identifier: Apache-2.0
   Copyright 2024 Atlan Pte. Ltd. */
package com.atlan.model.graph;

import com.atlan.model.assets.IModelEntity;
import com.atlan.model.assets.ModelAttribute;
import com.atlan.model.assets.ModelEntity;
import com.atlan.model.enums.ModelCardinalityType;
import java.util.List;
import java.util.SortedSet;

/**
 * Structure through which a model entity and its subcomponents (attributes) can be traversed.
 */
public class ModelEntityGraph {
    private ModelEntity details;
    private List attributes;
    private List associatedTos;
    private List associatedFroms;

    public SortedSet getMappedTo() {
        return details.getModelEntityMappedToEntities();
    }

    public SortedSet getMappedFrom() {
        return details.getModelEntityMappedFromEntities();
    }


    public static final class AssociatedEntity {
        private String label;
        private ModelEntity entity;
        private ModelCardinalityType cardinality;

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        AssociatedEntity(final String label, final ModelEntity entity, final ModelCardinalityType cardinality) {
            this.label = label;
            this.entity = entity;
            this.cardinality = cardinality;
        }


        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        static class AssociatedEntityBuilder {
            @java.lang.SuppressWarnings("all")
            @lombok.Generated
            private String label;
            @java.lang.SuppressWarnings("all")
            @lombok.Generated
            private ModelEntity entity;
            @java.lang.SuppressWarnings("all")
            @lombok.Generated
            private ModelCardinalityType cardinality;

            @java.lang.SuppressWarnings("all")
            @lombok.Generated
            AssociatedEntityBuilder() {
            }

            /**
             * @return {@code this}.
             */
            @java.lang.SuppressWarnings("all")
            @lombok.Generated
            ModelEntityGraph.AssociatedEntity.AssociatedEntityBuilder label(final String label) {
                this.label = label;
                return this;
            }

            /**
             * @return {@code this}.
             */
            @java.lang.SuppressWarnings("all")
            @lombok.Generated
            ModelEntityGraph.AssociatedEntity.AssociatedEntityBuilder entity(final ModelEntity entity) {
                this.entity = entity;
                return this;
            }

            /**
             * @return {@code this}.
             */
            @java.lang.SuppressWarnings("all")
            @lombok.Generated
            ModelEntityGraph.AssociatedEntity.AssociatedEntityBuilder cardinality(final ModelCardinalityType cardinality) {
                this.cardinality = cardinality;
                return this;
            }

            @java.lang.SuppressWarnings("all")
            @lombok.Generated
            ModelEntityGraph.AssociatedEntity build() {
                return new ModelEntityGraph.AssociatedEntity(this.label, this.entity, this.cardinality);
            }

            @java.lang.Override
            @java.lang.SuppressWarnings("all")
            @lombok.Generated
            public java.lang.String toString() {
                return "ModelEntityGraph.AssociatedEntity.AssociatedEntityBuilder(label=" + this.label + ", entity=" + this.entity + ", cardinality=" + this.cardinality + ")";
            }
        }

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        static ModelEntityGraph.AssociatedEntity.AssociatedEntityBuilder builder() {
            return new ModelEntityGraph.AssociatedEntity.AssociatedEntityBuilder();
        }

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        public String getLabel() {
            return this.label;
        }

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        public ModelEntity getEntity() {
            return this.entity;
        }

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        public ModelCardinalityType getCardinality() {
            return this.cardinality;
        }

        @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 ModelEntityGraph.AssociatedEntity)) return false;
            final ModelEntityGraph.AssociatedEntity other = (ModelEntityGraph.AssociatedEntity) o;
            final java.lang.Object this$label = this.getLabel();
            final java.lang.Object other$label = other.getLabel();
            if (this$label == null ? other$label != null : !this$label.equals(other$label)) return false;
            final java.lang.Object this$entity = this.getEntity();
            final java.lang.Object other$entity = other.getEntity();
            if (this$entity == null ? other$entity != null : !this$entity.equals(other$entity)) return false;
            final java.lang.Object this$cardinality = this.getCardinality();
            final java.lang.Object other$cardinality = other.getCardinality();
            if (this$cardinality == null ? other$cardinality != null : !this$cardinality.equals(other$cardinality)) return false;
            return true;
        }

        @java.lang.Override
        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        public int hashCode() {
            final int PRIME = 59;
            int result = 1;
            final java.lang.Object $label = this.getLabel();
            result = result * PRIME + ($label == null ? 43 : $label.hashCode());
            final java.lang.Object $entity = this.getEntity();
            result = result * PRIME + ($entity == null ? 43 : $entity.hashCode());
            final java.lang.Object $cardinality = this.getCardinality();
            result = result * PRIME + ($cardinality == null ? 43 : $cardinality.hashCode());
            return result;
        }
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    ModelEntityGraph(final ModelEntity details, final List attributes, final List associatedTos, final List associatedFroms) {
        this.details = details;
        this.attributes = attributes;
        this.associatedTos = associatedTos;
        this.associatedFroms = associatedFroms;
    }


    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    static class ModelEntityGraphBuilder {
        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        private ModelEntity details;
        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        private java.util.ArrayList attributes;
        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        private java.util.ArrayList associatedTos;
        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        private java.util.ArrayList associatedFroms;

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        ModelEntityGraphBuilder() {
        }

        /**
         * @return {@code this}.
         */
        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        ModelEntityGraph.ModelEntityGraphBuilder details(final ModelEntity details) {
            this.details = details;
            return this;
        }

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        ModelEntityGraph.ModelEntityGraphBuilder attribute(final ModelAttribute attribute) {
            if (this.attributes == null) this.attributes = new java.util.ArrayList();
            this.attributes.add(attribute);
            return this;
        }

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

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        ModelEntityGraph.ModelEntityGraphBuilder clearAttributes() {
            if (this.attributes != null) this.attributes.clear();
            return this;
        }

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        ModelEntityGraph.ModelEntityGraphBuilder associatedTo(final AssociatedEntity associatedTo) {
            if (this.associatedTos == null) this.associatedTos = new java.util.ArrayList();
            this.associatedTos.add(associatedTo);
            return this;
        }

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

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        ModelEntityGraph.ModelEntityGraphBuilder clearAssociatedTos() {
            if (this.associatedTos != null) this.associatedTos.clear();
            return this;
        }

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        ModelEntityGraph.ModelEntityGraphBuilder associatedFrom(final AssociatedEntity associatedFrom) {
            if (this.associatedFroms == null) this.associatedFroms = new java.util.ArrayList();
            this.associatedFroms.add(associatedFrom);
            return this;
        }

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

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        ModelEntityGraph.ModelEntityGraphBuilder clearAssociatedFroms() {
            if (this.associatedFroms != null) this.associatedFroms.clear();
            return this;
        }

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        ModelEntityGraph build() {
            java.util.List attributes;
            switch (this.attributes == null ? 0 : this.attributes.size()) {
            case 0: 
                attributes = java.util.Collections.emptyList();
                break;
            case 1: 
                attributes = java.util.Collections.singletonList(this.attributes.get(0));
                break;
            default: 
                attributes = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.attributes));
            }
            java.util.List associatedTos;
            switch (this.associatedTos == null ? 0 : this.associatedTos.size()) {
            case 0: 
                associatedTos = java.util.Collections.emptyList();
                break;
            case 1: 
                associatedTos = java.util.Collections.singletonList(this.associatedTos.get(0));
                break;
            default: 
                associatedTos = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.associatedTos));
            }
            java.util.List associatedFroms;
            switch (this.associatedFroms == null ? 0 : this.associatedFroms.size()) {
            case 0: 
                associatedFroms = java.util.Collections.emptyList();
                break;
            case 1: 
                associatedFroms = java.util.Collections.singletonList(this.associatedFroms.get(0));
                break;
            default: 
                associatedFroms = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.associatedFroms));
            }
            return new ModelEntityGraph(this.details, attributes, associatedTos, associatedFroms);
        }

        @java.lang.Override
        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        public java.lang.String toString() {
            return "ModelEntityGraph.ModelEntityGraphBuilder(details=" + this.details + ", attributes=" + this.attributes + ", associatedTos=" + this.associatedTos + ", associatedFroms=" + this.associatedFroms + ")";
        }
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    static ModelEntityGraph.ModelEntityGraphBuilder builder() {
        return new ModelEntityGraph.ModelEntityGraphBuilder();
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public ModelEntity getDetails() {
        return this.details;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public List getAttributes() {
        return this.attributes;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public List getAssociatedTos() {
        return this.associatedTos;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public List getAssociatedFroms() {
        return this.associatedFroms;
    }

    @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 ModelEntityGraph)) return false;
        final ModelEntityGraph other = (ModelEntityGraph) o;
        if (!other.canEqual((java.lang.Object) this)) return false;
        final java.lang.Object this$details = this.getDetails();
        final java.lang.Object other$details = other.getDetails();
        if (this$details == null ? other$details != null : !this$details.equals(other$details)) return false;
        final java.lang.Object this$attributes = this.getAttributes();
        final java.lang.Object other$attributes = other.getAttributes();
        if (this$attributes == null ? other$attributes != null : !this$attributes.equals(other$attributes)) return false;
        final java.lang.Object this$associatedTos = this.getAssociatedTos();
        final java.lang.Object other$associatedTos = other.getAssociatedTos();
        if (this$associatedTos == null ? other$associatedTos != null : !this$associatedTos.equals(other$associatedTos)) return false;
        final java.lang.Object this$associatedFroms = this.getAssociatedFroms();
        final java.lang.Object other$associatedFroms = other.getAssociatedFroms();
        if (this$associatedFroms == null ? other$associatedFroms != null : !this$associatedFroms.equals(other$associatedFroms)) return false;
        return true;
    }

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

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int hashCode() {
        final int PRIME = 59;
        int result = 1;
        final java.lang.Object $details = this.getDetails();
        result = result * PRIME + ($details == null ? 43 : $details.hashCode());
        final java.lang.Object $attributes = this.getAttributes();
        result = result * PRIME + ($attributes == null ? 43 : $attributes.hashCode());
        final java.lang.Object $associatedTos = this.getAssociatedTos();
        result = result * PRIME + ($associatedTos == null ? 43 : $associatedTos.hashCode());
        final java.lang.Object $associatedFroms = this.getAssociatedFroms();
        result = result * PRIME + ($associatedFroms == null ? 43 : $associatedFroms.hashCode());
        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy