public Authorization findExistingAuthorization( final ApiApplication inApiApplication, final Account inAccount) { Authorization authorization = findAnyByApiApplicationAccount(inApiApplication, inAccount); if (authorization != null) { authorization.setDateAccessed(new Date()); this.save(authorization); return authorization; } return null; }
public Authorization getNewSession( final ApiApplication inApiApplication, final Account inAccount) { Authorization authorization = findExistingAuthorization(inApiApplication, inAccount); if (authorization == null) { authorization = new Authorization(); authorization.setApiApplicaiton(inApiApplication); authorization.setAccount(inAccount); this.save(authorization); } return authorization; }