IDEMPIERE-221 Implement password policies
Thanks to Juliana Corredor for the research and integration Peer reviewed and tested by Carlos Ruiz (initial version, still pending tests) Sponsored by Trek Global
This commit is contained in:
parent
facd2b358a
commit
7fa3e80e16
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -18,10 +18,11 @@ package org.compiere.process;
|
|||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MPasswordRule;
|
||||
import org.compiere.model.MSysConfig;
|
||||
import org.compiere.model.MUser;
|
||||
import org.compiere.util.Util;
|
||||
|
||||
/**
|
||||
* Reset Password
|
||||
*
|
||||
|
@ -30,10 +31,12 @@ import org.compiere.util.Util;
|
|||
*/
|
||||
public class UserPassword extends SvrProcess
|
||||
{
|
||||
private int p_AD_User_ID = -1;
|
||||
private int p_AD_User_ID = -1;
|
||||
private String p_OldPassword = null;
|
||||
private String p_NewPassword = null;
|
||||
private String p_NewPasswordConfirm = null;
|
||||
private String p_NewEMail = null;
|
||||
private String p_NewEMailConfirm = null;
|
||||
private String p_NewEMailUser = null;
|
||||
private String p_NewEMailUserPW = null;
|
||||
|
||||
|
@ -60,6 +63,10 @@ public class UserPassword extends SvrProcess
|
|||
p_NewEMailUser = (String)para[i].getParameter();
|
||||
else if (name.equals("NewEMailUserPW"))
|
||||
p_NewEMailUserPW = (String)para[i].getParameter();
|
||||
else if (name.equals("NewPasswordConfirm"))
|
||||
p_NewPasswordConfirm=(String)para[i].getParameter();
|
||||
else if (name.equals("NewEMailConfirm"))
|
||||
p_NewEMailConfirm = (String)para[i].getParameter();
|
||||
else
|
||||
log.log(Level.SEVERE, "Unknown Parameter: " + name);
|
||||
}
|
||||
|
@ -77,7 +84,7 @@ public class UserPassword extends SvrProcess
|
|||
MUser user = MUser.get(getCtx(), p_AD_User_ID);
|
||||
MUser operator = MUser.get(getCtx(), getAD_User_ID());
|
||||
log.fine("User=" + user + ", Operator=" + operator);
|
||||
|
||||
|
||||
boolean hash_password = MSysConfig.getBooleanValue("USER_PASSWORD_HASH", false);
|
||||
|
||||
// Do we need a password ?
|
||||
|
@ -87,18 +94,43 @@ public class UserPassword extends SvrProcess
|
|||
|| p_AD_User_ID == 100 // change of SuperUser
|
||||
|| !operator.isAdministrator())
|
||||
throw new IllegalArgumentException("@OldPasswordMandatory@");
|
||||
}
|
||||
// is entered Password correct ?
|
||||
else {
|
||||
if (hash_password){
|
||||
if (!user.authenticateHash(p_OldPassword) )
|
||||
} else {
|
||||
// is entered Password correct ?
|
||||
if (hash_password) {
|
||||
if (!user.authenticateHash(p_OldPassword))
|
||||
throw new IllegalArgumentException("@OldPasswordNoMatch@");
|
||||
} else{
|
||||
} else {
|
||||
if (!p_OldPassword.equals(user.getPassword()))
|
||||
throw new IllegalArgumentException("@OldPasswordNoMatch@");
|
||||
}
|
||||
}
|
||||
|
||||
// new password confirm
|
||||
if (!Util.isEmpty(p_NewPassword)) {
|
||||
if (Util.isEmpty(p_NewPasswordConfirm)) {
|
||||
throw new IllegalArgumentException("@NewPasswordConfirmMandatory@");
|
||||
} else {
|
||||
if (!p_NewPassword.equals(p_NewPasswordConfirm)) {
|
||||
throw new IllegalArgumentException("@PasswordNotMatch@");
|
||||
} else {
|
||||
String msg = validate();
|
||||
if (msg != null) {
|
||||
throw new IllegalArgumentException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!Util.isEmpty(p_NewEMailUserPW)) {
|
||||
if (Util.isEmpty(p_NewEMailConfirm)) {
|
||||
throw new IllegalArgumentException("@NewEmailConfirmMandatory@");
|
||||
} else {
|
||||
if (!p_NewEMailUserPW.equals(p_NewEMailConfirm)) {
|
||||
throw new IllegalArgumentException("@NewEmailNotMatch@");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!Util.isEmpty(p_NewPassword))
|
||||
user.setPassword(p_NewPassword);
|
||||
if (!Util.isEmpty(p_NewEMail))
|
||||
|
@ -112,4 +144,21 @@ public class UserPassword extends SvrProcess
|
|||
return "OK";
|
||||
} // doIt
|
||||
|
||||
|
||||
private String validate()
|
||||
{
|
||||
MClient client=new MClient(getCtx(), getAD_Client_ID(), get_TrxName());
|
||||
int ad_passwordrule_id = client.getAD_PasswordRule_ID();
|
||||
|
||||
String error = null;
|
||||
if (ad_passwordrule_id > 0)
|
||||
{
|
||||
MPasswordRule rule =new MPasswordRule(getCtx(), ad_passwordrule_id, get_TrxName());
|
||||
error = rule.validate(p_NewPassword);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
} // UserPassword
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="vt-crypt-2.1.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="vt-dictionary-3.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="vt-password-3.1.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="groovy-all-1.7.5.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
||||
<accessrules>
|
||||
|
|
|
@ -15,7 +15,10 @@ Bundle-ClassPath: base.jar,
|
|||
jcommon-1.0.16.jar,
|
||||
jfreechart-1.0.13.jar,
|
||||
jnlp.jar,
|
||||
groovy-all-1.7.5.jar
|
||||
groovy-all-1.7.5.jar,
|
||||
vt-crypt-2.1.4.jar,
|
||||
vt-dictionary-3.0.jar,
|
||||
vt-password-3.1.1.jar
|
||||
Export-Package: bsh,
|
||||
bsh.classpath,
|
||||
bsh.collection,
|
||||
|
|
|
@ -13,7 +13,10 @@ bin.includes = META-INF/,\
|
|||
jfreechart-1.0.13.jar,\
|
||||
jnlp.jar,\
|
||||
OSGI-INF/,\
|
||||
groovy-all-1.7.5.jar
|
||||
groovy-all-1.7.5.jar,\
|
||||
vt-crypt-2.1.4.jar,\
|
||||
vt-dictionary-3.0.jar,\
|
||||
vt-password-3.1.1.jar
|
||||
output.base.jar = build/
|
||||
source.base.jar = src/
|
||||
src.includes = schema/
|
||||
|
|
|
@ -31,7 +31,7 @@ public interface I_AD_Client
|
|||
public static final String Table_Name = "AD_Client";
|
||||
|
||||
/** AD_Table_ID=112 */
|
||||
public static final int Table_ID = MTable.getTable_ID(Table_Name);
|
||||
public static final int Table_ID = 112;
|
||||
|
||||
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
|
@ -49,6 +49,15 @@ public interface I_AD_Client
|
|||
*/
|
||||
public int getAD_Client_ID();
|
||||
|
||||
/** Column name AD_Client_UU */
|
||||
public static final String COLUMNNAME_AD_Client_UU = "AD_Client_UU";
|
||||
|
||||
/** Set AD_Client_UU */
|
||||
public void setAD_Client_UU (String AD_Client_UU);
|
||||
|
||||
/** Get AD_Client_UU */
|
||||
public String getAD_Client_UU();
|
||||
|
||||
/** Column name AD_Language */
|
||||
public static final String COLUMNNAME_AD_Language = "AD_Language";
|
||||
|
||||
|
@ -75,6 +84,17 @@ public interface I_AD_Client
|
|||
*/
|
||||
public int getAD_Org_ID();
|
||||
|
||||
/** Column name AD_PasswordRule_ID */
|
||||
public static final String COLUMNNAME_AD_PasswordRule_ID = "AD_PasswordRule_ID";
|
||||
|
||||
/** Set AD_PasswordRule */
|
||||
public void setAD_PasswordRule_ID (int AD_PasswordRule_ID);
|
||||
|
||||
/** Get AD_PasswordRule */
|
||||
public int getAD_PasswordRule_ID();
|
||||
|
||||
public org.compiere.model.I_AD_PasswordRule getAD_PasswordRule() throws RuntimeException;
|
||||
|
||||
/** Column name AD_ReplicationStrategy_ID */
|
||||
public static final String COLUMNNAME_AD_ReplicationStrategy_ID = "AD_ReplicationStrategy_ID";
|
||||
|
||||
|
@ -88,7 +108,7 @@ public interface I_AD_Client
|
|||
*/
|
||||
public int getAD_ReplicationStrategy_ID();
|
||||
|
||||
public I_AD_ReplicationStrategy getAD_ReplicationStrategy() throws RuntimeException;
|
||||
public org.compiere.model.I_AD_ReplicationStrategy getAD_ReplicationStrategy() throws RuntimeException;
|
||||
|
||||
/** Column name AutoArchive */
|
||||
public static final String COLUMNNAME_AutoArchive = "AutoArchive";
|
||||
|
@ -171,19 +191,6 @@ public interface I_AD_Client
|
|||
*/
|
||||
public boolean isActive();
|
||||
|
||||
/** Column name IsCostImmediate */
|
||||
public static final String COLUMNNAME_IsCostImmediate = "IsCostImmediate";
|
||||
|
||||
/** Set Cost Immediately.
|
||||
* Update Costs immediately for testing
|
||||
*/
|
||||
public void setIsCostImmediate (boolean IsCostImmediate);
|
||||
|
||||
/** Get Cost Immediately.
|
||||
* Update Costs immediately for testing
|
||||
*/
|
||||
public boolean isCostImmediate();
|
||||
|
||||
/** Column name IsMultiLingualDocument */
|
||||
public static final String COLUMNNAME_IsMultiLingualDocument = "IsMultiLingualDocument";
|
||||
|
||||
|
|
|
@ -0,0 +1,333 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software, you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program, if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
|
||||
/** Generated Interface for AD_PasswordRule
|
||||
* @author Adempiere (generated)
|
||||
* @version Release 3.6.0LTS
|
||||
*/
|
||||
public interface I_AD_PasswordRule
|
||||
{
|
||||
|
||||
/** TableName=AD_PasswordRule */
|
||||
public static final String Table_Name = "AD_PasswordRule";
|
||||
|
||||
/** AD_Table_ID=200005 */
|
||||
public static final int Table_ID = 200005;
|
||||
|
||||
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
/** AccessLevel = 4 - System
|
||||
*/
|
||||
BigDecimal accessLevel = BigDecimal.valueOf(4);
|
||||
|
||||
/** Load Meta Data */
|
||||
|
||||
/** Column name AD_Client_ID */
|
||||
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
|
||||
|
||||
/** Get Client.
|
||||
* Client/Tenant for this installation.
|
||||
*/
|
||||
public int getAD_Client_ID();
|
||||
|
||||
/** Column name AD_Org_ID */
|
||||
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
|
||||
|
||||
/** Set Organization.
|
||||
* Organizational entity within client
|
||||
*/
|
||||
public void setAD_Org_ID (int AD_Org_ID);
|
||||
|
||||
/** Get Organization.
|
||||
* Organizational entity within client
|
||||
*/
|
||||
public int getAD_Org_ID();
|
||||
|
||||
/** Column name AD_PasswordRule_ID */
|
||||
public static final String COLUMNNAME_AD_PasswordRule_ID = "AD_PasswordRule_ID";
|
||||
|
||||
/** Set AD_PasswordRule */
|
||||
public void setAD_PasswordRule_ID (int AD_PasswordRule_ID);
|
||||
|
||||
/** Get AD_PasswordRule */
|
||||
public int getAD_PasswordRule_ID();
|
||||
|
||||
/** Column name AD_PasswordRule_UU */
|
||||
public static final String COLUMNNAME_AD_PasswordRule_UU = "AD_PasswordRule_UU";
|
||||
|
||||
/** Set AD_PasswordRule_UU */
|
||||
public void setAD_PasswordRule_UU (String AD_PasswordRule_UU);
|
||||
|
||||
/** Get AD_PasswordRule_UU */
|
||||
public String getAD_PasswordRule_UU();
|
||||
|
||||
/** Column name AlphabeticalCharacter */
|
||||
public static final String COLUMNNAME_AlphabeticalCharacter = "AlphabeticalCharacter";
|
||||
|
||||
/** Set Alphabetical Character */
|
||||
public void setAlphabeticalCharacter (int AlphabeticalCharacter);
|
||||
|
||||
/** Get Alphabetical Character */
|
||||
public int getAlphabeticalCharacter();
|
||||
|
||||
/** Column name AlphabeticalSequence */
|
||||
public static final String COLUMNNAME_AlphabeticalSequence = "AlphabeticalSequence";
|
||||
|
||||
/** Set Alphabetical Sequence.
|
||||
* Allow alphabetical sequences
|
||||
*/
|
||||
public void setAlphabeticalSequence (boolean AlphabeticalSequence);
|
||||
|
||||
/** Get Alphabetical Sequence.
|
||||
* Allow alphabetical sequences
|
||||
*/
|
||||
public boolean isAlphabeticalSequence();
|
||||
|
||||
/** Column name Created */
|
||||
public static final String COLUMNNAME_Created = "Created";
|
||||
|
||||
/** Get Created.
|
||||
* Date this record was created
|
||||
*/
|
||||
public Timestamp getCreated();
|
||||
|
||||
/** Column name CreatedBy */
|
||||
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
|
||||
|
||||
/** Get Created By.
|
||||
* User who created this records
|
||||
*/
|
||||
public int getCreatedBy();
|
||||
|
||||
/** Column name DictMatchBackwards */
|
||||
public static final String COLUMNNAME_DictMatchBackwards = "DictMatchBackwards";
|
||||
|
||||
/** Set Match Backwards of Dictionary.
|
||||
* Match dictionary words backwards
|
||||
*/
|
||||
public void setDictMatchBackwards (boolean DictMatchBackwards);
|
||||
|
||||
/** Get Match Backwards of Dictionary.
|
||||
* Match dictionary words backwards
|
||||
*/
|
||||
public boolean isDictMatchBackwards();
|
||||
|
||||
/** Column name DictWordLength */
|
||||
public static final String COLUMNNAME_DictWordLength = "DictWordLength";
|
||||
|
||||
/** Set Word Length Dictionary */
|
||||
public void setDictWordLength (int DictWordLength);
|
||||
|
||||
/** Get Word Length Dictionary */
|
||||
public int getDictWordLength();
|
||||
|
||||
/** Column name DigitCharacter */
|
||||
public static final String COLUMNNAME_DigitCharacter = "DigitCharacter";
|
||||
|
||||
/** Set Digit Character.
|
||||
* Require at least # digit in passwords
|
||||
*/
|
||||
public void setDigitCharacter (int DigitCharacter);
|
||||
|
||||
/** Get Digit Character.
|
||||
* Require at least # digit in passwords
|
||||
*/
|
||||
public int getDigitCharacter();
|
||||
|
||||
/** Column name IsActive */
|
||||
public static final String COLUMNNAME_IsActive = "IsActive";
|
||||
|
||||
/** Set Active.
|
||||
* The record is active in the system
|
||||
*/
|
||||
public void setIsActive (boolean IsActive);
|
||||
|
||||
/** Get Active.
|
||||
* The record is active in the system
|
||||
*/
|
||||
public boolean isActive();
|
||||
|
||||
/** Column name LowercaseCharacter */
|
||||
public static final String COLUMNNAME_LowercaseCharacter = "LowercaseCharacter";
|
||||
|
||||
/** Set Lowercase Character.
|
||||
* Require at least # lower case char
|
||||
*/
|
||||
public void setLowercaseCharacter (int LowercaseCharacter);
|
||||
|
||||
/** Get Lowercase Character.
|
||||
* Require at least # lower case char
|
||||
*/
|
||||
public int getLowercaseCharacter();
|
||||
|
||||
/** Column name MaxLength */
|
||||
public static final String COLUMNNAME_MaxLength = "MaxLength";
|
||||
|
||||
/** Set Maximum Length.
|
||||
* Maximum Length of Data
|
||||
*/
|
||||
public void setMaxLength (int MaxLength);
|
||||
|
||||
/** Get Maximum Length.
|
||||
* Maximum Length of Data
|
||||
*/
|
||||
public int getMaxLength();
|
||||
|
||||
/** Column name MinLength */
|
||||
public static final String COLUMNNAME_MinLength = "MinLength";
|
||||
|
||||
/** Set Min Length */
|
||||
public void setMinLength (int MinLength);
|
||||
|
||||
/** Get Min Length */
|
||||
public int getMinLength();
|
||||
|
||||
/** Column name Name */
|
||||
public static final String COLUMNNAME_Name = "Name";
|
||||
|
||||
/** Set Name.
|
||||
* Alphanumeric identifier of the entity
|
||||
*/
|
||||
public void setName (String Name);
|
||||
|
||||
/** Get Name.
|
||||
* Alphanumeric identifier of the entity
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/** Column name NonAlphaNumericCharacter */
|
||||
public static final String COLUMNNAME_NonAlphaNumericCharacter = "NonAlphaNumericCharacter";
|
||||
|
||||
/** Set Non Alpha Numeric Character.
|
||||
* Require at least # non-alphanumeric char
|
||||
*/
|
||||
public void setNonAlphaNumericCharacter (int NonAlphaNumericCharacter);
|
||||
|
||||
/** Get Non Alpha Numeric Character.
|
||||
* Require at least # non-alphanumeric char
|
||||
*/
|
||||
public int getNonAlphaNumericCharacter();
|
||||
|
||||
/** Column name NumericalSequence */
|
||||
public static final String COLUMNNAME_NumericalSequence = "NumericalSequence";
|
||||
|
||||
/** Set Numerical Sequence.
|
||||
* Allow numerical sequences of length #
|
||||
*/
|
||||
public void setNumericalSequence (int NumericalSequence);
|
||||
|
||||
/** Get Numerical Sequence.
|
||||
* Allow numerical sequences of length #
|
||||
*/
|
||||
public int getNumericalSequence();
|
||||
|
||||
/** Column name PathDictionary */
|
||||
public static final String COLUMNNAME_PathDictionary = "PathDictionary";
|
||||
|
||||
/** Set Path Dictionary */
|
||||
public void setPathDictionary (String PathDictionary);
|
||||
|
||||
/** Get Path Dictionary */
|
||||
public String getPathDictionary();
|
||||
|
||||
/** Column name QWERTYSequence */
|
||||
public static final String COLUMNNAME_QWERTYSequence = "QWERTYSequence";
|
||||
|
||||
/** Set QWERTY Sequence.
|
||||
* Allow QWERTY sequences
|
||||
*/
|
||||
public void setQWERTYSequence (boolean QWERTYSequence);
|
||||
|
||||
/** Get QWERTY Sequence.
|
||||
* Allow QWERTY sequences
|
||||
*/
|
||||
public boolean isQWERTYSequence();
|
||||
|
||||
/** Column name RepeatCharacterRegex */
|
||||
public static final String COLUMNNAME_RepeatCharacterRegex = "RepeatCharacterRegex";
|
||||
|
||||
/** Set Repeat Character Regex */
|
||||
public void setRepeatCharacterRegex (int RepeatCharacterRegex);
|
||||
|
||||
/** Get Repeat Character Regex */
|
||||
public int getRepeatCharacterRegex();
|
||||
|
||||
/** Column name Updated */
|
||||
public static final String COLUMNNAME_Updated = "Updated";
|
||||
|
||||
/** Get Updated.
|
||||
* Date this record was updated
|
||||
*/
|
||||
public Timestamp getUpdated();
|
||||
|
||||
/** Column name UpdatedBy */
|
||||
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
|
||||
|
||||
/** Get Updated By.
|
||||
* User who updated this records
|
||||
*/
|
||||
public int getUpdatedBy();
|
||||
|
||||
/** Column name UppercaseCharacter */
|
||||
public static final String COLUMNNAME_UppercaseCharacter = "UppercaseCharacter";
|
||||
|
||||
/** Set Uppercase Character.
|
||||
* Require at least # upper case char
|
||||
*/
|
||||
public void setUppercaseCharacter (int UppercaseCharacter);
|
||||
|
||||
/** Get Uppercase Character.
|
||||
* Require at least # upper case char
|
||||
*/
|
||||
public int getUppercaseCharacter();
|
||||
|
||||
/** Column name UserName */
|
||||
public static final String COLUMNNAME_UserName = "UserName";
|
||||
|
||||
/** Set Registered EMail.
|
||||
* Email of the responsible for the System
|
||||
*/
|
||||
public void setUserName (boolean UserName);
|
||||
|
||||
/** Get Registered EMail.
|
||||
* Email of the responsible for the System
|
||||
*/
|
||||
public boolean isUserName();
|
||||
|
||||
/** Column name UsingDictionary */
|
||||
public static final String COLUMNNAME_UsingDictionary = "UsingDictionary";
|
||||
|
||||
/** Set Using Dictionary */
|
||||
public void setUsingDictionary (boolean UsingDictionary);
|
||||
|
||||
/** Get Using Dictionary */
|
||||
public boolean isUsingDictionary();
|
||||
|
||||
/** Column name whitespace */
|
||||
public static final String COLUMNNAME_whitespace = "whitespace";
|
||||
|
||||
/** Set whitespace */
|
||||
public void setwhitespace (boolean whitespace);
|
||||
|
||||
/** Get whitespace */
|
||||
public boolean iswhitespace();
|
||||
}
|
|
@ -136,7 +136,6 @@ public class MClient extends X_AD_Client
|
|||
setAutoArchive(AUTOARCHIVE_None);
|
||||
setMMPolicy (MMPOLICY_FiFo); // F
|
||||
setIsPostImmediate(false);
|
||||
setIsCostImmediate(false);
|
||||
}
|
||||
else
|
||||
load(get_TrxName());
|
||||
|
|
|
@ -0,0 +1,186 @@
|
|||
/******************************************************************************
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) Trek Global All Rights Reserved. *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* *
|
||||
* @author Juliana Corredor, jcorredor@trekglobal.com *
|
||||
* IDEMPIERE-221 Password reset validation *
|
||||
* http://jira.idempiere.com/browse/IDEMPIERE-221 *
|
||||
* *
|
||||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
|
||||
import edu.vt.middleware.dictionary.ArrayWordList;
|
||||
import edu.vt.middleware.dictionary.WordListDictionary;
|
||||
import edu.vt.middleware.dictionary.WordLists;
|
||||
import edu.vt.middleware.dictionary.sort.ArraysSort;
|
||||
import edu.vt.middleware.password.AlphabeticalSequenceRule;
|
||||
import edu.vt.middleware.password.CharacterCharacteristicsRule;
|
||||
import edu.vt.middleware.password.DictionarySubstringRule;
|
||||
import edu.vt.middleware.password.DigitCharacterRule;
|
||||
import edu.vt.middleware.password.LengthRule;
|
||||
import edu.vt.middleware.password.LowercaseCharacterRule;
|
||||
import edu.vt.middleware.password.NonAlphanumericCharacterRule;
|
||||
import edu.vt.middleware.password.NumericalSequenceRule;
|
||||
import edu.vt.middleware.password.Password;
|
||||
import edu.vt.middleware.password.PasswordData;
|
||||
import edu.vt.middleware.password.PasswordValidator;
|
||||
import edu.vt.middleware.password.QwertySequenceRule;
|
||||
import edu.vt.middleware.password.RepeatCharacterRegexRule;
|
||||
import edu.vt.middleware.password.Rule;
|
||||
import edu.vt.middleware.password.RuleResult;
|
||||
import edu.vt.middleware.password.UppercaseCharacterRule;
|
||||
import edu.vt.middleware.password.WhitespaceRule;
|
||||
|
||||
/**
|
||||
* @author juliana
|
||||
*
|
||||
*/
|
||||
public class MPasswordRule extends X_AD_PasswordRule {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6369065572886752718L;
|
||||
|
||||
/**
|
||||
* @param ctx
|
||||
* @param AD_PasswordRule_ID
|
||||
* @param trxName
|
||||
*/
|
||||
public MPasswordRule(Properties ctx, int AD_PasswordRule_ID, String trxName) {
|
||||
super(ctx, AD_PasswordRule_ID, trxName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ctx
|
||||
* @param rs
|
||||
* @param trxName
|
||||
*/
|
||||
public MPasswordRule(Properties ctx, ResultSet rs, String trxName) {
|
||||
super(ctx, rs, trxName);
|
||||
}
|
||||
|
||||
public String validate(String newPassword) {
|
||||
WhitespaceRule whitespaceRule;
|
||||
AlphabeticalSequenceRule alphaSeqRule;
|
||||
NumericalSequenceRule numSeqRule;
|
||||
QwertySequenceRule qwertySeqRule;
|
||||
RepeatCharacterRegexRule repeatRule;
|
||||
|
||||
ArrayList<Rule> ruleList = new ArrayList<Rule>();
|
||||
|
||||
if (getMinLength()>0 || getMaxLength()>0) {
|
||||
LengthRule lengthRule = new LengthRule();
|
||||
if (getMinLength()>0)
|
||||
lengthRule.setMinimumLength(getMinLength());
|
||||
if (getMaxLength()>0)
|
||||
lengthRule.setMaximumLength(getMaxLength());
|
||||
ruleList.add(lengthRule);
|
||||
}
|
||||
|
||||
if (iswhitespace()) {
|
||||
whitespaceRule = new WhitespaceRule();
|
||||
ruleList.add(whitespaceRule);
|
||||
}
|
||||
// control allowed characters
|
||||
CharacterCharacteristicsRule charRule = new CharacterCharacteristicsRule();
|
||||
|
||||
if (getDigitCharacter()>0) {
|
||||
// require at least 1 digit in passwords
|
||||
charRule.getRules().add(new DigitCharacterRule(getDigitCharacter()));
|
||||
}
|
||||
if (getNonAlphaNumericCharacter()>0) {
|
||||
// require at least 1 non-alphanumeric char
|
||||
charRule.getRules().add(new NonAlphanumericCharacterRule(getNonAlphaNumericCharacter()));
|
||||
}
|
||||
if (getUppercaseCharacter()>0) {
|
||||
charRule.getRules().add(new UppercaseCharacterRule(getUppercaseCharacter()));
|
||||
}
|
||||
|
||||
if (getLowercaseCharacter()>0) {
|
||||
charRule.getRules().add(new LowercaseCharacterRule(getLowercaseCharacter()));
|
||||
}
|
||||
ruleList.add(charRule);
|
||||
|
||||
if (isAlphabeticalSequence()) {
|
||||
alphaSeqRule=new AlphabeticalSequenceRule();
|
||||
ruleList.add(alphaSeqRule);
|
||||
}
|
||||
|
||||
if (getNumericalSequence()>0) {
|
||||
numSeqRule = new NumericalSequenceRule(getNumericalSequence(),true);
|
||||
ruleList.add(numSeqRule);
|
||||
}
|
||||
if (isQWERTYSequence()) {
|
||||
qwertySeqRule = new QwertySequenceRule();
|
||||
ruleList.add(qwertySeqRule);
|
||||
}
|
||||
|
||||
if (getRepeatCharacterRegex()>0) {
|
||||
repeatRule = new RepeatCharacterRegexRule(getRepeatCharacterRegex());
|
||||
ruleList.add(repeatRule);
|
||||
}
|
||||
|
||||
if (isUsingDictionary()) {
|
||||
if (getPathDictionary().length()>0) {
|
||||
try {
|
||||
ArrayWordList awl = WordLists.createFromReader(
|
||||
new FileReader[] {new FileReader(getPathDictionary())},
|
||||
true,
|
||||
new ArraysSort());
|
||||
|
||||
WordListDictionary dict = new WordListDictionary(awl);
|
||||
DictionarySubstringRule dictRule = new DictionarySubstringRule(dict);
|
||||
|
||||
if (getDictWordLength()>0) {
|
||||
dictRule.setWordLength(getDictWordLength()); // size of words to check in the password
|
||||
}
|
||||
else{
|
||||
dictRule.setWordLength(DictionarySubstringRule.DEFAULT_WORD_LENGTH);
|
||||
}
|
||||
|
||||
if (isDictMatchBackwards()) {
|
||||
dictRule.setMatchBackwards(true); // match dictionary words backwards
|
||||
}
|
||||
ruleList.add(dictRule);
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
return "Could not find dictionary file: " + e.getMessage();
|
||||
} catch (IOException e) {
|
||||
return "Could not read dictionary file: " + e.getMessage();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!ruleList.isEmpty()) {
|
||||
PasswordValidator validator = new PasswordValidator(ruleList);
|
||||
PasswordData passwordData = new PasswordData(new Password(newPassword));
|
||||
RuleResult result = validator.validate(passwordData);
|
||||
if (!result.isValid()) {
|
||||
String error = null;
|
||||
for (String msg : validator.getMessages(result)) {
|
||||
error = (error == null ? "" : error) + " " + msg;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -30,7 +30,7 @@ public class X_AD_Client extends PO implements I_AD_Client, I_Persistent
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20100614L;
|
||||
private static final long serialVersionUID = 20120802L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_AD_Client (Properties ctx, int AD_Client_ID, String trxName)
|
||||
|
@ -39,8 +39,6 @@ public class X_AD_Client extends PO implements I_AD_Client, I_Persistent
|
|||
/** if (AD_Client_ID == 0)
|
||||
{
|
||||
setAutoArchive (null);
|
||||
// N
|
||||
setIsCostImmediate (false);
|
||||
// N
|
||||
setIsMultiLingualDocument (false);
|
||||
setIsPostImmediate (false);
|
||||
|
@ -89,6 +87,20 @@ public class X_AD_Client extends PO implements I_AD_Client, I_Persistent
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
/** Set AD_Client_UU.
|
||||
@param AD_Client_UU AD_Client_UU */
|
||||
public void setAD_Client_UU (String AD_Client_UU)
|
||||
{
|
||||
set_Value (COLUMNNAME_AD_Client_UU, AD_Client_UU);
|
||||
}
|
||||
|
||||
/** Get AD_Client_UU.
|
||||
@return AD_Client_UU */
|
||||
public String getAD_Client_UU ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_AD_Client_UU);
|
||||
}
|
||||
|
||||
/** AD_Language AD_Reference_ID=327 */
|
||||
public static final int AD_LANGUAGE_AD_Reference_ID=327;
|
||||
/** Set Language.
|
||||
|
@ -109,9 +121,34 @@ public class X_AD_Client extends PO implements I_AD_Client, I_Persistent
|
|||
return (String)get_Value(COLUMNNAME_AD_Language);
|
||||
}
|
||||
|
||||
public I_AD_ReplicationStrategy getAD_ReplicationStrategy() throws RuntimeException
|
||||
public org.compiere.model.I_AD_PasswordRule getAD_PasswordRule() throws RuntimeException
|
||||
{
|
||||
return (I_AD_ReplicationStrategy)MTable.get(getCtx(), I_AD_ReplicationStrategy.Table_Name)
|
||||
return (org.compiere.model.I_AD_PasswordRule)MTable.get(getCtx(), org.compiere.model.I_AD_PasswordRule.Table_Name)
|
||||
.getPO(getAD_PasswordRule_ID(), get_TrxName()); }
|
||||
|
||||
/** Set AD_PasswordRule.
|
||||
@param AD_PasswordRule_ID AD_PasswordRule */
|
||||
public void setAD_PasswordRule_ID (int AD_PasswordRule_ID)
|
||||
{
|
||||
if (AD_PasswordRule_ID < 1)
|
||||
set_Value (COLUMNNAME_AD_PasswordRule_ID, null);
|
||||
else
|
||||
set_Value (COLUMNNAME_AD_PasswordRule_ID, Integer.valueOf(AD_PasswordRule_ID));
|
||||
}
|
||||
|
||||
/** Get AD_PasswordRule.
|
||||
@return AD_PasswordRule */
|
||||
public int getAD_PasswordRule_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_AD_PasswordRule_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
public org.compiere.model.I_AD_ReplicationStrategy getAD_ReplicationStrategy() throws RuntimeException
|
||||
{
|
||||
return (org.compiere.model.I_AD_ReplicationStrategy)MTable.get(getCtx(), org.compiere.model.I_AD_ReplicationStrategy.Table_Name)
|
||||
.getPO(getAD_ReplicationStrategy_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Replication Strategy.
|
||||
|
@ -216,30 +253,6 @@ public class X_AD_Client extends PO implements I_AD_Client, I_Persistent
|
|||
return (String)get_Value(COLUMNNAME_EMailTest);
|
||||
}
|
||||
|
||||
/** Set Cost Immediately.
|
||||
@param IsCostImmediate
|
||||
Update Costs immediately for testing
|
||||
*/
|
||||
public void setIsCostImmediate (boolean IsCostImmediate)
|
||||
{
|
||||
set_Value (COLUMNNAME_IsCostImmediate, Boolean.valueOf(IsCostImmediate));
|
||||
}
|
||||
|
||||
/** Get Cost Immediately.
|
||||
@return Update Costs immediately for testing
|
||||
*/
|
||||
public boolean isCostImmediate ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_IsCostImmediate);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set Multi Lingual Documents.
|
||||
@param IsMultiLingualDocument
|
||||
Documents are Multi Lingual
|
||||
|
|
|
@ -0,0 +1,471 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software, you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program, if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
/** Generated Model - DO NOT CHANGE */
|
||||
package org.compiere.model;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
|
||||
/** Generated Model for AD_PasswordRule
|
||||
* @author Adempiere (generated)
|
||||
* @version Release 3.6.0LTS - $Id$ */
|
||||
public class X_AD_PasswordRule extends PO implements I_AD_PasswordRule, I_Persistent
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20120802L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_AD_PasswordRule (Properties ctx, int AD_PasswordRule_ID, String trxName)
|
||||
{
|
||||
super (ctx, AD_PasswordRule_ID, trxName);
|
||||
/** if (AD_PasswordRule_ID == 0)
|
||||
{
|
||||
setAD_PasswordRule_ID (0);
|
||||
} */
|
||||
}
|
||||
|
||||
/** Load Constructor */
|
||||
public X_AD_PasswordRule (Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
|
||||
/** AccessLevel
|
||||
* @return 4 - System
|
||||
*/
|
||||
protected int get_AccessLevel()
|
||||
{
|
||||
return accessLevel.intValue();
|
||||
}
|
||||
|
||||
/** Load Meta Data */
|
||||
protected POInfo initPO (Properties ctx)
|
||||
{
|
||||
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
|
||||
return poi;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer ("X_AD_PasswordRule[")
|
||||
.append(get_ID()).append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/** Set AD_PasswordRule.
|
||||
@param AD_PasswordRule_ID AD_PasswordRule */
|
||||
public void setAD_PasswordRule_ID (int AD_PasswordRule_ID)
|
||||
{
|
||||
if (AD_PasswordRule_ID < 1)
|
||||
set_ValueNoCheck (COLUMNNAME_AD_PasswordRule_ID, null);
|
||||
else
|
||||
set_ValueNoCheck (COLUMNNAME_AD_PasswordRule_ID, Integer.valueOf(AD_PasswordRule_ID));
|
||||
}
|
||||
|
||||
/** Get AD_PasswordRule.
|
||||
@return AD_PasswordRule */
|
||||
public int getAD_PasswordRule_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_AD_PasswordRule_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set AD_PasswordRule_UU.
|
||||
@param AD_PasswordRule_UU AD_PasswordRule_UU */
|
||||
public void setAD_PasswordRule_UU (String AD_PasswordRule_UU)
|
||||
{
|
||||
set_Value (COLUMNNAME_AD_PasswordRule_UU, AD_PasswordRule_UU);
|
||||
}
|
||||
|
||||
/** Get AD_PasswordRule_UU.
|
||||
@return AD_PasswordRule_UU */
|
||||
public String getAD_PasswordRule_UU ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_AD_PasswordRule_UU);
|
||||
}
|
||||
|
||||
/** Set Alphabetical Character.
|
||||
@param AlphabeticalCharacter Alphabetical Character */
|
||||
public void setAlphabeticalCharacter (int AlphabeticalCharacter)
|
||||
{
|
||||
set_Value (COLUMNNAME_AlphabeticalCharacter, Integer.valueOf(AlphabeticalCharacter));
|
||||
}
|
||||
|
||||
/** Get Alphabetical Character.
|
||||
@return Alphabetical Character */
|
||||
public int getAlphabeticalCharacter ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_AlphabeticalCharacter);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Alphabetical Sequence.
|
||||
@param AlphabeticalSequence
|
||||
Allow alphabetical sequences
|
||||
*/
|
||||
public void setAlphabeticalSequence (boolean AlphabeticalSequence)
|
||||
{
|
||||
set_Value (COLUMNNAME_AlphabeticalSequence, Boolean.valueOf(AlphabeticalSequence));
|
||||
}
|
||||
|
||||
/** Get Alphabetical Sequence.
|
||||
@return Allow alphabetical sequences
|
||||
*/
|
||||
public boolean isAlphabeticalSequence ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_AlphabeticalSequence);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set Match Backwards of Dictionary.
|
||||
@param DictMatchBackwards
|
||||
Match dictionary words backwards
|
||||
*/
|
||||
public void setDictMatchBackwards (boolean DictMatchBackwards)
|
||||
{
|
||||
set_Value (COLUMNNAME_DictMatchBackwards, Boolean.valueOf(DictMatchBackwards));
|
||||
}
|
||||
|
||||
/** Get Match Backwards of Dictionary.
|
||||
@return Match dictionary words backwards
|
||||
*/
|
||||
public boolean isDictMatchBackwards ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_DictMatchBackwards);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set Word Length Dictionary.
|
||||
@param DictWordLength Word Length Dictionary */
|
||||
public void setDictWordLength (int DictWordLength)
|
||||
{
|
||||
set_Value (COLUMNNAME_DictWordLength, Integer.valueOf(DictWordLength));
|
||||
}
|
||||
|
||||
/** Get Word Length Dictionary.
|
||||
@return Word Length Dictionary */
|
||||
public int getDictWordLength ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_DictWordLength);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Digit Character.
|
||||
@param DigitCharacter
|
||||
Require at least # digit in passwords
|
||||
*/
|
||||
public void setDigitCharacter (int DigitCharacter)
|
||||
{
|
||||
set_Value (COLUMNNAME_DigitCharacter, Integer.valueOf(DigitCharacter));
|
||||
}
|
||||
|
||||
/** Get Digit Character.
|
||||
@return Require at least # digit in passwords
|
||||
*/
|
||||
public int getDigitCharacter ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_DigitCharacter);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Lowercase Character.
|
||||
@param LowercaseCharacter
|
||||
Require at least # lower case char
|
||||
*/
|
||||
public void setLowercaseCharacter (int LowercaseCharacter)
|
||||
{
|
||||
set_Value (COLUMNNAME_LowercaseCharacter, Integer.valueOf(LowercaseCharacter));
|
||||
}
|
||||
|
||||
/** Get Lowercase Character.
|
||||
@return Require at least # lower case char
|
||||
*/
|
||||
public int getLowercaseCharacter ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_LowercaseCharacter);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Maximum Length.
|
||||
@param MaxLength
|
||||
Maximum Length of Data
|
||||
*/
|
||||
public void setMaxLength (int MaxLength)
|
||||
{
|
||||
set_Value (COLUMNNAME_MaxLength, Integer.valueOf(MaxLength));
|
||||
}
|
||||
|
||||
/** Get Maximum Length.
|
||||
@return Maximum Length of Data
|
||||
*/
|
||||
public int getMaxLength ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_MaxLength);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Min Length.
|
||||
@param MinLength Min Length */
|
||||
public void setMinLength (int MinLength)
|
||||
{
|
||||
set_Value (COLUMNNAME_MinLength, Integer.valueOf(MinLength));
|
||||
}
|
||||
|
||||
/** Get Min Length.
|
||||
@return Min Length */
|
||||
public int getMinLength ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_MinLength);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Name.
|
||||
@param Name
|
||||
Alphanumeric identifier of the entity
|
||||
*/
|
||||
public void setName (String Name)
|
||||
{
|
||||
set_Value (COLUMNNAME_Name, Name);
|
||||
}
|
||||
|
||||
/** Get Name.
|
||||
@return Alphanumeric identifier of the entity
|
||||
*/
|
||||
public String getName ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_Name);
|
||||
}
|
||||
|
||||
/** Get Record ID/ColumnName
|
||||
@return ID/ColumnName pair
|
||||
*/
|
||||
public KeyNamePair getKeyNamePair()
|
||||
{
|
||||
return new KeyNamePair(get_ID(), getName());
|
||||
}
|
||||
|
||||
/** Set Non Alpha Numeric Character.
|
||||
@param NonAlphaNumericCharacter
|
||||
Require at least # non-alphanumeric char
|
||||
*/
|
||||
public void setNonAlphaNumericCharacter (int NonAlphaNumericCharacter)
|
||||
{
|
||||
set_Value (COLUMNNAME_NonAlphaNumericCharacter, Integer.valueOf(NonAlphaNumericCharacter));
|
||||
}
|
||||
|
||||
/** Get Non Alpha Numeric Character.
|
||||
@return Require at least # non-alphanumeric char
|
||||
*/
|
||||
public int getNonAlphaNumericCharacter ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_NonAlphaNumericCharacter);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Numerical Sequence.
|
||||
@param NumericalSequence
|
||||
Allow numerical sequences of length #
|
||||
*/
|
||||
public void setNumericalSequence (int NumericalSequence)
|
||||
{
|
||||
set_Value (COLUMNNAME_NumericalSequence, Integer.valueOf(NumericalSequence));
|
||||
}
|
||||
|
||||
/** Get Numerical Sequence.
|
||||
@return Allow numerical sequences of length #
|
||||
*/
|
||||
public int getNumericalSequence ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_NumericalSequence);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Path Dictionary.
|
||||
@param PathDictionary Path Dictionary */
|
||||
public void setPathDictionary (String PathDictionary)
|
||||
{
|
||||
set_Value (COLUMNNAME_PathDictionary, PathDictionary);
|
||||
}
|
||||
|
||||
/** Get Path Dictionary.
|
||||
@return Path Dictionary */
|
||||
public String getPathDictionary ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_PathDictionary);
|
||||
}
|
||||
|
||||
/** Set QWERTY Sequence.
|
||||
@param QWERTYSequence
|
||||
Allow QWERTY sequences
|
||||
*/
|
||||
public void setQWERTYSequence (boolean QWERTYSequence)
|
||||
{
|
||||
set_Value (COLUMNNAME_QWERTYSequence, Boolean.valueOf(QWERTYSequence));
|
||||
}
|
||||
|
||||
/** Get QWERTY Sequence.
|
||||
@return Allow QWERTY sequences
|
||||
*/
|
||||
public boolean isQWERTYSequence ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_QWERTYSequence);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set Repeat Character Regex.
|
||||
@param RepeatCharacterRegex Repeat Character Regex */
|
||||
public void setRepeatCharacterRegex (int RepeatCharacterRegex)
|
||||
{
|
||||
set_Value (COLUMNNAME_RepeatCharacterRegex, Integer.valueOf(RepeatCharacterRegex));
|
||||
}
|
||||
|
||||
/** Get Repeat Character Regex.
|
||||
@return Repeat Character Regex */
|
||||
public int getRepeatCharacterRegex ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_RepeatCharacterRegex);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Uppercase Character.
|
||||
@param UppercaseCharacter
|
||||
Require at least # upper case char
|
||||
*/
|
||||
public void setUppercaseCharacter (int UppercaseCharacter)
|
||||
{
|
||||
set_Value (COLUMNNAME_UppercaseCharacter, Integer.valueOf(UppercaseCharacter));
|
||||
}
|
||||
|
||||
/** Get Uppercase Character.
|
||||
@return Require at least # upper case char
|
||||
*/
|
||||
public int getUppercaseCharacter ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_UppercaseCharacter);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Registered EMail.
|
||||
@param UserName
|
||||
Email of the responsible for the System
|
||||
*/
|
||||
public void setUserName (boolean UserName)
|
||||
{
|
||||
set_Value (COLUMNNAME_UserName, Boolean.valueOf(UserName));
|
||||
}
|
||||
|
||||
/** Get Registered EMail.
|
||||
@return Email of the responsible for the System
|
||||
*/
|
||||
public boolean isUserName ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_UserName);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set Using Dictionary.
|
||||
@param UsingDictionary Using Dictionary */
|
||||
public void setUsingDictionary (boolean UsingDictionary)
|
||||
{
|
||||
set_Value (COLUMNNAME_UsingDictionary, Boolean.valueOf(UsingDictionary));
|
||||
}
|
||||
|
||||
/** Get Using Dictionary.
|
||||
@return Using Dictionary */
|
||||
public boolean isUsingDictionary ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_UsingDictionary);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set whitespace.
|
||||
@param whitespace whitespace */
|
||||
public void setwhitespace (boolean whitespace)
|
||||
{
|
||||
set_Value (COLUMNNAME_whitespace, Boolean.valueOf(whitespace));
|
||||
}
|
||||
|
||||
/** Get whitespace.
|
||||
@return whitespace */
|
||||
public boolean iswhitespace ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_whitespace);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue