Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2010 Västra Götalandsregionen This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public License as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package se.vgregion.userupdate.ldap;
import  org.springframework.ldap.core.LdapTemplate;
Data access object using LDAP.

Author(s):
David Rosell
@SuppressWarnings("unchecked")
public class UserLdapDao {
    @Autowired
    private LdapTemplate ldapTemplate;

    
Retrieve UserLdapAttributess for a uid.

Parameters:
uid the uid
Returns:
a List of UserLdapAttributes
    public List<UserLdapAttributesresolve(String uid) {
        String base = "ou=anv,o=vgr";
        String filter = String.format("(&(objectClass=person)(uid=%s))"uid);
        return .search(basefilternew UserMapper());
    }

    
Retrieve all UnitLdapAttributes which are associated with a certain UserLdapAttributes.

Parameters:
userLdapAttributes the UserLdapAttributes
Returns:
a List of UnitLdapAttributes
    public List<UnitLdapAttributesresolve(UserLdapAttributes userLdapAttributes) {
        List<UnitLdapAttributesunitList = new ArrayList<UnitLdapAttributes>();
        if (userLdapAttributes.getVgrStrukturPersonDN() != null) {
            for (String orgDn : userLdapAttributes.getVgrStrukturPersonDN()) {
                Object result = .lookup(orgDnnew UnitMapper());
                if (result != null && (result instanceof UnitLdapAttributes)) {
                    unitList.add((UnitLdapAttributesresult);
                }
            }
        }
        return unitList;
    }
New to GrepCode? Check out our FAQ X