maia_modificado/.svn/pristine/3e/3e7a0ac6da8124310b626b4da99...

328 lines
6.9 KiB
Plaintext
Executable File
Raw Permalink Blame History

package com.fp.persistence.pgeneral.schedule;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Column;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.io.Serializable;
import javax.persistence.Table;
import com.fp.dto.hb.HibernateBean;
import java.lang.reflect.Field;
import java.util.List;
import javax.persistence.Transient;
/**
* Clase que implementa la entidad de Hibernate que hace referencia a la tabla
* TGENESCHEDULEEVENT
*/
@Entity(name = "TgeneScheduleEvent")
@Table(name = "TGENESCHEDULEEVENT")
public class TgeneScheduleEvent extends com.fp.dto.AbstractDataTransport
implements Serializable, HibernateBean, Cloneable {
/**
* 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 TgeneScheduleEvent
*/
@Id
@Column(name = "EVENTCODE", nullable = false, updatable = false)
private String pk;
@Column(name = "DESCRIPTION", nullable = true)
/**
* Descripcion del codigo de evento
*/
private String description;
@Column(name = "EXEHOUR", nullable = true)
/**
* Hora de ejecucion.
*/
private Integer exehour;
@Column(name = "EXEMINUTE", nullable = true)
/**
* Minuto de ejecucion.
*/
private Integer exeminute;
@Column(name = "EXESECOND", nullable = true)
/**
* Segundo de ejecucion.
*/
private Integer exesecond;
@Column(name = "BEGINWEEKDAY", nullable = true)
/**
* Dia de inicio de ejecucion
*/
private Integer beginweekday;
@Column(name = "ENDWEEKDAY", nullable = true)
/**
* Dia final de ejecucion
*/
private Integer endweekday;
/** Contructor por defecto */
public TgeneScheduleEvent() {
}
/**
* Contructor de TgeneScheduleEvent
*
* @param pPk
* Clave Primaria del entity
*/
public TgeneScheduleEvent(String 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 TgeneScheduleEvent
*/
public static TgeneScheduleEvent find(EntityManager pEntityManager,
Object pKey) throws Exception {
TgeneScheduleEvent obj = pEntityManager.find(TgeneScheduleEvent.class,
pKey);
return obj;
}
/**
* Entrega la Clave primaria de TgeneScheduleEvent
*
* @return El objeto que referencia a la Clave primaria de
* TgeneScheduleEvent
*/
public String getPk() {
return pk;
}
/**
* Fija un nuevo valor a la Clave primaria de TgeneScheduleEvent
*
* @param pPk
* El objeto que referencia a la nueva Clave primaria de
* TgeneScheduleEvent
*/
public void setPk(String pPk) {
pk = pPk;
}
/**
* Obtiene el valor de description
*
* @return valor de description
*/
public String getDescription() {
return description;
}
/**
* Fija el valor de description
*
* @param pDescription
* nuevo Valor de description
*/
public void setDescription(String pDescription) {
description = pDescription;
}
/**
* Obtiene el valor de exehour
*
* @return valor de exehour
*/
public Integer getExehour() {
return exehour;
}
/**
* Fija el valor de exehour
*
* @param pExehour
* nuevo Valor de exehour
*/
public void setExehour(Integer pExehour) {
exehour = pExehour;
}
/**
* Obtiene el valor de exeminute
*
* @return valor de exeminute
*/
public Integer getExeminute() {
return exeminute;
}
/**
* Fija el valor de exeminute
*
* @param pExeminute
* nuevo Valor de exeminute
*/
public void setExeminute(Integer pExeminute) {
exeminute = pExeminute;
}
/**
* Obtiene el valor de exesecond
*
* @return valor de exesecond
*/
public Integer getExesecond() {
return exesecond;
}
/**
* Fija el valor de exesecond
*
* @param pExesecond
* nuevo Valor de exesecond
*/
public void setExesecond(Integer pExesecond) {
exesecond = pExesecond;
}
/**
* Obtiene el valor de beginweekday
*
* @return valor de beginweekday
*/
public Integer getBeginweekday() {
return beginweekday;
}
/**
* Fija el valor de beginweekday
*
* @param pBeginweekday
* nuevo Valor de beginweekday
*/
public void setBeginweekday(Integer pBeginweekday) {
beginweekday = pBeginweekday;
}
/**
* Obtiene el valor de endweekday
*
* @return valor de endweekday
*/
public Integer getEndweekday() {
return endweekday;
}
/**
* Fija el valor de endweekday
*
* @param pEndweekday
* nuevo Valor de endweekday
*/
public void setEndweekday(Integer pEndweekday) {
endweekday = pEndweekday;
}
public boolean equals(Object rhs) {
if (rhs == null)
return false;
if (!(rhs instanceof TgeneScheduleEvent))
return false;
TgeneScheduleEvent that = (TgeneScheduleEvent) 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 TgeneScheduleEvent
*
* @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 TgeneScheduleEvent */
public Object createInstance() {
TgeneScheduleEvent instance = new TgeneScheduleEvent();
return instance;
}
/**
* Clona la entidad TgeneScheduleEvent
*
* @see com.fp.dto.hb.HibernateBean#cloneMe()
*/
public Object cloneMe() throws CloneNotSupportedException {
TgeneScheduleEvent p = (TgeneScheduleEvent) this.clone();
return p;
}
//Metodos manuales
/**Sentencia que devuelve una lista de los eventos a calendarizar..*/
private static final String JPQL =
"from TgeneScheduleEvent t ";
/**
* Entrega una lista de eventos a ser calendarizados.
* @return List<TgeneScheduleEvent>
* @throws Exception
*/
@SuppressWarnings("unchecked")
public static List<TgeneScheduleEvent> find(EntityManager pEntityManager) throws Exception {
Query qry = pEntityManager.createQuery(JPQL);
return qry.getResultList();
}
}