| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * Tells whether a given entry exists and contains the specified object class. |
| | | * Tells whether a given entry exists and contains one of the specified object |
| | | * classes. |
| | | * @param dn the DN of the entry. |
| | | * @param objectClass the object class. |
| | | * @return <CODE>true</CODE> if the entry exists and contains the specified |
| | | * object class and <CODE>false</CODE> otherwise. |
| | | * @param objectClasses the object classes to check. |
| | | * @return <CODE>true</CODE> if the entry exists and contains one of the |
| | | * specified object classes and <CODE>false</CODE> otherwise. |
| | | */ |
| | | protected boolean hasObjectClass(String dn, String objectClass) |
| | | protected boolean hasObjectClass(String dn, String... objectClasses) |
| | | { |
| | | boolean hasObjectClass = false; |
| | | try |
| | | { |
| | | SearchControls ctls = new SearchControls(); |
| | |
| | | { |
| | | for (String s : values) |
| | | { |
| | | if (s.equalsIgnoreCase(objectClass)) |
| | | for (String objectClass: objectClasses) |
| | | { |
| | | hasObjectClass = true; |
| | | break; |
| | | if (s.equalsIgnoreCase(objectClass)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | catch (Throwable t) |
| | | { |
| | | } |
| | | return hasObjectClass; |
| | | return false; |
| | | } |
| | | |
| | | /** |