Results 1 to 3 of 3

Thread: Reading modifyTimeStamp and createTimeStamp attributes

  1. #1
    Join Date
    Jan 2006
    Location
    Monterrey, MEXICO
    Posts
    34

    Default 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. #2
    Join Date
    Mar 2005
    Location
    Landskrona, Sweden
    Posts
    505

    Default

    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.
    Mattias Arthursson
    Jayway AB (www.jayway.se)
    Spring-LDAP project member

  3. #3
    Join Date
    Aug 2009
    Posts
    2

    Default

    would love to have an answer for this actually

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •