⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jbmapto.java

📁 OPIAM stands for Open Identity and Access Management. This Suite will provide modules for user & rig
💻 JAVA
字号:
/*
 * OPIAM Suite
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

package opiam.admin.faare.config.javabeans;

import java.io.Serializable;

import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;


/**
 * This class corresponds to the "map-to" element of the faare_mapping.xml file.
 * This defines a set of LDAP object classes corresponding to the mapped object.
 */
public class JBMapTo implements Serializable
{
    /** Comma separated list of object classes. */
    private String ldapoc;

    /** LDAP filter built from object classes . */
    private String ldapocFilter;

    /** Set of object classes, without "*". */
    private Set ldapocSet = new HashSet();

    /** If object classes contains *, set to false. */
    private boolean fullySpecified = true;

    /**
     * Returns the comma separated list of object classes.
     * @return list of object classes
     */
    public String getLdapoc()
    {
        return ldapoc;
    }

    /**
     * Sets the comma separated list of object classes.
     * @param aldapoc The list of object classes to set
     */
    public void setLdapoc(String aldapoc)
    {
        this.ldapoc = aldapoc;

        // compute the ldapocSet
        StringTokenizer tok = new StringTokenizer(ldapoc, ",");
        String oc = null;
        StringBuffer buf = new StringBuffer();

        while (tok.hasMoreTokens())
        {
            oc = tok.nextToken();

            if (oc != null)
            {
                // should make this case insensitive : transform to lowercase
                oc = oc.trim().toLowerCase();

                if (oc.equals("*"))
                {
                    fullySpecified = false;
                }
                else
                {
                    // not a joker char
                    ldapocSet.add(oc);
                    buf.append("(objectclass=");
                    buf.append(oc);
                    buf.append(")");
                }
            }
        }

        // end while
        ldapocFilter = buf.toString();
    }

    /**
     * Returns the set of object classes.
     * If configured with "*", "*" is not returned in this set.
     * @return set of object classes.
     */
    public Set getLdapocSet()
    {
        return ldapocSet;
    }

    /**
     * Checks whether the mapped object classes contain "*" or not.
     * @return true if they do not contain "*", false if they do.
     */
    public boolean isFullySpecified()
    {
        return fullySpecified;
    }

    /**
     * Gets the LDAP filter built from object classes.
     *
     * @return LDAP filter
     */
    public String getLdapocFilter()
    {
        return ldapocFilter;
    }

    /**
     * Displays the object classes definition.
     *
     * @return String formatted representation of the definition.
     */
    public String toString()
    {
        StringBuffer buf = new StringBuffer();
        java.util.Iterator it = null;
        buf.append(System.getProperty("line.separator"));
        buf.append("......ldapoc = ");
        buf.append(ldapoc);
        buf.append(System.getProperty("line.separator"));
        buf.append("......ldapocFilter = ");
        buf.append(ldapocFilter);
        buf.append(System.getProperty("line.separator"));
        buf.append("......fullySpecified = ");
        buf.append(fullySpecified);
        buf.append(System.getProperty("line.separator"));
        buf.append("......ldapocSet = ");
        buf.append(System.getProperty("line.separator"));
        it = ldapocSet.iterator();

        while (it.hasNext())
        {
            buf.append(".........");
            buf.append((String) it.next());
            buf.append(System.getProperty("line.separator"));
        }

        buf.append(System.getProperty("line.separator"));

        return buf.toString();
    }

    // end of toString method
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -