@Test public void test_should_save_entity_token() { final Token token = Token.builder().uuid(UUID.randomUUID().toString()).number("99999").identity("someIdentity") .timeToLiveInSeconds(400l).createdDate(new Date()).tenantId("test").build(); Token savedToken = tokenRepository.save(token); assertNotNull(savedToken); assertEquals(token.getTenantId(), savedToken.getTenantId()); assertEquals(token.getUuid(), savedToken.getUuid()); }
public Token save(Token token) { final Map<String, Object> tokenInputs = new HashMap<String, Object>(); Date createdDate = new Date(); tokenInputs.put("id", token.getUuid()); tokenInputs.put("tenantId", token.getTenantId()); tokenInputs.put("tokenNumber", token.getNumber()); tokenInputs.put("tokenIdentity", token.getIdentity()); tokenInputs.put("validated", NO); tokenInputs.put("ttlSecs", token.getTimeToLiveInSeconds()); tokenInputs.put("createdDate", createdDate); tokenInputs.put("createdBy", 0l); tokenInputs.put("version", 0l); tokenInputs.put("createddatenew", System.currentTimeMillis()); namedParameterJdbcTemplate.update(INSERT_TOKEN, tokenInputs); return token; }
TokenRepository { public Token save(Token token) { final Map<String, Object> tokenInputs = new HashMap<String, Object>(); Date createdDate = new Date(); tokenInputs.put("id", token.getUuid()); tokenInputs.put("tenantId", token.getTenantId()); tokenInputs.put("tokenNumber", token.getNumber()); tokenInputs.put("tokenIdentity", token.getIdentity()); tokenInputs.put("validated", NO); tokenInputs.put("ttlSecs", token.getTimeToLiveInSeconds()); tokenInputs.put("createdDate", createdDate); tokenInputs.put("createdBy", 0l); tokenInputs.put("version", 0l); tokenInputs.put("createddatenew", System.currentTimeMillis()); namedParameterJdbcTemplate.update(INSERT_TOKEN, tokenInputs); return token; } }
TokenRepository { public Token save(Token token) { final Map<String, Object> tokenInputs = new HashMap<String, Object>(); Date createdDate = new Date(); tokenInputs.put("id", token.getUuid()); tokenInputs.put("tenantId", token.getTenantId()); tokenInputs.put("tokenNumber", token.getNumber()); tokenInputs.put("tokenIdentity", token.getIdentity()); tokenInputs.put("validated", NO); tokenInputs.put("ttlSecs", token.getTimeToLiveInSeconds()); tokenInputs.put("createdDate", createdDate); tokenInputs.put("createdBy", 0l); tokenInputs.put("version", 0l); tokenInputs.put("createddatenew", System.currentTimeMillis()); namedParameterJdbcTemplate.update(INSERT_TOKEN, tokenInputs); return token; } TokenRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate); }
TokenRepository { public Token save(Token token) { final Map<String, Object> tokenInputs = new HashMap<String, Object>(); Date createdDate = new Date(); tokenInputs.put("id", token.getUuid()); tokenInputs.put("tenantId", token.getTenantId()); tokenInputs.put("tokenNumber", token.getNumber()); tokenInputs.put("tokenIdentity", token.getIdentity()); tokenInputs.put("validated", NO); tokenInputs.put("ttlSecs", token.getTimeToLiveInSeconds()); tokenInputs.put("createdDate", createdDate); tokenInputs.put("createdBy", 0l); tokenInputs.put("version", 0l); tokenInputs.put("createddatenew", System.currentTimeMillis()); namedParameterJdbcTemplate.update(INSERT_TOKEN, tokenInputs); return token; } TokenRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate); Token save(Token token); Token markAsValidated(Token token); Tokens findByNumberAndIdentityAndTenantId(ValidateRequest request); Tokens findByNumberAndIdentityAndTenantIdLike(ValidateRequest request); Token findBy(TokenSearchCriteria searchCriteria); }
TokenRepository { public Token save(Token token) { final Map<String, Object> tokenInputs = new HashMap<String, Object>(); Date createdDate = new Date(); tokenInputs.put("id", token.getUuid()); tokenInputs.put("tenantId", token.getTenantId()); tokenInputs.put("tokenNumber", token.getNumber()); tokenInputs.put("tokenIdentity", token.getIdentity()); tokenInputs.put("validated", NO); tokenInputs.put("ttlSecs", token.getTimeToLiveInSeconds()); tokenInputs.put("createdDate", createdDate); tokenInputs.put("createdBy", 0l); tokenInputs.put("version", 0l); tokenInputs.put("createddatenew", System.currentTimeMillis()); namedParameterJdbcTemplate.update(INSERT_TOKEN, tokenInputs); return token; } TokenRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate); Token save(Token token); Token markAsValidated(Token token); Tokens findByNumberAndIdentityAndTenantId(ValidateRequest request); Tokens findByNumberAndIdentityAndTenantIdLike(ValidateRequest request); Token findBy(TokenSearchCriteria searchCriteria);  }