Introduce CMS-specific user APIs, based at this stage on OSGi UserAdmin
[lgpl/argeo-commons.git] / org.argeo.api.cms / src / org / argeo / api / cms / directory / HierarchyUnit.java
index 04593d94e428ef766fa87831fbaa0f3c745aaee7..6c67736eb89c3599e0786adccf41a394aca349e6 100644 (file)
@@ -13,7 +13,7 @@ public interface HierarchyUnit {
 
        /**
         * The parent {@link HierarchyUnit}, or <code>null</code> if a
-        * {@link Directory}.
+        * {@link CmsDirectory}.
         */
        HierarchyUnit getParent();
 
@@ -26,7 +26,11 @@ public interface HierarchyUnit {
         * @return <code>true</code> if functional, <code>false</code> is technical
         *         (e.g. People, Groups, etc.)
         */
-       boolean isFunctional();
+       default boolean isFunctional() {
+               return isType(Type.FUNCTIONAL);
+       }
+
+       boolean isType(Type type);
 
        /**
         * The base of this organisational unit within the hierarchy. This would
@@ -34,9 +38,16 @@ public interface HierarchyUnit {
         */
        String getBase();
 
-       /** The related {@link Directory}. */
-       Directory getDirectory();
+       /** The related {@link CmsDirectory}. */
+       CmsDirectory getDirectory();
 
        /** Its metadata (typically LDAP attributes). */
        Dictionary<String, Object> getProperties();
+
+       enum Type {
+               PEOPLE, //
+               GROUPS, //
+               ROLES, //
+               FUNCTIONAL;
+       }
 }