314 lines
8.0 KiB
Plaintext
Executable File
314 lines
8.0 KiB
Plaintext
Executable File
package com.fp.persistence.pbpm.gene;
|
|
|
|
import java.io.Serializable;
|
|
import java.lang.reflect.Field;
|
|
import java.sql.Date;
|
|
|
|
import javax.persistence.Column;
|
|
import javax.persistence.Entity;
|
|
import javax.persistence.EntityManager;
|
|
import javax.persistence.Id;
|
|
import javax.persistence.Query;
|
|
import javax.persistence.Table;
|
|
import javax.persistence.Transient;
|
|
|
|
import com.fp.dto.hb.HibernateBean;
|
|
|
|
/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMPROCESSINSTANCE */
|
|
@Entity(name = "TbpmProcessInstance")
|
|
@Table(name = "TBPMPROCESSINSTANCE")
|
|
public class TbpmProcessInstance 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 TbpmProcessInstance
|
|
*/
|
|
@Id
|
|
@Column(name = "JOURNALID", nullable = false, updatable = false)
|
|
private String pk;
|
|
|
|
@Column(name = "SESSIONID", nullable = false)
|
|
/**
|
|
* Codigo de session en las tablas del jbpm asociadas al flujo
|
|
*/
|
|
private Integer sessionid;
|
|
|
|
@Column(name = "PROCESSID", nullable = true)
|
|
/**
|
|
* Codigo de instancia de proceso asociado a un flujo
|
|
*/
|
|
private Long processid;
|
|
|
|
@Column(name = "FINALIZED", nullable = true)
|
|
/**
|
|
* Y indica que el flujo esta filizado, N el flujo se esta en proceso
|
|
*/
|
|
private String finalized;
|
|
|
|
@Column(name = "SNAPSHOT", nullable = true)
|
|
/**
|
|
* Referencia a la base de conocimiento empreada en la creacion del flujo
|
|
*/
|
|
private String snapshot;
|
|
|
|
@Column(name = "CREATIONDATE", nullable = false)
|
|
/**
|
|
* Fecha de Creación
|
|
*/
|
|
private Date creationdate;
|
|
|
|
@Column(name = "ENDDATE", nullable = true)
|
|
/**
|
|
* Fecha de Finalización
|
|
*/
|
|
private Date enddate;
|
|
|
|
/** Contructor por defecto */
|
|
public TbpmProcessInstance() {
|
|
}
|
|
|
|
/**
|
|
* Contructor de TbpmProcessInstance
|
|
*
|
|
* @param pPk Clave Primaria del entity
|
|
* @param pSessionid Codigo de session en las tablas del jbpm asociadas al flujo
|
|
* @param pCreationdate Fecha de Creación
|
|
*/
|
|
public TbpmProcessInstance(String pPk, Integer pSessionid, Date pCreationdate) {
|
|
this();
|
|
this.pk = pPk;
|
|
this.sessionid = pSessionid;
|
|
this.creationdate = pCreationdate;
|
|
}
|
|
|
|
/**
|
|
* 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 TbpmProcessInstance
|
|
*/
|
|
public static TbpmProcessInstance find(EntityManager pEntityManager, Object pKey) throws Exception {
|
|
TbpmProcessInstance obj = pEntityManager.find(TbpmProcessInstance.class, pKey);
|
|
return obj;
|
|
}
|
|
|
|
/**
|
|
* Entrega la Clave primaria de TbpmProcessInstance
|
|
*
|
|
* @return El objeto que referencia a la Clave primaria de TbpmProcessInstance
|
|
*/
|
|
public String getPk() {
|
|
return this.pk;
|
|
}
|
|
|
|
/**
|
|
* Fija un nuevo valor a la Clave primaria de TbpmProcessInstance
|
|
*
|
|
* @param pPk El objeto que referencia a la nueva Clave primaria de TbpmProcessInstance
|
|
*/
|
|
public void setPk(String pPk) {
|
|
this.pk = pPk;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de sessionid
|
|
*
|
|
* @return valor de sessionid
|
|
*/
|
|
public Integer getSessionid() {
|
|
return this.sessionid;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de sessionid
|
|
*
|
|
* @param pSessionid nuevo Valor de sessionid
|
|
*/
|
|
public void setSessionid(Integer pSessionid) {
|
|
this.sessionid = pSessionid;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de processid
|
|
*
|
|
* @return valor de processid
|
|
*/
|
|
public Long getProcessid() {
|
|
return this.processid;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de processid
|
|
*
|
|
* @param pProcessid nuevo Valor de processid
|
|
*/
|
|
public void setProcessid(Long pProcessid) {
|
|
this.processid = pProcessid;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de finalized
|
|
*
|
|
* @return valor de finalized
|
|
*/
|
|
public String getFinalized() {
|
|
return this.finalized;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de finalized
|
|
*
|
|
* @param pFinalized nuevo Valor de finalized
|
|
*/
|
|
public void setFinalized(String pFinalized) {
|
|
this.finalized = pFinalized;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de snapshot
|
|
*
|
|
* @return valor de snapshot
|
|
*/
|
|
public String getSnapshot() {
|
|
return this.snapshot;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de snapshot
|
|
*
|
|
* @param pSnapshot nuevo Valor de snapshot
|
|
*/
|
|
public void setSnapshot(String pSnapshot) {
|
|
this.snapshot = pSnapshot;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de creationdate
|
|
*
|
|
* @return valor de creationdate
|
|
*/
|
|
public Date getCreationdate() {
|
|
return this.creationdate;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de creationdate
|
|
*
|
|
* @param pCreationdate nuevo Valor de creationdate
|
|
*/
|
|
public void setCreationdate(Date pCreationdate) {
|
|
this.creationdate = pCreationdate;
|
|
}
|
|
|
|
/**
|
|
* Obtiene el valor de enddate
|
|
*
|
|
* @return valor de enddate
|
|
*/
|
|
public Date getEnddate() {
|
|
return this.enddate;
|
|
}
|
|
|
|
/**
|
|
* Fija el valor de enddate
|
|
*
|
|
* @param pEnddate nuevo Valor de enddate
|
|
*/
|
|
public void setEnddate(Date pEnddate) {
|
|
this.enddate = pEnddate;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object rhs) {
|
|
if (rhs == null) {
|
|
return false;
|
|
}
|
|
if (!(rhs instanceof TbpmProcessInstance)) {
|
|
return false;
|
|
}
|
|
TbpmProcessInstance that = (TbpmProcessInstance) rhs;
|
|
if ((this.getPk() == null) || (that.getPk() == null)) {
|
|
return false;
|
|
}
|
|
return (this.getPk().equals(that.getPk()));
|
|
}
|
|
|
|
/**
|
|
* Implementacion del metodo hashCode de la la entidad TbpmProcessInstance
|
|
*
|
|
* @return el hashCode la instancia
|
|
*/
|
|
@Override
|
|
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;
|
|
}
|
|
|
|
/** Implementacion toString */
|
|
@Override
|
|
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;
|
|
}
|
|
|
|
/** Implementacion de la creacion de un bean en blanco TbpmProcessInstance */
|
|
@Override
|
|
public Object createInstance() {
|
|
TbpmProcessInstance instance = new TbpmProcessInstance();
|
|
return instance;
|
|
}
|
|
|
|
/**
|
|
* Clona la entidad TbpmProcessInstance
|
|
*
|
|
* @see com.fp.dto.hb.HibernateBean#cloneMe()
|
|
*/
|
|
@Override
|
|
public Object cloneMe() throws CloneNotSupportedException {
|
|
TbpmProcessInstance p = (TbpmProcessInstance) this.clone();
|
|
return p;
|
|
}
|
|
|
|
public static TbpmProcessInstance findByProcessId(EntityManager pEntityManager, long pProcessId) throws Exception {
|
|
Query q = pEntityManager.createQuery("from TbpmProcessInstance p where p.processid=:pid");
|
|
q.setParameter("pid", pProcessId);
|
|
return (TbpmProcessInstance) q.getSingleResult();
|
|
}
|
|
}
|