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

com.emc.storageos.model.tenant.UserMappingParam Maven / Gradle / Ivy

There is a newer version: 3.5.0.0
Show newest version
/*
 * Copyright (c) 2013 EMC Corporation
 * All Rights Reserved
 */
package com.emc.storageos.model.tenant;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;

import org.codehaus.jackson.annotate.JsonProperty;

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

public class UserMappingParam {
    private String domain;
    private List attributes;
    private List groups;

    public UserMappingParam() {
    }

    public UserMappingParam(String domain,
            List attributes, List groups) {
        this.domain = domain;
        this.attributes = this.removeDuplicate(attributes);
        ;
        this.groups = this.removeDuplicate(groups);
    }

    /**
     * 
     * A single-valued attribute indicating the user's IDP domain
     * 
     * @valid Examples: "emc.com" or "netapp.com"
     */
    @XmlElement(required = true, name = "domain")
    @JsonProperty("domain")
    public String getDomain() {
        return domain;
    }

    public void setDomain(String domain) {
        this.domain = domain;
    }

    @XmlElementWrapper(name = "attributes")
    /**
     * The user's LDAP attributes that can be used to further scope tenancy as
     * a set of key-value pairs.
     * 
     * @valid none
     */
    @XmlElement(name = "attribute")
    public List getAttributes() {
        if (attributes == null) {
            attributes = new ArrayList();
        }
        return attributes;
    }

    public void setAttributes(List attributes) {
        this.attributes = removeDuplicate(attributes);
    }

    @XmlElementWrapper(name = "groups")
    /**
     * AD Users group memberships to be used for mapping to this tenant
     * @valid Example: "admins" or "lab-managers"
     */
    @XmlElement(name = "group")
    public List getGroups() {
        if (groups == null) {
            groups = new ArrayList();
        }
        return groups;
    }

    public void setGroups(List groups) {
        this.groups = removeDuplicate(groups);
    }

    /**
     * Removes the duplicate entries from the collection (List)
     * and returns the list with unique entries.
     * 
     * @valid none
     */
    private  List removeDuplicate(List listWithDuplicates) {
        List uniqueList = new ArrayList(new LinkedHashSet(listWithDuplicates));
        return uniqueList;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy