Bonjour,

J'essaie de rajouter à un attribut à un enregistrement que je récupère en java.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 
	public boolean putId(String filter)
	{
		try
		{
			creationContext();
 
			SearchControls searchCtls = new SearchControls();
					searchCtls.setReturningAttributes(returnedAtts);
					searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
 
			String searchFilter = filter;
			NamingEnumeration answer = ctx.search(basedn, searchFilter, searchCtls);
 
			while(answer.hasMore())
			{
				SearchResult sr = (SearchResult)answer.next();
				Attributes attrs = sr.getAttributes();
				if (attrs != null) 
				{
					attrs.put("employeeID", "10000000000000000");
					System.out.println("id"+attrs.get("employeeID"));
					return true;
				}
			}
			ctx.close();
		}
		catch (NamingException e)
 		{
 			e.printStackTrace();
		}
		return false;
	}
L'id est bien affiché. Mais il n'y a aucun impact sur mon annuaire ldap.

Quelqu'un aurait une idée sur la démarche à suivre ?

Merci