]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.api.cms/src/org/argeo/api/cms/directory/HierarchyUnit.java
Use Argeo Build from testing
[lgpl/argeo-commons.git] / org.argeo.api.cms / src / org / argeo / api / cms / directory / HierarchyUnit.java
1 package org.argeo.api.cms.directory;
2
3 import java.util.Dictionary;
4 import java.util.Locale;
5
6 /** A unit within the high-level organisational structure of a directory. */
7 public interface HierarchyUnit {
8 /** Name to use in paths. */
9 String getHierarchyUnitName();
10
11 /** Name to use in UI. */
12 String getHierarchyUnitLabel(Locale locale);
13
14 /**
15 * The parent {@link HierarchyUnit}, or <code>null</code> if a
16 * {@link CmsDirectory}.
17 */
18 HierarchyUnit getParent();
19
20 /** Direct children {@link HierarchyUnit}s. */
21 Iterable<HierarchyUnit> getDirectHierarchyUnits(boolean functionalOnly);
22
23 /**
24 * Whether this is an arbitrary named and placed {@link HierarchyUnit}.
25 *
26 * @return <code>true</code> if functional, <code>false</code> is technical
27 * (e.g. People, Groups, etc.)
28 */
29 default boolean isFunctional() {
30 return isType(Type.FUNCTIONAL);
31 }
32
33 boolean isType(Type type);
34
35 /** A technical direct child. */
36 HierarchyUnit getDirectChild(Type type);
37
38 /**
39 * The base of this organisational unit within the hierarchy. This would
40 * typically be an LDAP base DN.
41 */
42 String getBase();
43
44 /** The related {@link CmsDirectory}. */
45 CmsDirectory getDirectory();
46
47 /** Its metadata (typically LDAP attributes). */
48 Dictionary<String, Object> getProperties();
49
50 enum Type {
51 PEOPLE, //
52 GROUPS, //
53 ROLES, //
54 FUNCTIONAL;
55 }
56 }