/** * 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); } } }
@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(); }
public void unlock() { setType(AccountStatusType.unlocked); setUnlocked(new Date()); } }
AccountStatus status = new AccountStatus(); if (!StringUtil.isNullOrEmpty(configuration.getIdentityEnabledColumn())) { if (Objects.equals(String.valueOf(resultSet.getObject(configuration.getIdentityEnabledColumn())), configuration.getIdentityEnabledValue())) status.setDisabled(false); else if (Objects.equals(String.valueOf(resultSet.getObject(configuration.getIdentityEnabledColumn())), configuration.getIdentityDisabledValue())) status.setDisabled(true); configuration.getIdentityLockedValue())) status.setLocked(new Date(0)); else if (Objects.equals(String.valueOf(resultSet.getObject(configuration.getIdentityLockedColumn())), configuration.getIdentityUnlockedValue())) status.setLocked(null); status.calculateType(); i.setAccountStatus(status);