diff options
author | Fraser Tweedale <ftweedal@redhat.com> | 2015-11-27 14:31:18 +1100 |
---|---|---|
committer | Fraser Tweedale <ftweedal@redhat.com> | 2016-01-19 10:21:13 +1100 |
commit | d272cec2614a4a45abd3fdbf7139dbd52b3275ae (patch) | |
tree | c006ffdb17fe729868baadb33152b15a64576cee /base/util/src/com/netscape/cmsutil/ldap/LDAPUtil.java | |
parent | 18e834450956352fab9dfdef1d10e115df9acbb8 (diff) | |
download | pki-d272cec2614a4a45abd3fdbf7139dbd52b3275ae.tar.gz pki-d272cec2614a4a45abd3fdbf7139dbd52b3275ae.tar.xz pki-d272cec2614a4a45abd3fdbf7139dbd52b3275ae.zip |
Extract LDAPControl search function to LDAPUtil
Diffstat (limited to 'base/util/src/com/netscape/cmsutil/ldap/LDAPUtil.java')
-rw-r--r-- | base/util/src/com/netscape/cmsutil/ldap/LDAPUtil.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/base/util/src/com/netscape/cmsutil/ldap/LDAPUtil.java b/base/util/src/com/netscape/cmsutil/ldap/LDAPUtil.java index b02ffee78..f8162235d 100644 --- a/base/util/src/com/netscape/cmsutil/ldap/LDAPUtil.java +++ b/base/util/src/com/netscape/cmsutil/ldap/LDAPUtil.java @@ -18,11 +18,13 @@ package com.netscape.cmsutil.ldap; import java.io.IOException; +import java.lang.Class; import java.util.ArrayList; import netscape.ldap.LDAPAttribute; import netscape.ldap.LDAPAttributeSet; import netscape.ldap.LDAPConnection; +import netscape.ldap.LDAPControl; import netscape.ldap.LDAPEntry; import netscape.ldap.LDAPException; import netscape.ldap.LDAPModification; @@ -145,4 +147,20 @@ public class LDAPUtil { } } } + + /** + * Get the control of the specified class from the array of controls. + * + * @return the LDAPControl, or null if not found + */ + public static LDAPControl getControl( + Class<? extends LDAPControl> cls, LDAPControl[] controls) { + if (controls != null) { + for (LDAPControl control : controls) { + if (cls.isInstance(control)) + return control; + } + } + return null; + } } |