public enum UniStructure extends Enum<UniStructure>
refresh()
is called. LDAP reads are retried,
and if this fails the existing cached data will continue to be used for a further period.
If the data cannot be read on first initialisation then a RuntimeException will be thrown.Enum Constant and Description |
---|
INSTANCE |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
static Set<String> |
getChildren(String parentOu)
Returns the direct children of the specified OU.
|
static Set<String> |
getDescendants(String parentOu,
boolean includeParent)
Returns all the descendants of the specified OU.
|
static UniStructure |
getInstance()
Gets a reference to the underlying singleton instance.
|
static String |
getNameFromCode(String shortou)
Returns the full name of an OU, given the shortou code.
|
static String |
getParent(String shortou)
Looks up the code for the parent of the supplied shortou code.
|
static boolean |
isChildOf(String ou1,
String ou2)
Returns true if ou1 is equal to ou2 or a child of it.
|
static void |
refresh()
Causes UniStructure to re-cache its data from the LDAP.
|
static UniStructure |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static UniStructure[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final UniStructure INSTANCE
public static UniStructure[] values()
for (UniStructure c : UniStructure.values()) System.out.println(c);
public static UniStructure valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static String getNameFromCode(String shortou) throws NotFoundException
shortou
- The code for the OUNotFoundException
- if the code does not match a known OUCacheFailureException
- if unable to get LDAP data after retriespublic static String getParent(String shortou) throws NotFoundException
shortou
- The code for the starting OUNotFoundException
- if the shortou code is not recognisedCacheFailureException
- if unable to get LDAP data after retriespublic static boolean isChildOf(String ou1, String ou2) throws NotFoundException
ou1
- 8-letter OU code to check for childhoodou2
- 8-letter OU code to check for parenthoodNotFoundException
- if no parent is found for the shortou codeCacheFailureException
- if unable to get LDAP data after retriespublic static Set<String> getChildren(String parentOu) throws NotFoundException
parentOu
- the shortou
code of the parent OU of which to return the childrenSet
of child shortou
codes - empty if there are noneNotFoundException
- if the parent cannot be foundCacheFailureException
- if unable to get LDAP data after retriespublic static Set<String> getDescendants(String parentOu, boolean includeParent) throws NotFoundException
parentOu
- the shortou
code of the parent OU of which to return the descendantsincludeParent
- if true
then the parentOu will be included in the resultSet
of descendant shortou
codes - empty if there are noneNotFoundException
- if the parent cannot be foundCacheFailureException
- if unable to get LDAP data after retriespublic static void refresh()
@PreDestroy public void destroy()
public static UniStructure getInstance()
destroy()
gets called.Copyright © 2018. All rights reserved.