Greetings all,
now that I've got a working locator, I'm having trouble with the get() method of Attribute - it doesn't seem to want to be cast to anything other than String.
In my LDAP objectClass I have an attribute "isEnabled" that uses an attributeType of boolean. I have a corresponding private Boolean member declared in class EventConfig with a getter/setter pair defined.
so in my java
the program runs fine and returns the object from LDAP when the lines in the mapper are commented out as shown. But uncommenting causes the lookup to fail .Code:String hardcode ="cn=cut,ou=knot,ou=auditLogger,dc=jpost3,dc=dev,dc=abccorp,dc=com"; result = (EventConfig) ldapTemplate.lookup( hardcode, new EventConfigAttributesMapper() ); ..... //creator private class EventConfigAttributesMapper implements AttributesMapper { public Object mapFromAttributes(Attributes attrs) throws NamingException { EventConfig ec = new EventConfig(); // Attribute kver = attrs.get("isEnabled"); // if( kver != null) ec.setIsEnabled( (Boolean)attrs.get("isEnabled").get()); return ec; } }
LDAP object classes can be made up of attributes with a wide array of attribute types besides String - can't Spring's Attribute.get() method handle these?
TIA,
Still-learning Stuart


Reply With Quote