/** * Adds a given role to this manager. * * @param role the role to add, cannot be <code>null</code>. If it is already contained by this * manager, this method will not do anything. * @return the given role if added, <code>null</code> otherwise. */ public Role addRole(String name, int type) { if ((name == null) || "".equals(name.trim())) { throw new IllegalArgumentException("Name cannot be null or empty!"); } if (type != Role.GROUP && type != Role.USER) { throw new IllegalArgumentException("Invalid role type!"); } checkPermissions(); try { Role result = m_store.addRole(name, type); if (result != null) { result = wireChangeListener(result); m_roleChangeReflector.roleAdded(result); } return result; } catch (Exception e) { throw new BackendException("Adding role " + name + " failed!", e); } }