285 lines
7.7 KiB
Plaintext
Executable File
285 lines
7.7 KiB
Plaintext
Executable File
package com.fp.persistence.pgeneral.safe;
|
||
|
||
import javax.persistence.EmbeddedId;
|
||
import javax.persistence.Entity;
|
||
import com.fp.dto.hb.Log;
|
||
import javax.persistence.Column;
|
||
import javax.persistence.EntityManager;
|
||
import java.io.Serializable;
|
||
import javax.persistence.Table;
|
||
import com.fp.dto.hb.HibernateBean;
|
||
import java.lang.reflect.Field;
|
||
import javax.persistence.Transient;
|
||
|
||
/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEPASSWORD*/
|
||
@Entity(name="TsafePassword")
|
||
@Table(name="TSAFEPASSWORD")
|
||
public class TsafePassword extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{
|
||
/**
|
||
* HashCode asociado con la Instancia
|
||
*/
|
||
@Transient
|
||
private int hashValue = 0;
|
||
/**
|
||
* Version de la Clase
|
||
*/
|
||
private static final long serialVersionUID = 1L;
|
||
/**
|
||
* Clave primaria de la Entidad TsafePassword
|
||
*/
|
||
@EmbeddedId
|
||
private TsafePasswordKey pk;
|
||
@Column(name="VALIDITYDAYS", nullable=true)
|
||
|
||
/**
|
||
* Dias de validez del password
|
||
*/
|
||
private Integer validitydays;
|
||
|
||
@Column(name="MINLENGTH", nullable=true)
|
||
|
||
/**
|
||
* Longitud minica del password
|
||
*/
|
||
private Integer minlength;
|
||
|
||
@Column(name="MINNOTREPEATED", nullable=true)
|
||
|
||
/**
|
||
* Numero de las ultimas n veces que el password no se puede repetir, ejemplo 3, el nuevo password tiene que ser diferente a los ultimos 3 password
|
||
*/
|
||
private Integer minnotrepeated;
|
||
|
||
@Column(name="MINNUMBER", nullable=true)
|
||
|
||
/**
|
||
* Numero minimo de digios del 0-9 que formen parte del password
|
||
*/
|
||
private Integer minnumber;
|
||
|
||
@Column(name="MINSPECIALCHARACTERS", nullable=true)
|
||
|
||
/**
|
||
* Numero minimo de caracteres especiales no numeros si a-z o A_Z
|
||
*/
|
||
private Integer minspecialcharacters;
|
||
|
||
@Column(name="MINUPPERCASE", nullable=true)
|
||
|
||
/**
|
||
* Minimo numero de minusculas compredidas entre la a-z
|
||
*/
|
||
private Integer minuppercase;
|
||
|
||
@Column(name="MINLOWERCASE", nullable=true)
|
||
|
||
/**
|
||
* Minimo numero de mayusculas comprendidas entre la A_Z
|
||
*/
|
||
private Integer minlowercase;
|
||
|
||
@Column(name="MESSAGEDAYS", nullable=true)
|
||
|
||
/**
|
||
* Numero de dias antes del vencimiento del password para enviar mensajes de notificaion
|
||
*/
|
||
private Integer messagedays;
|
||
|
||
@Column(name="INTENTNUMBER", nullable=true)
|
||
|
||
/**
|
||
* Numero de intentos, de ingreso de password fallido para bloquear al usuario
|
||
*/
|
||
private Integer intentnumber;
|
||
|
||
/**Contructor por defecto*/
|
||
public TsafePassword(){
|
||
}
|
||
/**Contructor de TsafePassword
|
||
@param pPk Clave Primaria del entity
|
||
*/
|
||
public TsafePassword(TsafePasswordKey pPk){
|
||
this();
|
||
pk=pPk;
|
||
}
|
||
/**
|
||
* Metodo que entrega datos de la tabla dada la clave primaria.
|
||
* @param pEntityManager referencia de la session a obtener datos del bean.
|
||
* @param pKey Caleve primaria del bean.
|
||
* @return TsafePassword
|
||
*/
|
||
public static TsafePassword find(EntityManager pEntityManager,TsafePasswordKey pKey) throws Exception{
|
||
TsafePassword obj = pEntityManager.find(TsafePassword.class,pKey);
|
||
return obj;
|
||
}
|
||
/**Entrega la Clave primaria de TsafePassword
|
||
@return El objeto que referencia a la Clave primaria de TsafePassword
|
||
*/
|
||
public TsafePasswordKey getPk(){
|
||
return pk;
|
||
}
|
||
/**Fija un nuevo valor a la Clave primaria de TsafePassword
|
||
@param pPk El objeto que referencia a la nueva Clave primaria de TsafePassword
|
||
*/
|
||
public void setPk(TsafePasswordKey pPk){
|
||
pk=pPk;
|
||
}
|
||
/**Obtiene el valor de validitydays
|
||
@return valor de validitydays*/
|
||
public Integer getValiditydays(){
|
||
return validitydays;
|
||
}
|
||
/**Fija el valor de validitydays
|
||
@param pValiditydays nuevo Valor de validitydays*/
|
||
public void setValiditydays(Integer pValiditydays){
|
||
validitydays=pValiditydays;
|
||
}
|
||
|
||
/**Obtiene el valor de minlength
|
||
@return valor de minlength*/
|
||
public Integer getMinlength(){
|
||
return minlength;
|
||
}
|
||
/**Fija el valor de minlength
|
||
@param pMinlength nuevo Valor de minlength*/
|
||
public void setMinlength(Integer pMinlength){
|
||
minlength=pMinlength;
|
||
}
|
||
|
||
/**Obtiene el valor de minnotrepeated
|
||
@return valor de minnotrepeated*/
|
||
public Integer getMinnotrepeated(){
|
||
return minnotrepeated;
|
||
}
|
||
/**Fija el valor de minnotrepeated
|
||
@param pMinnotrepeated nuevo Valor de minnotrepeated*/
|
||
public void setMinnotrepeated(Integer pMinnotrepeated){
|
||
minnotrepeated=pMinnotrepeated;
|
||
}
|
||
|
||
/**Obtiene el valor de minnumber
|
||
@return valor de minnumber*/
|
||
public Integer getMinnumber(){
|
||
return minnumber;
|
||
}
|
||
/**Fija el valor de minnumber
|
||
@param pMinnumber nuevo Valor de minnumber*/
|
||
public void setMinnumber(Integer pMinnumber){
|
||
minnumber=pMinnumber;
|
||
}
|
||
|
||
/**Obtiene el valor de minspecialcharacters
|
||
@return valor de minspecialcharacters*/
|
||
public Integer getMinspecialcharacters(){
|
||
return minspecialcharacters;
|
||
}
|
||
/**Fija el valor de minspecialcharacters
|
||
@param pMinspecialcharacters nuevo Valor de minspecialcharacters*/
|
||
public void setMinspecialcharacters(Integer pMinspecialcharacters){
|
||
minspecialcharacters=pMinspecialcharacters;
|
||
}
|
||
|
||
/**Obtiene el valor de minuppercase
|
||
@return valor de minuppercase*/
|
||
public Integer getMinuppercase(){
|
||
return minuppercase;
|
||
}
|
||
/**Fija el valor de minuppercase
|
||
@param pMinuppercase nuevo Valor de minuppercase*/
|
||
public void setMinuppercase(Integer pMinuppercase){
|
||
minuppercase=pMinuppercase;
|
||
}
|
||
|
||
/**Obtiene el valor de minlowercase
|
||
@return valor de minlowercase*/
|
||
public Integer getMinlowercase(){
|
||
return minlowercase;
|
||
}
|
||
/**Fija el valor de minlowercase
|
||
@param pMinlowercase nuevo Valor de minlowercase*/
|
||
public void setMinlowercase(Integer pMinlowercase){
|
||
minlowercase=pMinlowercase;
|
||
}
|
||
|
||
/**Obtiene el valor de messagedays
|
||
@return valor de messagedays*/
|
||
public Integer getMessagedays(){
|
||
return messagedays;
|
||
}
|
||
/**Fija el valor de messagedays
|
||
@param pMessagedays nuevo Valor de messagedays*/
|
||
public void setMessagedays(Integer pMessagedays){
|
||
messagedays=pMessagedays;
|
||
}
|
||
|
||
/**Obtiene el valor de intentnumber
|
||
@return valor de intentnumber*/
|
||
public Integer getIntentnumber(){
|
||
return intentnumber;
|
||
}
|
||
/**Fija el valor de intentnumber
|
||
@param pIntentnumber nuevo Valor de intentnumber*/
|
||
public void setIntentnumber(Integer pIntentnumber){
|
||
intentnumber=pIntentnumber;
|
||
}
|
||
|
||
public boolean equals(Object rhs){
|
||
if (rhs == null)return false;
|
||
if (! (rhs instanceof TsafePassword))return false;
|
||
TsafePassword that = (TsafePassword) rhs;
|
||
if (this.getPk() == null || that.getPk() == null)
|
||
return false;
|
||
return (this.getPk().equals(that.getPk()));
|
||
}
|
||
/**Implementaci<63>n del metodo hashCode de la la entidad TsafePassword
|
||
@return el hashCode la instancia
|
||
*/
|
||
public int hashCode() {
|
||
if (this.hashValue == 0){
|
||
int result = 17;
|
||
if (this.getPk() == null){
|
||
result = super.hashCode();
|
||
}else{
|
||
result = this.getPk().hashCode();
|
||
}
|
||
this.hashValue = result;
|
||
}
|
||
return this.hashValue;
|
||
}
|
||
/**Implementaci<63>n toString
|
||
*/
|
||
public String toString() {
|
||
Field[]fs=this.getClass().getDeclaredFields();
|
||
String data="";
|
||
for(Field f:fs){
|
||
try{
|
||
String name=f.getName();
|
||
if(f.getType().getName().compareTo("java.util.Set")==0)continue;
|
||
if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue;
|
||
data+=name+"="+f.get(this)+";";
|
||
}catch(Exception e){
|
||
continue;
|
||
}
|
||
}
|
||
if(data.compareTo("")==0){
|
||
data=super.toString();
|
||
}
|
||
return data;
|
||
}
|
||
/**Implementaci<63>n de la creaci<63>n de un bean en blanco TsafePassword
|
||
*/
|
||
public Object createInstance(){
|
||
TsafePassword instance=new TsafePassword();
|
||
instance.setPk(new TsafePasswordKey());
|
||
return instance;
|
||
}
|
||
/**Clona la entidad TsafePassword
|
||
@see com.fp.dto.hb.HibernateBean#cloneMe()
|
||
*/
|
||
public Object cloneMe() throws CloneNotSupportedException{
|
||
TsafePassword p=(TsafePassword)this.clone();
|
||
p.setPk((TsafePasswordKey)this.pk.cloneMe());
|
||
return p;
|
||
}
|
||
}
|