/** {@inheritDoc} */ public boolean apply(RoleDescriptor input) { if (input == null) { return false; } return input.isSupportedProtocol(protocol); }
/** {@inheritDoc} */ public List<RoleDescriptor> getRoleDescriptors(QName type, String supportedProtocol) { ArrayList<RoleDescriptor> supportingRoleDescriptors = new ArrayList<>(); for (RoleDescriptor descriptor : roleDescriptors.subList(type)) { if (descriptor.isSupportedProtocol(supportedProtocol)) { supportingRoleDescriptors.add(descriptor); } } return supportingRoleDescriptors; }
/** * Gets the role which supports the given protocol. * * @param entityID ID of the entity from which to retrieve roles, never null * @param roleName name of the role to search for, never null * @param supportedProtocol protocol to search for, never null * * @return the role supporting the protocol or null if no such role exists * * @throws ResolverException thrown if there is a problem search for the roles */ protected RoleDescriptor doGetRole(final String entityID, final QName roleName, final String supportedProtocol) throws ResolverException { final List<RoleDescriptor> roles = doGetRole(entityID, roleName); if (roles == null || roles.isEmpty()) { log.debug("Metadata document did not contain any role descriptors of type {} for entity {}", roleName, entityID); return null; } final Iterator<RoleDescriptor> rolesItr = roles.iterator(); RoleDescriptor role = null; while (rolesItr.hasNext()) { role = rolesItr.next(); if (role != null && role.isSupportedProtocol(supportedProtocol)) { return role; } } return null; }