}
}
protected Group buildGroup(String groupDN, Attributes attrs) throws NamingException
{
GroupImpl group = new GroupImpl();
// extract group's id, group's name and parent's group from DN
StringBuffer idBuffer = new StringBuffer();
String parentId = null;
String[] baseParts = explodeDN(ldapAttrMapping.groupsURL, true);
String[] membershipParts = explodeDN(groupDN, true);
for (int x = (membershipParts.length - baseParts.length - 1); x > -1; x--)
{
idBuffer.append("/" + membershipParts[x]);
if (x == 1)
parentId = idBuffer.toString();
}
group.setGroupName(membershipParts[0]);
group.setId(idBuffer.toString());
if (attrs != null)
{
group.setDescription(ldapAttrMapping.getAttributeValueAsString(attrs, ldapAttrMapping.ldapDescriptionAttr));
group.setLabel(ldapAttrMapping.getAttributeValueAsString(attrs, ldapAttrMapping.groupLabelAttr));
}
group.setParentId(parentId);
return group;
}