public int compareTo(Object o) { if (!(o instanceof Group)) { return 0; } Group group = (Group) o; return groupName.compareTo(group.getGroupName()); } }
/** * {@inheritDoc} */ public Group removeGroup(Group group, boolean broadcast) throws Exception { if (broadcast) preDelete(group); Session session = service_.openSession(); if (session.get(group.getClass(), group.getId()) == null) { throw new InvalidNameException("Can not remove group " + group.getGroupName() + "record, because group does not exist."); } if (hasChildrenGroups(group)) { throw new IllegalStateException("Group " + group.getGroupName() + " has at least one child group"); } session.delete(group); MembershipDAOImpl.removeMembershipEntriesOfGroup(group, session); session.flush(); if (broadcast) postDelete(group); return group; }
private List<LocalPath> getPath(List<LocalPath> list, String id) throws Exception { if (list == null) list = new ArrayList<LocalPath>(5); if (id == null) return list; OrganizationService service = getApplicationComponent(OrganizationService.class); Group group = service.getGroupHandler().findGroupById(id); if (group == null) return list; list.add(0, new LocalPath(group.getId(), group.getGroupName())); getPath(list, group.getParentId()); return list; }
static public String getGroupLabel(String groupId) throws Exception { WebuiRequestContext context = WebuiRequestContext.getCurrentInstance(); ExoContainer container = context.getApplication().getApplicationServiceContainer(); OrganizationService orgService = (OrganizationService)container.getComponentInstanceOfType(OrganizationService.class); Group group = orgService.getGroupHandler().findGroupById(groupId); if(group == null){ return cachedGroupLabel; } String label = group.getLabel(); cachedGroupLabel = (label != null && label.trim().length() > 0 )? label : group.getGroupName(); return cachedGroupLabel; }
private List<LocalPath> getPath(List<LocalPath> list, String id) throws Exception { if (list == null) list = new ArrayList<LocalPath>(5); if (id == null) return list; OrganizationService service = getApplicationComponent(OrganizationService.class); Group group = service.getGroupHandler().findGroupById(id); if (group == null) return list; list.add(0, new LocalPath(group.getId(), group.getGroupName())); getPath(list, group.getParentId()); return list; }
/** * Create LDAP attributes that represents group in LDAP context. * * @param group Group * @return LDAP attributes */ public final Attributes groupToAttributes(Group group) { BasicAttributes attrs = new BasicAttributes(); if (GROUP_LDAP_CLASSES == null) GROUP_LDAP_CLASSES = groupLDAPClasses.split(","); attrs.put(new ObjectClassAttribute(GROUP_LDAP_CLASSES)); attrs.put(groupNameAttr, group.getGroupName()); String desc = group.getDescription(); if (desc != null && desc.length() > 0) attrs.put(ldapDescriptionAttr, desc); String lbl = group.getLabel(); if (lbl != null && lbl.length() > 0) attrs.put(groupLabelAttr, lbl); return attrs; }
private List<LocalPath> getPath(List<LocalPath> list, String id) throws Exception { if (list == null) { list = new ArrayList<LocalPath>(5); } if (id == null) { return list; } OrganizationService service = getApplicationComponent(OrganizationService.class); Group group = service.getGroupHandler().findGroupById(id); if (group == null) { return list; } list.add(0, new LocalPath(group.getId(), group.getGroupName())); getPath(list, group.getParentId()); return list; }
String groupId = "/" + child.getGroupName(); GroupImpl childImpl = (GroupImpl)child; if (parent != null) groupId = parentGroup.getId() + "/" + child.getGroupName(); childImpl.setParentId(parentGroup.getId()); if (o != null) Object[] args = {child.getGroupName()}; throw new UniqueObjectException("OrganizationService.unique-group-exception", args);
public Group removeGroup(Group group, boolean broadcast) throws Exception { if (findGroupById(group.getId()) == null) { throw new InvalidNameException("Can't remove group since group with groupId " + group.getId() + " is not found"); } GroupImpl groupImpl = (GroupImpl)group; if (hasChildrenGroups(group)) { throw new IllegalStateException("Group " + group.getGroupName() + " has at least one child group"); } if (broadcast) listenerService_.broadcast(GroupHandler.PRE_DELETE_GROUP_EVENT, this, groupImpl); super.remove(groupImpl); if (broadcast) listenerService_.broadcast(GroupHandler.POST_DELETE_GROUP_EVENT, this, groupImpl); return group; }
private List<OrganizationConfig.Group> getAllGroups() throws Exception { List<OrganizationConfig.Group> allGroups = new ArrayList<OrganizationConfig.Group>(); try { @SuppressWarnings("unchecked") Collection<Group> groups = organizationService.getGroupHandler().getAllGroups(); for (Group group : groups) { OrganizationConfig.Group orgConfGroup = new OrganizationConfig.Group(); orgConfGroup.setDescription(group.getDescription()); orgConfGroup.setLabel(group.getLabel()); orgConfGroup.setName(group.getGroupName()); orgConfGroup.setParentId(group.getParentId()); allGroups.add(orgConfGroup); } } catch (Exception e) { LOG.error("Error when recovering of all groups ... ", e); return null; } return allGroups; }
String groupDN = ldapAttrMapping.groupDNKey + "=" + child.getGroupName() + "," + searchBase; String filter = ldapAttrMapping.groupNameAttr + "=" + child.getGroupName();
String filter = ldapAttrMapping.groupNameAttr + "=" + group.getGroupName(); String searchBase = this.createSubDN(group.getParentId()); SearchControls constraints = new SearchControls(); throw new IllegalStateException("Group " + group.getGroupName() + " has at least one child group");
String plGroupName = getPLIDMGroupName(exoGroup.getGroupName());
String groupDN = ldapAttrMapping.groupDNKey + "=" + group.getGroupName() + "," + createSubDN(parent);
} else { try { String plGroupName = getPLIDMGroupName(parent.getGroupName());
String parentPLGroupName = getPLIDMGroupName(parent.getGroupName()); try { parentGroup = getIdentitySession().getPersistenceManager().findGroup(parentPLGroupName, ((ExtGroup) child).setId(parent.getId() + "/" + child.getGroupName()); ((ExtGroup) child).setId("/" + child.getGroupName());
String plGroupName = getPLIDMGroupName(group.getGroupName()); } finally { if(oneLevelChilds != null && oneLevelChilds.size() > 0) { throw new IllegalStateException("Group " + group.getGroupName() + " has at least one child group");
String groupId = "/" + child.getGroupName(); Connection connection = eXoDS_.getConnection(); childImpl.setParentId("/"); + " not exists"); groupId = parentGroup.getId() + "/" + child.getGroupName(); childImpl.setParentId(parentGroup.getId()); if (o != null) Object[] args = {child.getGroupName()}; throw new UniqueObjectException("OrganizationService.unique-group-exception", args);
LOG.debug("Remove all Membership by Group: " + group.getGroupName());
if(g1 == null) { throw new InvalidNameException("Can not create membership record for " + user.getUserName() + " because group " + g.getGroupName() + " is not exist"); String plGroupName = getPLIDMGroupName(g.getGroupName());