/** * Calculate that status type based on the dates attributes set in this * object. */ public void calculateType() { Date now = new Date(); setType(AccountStatusType.unlocked); if(isDisabled()) { setType(AccountStatusType.disabled); } else if (getExpire() != null && now.after(getExpire())) { // Expired account setType(AccountStatusType.expired); } else if (getLocked() != null) { if (getUnlocked() == null || getUnlocked().compareTo(now) < 1) { setType(AccountStatusType.locked); } } }