directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Thomas <greg.d.tho...@gmail.com>
Subject Mapping hierarchical models
Date Tue, 13 Dec 2016 17:26:49 GMT
Firstly, apologies for all the recent questions. I recently started looking
at our LDAP code, and would like to migrate away from JNDI, The Apache LDAP
API seems like the way to go, but I'm having fun with the API.

Secondly, can I say congratulations on all the good work that you've done;
the API seems streets ahead of JNDI, and it makes it /much/ easier to use.

Finally, my question. Our LDAP server is, from the client we're
considering, read-only - so I'm only interesting in reading information out
of it. It models what I suspect is a fairly normal hierarchy of objects.
For simplicity, let's assume it models equipment that people are
responsible for, which is close enough to explain my problem. So
conceptually, we may have

Alice (objectclass=person)
|
+--> PC (objectclass=equipment)
+--> Monitor (objectclass=equipment)
+--> Phone (objectclass=equipment)

Bob
|
+--> PC (objectclass=equipment)
+--> Monitor (objectclass=equipment)
+--> Phone (objectclass=equipment)

etc. etc.

Now, I can find just the people

connectionTemplate.search(baseDn.add("ou=people"), "(objectClass=*person*
*)"*, SearchScope.ONELEVEL, PERSON_MAPPER);

I can also find just the equipment

connectionTemplate.search(baseDn.add("ou=people").add("ou=equipment"),
"(objectClass=equipment*)"*, SearchScope.ONELEVEL, EQUIPMENT_MAPPER);

Is there a way I could use an EntryMapper to somehow map both people and
equipment in the one search? Something like ...

connectionTemplate.search(baseDn.add("ou=people"), "(|(objectClass=*person*
)(objectClass=equipment*))"*, SearchScope.SUBTREE,
PEOPLE_AND_EQUIPMENT_MAPPER);

Although that does pass in a sequence of Entry objects to the mapper, the
order is "all the people" followed by "all the equipment". Unless I've
missed something, there's no easy way to add the equipment to the person as
part of the mapper - i.e. it has to be done as part of a two part process;
find all the people, find all the equioment, and then assign the equipment
back to the people.

Have I missed anything here?

Thanks,

Greg

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message