1 package org
.argeo
.util
.directory
.ldap
;
3 import javax
.naming
.ldap
.LdapName
;
4 import javax
.naming
.ldap
.Rdn
;
6 import org
.argeo
.util
.directory
.HierarchyUnit
;
8 /** LDIF/LDAP based implementation of {@link HierarchyUnit}. */
9 public class LdapHierarchyUnit
extends DefaultLdapEntry
implements HierarchyUnit
{
10 private final boolean functional
;
12 public LdapHierarchyUnit(AbstractLdapDirectory directory
, LdapName dn
) {
15 Rdn rdn
= LdapNameUtils
.getLastRdn(dn
);
16 functional
= !(directory
.getUserBaseRdn().equals(rdn
) || directory
.getGroupBaseRdn().equals(rdn
)
17 || directory
.getSystemRoleBaseRdn().equals(rdn
));
21 public HierarchyUnit
getParent() {
22 return getDirectoryDao().doGetHierarchyUnit(LdapNameUtils
.getParent(getDn()));
26 public Iterable
<HierarchyUnit
> getDirectHierarchyUnits(boolean functionalOnly
) {
27 return getDirectoryDao().doGetDirectHierarchyUnits(getDn(), functionalOnly
);
31 public boolean isFunctional() {
36 public String
getHierarchyUnitName() {
37 String name
= LdapNameUtils
.getLastRdnValue(getDn());
38 // TODO check ou, o, etc.
43 public String
getBase() {
44 return getDn().toString();
48 public String
toString() {
49 return "Hierarchy Unit " + getDn().toString();