package org.argeo.api.cms.directory;
import java.util.Dictionary;
import java.util.Locale;
/** A unit within the high-level organisational structure of a directory. */
public interface HierarchyUnit {
/** Name to use in paths. */
String getHierarchyUnitName();
/** Name to use in UI. */
String getHierarchyUnitLabel(Locale locale);
/**
* The parent {@link HierarchyUnit}, or null
if a
* {@link CmsDirectory}.
*/
HierarchyUnit getParent();
/** Direct children {@link HierarchyUnit}s. */
Iterable getDirectHierarchyUnits(boolean functionalOnly);
/**
* Whether this is an arbitrary named and placed {@link HierarchyUnit}.
*
* @return true
if functional, false
is technical
* (e.g. People, Groups, etc.)
*/
default boolean isFunctional() {
return isType(Type.FUNCTIONAL);
}
boolean isType(Type type);
/**
* The base of this organisational unit within the hierarchy. This would
* typically be an LDAP base DN.
*/
String getBase();
/** The related {@link CmsDirectory}. */
CmsDirectory getDirectory();
/** Its metadata (typically LDAP attributes). */
Dictionary getProperties();
enum Type {
PEOPLE, //
GROUPS, //
ROLES, //
FUNCTIONAL;
}
}