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

com.manywho.sdk.api.run.elements.config.Authorization Maven / Gradle / Ivy

The newest version!
package com.manywho.sdk.api.run.elements.config;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.google.common.base.MoreObjects;
import com.google.common.collect.Lists;

import java.util.ArrayList;
import java.util.List;

public class Authorization {
    private List users = Lists.newArrayList();
    private List groups = Lists.newArrayList();
    private String runningAuthenticationId;
    private AuthenticationType globalAuthenticationType;

    public List getUsers() {
        return users;
    }

    public boolean hasUsers() {
        return !users.isEmpty();
    }

    public void setUsers(List users) {
        this.users = MoreObjects.firstNonNull(users, new ArrayList());
    }

    public List getGroups() {
        return groups;
    }

    public boolean hasGroups() {
        return !groups.isEmpty();
    }

    public void setGroups(List groups) {
        this.groups = MoreObjects.firstNonNull(groups, new ArrayList());
    }

    public String getRunningAuthenticationId() {
        return runningAuthenticationId;
    }

    public void setRunningAuthenticationId(String runningAuthenticationId) {
        this.runningAuthenticationId = runningAuthenticationId;
    }

    public AuthenticationType getGlobalAuthenticationType() {
        return globalAuthenticationType;
    }

    public void setGlobalAuthenticationType(AuthenticationType globalAuthenticationType) {
        this.globalAuthenticationType = globalAuthenticationType;
    }

    public static enum AuthenticationType {
        Public("PUBLIC"),
        AllUsers("ALL_USERS"),
        Specified("SPECIFIED");

        private final String text;

        AuthenticationType(final String text) {
            this.text = text;
        }

        @Override
        public String toString() {
            return text;
        }

        @JsonCreator
        public static AuthenticationType forValue(String value) {
            for (AuthenticationType authenticationType : AuthenticationType.values()) {
                if (value.equalsIgnoreCase(authenticationType.text)) {
                    return authenticationType;
                }
            }

            throw new IllegalArgumentException("No constant with text " + value + " found");
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy