@Override public String toString() { StringBuilder builder = new StringBuilder(super.toString()); builder.append("[type='").append(getType()); builder.append("', expire='").append(getExpire() == null ? "" : getExpire().toString()); builder.append("', locked='").append(getLocked() == null ? "" : getLocked().toString()); builder.append("', unlocked='").append(getUnlocked() == null ? "" : getUnlocked().toString()); builder.append("']"); return builder.toString(); }
/** * 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); } } }