public LdapDirectoryConfiguration toLdapConfiguration(Directory directory) { LdapDirectoryConfiguration configuration = new LdapDirectoryConfiguration(); configuration.setLdapPermissionOption( PermissionOption.fromAllowedOperations(directory.getAllowedOperations())); configuration.setActive(directory.isActive()); configuration.setLdapUserEncryption(directory.getEncryptionType()); configuration.setDirectoryId(directory.getId() != null ? directory.getId() : 0); configuration.setType(directory.getImplementationClass()); configuration.setName(directory.getName()); LdapDirectoryAttributes attributes = LdapDirectoryAttributes.fromAttributesMap(directory.getAttributes()); BeanUtils.copyProperties(attributes, configuration); configuration.setCrowdSyncIncrementalEnabled(attributes.isIncrementalSyncEnabled()); return configuration; }