Announcement Announcement Module
Collapse
No announcement yet.
Reading modifyTimeStamp and createTimeStamp attributes Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reading modifyTimeStamp and createTimeStamp attributes

    Hi.

    I'm using iPlanet Directory Server 5.1 and so far so good, but I want to be able to read the attributes modifyTimeStamp and createTimeStamp but if I try to read it using a DirContextAdapter I get a null, the System.out.println from the following code prints a null.

    Is it possible to get those attributes?

    Code:
    private static class PersonContextMapper implements ContextMapper
    {
    	public Object mapFromContext(Object ctx)
    	{
    		DirContextAdapter context = (DirContextAdapter) ctx;
    		// DistinguishedName dn = new DistinguishedName(context.getDn());
    		Person person = new Person();
    		person.setObjectClasses(context.getStringAttributes("objectclass"));
    		person.setDn(context.getDn().toString());
    		person.setName(context.getStringAttribute("givenName"));
    		person.setLastName(context.getStringAttribute("sn"));
    		person.setEmail(context.getStringAttribute("mail"));
    		person.setPhone(context.getStringAttribute("telephoneNumber"));
    		person.setCountry(context.getStringAttribute("c"));
    		person.setUserPassword((byte[]) context
    				.getObjectAttribute("userPassword"));
    		person.setGessouid(context.getStringAttribute("gessouid"));
    		person.setCn(context.getStringAttribute("cn"));
    		person.setSso(context.getStringAttribute("uid"));
    		
    		System.out.println(context.getStringAttribute("modifytimestamp"));
    
    		return person;
    	}
    }
    Thanks!

  • #2
    CreateTimeStamp and ModifyTimeStamp are operational Attributes and are not returned in searches and lookups by default.

    In order to have them returned you need to explicitly ask for them using one of the search methods that take returning attributes as an argument. These methods are included in Spring LDAP - if you are using LdapTemplate you need to use a custom SearchExecutor instead. The reference documentation contains information about that.

    Comment


    • #3
      would love to have an answer for this actually

      Comment

      Working...
      X