@Override protected void processElement(SecurityRoleMetaData metaData, XMLStreamReader reader, final PropertyReplacer propertyReplacer) throws XMLStreamException { if (reader.getNamespaceURI().equals(LEGACY_NAMESPACE_URI) || reader.getNamespaceURI().equals(NAMESPACE_URI)) { final String localName = reader.getLocalName(); if (localName.equals(Element.ROLE_NAME.getLocalName())) metaData.setRoleName(getElementText(reader, propertyReplacer)); else if (localName.equals(Element.PRINCIPAL_NAME.getLocalName())) { Set<String> principalNames = metaData.getPrincipals(); if (principalNames == null) { principalNames = new HashSet<String>(); metaData.setPrincipals(principalNames); } principalNames.add(getElementText(reader, propertyReplacer)); } else throw unexpectedElement(reader); } else { super.processElement(metaData, reader, propertyReplacer); } }
/** * Get the principals * * @return the principals */ public Set<String> getPrincipals() { return getDelegate().getPrincipals(); }
/** * Get the principals * * @return the principals */ public Set<String> getPrincipals() { return getDelegate().getPrincipals(); }
public Map<String, Set<String>> getPrincipalVersusRolesMap() { Map<String, Set<String>> principalRolesMap = null; for (SecurityRoleMetaData srm : securityRoles) { String rolename = srm.getRoleName(); if (principalRolesMap == null) { principalRolesMap = new HashMap<String, Set<String>>(); } if (srm.getPrincipals() != null) { for (String pr : srm.getPrincipals()) { Set<String> roleset = principalRolesMap.get(pr); if (roleset == null) { roleset = new HashSet<String>(); } if (!roleset.contains(rolename)) { roleset.add(rolename); } principalRolesMap.put(pr, roleset); } } } return principalRolesMap; }
/** * Get a security role's principals * * @param name the role name * @return the security role principals or null if not found */ public Set<String> getSecurityRolePrincipals(String name) { if (securityRoles == null) return null; SecurityRoleMetaData securityRole = securityRoles.get(name); if (securityRole == null) return null; return securityRole.getPrincipals(); }
public Map<String, Set<String>> getPrincipalVersusRolesMap() { Map<String, Set<String>> principalRolesMap = null; for(SecurityRoleMetaData srm : securityRoles) { String rolename = srm.getRoleName(); if(principalRolesMap == null) principalRolesMap = new HashMap<String, Set<String>>(); if(srm.getPrincipals() != null) for(String pr : srm.getPrincipals()) { Set<String> roleset = (Set<String>)principalRolesMap.get(pr); if(roleset == null) roleset = new HashSet<String>(); if(!roleset.contains(rolename)) roleset.add(rolename); principalRolesMap.put(pr, roleset); } } return principalRolesMap; }
/** * Get a security role's principals * * @param name the role name * @return the security role principals or null if not found */ public Set<String> getSecurityRolePrincipals(String name) { if (securityRoles == null) return null; SecurityRoleMetaData securityRole = securityRoles.get(name); if (securityRole == null) return null; return securityRole.getPrincipals(); }
public Map<String, Set<String>> getPrincipalVersusRolesMap() { Map<String, Set<String>> principalRolesMap = null; for(SecurityRoleMetaData srm : securityRoles) { String rolename = srm.getRoleName(); if(principalRolesMap == null) principalRolesMap = new HashMap<String, Set<String>>(); if(srm.getPrincipals() != null) for(String pr : srm.getPrincipals()) { Set<String> roleset = (Set<String>)principalRolesMap.get(pr); if(roleset == null) roleset = new HashSet<String>(); if(!roleset.contains(rolename)) roleset.add(rolename); principalRolesMap.put(pr, roleset); } } return principalRolesMap; }
public Map<String, Set<String>> getPrincipalVersusRolesMap() { Map<String, Set<String>> principalRolesMap = null; for(SecurityRoleMetaData srm : securityRoles) { String rolename = srm.getRoleName(); if(principalRolesMap == null) principalRolesMap = new HashMap<String, Set<String>>(); if(srm.getPrincipals() != null) for(String pr : srm.getPrincipals()) { Set<String> roleset = principalRolesMap.get(pr); if(roleset == null) roleset = new HashSet<String>(); if(!roleset.contains(rolename)) roleset.add(rolename); principalRolesMap.put(pr, roleset); } } return principalRolesMap; }
/** * Add entries to principalVersusRolesMap for the specified role meta data. * * @param roleMetaData the security role meta data */ private void processSecurityRoleMetaData(SecurityRoleMetaData roleMetaData) { Set<String> principals = roleMetaData.getPrincipals(); if(principals == null) return; for(String principal : principals) { Set<String> roles = principalVersusRolesMap.get(principal); if(roles == null) { roles = new HashSet<String>(); principalVersusRolesMap.put(principal, roles); } roles.add(roleMetaData.getRoleName()); } }
/** * Add entries to principalVersusRolesMap for the specified role meta data. * * @param roleMetaData the security role meta data */ private void processSecurityRoleMetaData(SecurityRoleMetaData roleMetaData) { Set<String> principals = roleMetaData.getPrincipals(); if(principals == null) return; for(String principal : principals) { Set<String> roles = principalVersusRolesMap.get(principal); if(roles == null) { roles = new HashSet<String>(); principalVersusRolesMap.put(principal, roles); } roles.add(roleMetaData.getRoleName()); } }
@Override protected void removeNotification(SecurityRoleMetaData removed) { super.removeNotification(removed); Set<String> principals = removed.getPrincipals(); if(principals == null) return; for(String principal : principals) { Set<String> roles = principalVersusRolesMap.get(principal); if(roles != null) { roles.remove(removed.getRoleName()); } } } }
@Override protected void removeNotification(SecurityRoleMetaData removed) { super.removeNotification(removed); Set<String> principals = removed.getPrincipals(); if(principals == null) return; for(String principal : principals) { Set<String> roles = principalVersusRolesMap.get(principal); if(roles != null) { roles.remove(removed.getRoleName()); } } } }
@Override protected void processElement(SecurityRoleMetaData metaData, XMLStreamReader reader, final PropertyReplacer propertyReplacer) throws XMLStreamException { if (reader.getNamespaceURI().equals(LEGACY_NAMESPACE_URI) || reader.getNamespaceURI().equals(NAMESPACE_URI)) { final String localName = reader.getLocalName(); if (localName.equals(Element.ROLE_NAME.getLocalName())) metaData.setRoleName(getElementText(reader, propertyReplacer)); else if (localName.equals(Element.PRINCIPAL_NAME.getLocalName())) { Set<String> principalNames = metaData.getPrincipals(); if (principalNames == null) { principalNames = new HashSet<String>(); metaData.setPrincipals(principalNames); } principalNames.add(getElementText(reader, propertyReplacer)); } else throw unexpectedElement(reader); } else { super.processElement(metaData, reader, propertyReplacer); } }