throw new EMFUserError(EMFErrorSeverity.ERROR, 14000);
}
//getting and applying all check configureted for this module:
for (int i=0; i < lstConfigChecks.size(); i++ ){
Config check = (Config)lstConfigChecks.get(i);
//checks that the configuration is correct (when getValueTypeId is valorized valueCheck must be valorized too)
if (check.getValueTypeId() != null && check.getValueCheck() == null){
logger.debug("The value configuration on db isn't valorized." );
Vector v = new Vector();
v.add(check.getLabel());
throw new EMFUserError(EMFErrorSeverity.ERROR, 14009,v, new HashMap());
}
if (check.getLabel().equals(SpagoBIConstants.CHANGEPWDMOD_LEN_MIN)){
//checks the minmum length of password
int pwdLen = newPwd.length();
if (pwdLen < Integer.parseInt(check.getValueCheck())){
logger.debug("The password's length isn't correct." );
Vector v = new Vector();
v.add(check.getValueCheck());
throw new EMFUserError(EMFErrorSeverity.ERROR, 14001,v, new HashMap());
}
}
if (check.getLabel().equals(SpagoBIConstants.CHANGEPWDMOD_ALPHA)){
//checks that the new pwd contains alphabetical chars
char PwdChars[] = new char[newPwd.length()];
newPwd.getChars(0, newPwd.length(), PwdChars, 0);
boolean containsChar = false;
for (int j = 0; j < PwdChars.length; j++) {
if (check.getValueCheck().contains(String.valueOf(PwdChars[j]))){
containsChar = true;
break;
}
}
if (!containsChar){
logger.debug("The password's doesn't contain alphabetical char." );
throw new EMFUserError(EMFErrorSeverity.ERROR, 14002,new Vector(), new HashMap());
}
}
if (check.getLabel().equals(SpagoBIConstants.CHANGEPWDMOD_LOWER_CHAR)){
//checks that the new pwd contains LOWER chars
char PwdChars[] = new char[newPwd.length()];
newPwd.getChars(0, newPwd.length(), PwdChars, 0);
boolean containsChar = false;
for (int j = 0; j < PwdChars.length; j++) {
if (check.getValueCheck().contains(String.valueOf(PwdChars[j]))){
containsChar = true;
break;
}
}
if (!containsChar){
logger.debug("The password's doesn't contain lower char." );
throw new EMFUserError(EMFErrorSeverity.ERROR, 14004,new Vector(), new HashMap());
}
}
if (check.getLabel().equals(SpagoBIConstants.CHANGEPWDMOD_UPPER_CHAR)){
//checks that the new pwd contains UPPER chars
char PwdChars[] = new char[newPwd.length()];
newPwd.getChars(0, newPwd.length(), PwdChars, 0);
boolean containsChar = false;
for (int j = 0; j < PwdChars.length; j++) {
if (check.getValueCheck().contains(String.valueOf(PwdChars[j]))){
containsChar = true;
break;
}
}
if (!containsChar){
logger.debug("The password's doesn't contain upper char." );
throw new EMFUserError(EMFErrorSeverity.ERROR, 14005,new Vector(), new HashMap());
}
}
if (check.getLabel().equals(SpagoBIConstants.CHANGEPWDMOD_SPECIAL_CHAR)){
//checks that the new pwd contains special chars
char PwdChars[] = new char[newPwd.length()];
newPwd.getChars(0, newPwd.length(), PwdChars, 0);
boolean containsChar = false;
for (int j = 0; j < PwdChars.length; j++) {
if (check.getValueCheck().contains(String.valueOf(PwdChars[j]))){
containsChar = true;
break;
}
}
if (!containsChar){
logger.debug("The password's doesn't contain special char." );
Vector v = new Vector();
v.add(check.getValueCheck());
throw new EMFUserError(EMFErrorSeverity.ERROR, 14003,v, new HashMap());
}
}
if (check.getLabel().equals(SpagoBIConstants.CHANGEPWDMOD_NUMBER)){
//checks that the new pwd contains numeric chars
char PwdChars[] = new char[newPwd.length()];
newPwd.getChars(0, newPwd.length(), PwdChars, 0);
boolean containsChar = false;
for (int j = 0; j < PwdChars.length; j++) {
if (check.getValueCheck().contains(String.valueOf(PwdChars[j]))){
containsChar = true;
break;
}
}
if (!containsChar){
logger.debug("The password's doesn't contain numeric char." );
throw new EMFUserError(EMFErrorSeverity.ERROR, 14006,new Vector(), new HashMap());
}
}
if (check.getLabel().equals(SpagoBIConstants.CHANGEPWDMOD_CHANGE)){
//the password must be different from the lastest
if (oldPwd.equalsIgnoreCase(newPwd)){
logger.debug("The password's doesn't be equal the lastest." );
throw new EMFUserError(EMFErrorSeverity.ERROR, 14007,new Vector(), new HashMap());
}