Example usage for javax.naming.ldap LdapName endsWith

List of usage examples for javax.naming.ldap LdapName endsWith

Introduction

In this page you can find the example usage for javax.naming.ldap LdapName endsWith.

Prototype

public boolean endsWith(List<Rdn> rdns) 

Source Link

Document

Determines whether the specified RDN sequence forms a suffix of this LDAP name.

Usage

From source file:Main.java

public static void main(String args[]) {
    try {/*from  w w  w.  j av a2 s  .  com*/
        LdapName one = new LdapName("cn=Abc Def, ou=People, o=JNDITutorial");
        LdapName two = new LdapName("cn=Abc Def");
        LdapName three = new LdapName("o=JNDITutorial");
        LdapName four = new LdapName("");

        System.out.println(one.equals(two));
        System.out.println(one.startsWith(three));
        System.out.println(one.endsWith(two));
        System.out.println(one.startsWith(four));
        System.out.println(one.endsWith(four));
        System.out.println(one.endsWith(three));
        System.out.println(one.isEmpty());
        System.out.println(four.isEmpty());
        System.out.println(four.size() == 0);
    } catch (InvalidNameException e) {
        e.printStackTrace();
    }
}

From source file:CompareLdapNames.java

public static void main(String args[]) {
    try {/*from   www.ja  v a 2  s.com*/
        LdapName one = new LdapName("cn=Vincent Ryan, ou=People, o=JNDITutorial");
        LdapName two = new LdapName("cn=Vincent Ryan");
        LdapName three = new LdapName("o=JNDITutorial");
        LdapName four = new LdapName("");

        System.out.println(one.equals(two)); // false
        System.out.println(one.startsWith(three)); // true
        System.out.println(one.endsWith(two)); // true
        System.out.println(one.startsWith(four)); // true
        System.out.println(one.endsWith(four)); // true
        System.out.println(one.endsWith(three)); // false
        System.out.println(one.isEmpty()); // false
        System.out.println(four.isEmpty()); // true
        System.out.println(four.size() == 0); // true
    } catch (InvalidNameException e) {
        e.printStackTrace();
    }
}

From source file:org.wso2.carbon.user.core.ldap.ReadOnlyLDAPUserStoreManager.java

private boolean isInSearchBase(LdapName dn, LdapName searchBase) {

    List<Rdn> baseRdns = searchBase.getRdns();
    return dn.endsWith(baseRdns);
}