use of org.apache.directory.api.ldap.model.ldif.anonymizer.StringAnonymizer in project directory-ldap-api by apache.
the class LdifAnonymizer method init.
/**
* Initialize the anonymizer, filling the maps we use.
*/
private void init(Map<Integer, String> stringLatestValueMap, Map<Integer, byte[]> binaryLatestValueMap, Map<Integer, String> integerLatestValueMap, Map<Integer, String> telephoneNumberLatestValueMap) {
// Load the anonymizers
attributeAnonymizers.put(SchemaConstants.CAR_LICENSE_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.DOMAIN_COMPONENT_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.CN_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.DESCRIPTION_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.DISPLAY_NAME_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.GECOS_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.GID_NUMBER_AT_OID, new IntegerAnonymizer(integerLatestValueMap));
attributeAnonymizers.put(SchemaConstants.GIVENNAME_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.HOME_DIRECTORY_AT_OID, new CaseSensitiveStringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.HOME_PHONE_AT_OID, new TelephoneNumberAnonymizer());
attributeAnonymizers.put(SchemaConstants.HOME_POSTAL_ADDRESS_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.HOST_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.HOUSE_IDENTIFIER_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.JPEG_PHOTO_AT_OID, new BinaryAnonymizer(binaryLatestValueMap));
attributeAnonymizers.put(SchemaConstants.LABELED_URI_AT_OID, new CaseSensitiveStringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.LOCALITY_NAME_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.MAIL_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.MANAGER_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.MEMBER_UID_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.MOBILE_AT_OID, new TelephoneNumberAnonymizer());
attributeAnonymizers.put(SchemaConstants.ORGANIZATION_NAME_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.ORGANIZATIONAL_UNIT_NAME_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.PAGER_AT_OID, new TelephoneNumberAnonymizer());
attributeAnonymizers.put(SchemaConstants.POSTAL_ADDRESS_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.PHOTO_AT_OID, new BinaryAnonymizer(binaryLatestValueMap));
attributeAnonymizers.put(SchemaConstants.SECRETARY_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.SEE_ALSO_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.SN_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.TELEPHONE_NUMBER_AT_OID, new TelephoneNumberAnonymizer(telephoneNumberLatestValueMap));
attributeAnonymizers.put(SchemaConstants.UID_AT_OID, new StringAnonymizer(stringLatestValueMap));
attributeAnonymizers.put(SchemaConstants.UID_NUMBER_AT_OID, new IntegerAnonymizer(integerLatestValueMap));
attributeAnonymizers.put(SchemaConstants.USER_CERTIFICATE_AT_OID, new BinaryAnonymizer(binaryLatestValueMap));
attributeAnonymizers.put(SchemaConstants.USER_PASSWORD_AT_OID, new BinaryAnonymizer(binaryLatestValueMap));
attributeAnonymizers.put(SchemaConstants.USER_PKCS12_AT_OID, new BinaryAnonymizer(binaryLatestValueMap));
attributeAnonymizers.put(SchemaConstants.USER_SMIME_CERTIFICATE_AT_OID, new BinaryAnonymizer(binaryLatestValueMap));
attributeAnonymizers.put(SchemaConstants.X500_UNIQUE_IDENTIFIER_AT_OID, new BinaryAnonymizer(binaryLatestValueMap));
attributeAnonymizers.put(SchemaConstants.FACSIMILE_TELEPHONE_NUMBER_AT_OID, new TelephoneNumberAnonymizer(telephoneNumberLatestValueMap));
}
use of org.apache.directory.api.ldap.model.ldif.anonymizer.StringAnonymizer in project directory-ldap-api by apache.
the class LdifAnonymizer method addAnonAttributeType.
/**
* Add an attributeType that has to be anonymized
*
* @param attributeType the AttributeType that has to be anonymized
* @throws LdapException If the attributeType cannot be added
*/
public void addAnonAttributeType(AttributeType attributeType) throws LdapException {
schemaManager.add(attributeType);
LdapSyntax syntax = attributeType.getSyntax();
if (syntax.isHumanReadable()) {
if (syntax.getOid().equals(SchemaConstants.INTEGER_SYNTAX)) {
attributeAnonymizers.put(attributeType.getOid(), new IntegerAnonymizer());
} else if (syntax.getOid().equals(SchemaConstants.DIRECTORY_STRING_SYNTAX)) {
attributeAnonymizers.put(attributeType.getOid(), new StringAnonymizer());
} else if (syntax.getOid().equals(SchemaConstants.TELEPHONE_NUMBER_SYNTAX)) {
attributeAnonymizers.put(attributeType.getOid(), new TelephoneNumberAnonymizer());
}
} else {
attributeAnonymizers.put(attributeType.getOid(), new BinaryAnonymizer());
}
}
Aggregations