@Test public void checkExpirePasswordResetCode() { SocialPerson person = personRepo.findOne("atang"); DateTime passwordResetExpiryTime = person.getPasswordResetExpiryTime(); Date dateExpire = passwordResetExpiryTime.toDate(); DateMidnight dateMidnightExpire = new DateMidnight(dateExpire); DateMidnight confirmTime = new DateMidnight(2013, 03, 31); assertEquals(true, confirmTime.isAfter(passwordResetExpiryTime)); }
@SuppressWarnings("unchecked") @Override public <U extends T> U findOne(String id) { final String dn = toDn(id); log.debug("Lookup LDAP Entry {}", dn); final Entry entry = withConnection(new Function<LdapConnection, Entry>() { @Override @Nullable public Entry apply(@Nullable LdapConnection conn) { try { return conn.lookup(dn); } catch (LdapException e) { throw new LdapRepositoryException(e, "Error during lookup of LDAP Entry %s", dn); } } }); if (entry != null) { T obj = mapper.fromEntry(entry, entityClass); return (U) obj; } else { log.trace("Lookup LDAP Entry " + dn + " returns nothing"); return null; } }
PooledLdapRepository extends CrudRepositoryBase<T, String> implements LdapRepository<T> { @SuppressWarnings("unchecked") @Override public <U extends T> U findOne(String id) { final String dn = toDn(id); log.debug("Lookup LDAP Entry {}", dn); final Entry entry = withConnection(new Function<LdapConnection, Entry>() { @Override @Nullable public Entry apply(@Nullable LdapConnection conn) { try { return conn.lookup(dn); } catch (LdapException e) { throw new LdapRepositoryException(e, "Error during lookup of LDAP Entry %s", dn); } } }); if (entry != null) { T obj = mapper.fromEntry(entry, entityClass); return (U) obj; } else { log.trace("Lookup LDAP Entry " + dn + " returns nothing"); return null; } } }
PooledLdapRepository extends CrudRepositoryBase<T, String> implements LdapRepository<T> { @SuppressWarnings("unchecked") @Override public <U extends T> U findOne(String id) { final String dn = toDn(id); log.debug("Lookup LDAP Entry {}", dn); final Entry entry = withConnection(new Function<LdapConnection, Entry>() { @Override @Nullable public Entry apply(@Nullable LdapConnection conn) { try { return conn.lookup(dn); } catch (LdapException e) { throw new LdapRepositoryException(e, "Error during lookup of LDAP Entry %s", dn); } } }); if (entry != null) { T obj = mapper.fromEntry(entry, entityClass); return (U) obj; } else { log.trace("Lookup LDAP Entry " + dn + " returns nothing"); return null; } } PooledLdapRepository(final Class<? extends T> entityClass, final ObjectPool<LdapConnection> pool, final String baseDn); }
PooledLdapRepository extends CrudRepositoryBase<T, String> implements LdapRepository<T> { @SuppressWarnings("unchecked") @Override public <U extends T> U findOne(String id) { final String dn = toDn(id); log.debug("Lookup LDAP Entry {}", dn); final Entry entry = withConnection(new Function<LdapConnection, Entry>() { @Override @Nullable public Entry apply(@Nullable LdapConnection conn) { try { return conn.lookup(dn); } catch (LdapException e) { throw new LdapRepositoryException(e, "Error during lookup of LDAP Entry %s", dn); } } }); if (entry != null) { T obj = mapper.fromEntry(entry, entityClass); return (U) obj; } else { log.trace("Lookup LDAP Entry " + dn + " returns nothing"); return null; } } PooledLdapRepository(final Class<? extends T> entityClass, final ObjectPool<LdapConnection> pool, final String baseDn); @Override @Deprecated void init(); @Override S add(S entity); @Override @Nonnull T modify(final T entity); @Override S modify(String id, final S entity); @Override boolean delete(String id); @SuppressWarnings("unchecked") @Override U findOne(String id); @Override String toDn(String id); @Override T findOneByAttribute(String attribute, String value); @Override List<String> findIdsByAttribute(String attribute, String value); @Override List<T> findAll(); @Override String getBaseDn(); @Override Class<? extends T> getEntityClass(); @Override LdapMapper<T> getMapper(); ObjectPool<LdapConnection> getPool(); @Override boolean exists(@Nullable String id); @Override List<T> search(@Nullable String searchText); @Override boolean existsByAttribute(String attribute, String value); @Override List<T> findAllByFilter(String filter); @Override long count(); @Override long countByAttribute(String attribute, String value); @Override Page<T> findAll(final Pageable pageable); @Override List<String> findIdsByFilter(String filter); }
PooledLdapRepository extends CrudRepositoryBase<T, String> implements LdapRepository<T> { @SuppressWarnings("unchecked") @Override public <U extends T> U findOne(String id) { final String dn = toDn(id); log.debug("Lookup LDAP Entry {}", dn); final Entry entry = withConnection(new Function<LdapConnection, Entry>() { @Override @Nullable public Entry apply(@Nullable LdapConnection conn) { try { return conn.lookup(dn); } catch (LdapException e) { throw new LdapRepositoryException(e, "Error during lookup of LDAP Entry %s", dn); } } }); if (entry != null) { T obj = mapper.fromEntry(entry, entityClass); return (U) obj; } else { log.trace("Lookup LDAP Entry " + dn + " returns nothing"); return null; } } PooledLdapRepository(final Class<? extends T> entityClass, final ObjectPool<LdapConnection> pool, final String baseDn); @Override @Deprecated void init(); @Override S add(S entity); @Override @Nonnull T modify(final T entity); @Override S modify(String id, final S entity); @Override boolean delete(String id); @SuppressWarnings("unchecked") @Override U findOne(String id); @Override String toDn(String id); @Override T findOneByAttribute(String attribute, String value); @Override List<String> findIdsByAttribute(String attribute, String value); @Override List<T> findAll(); @Override String getBaseDn(); @Override Class<? extends T> getEntityClass(); @Override LdapMapper<T> getMapper(); ObjectPool<LdapConnection> getPool(); @Override boolean exists(@Nullable String id); @Override List<T> search(@Nullable String searchText); @Override boolean existsByAttribute(String attribute, String value); @Override List<T> findAllByFilter(String filter); @Override long count(); @Override long countByAttribute(String attribute, String value); @Override Page<T> findAll(final Pageable pageable); @Override List<String> findIdsByFilter(String filter);  }