/** * Returns the name of the group this role is mapped to in the OpenCms database.<p> * * Here the fully qualified group name is returned.<p> * * @return the name of the group this role is mapped to in the OpenCms database */ public String getGroupName() { if ((m_ouFqn == null) || isOrganizationalUnitIndependent()) { return m_groupName; } return m_ouFqn + m_groupName; }
/** * Returns the name of the group this role is mapped to in the OpenCms database.<p> * * Here the fully qualified group name is returned.<p> * * @return the name of the group this role is mapped to in the OpenCms database */ public String getGroupName() { if ((m_ouFqn == null) || isOrganizationalUnitIndependent()) { return m_groupName; } return m_ouFqn + m_groupName; }
/** * @see java.lang.Object#hashCode() */ @Override public int hashCode() { return m_roleName.hashCode() + (((m_ouFqn == null) || isOrganizationalUnitIndependent()) ? 13 : m_ouFqn.hashCode()); }
/** * @see java.lang.Object#hashCode() */ @Override public int hashCode() { return m_roleName.hashCode() + (((m_ouFqn == null) || isOrganizationalUnitIndependent()) ? 13 : m_ouFqn.hashCode()); }
/** * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof CmsRole) { CmsRole that = (CmsRole)obj; // first check name if (m_roleName.equals(that.m_roleName)) { if (isOrganizationalUnitIndependent()) { // if ou independent ignore ou info return true; } // then check the org unit if (m_ouFqn == null) { // if org unit not set return (that.m_ouFqn == null); } else { // if org unit set return (m_ouFqn.equals(that.m_ouFqn)); } } } return false; }
/** * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof CmsRole) { CmsRole that = (CmsRole)obj; // first check name if (m_roleName.equals(that.m_roleName)) { if (isOrganizationalUnitIndependent()) { // if ou independent ignore ou info return true; } // then check the org unit if (m_ouFqn == null) { // if org unit not set return (that.m_ouFqn == null); } else { // if org unit set return (m_ouFqn.equals(that.m_ouFqn)); } } } return false; }
/** * Returns a list of all sub roles.<p> * * @param recursive if not set just direct children are returned * * @return all sub roles as a list of {@link CmsRole} objects */ public List getChildren(boolean recursive) { List children = new ArrayList(); Iterator itChildren = m_children.iterator(); while (itChildren.hasNext()) { CmsRole child = (CmsRole)itChildren.next(); if (child.isOrganizationalUnitIndependent()) { child = child.forOrgUnit(null); } else { child = child.forOrgUnit(m_ouFqn); } children.add(child); if (recursive) { children.addAll(child.getChildren(true)); } } return children; }
/** * Returns a list of all sub roles.<p> * * @param recursive if not set just direct children are returned * * @return all sub roles as a list of {@link CmsRole} objects */ public List<CmsRole> getChildren(boolean recursive) { List<CmsRole> children = new ArrayList<CmsRole>(); Iterator<CmsRole> itChildren = m_children.iterator(); while (itChildren.hasNext()) { CmsRole child = itChildren.next(); if (child.isOrganizationalUnitIndependent()) { child = child.forOrgUnit(null); } else { child = child.forOrgUnit(m_ouFqn); } children.add(child); if (recursive) { for (CmsRole grandChild : child.getChildren(true)) { if (!children.contains(grandChild)) { children.add(grandChild); } } } } return children; }
/** * Returns the role for the given role name.<p> * * @param roleName a role name to check for role representation * * @return the role for the given role name */ public static CmsRole valueOfRoleName(String roleName) { String roleOu = CmsOrganizationalUnit.getParentFqn(roleName); Iterator<CmsRole> it = SYSTEM_ROLES.iterator(); while (it.hasNext()) { CmsRole role = it.next(); // direct check if (roleName.equals(role.getRoleName())) { return role.forOrgUnit(roleOu); } if (!role.isOrganizationalUnitIndependent()) { // the role name does not start with "/", but the given role fqn does if (roleName.endsWith(CmsOrganizationalUnit.SEPARATOR + role.getRoleName())) { return role.forOrgUnit(roleOu); } } } return null; }
/** * Returns the role for the given group name.<p> * * @param groupName a group name to check for role representation * * @return the role for the given group name */ public static CmsRole valueOfGroupName(String groupName) { String groupOu = CmsOrganizationalUnit.getParentFqn(groupName); Iterator<CmsRole> it = SYSTEM_ROLES.iterator(); while (it.hasNext()) { CmsRole role = it.next(); // direct check if (groupName.equals(role.getGroupName())) { return role.forOrgUnit(groupOu); } if (!role.isOrganizationalUnitIndependent()) { // the role group name does not start with "/", but the given group fqn does if (groupName.endsWith(CmsOrganizationalUnit.SEPARATOR + role.getGroupName())) { return role.forOrgUnit(groupOu); } } } return null; }
/** * Returns the role for the given group name.<p> * * @param groupName a group name to check for role representation * * @return the role for the given group name */ public static CmsRole valueOfGroupName(String groupName) { String groupOu = CmsOrganizationalUnit.getParentFqn(groupName); Iterator it = SYSTEM_ROLES.iterator(); while (it.hasNext()) { CmsRole role = (CmsRole)it.next(); // direct check if (groupName.equals(role.getGroupName())) { return role.forOrgUnit(groupOu); } if (!role.isOrganizationalUnitIndependent()) { // the role group name does not start with "/", but the given group fqn does if (groupName.endsWith(CmsOrganizationalUnit.SEPARATOR + role.getGroupName())) { return role.forOrgUnit(groupOu); } } } return null; }
/** * Returns the role for the given role name.<p> * * @param roleName a role name to check for role representation * * @return the role for the given role name */ public static CmsRole valueOfRoleName(String roleName) { String roleOu = CmsOrganizationalUnit.getParentFqn(roleName); Iterator it = SYSTEM_ROLES.iterator(); while (it.hasNext()) { CmsRole role = (CmsRole)it.next(); // direct check if (roleName.equals(role.getRoleName())) { return role.forOrgUnit(roleOu); } if (!role.isOrganizationalUnitIndependent()) { // the role name does not start with "/", but the given role fqn does if (roleName.endsWith(CmsOrganizationalUnit.SEPARATOR + role.getRoleName())) { return role.forOrgUnit(roleOu); } } } return null; }
CmsGroup group = it.next(); CmsRole givenRole = CmsRole.valueOf(group).forOrgUnit(null); if (givenRole.isOrganizationalUnitIndependent() || result.contains(givenRole)) {
CmsGroup group = (CmsGroup)it.next(); CmsRole givenRole = CmsRole.valueOf(group).forOrgUnit(null); if (givenRole.isOrganizationalUnitIndependent() || result.contains(givenRole)) {
while (itRoles.hasNext()) { CmsRole role = itRoles.next(); if (role.isOrganizationalUnitIndependent() && !inRootOu) { continue;
if (role.isOrganizationalUnitIndependent() && (CmsOrganizationalUnit.getParentFqn(ouFqn) != null)) {
if (role.isOrganizationalUnitIndependent() && !isRootOu) {
if (role.isOrganizationalUnitIndependent() && (CmsOrganizationalUnit.getParentFqn(ouFqn) != null)) {