[Spring-Ldap] spring-ldap1.x升級到2.1
改前輩 spring-ldap-core 1.x版的到2.1
因為 DistinguishedName 被deprecate的關係,要改一點東西
1. 架構 DistinguishedName 的地方
//舊版 (1.x)
protected Name buildDn(String uid)
{
DistinguishedName dn = new DistinguishedName();
dn.add("a", aValue);
dn.add("b", bValue);
dn.add("uid", uid);
return dn;
}
//新版 (2.1)
protected Name buildDn(String uid) throws InvalidNameException
{
return LdapNameBuilder.newInstance().add("a", aValue).add("b", bValue).add("uid",uid).build();
}
2. findAll的ldapTemplate.search
//舊版 (1.x)
return ldapTemplate.search(DistinguishedName.EMPTY_PATH, filter.encode(), getContextMapper());
//新版 (2.1)
return ldapTemplate.search(LdapUtils.emptyLdapName(), filter.encode(), getContextMapper());