| | |
| | | */ |
| | | package org.opends.server.util; |
| | | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | |
| | | import static org.opends.server.schema.SchemaConstants.SYNTAX_AUTH_PASSWORD_OID; |
| | | import static org.opends.server.schema.SchemaConstants.SYNTAX_USER_PASSWORD_OID; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.ObjectClass; |
| | | |
| | | /** Utility methods related to schema. */ |
| | | public class SchemaUtils |
| | | { |
| | |
| | | } |
| | | return PasswordType.NOT_A_PASSWORD; |
| | | } |
| | | |
| | | /** |
| | | * Returns a new collection with the result of calling {@link ObjectClass#getNameOrOID()} on each |
| | | * element of the provided collection. |
| | | * |
| | | * @param objectClasses |
| | | * the schema elements on which to act |
| | | * @return a new collection comprised of the names or OIDs of each element |
| | | */ |
| | | public static Collection<String> getNameOrOIDsForOCs(Collection<ObjectClass> objectClasses) |
| | | { |
| | | Set<String> results = new HashSet<>(objectClasses.size()); |
| | | for (ObjectClass objectClass : objectClasses) |
| | | { |
| | | results.add(objectClass.getNameOrOID()); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | /** |
| | | * Returns a new collection with the result of calling {@link AttributeType#getNameOrOID()} on |
| | | * each element of the provided collection. |
| | | * |
| | | * @param attributeTypes |
| | | * the schema elements on which to act |
| | | * @return a new collection comprised of the names or OIDs of each element |
| | | */ |
| | | public static Collection<String> getNameOrOIDsForATs(Collection<AttributeType> attributeTypes) |
| | | { |
| | | Set<String> results = new HashSet<>(attributeTypes.size()); |
| | | for (AttributeType attrType : attributeTypes) |
| | | { |
| | | results.add(attrType.getNameOrOID()); |
| | | } |
| | | return results; |
| | | } |
| | | } |