Examples of LDAPSearchResults


Examples of com.novell.ldap.LDAPSearchResults

  }

  public static void getAllDisplayName() {
    try {
      log.info("LDAP getAllDisplayName");
      LDAPSearchResults rs = conn.search("ou=skymobi,dc=sky-mobi,dc=com", 2,
        "(sAMAccountName=*)", new String[] { "sAMAccountName",
        "displayName" }, false);
      if (rs != null)
        while (rs.hasMore()) {
          LDAPEntry entry = rs.next();
          try {
            userMap.put(entry.getAttribute("sAMAccountName")
              .getStringValue().toLowerCase(), entry.getAttribute("displayName")
              .getStringValue());
          } catch (Exception localException) {
View Full Code Here

Examples of com.novell.ldap.LDAPSearchResults

      conn.add(newEntry);
      System.out.println("<======Added object: " + EXO_DEVELOPER_DN + " successfully.");

      System.out.println("\nAdded object: " + EXO_DEVELOPER_DN + " successfully.");

      LDAPSearchResults results = conn.search(DEVELOPER_UNIT_DN, // search only
         // the object in
         // the subtree of
         // this dn
         LDAPConnection.SCOPE_SUB, // return
         // all the
         // objects
         // that
         // match
         // the
         // filter
         // criteria
         // and in
         // the sub
         // tree
         "(objectclass=person)", // query
         // filter, (
         // objectclass
         // =*) for
         // all the
         // object
         null, // return all the attributes
         // of the object
         false); // return attrs and values

      // assertEquals("Expect to find 1 entry", 1, results.getCount()) ;
      while (results.hasMore())
      {
         LDAPEntry nextEntry = null;
         nextEntry = results.next();
         System.out.println("\n entry: " + nextEntry.getDN());
         System.out.println("  Attributes: ");
         LDAPAttributeSet attrs = nextEntry.getAttributeSet();
         printLDAPAttributeSet(attrs);
      }
      System.out.println("   ---> count: " + results.getCount());
      System.out.println("<======search " + DEVELOPER_UNIT_DN + " successfully.");
      // delete the new created ldap entry
      conn.delete(EXO_DEVELOPER_DN);
      conn.disconnect();
   }
View Full Code Here

Examples of com.novell.ldap.LDAPSearchResults

      conn.add(newEntry);
      System.out.println("<======Added object: " + EXO_DEVELOPER_DN + " successfully.");

      System.out.println("\nAdded object: " + EXO_DEVELOPER_DN + " successfully.");

      LDAPSearchResults results = conn.search(DEVELOPER_UNIT_DN, // search only
         // the object in
         // the subtree of
         // this dn
         LDAPConnection.SCOPE_SUB, // return
         // all the
         // objects
         // that
         // match
         // the
         // filter
         // criteria
         // and in
         // the sub
         // tree
         "(objectclass=person)", // query
         // filter, (
         // objectclass
         // =*) for
         // all the
         // object
         null, // return all the attributes
         // of the object
         false); // return attrs and values

      // assertEquals("Expect to find 1 entry", 1, results.getCount()) ;
      while (results.hasMore())
      {
         LDAPEntry nextEntry = null;
         nextEntry = results.next();
         System.out.println("\n entry: " + nextEntry.getDN());
         System.out.println("  Attributes: ");
         LDAPAttributeSet attrs = nextEntry.getAttributeSet();
         printLDAPAttributeSet(attrs);
      }
      System.out.println("   ---> count: " + results.getCount());
      System.out.println("<======search " + DEVELOPER_UNIT_DN + " successfully.");
      // delete the new created ldap entry
      conn.delete(EXO_DEVELOPER_DN);
      conn.disconnect();
   }
View Full Code Here

Examples of com.novell.ldap.LDAPSearchResults

  public static String getLDAPEmailBySN(String user) {
    String mail = null;
    LDAPEntry fullEntry = null;
    LDAPConnection lc = null;
    LDAPAttributeSet set = null;
    LDAPSearchResults rs = null;

    try {
      lc = getConnection();

      rs = lc.search(ENTRYDN, LDAPConnection.SCOPE_SUB, "sn=" + user,
          attrNames, false);

      while (rs.hasMore()) {
        try {
          fullEntry = rs.next();
          set = fullEntry.getAttributeSet();
          Iterator<?> attrs = set.iterator();
          while (attrs.hasNext()) {
            LDAPAttribute attribute = (LDAPAttribute) attrs.next();
            String name = attribute.getName();
View Full Code Here

Examples of com.novell.ldap.LDAPSearchResults

  public static String getLDAPEmailByCN(String user) {
    String mail = null;
    LDAPEntry fullEntry = null;
    LDAPConnection lc = null;
    LDAPAttributeSet set = null;
    LDAPSearchResults rs = null;

    try {
      lc = getConnection();
      rs = lc.search(ENTRYDN, LDAPConnection.SCOPE_SUB, "cn=" + user,
          attrNames, false);

      while (rs.hasMore()) {
        try {
          fullEntry = rs.next();
          set = fullEntry.getAttributeSet();
          Iterator<?> attrs = set.iterator();
          while (attrs.hasNext()) {
            LDAPAttribute attribute = (LDAPAttribute) attrs.next();
            String name = attribute.getName();
View Full Code Here

Examples of com.novell.ldap.LDAPSearchResults

  public static String getLDAPSNByCN(String cn) {
    String sn = null;
    LDAPEntry fullEntry = null;
    LDAPConnection lc = null;
    LDAPAttributeSet set = null;
    LDAPSearchResults rs = null;
    try {
      lc = getConnection();
      rs = lc.search(ENTRYDN, LDAPConnection.SCOPE_SUB, "cn=" + cn,
          attrNames, false);

      while (rs.hasMore()) {
        try {
          fullEntry = rs.next();
          set = fullEntry.getAttributeSet();
          Iterator<?> attrs = set.iterator();
          while (attrs.hasNext()) {
            LDAPAttribute attribute = (LDAPAttribute) attrs.next();
            String name = attribute.getName();
View Full Code Here

Examples of com.novell.ldap.LDAPSearchResults

  public static String getLDAPCNBySN(String sn) {
    String cn = null;
    LDAPEntry fullEntry = null;
    LDAPConnection lc = null;
    LDAPAttributeSet set = null;
    LDAPSearchResults rs = null;

    try {
      lc = getConnection();
      rs = lc.search(ENTRYDN, LDAPConnection.SCOPE_SUB, "sn=" + sn,
          attrNames, false);

      while (rs.hasMore()) {
        try {
          fullEntry = rs.next();
          set = fullEntry.getAttributeSet();
          Iterator<?> attrs = set.iterator();
          while (attrs.hasNext()) {
            LDAPAttribute attribute = (LDAPAttribute) attrs.next();
            String name = attribute.getName();
View Full Code Here

Examples of netscape.ldap.LDAPSearchResults

                " may be the connect method was not called");
         }
     
         if(logger != null){logger.debug5("search : base = "+base+" filter = " + filter);}
        
         LDAPSearchResults res = connection.search(   base
            ,this.getScope() // SCOPE_BASE, SCOPE_ONE oder SCOPE_SUB                         
            , filter
            , attrs
            ,this.getSearchOnlyAttributes());
       
      /*
       *  Verwendung von SORT
       */
      /*
      String[]  sortAttrs = {"sn", "cn"};
      boolean[] ascending = {true, true};
      res.sort( new LDAPCompareAttrNames(sortAttrs, ascending) );
      */
       
       
      // alle entries lesen
      while (res.hasMoreElements()) {
          try {
              // The next entry
          LDAPEntry entry = res.next();
          entries.add(entry);
           
        }
          catch (LDAPReferralException e) {
              // Ignore any referrals
View Full Code Here

Examples of netscape.ldap.LDAPSearchResults

      Integer.decode(hr.get("limit","1000")));
      } catch (Exception e) {
    System.out.println("Ldap error: " + e);
      }
     
      LDAPSearchResults results = ld.search(base, scope, search, attrs,
        false);
      for (i = 0; results.hasMoreElements(); i++) {
    shove(hr.request.props, name + i + ".", results.next(), attrs);
    sb.append(i).append(' ');
      }

      ld.disconnect();
  } catch (LDAPException e) {
View Full Code Here

Examples of netscape.ldap.LDAPSearchResults

                 * ld.setOption(LDAPv2.SIZELIMIT,
                 * Integer.decode(hr.get("limit","1000")));
                 * } catch (Exception e) {}
                 */
                StringBuffer sb = new StringBuffer();
                LDAPSearchResults results = ld.search(base, scope, search,
                                                      attrs, false);

                for (int i = 0; results.hasMoreElements(); i++) {
                    sb.append(i).append(' ');
                    shove(hr.request.props, name + i + ".", results.next(),
                          attrs);
                }

                hr.request.props.put(name + "rows", sb.toString().trim());
            } else if (hr.get("modattr") != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.