244 lines
6.2 KiB
Java
244 lines
6.2 KiB
Java
/*
|
|
* To change this template, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
package com.rjconsultores.ventaboletos.entidad;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.Date;
|
|
|
|
import javax.persistence.Basic;
|
|
import javax.persistence.Column;
|
|
import javax.persistence.Entity;
|
|
import javax.persistence.GeneratedValue;
|
|
import javax.persistence.GenerationType;
|
|
import javax.persistence.Id;
|
|
import javax.persistence.JoinColumn;
|
|
import javax.persistence.ManyToOne;
|
|
import javax.persistence.SequenceGenerator;
|
|
import javax.persistence.Table;
|
|
import javax.persistence.Temporal;
|
|
import javax.persistence.TemporalType;
|
|
import javax.persistence.Transient;
|
|
|
|
import org.hibernate.Hibernate;
|
|
|
|
import br.com.rjconsultores.auditador.annotations.AuditarClasse;
|
|
import br.com.rjconsultores.auditador.annotations.NaoAuditar;
|
|
import br.com.rjconsultores.auditador.interfaces.Auditavel;
|
|
|
|
/**
|
|
*
|
|
* @author Rafael
|
|
*/
|
|
@AuditarClasse(nome = "PtoVtaUsuarioBancario", tela = "auditarClasse.PtovtaEstoque")
|
|
@Entity
|
|
@SequenceGenerator(name = "PTOVTA_ESTOQUE_SEQ ", sequenceName = "PTOVTA_ESTOQUE_SEQ ", allocationSize = 1)
|
|
@Table(name = "PTOVTA_ESTOQUE")
|
|
|
|
public class PtovtaEstoque implements Serializable, Auditavel<PtovtaEstoque>{
|
|
private static final long serialVersionUID = 1L;
|
|
@Id
|
|
@Basic(optional = false)
|
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_ESTOQUE_SEQ ")
|
|
@Column(name = "PTOVTAESTOQUE_ID")
|
|
private Integer ptovtaEstoqueId;
|
|
|
|
@Column(name = "ESPECIE")
|
|
private String especie;
|
|
|
|
@Column(name = "FORMCONT")
|
|
private Integer formCont;
|
|
|
|
@Column(name = "QUANTIDADE")
|
|
private int quantidade;
|
|
|
|
@Column(name = "LOTEFORM")
|
|
private Integer loteform;
|
|
|
|
@Basic(optional = false)
|
|
@Column(name = "ACTIVO")
|
|
private Boolean activo;
|
|
|
|
@Column(name = "FECMODIF")
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
private Date fecmodif;
|
|
|
|
@Column(name = "USUARIO_ID")
|
|
private int usuarioId;
|
|
@JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID")
|
|
@ManyToOne
|
|
private PuntoVenta puntoventaId;
|
|
|
|
@Transient
|
|
@NaoAuditar
|
|
private PtovtaEstoque ptovtaEstoqueClone;
|
|
|
|
public PtovtaEstoque() {
|
|
}
|
|
|
|
public PtovtaEstoque(Integer ptovtaEstoqueId) {
|
|
this.ptovtaEstoqueId = ptovtaEstoqueId;
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum gerarEnum {
|
|
// Declaração dos enum
|
|
SIM ("SIM", "1"),
|
|
|
|
NAO ("NAO", "0");
|
|
|
|
|
|
|
|
// Definição das constantes
|
|
public final String valor;
|
|
public final String descricao;
|
|
|
|
|
|
public String valor() {
|
|
return this.valor;
|
|
}
|
|
public String descricao() {
|
|
return this.descricao;
|
|
}
|
|
private gerarEnum( String descricao, String valor) {
|
|
this.descricao = descricao;
|
|
this.valor = valor;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public PtovtaEstoque(Integer ptovtaEstoqueId, String especie, Integer formCont, int quantidade, Integer loteform, Boolean activo, Date fecmodif, int usuarioId) {
|
|
this.ptovtaEstoqueId = ptovtaEstoqueId;
|
|
this.especie = especie;
|
|
this.formCont = formCont;
|
|
this.quantidade = quantidade;
|
|
this.loteform = loteform;
|
|
this.activo = activo;
|
|
this.fecmodif = fecmodif;
|
|
this.usuarioId = usuarioId;
|
|
}
|
|
|
|
|
|
|
|
public Integer getPtovtaEstoqueId() {
|
|
return ptovtaEstoqueId;
|
|
}
|
|
|
|
public void setPtovtaEstoqueId(Integer ptovtaEstoqueId) {
|
|
this.ptovtaEstoqueId = ptovtaEstoqueId;
|
|
}
|
|
|
|
public String getEspecie() {
|
|
return especie;
|
|
}
|
|
|
|
public void setEspecie(String especie) {
|
|
this.especie = especie;
|
|
}
|
|
|
|
public Integer getFormCont() {
|
|
return formCont;
|
|
}
|
|
|
|
public void setFormCont(Integer formCont) {
|
|
this.formCont = formCont;
|
|
}
|
|
|
|
public int getQuantidade() {
|
|
return quantidade;
|
|
}
|
|
|
|
public void setQuantidade(int quantidade) {
|
|
this.quantidade = quantidade;
|
|
}
|
|
|
|
public Integer getLoteform() {
|
|
return loteform;
|
|
}
|
|
|
|
public void setLoteform(Integer loteform) {
|
|
this.loteform = loteform;
|
|
}
|
|
|
|
public Boolean getActivo() {
|
|
return activo;
|
|
}
|
|
|
|
public void setActivo(Boolean activo) {
|
|
this.activo = activo;
|
|
}
|
|
|
|
public Date getFecmodif() {
|
|
return fecmodif;
|
|
}
|
|
|
|
public void setFecmodif(Date fecmodif) {
|
|
this.fecmodif = fecmodif;
|
|
}
|
|
|
|
public int getUsuarioId() {
|
|
return usuarioId;
|
|
}
|
|
|
|
public void setUsuarioId(int usuarioId) {
|
|
this.usuarioId = usuarioId;
|
|
}
|
|
|
|
public PuntoVenta getPuntoventaId() {
|
|
return puntoventaId;
|
|
}
|
|
|
|
public void setPuntoventaId(PuntoVenta puntoventaId) {
|
|
this.puntoventaId = puntoventaId;
|
|
}
|
|
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
int hash = 0;
|
|
hash += (ptovtaEstoqueId != null ? ptovtaEstoqueId.hashCode() : 0);
|
|
return hash;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object object) {
|
|
// TODO: Warning - this method won't work in the case the id fields are not set
|
|
if (!(object instanceof PtovtaEstoque)) {
|
|
return false;
|
|
}
|
|
PtovtaEstoque other = (PtovtaEstoque) object;
|
|
if ((this.ptovtaEstoqueId == null && other.ptovtaEstoqueId != null) || (this.ptovtaEstoqueId != null && !this.ptovtaEstoqueId.equals(other.ptovtaEstoqueId))) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "com.rjconsultores.ventaboletos.entidad.PtovtaEstoque[ ptovtaEstoqueId=" + ptovtaEstoqueId + " ]";
|
|
}
|
|
|
|
@Override
|
|
public void clonar() throws CloneNotSupportedException {
|
|
ptovtaEstoqueClone = new PtovtaEstoque();
|
|
ptovtaEstoqueClone = (PtovtaEstoque) this.clone();
|
|
Hibernate.initialize(ptovtaEstoqueClone.getPuntoventaId());
|
|
|
|
}
|
|
|
|
@Override
|
|
public PtovtaEstoque getCloneObject() throws CloneNotSupportedException {
|
|
return ptovtaEstoqueClone;
|
|
}
|
|
|
|
@Override
|
|
public String getTextoInclusaoExclusao() {
|
|
return String.format("ID [%s]", getPtovtaEstoqueId());
|
|
}
|
|
|
|
}
|