/** * Calculate that status type based on the dates attribtues set in this * object. */ public void calculateType() { Date now = new Date(); if(isNeedChange()) { setType(PasswordStatusType.changeRequired); } else if (getExpire() != null && now.after(getExpire())) { // Expired, must change password setType(PasswordStatusType.expired); } else if (getWarn() != null && now.after(getWarn())) { // Near expiry setType(PasswordStatusType.nearExpiry); } else { // Locked // TODO prevent password change if locked. Can be // permanently locked as well by making unlock > expiry if (getUnlocked() != null && now.before(getUnlocked())) { setType(PasswordStatusType.locked); } else { setType(PasswordStatusType.upToDate); } } }