String tokenId = UUID.randomUUID().toString();
long expMillis = expirationUnit.toMillis(expiration);
Calendar expires = Calendar.getInstance();
expires.setTime(new Date(System.currentTimeMillis() + expMillis));
UrlToken tiny = new UrlToken();
//tiny.setId(tokenId);
tiny.setUserId(user.getId());
tiny.setExpires(expires);
tiny.setProjectId(projectId);
for (Role role : roles)
{
tiny.getRoles().add(role.getName());
}
return tiny;
}