TO MUCH THINGS
Pero ya esta casi casi, estoy haciendo la eliminacion de cosas de las tarjetas de credito, luego empiezo a utilizar la linea de sobregiro y esta done done <3
This commit is contained in:
@@ -35,7 +35,7 @@ public class ClienteFacade extends AbstractFacade<Cliente> implements ClienteFac
|
||||
|
||||
@Override
|
||||
public Cliente findByRut(String rut) {
|
||||
TypedQuery<Cliente> query = em.createNamedQuery("Cliente.findByRut", Cliente.class);
|
||||
TypedQuery<Cliente> query = em.createQuery("SELECT c FROM Cliente c WHERE c.rut = :rut ", Cliente.class);
|
||||
query.setParameter("rut", rut);
|
||||
try {
|
||||
return query.getSingleResult();
|
||||
|
||||
@@ -34,7 +34,7 @@ public class UsuarioFacade extends AbstractFacade<Usuario> implements UsuarioFac
|
||||
|
||||
@Override
|
||||
public Usuario findByNombre(String name) {
|
||||
TypedQuery<Usuario> query = em.createNamedQuery("Usuario.findByNombre", Usuario.class);
|
||||
TypedQuery<Usuario> query = em.createQuery("SELECT u FROM Usuario u WHERE u.nombre = :nombre", Usuario.class);
|
||||
query.setParameter("nombre", name);
|
||||
try{
|
||||
return query.getSingleResult();
|
||||
|
||||
@@ -1,88 +1,59 @@
|
||||
package entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.CascadeType;
|
||||
import java.time.LocalDateTime;
|
||||
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.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.PrePersist;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ryuuji
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "cliente")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "Cliente.findAll", query = "SELECT c FROM Cliente c")
|
||||
, @NamedQuery(name = "Cliente.findById", query = "SELECT c FROM Cliente c WHERE c.id = :id")
|
||||
, @NamedQuery(name = "Cliente.findByRut", query = "SELECT c FROM Cliente c WHERE c.rut = :rut")
|
||||
, @NamedQuery(name = "Cliente.findByNombre", query = "SELECT c FROM Cliente c WHERE c.nombre = :nombre")
|
||||
, @NamedQuery(name = "Cliente.findByCiudad", query = "SELECT c FROM Cliente c WHERE c.ciudad = :ciudad")
|
||||
, @NamedQuery(name = "Cliente.findByInsertedAt", query = "SELECT c FROM Cliente c WHERE c.insertedAt = :insertedAt")})
|
||||
public class Cliente implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "rut")
|
||||
private String rut;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "nombre")
|
||||
private String nombre;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "ciudad")
|
||||
private String ciudad;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "inserted_at")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date insertedAt;
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "cliente")
|
||||
private List<CuentaCorriente> cuentaCorrienteList;
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "cliente")
|
||||
private List<TarjetaDebito> tarjetaDebitoList;
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "cliente")
|
||||
private List<TarjetaCredito> tarjetaCreditoList;
|
||||
@JoinColumn(name = "linea_sobregiro", referencedColumnName = "id")
|
||||
@OneToOne(optional = true)
|
||||
private LineaSobregiro lineaSobregiro;
|
||||
@JoinColumn(name = "usuario", referencedColumnName = "id")
|
||||
@OneToOne(optional = false)
|
||||
private LocalDateTime insertedAt;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "cuenta_corriente")
|
||||
private CuentaCorriente cuentaCorriente;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "tarjeta_debito")
|
||||
private TarjetaDebito tarjetaDebito;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "tarjeta_credito")
|
||||
private TarjetaCredito tarjetaCredito;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "usuario")
|
||||
private Usuario usuario;
|
||||
|
||||
public Cliente() {
|
||||
}
|
||||
|
||||
public Cliente(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Cliente(Integer id, String rut, String nombre, String ciudad, Date insertedAt) {
|
||||
this.id = id;
|
||||
this.rut = rut;
|
||||
this.nombre = nombre;
|
||||
this.ciudad = ciudad;
|
||||
this.insertedAt = insertedAt;
|
||||
|
||||
@PrePersist
|
||||
public void onPersist() {
|
||||
this.insertedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
@@ -117,53 +88,42 @@ public class Cliente implements Serializable {
|
||||
this.ciudad = ciudad;
|
||||
}
|
||||
|
||||
public Date getInsertedAt() {
|
||||
public LocalDateTime getInsertedAt() {
|
||||
return insertedAt;
|
||||
}
|
||||
|
||||
public void setInsertedAt(Date insertedAt) {
|
||||
public void setInsertedAt(LocalDateTime insertedAt) {
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<CuentaCorriente> getCuentaCorrienteList() {
|
||||
if (cuentaCorrienteList == null)
|
||||
cuentaCorrienteList = new ArrayList<>();
|
||||
return cuentaCorrienteList;
|
||||
public CuentaCorriente getCuentaCorriente() {
|
||||
return cuentaCorriente;
|
||||
}
|
||||
|
||||
public void setCuentaCorrienteList(List<CuentaCorriente> cuentaCorrienteList) {
|
||||
this.cuentaCorrienteList = cuentaCorrienteList;
|
||||
public void setCuentaCorriente(CuentaCorriente cuentaCorriente) {
|
||||
this.cuentaCorriente = cuentaCorriente;
|
||||
if(this.cuentaCorriente.getCliente() != this)
|
||||
this.cuentaCorriente.setCliente(this);
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<TarjetaDebito> getTarjetaDebitoList() {
|
||||
return tarjetaDebitoList;
|
||||
public TarjetaDebito getTarjetaDebito() {
|
||||
return tarjetaDebito;
|
||||
}
|
||||
|
||||
public void setTarjetaDebitoList(List<TarjetaDebito> tarjetaDebitoList) {
|
||||
if (tarjetaDebitoList == null)
|
||||
tarjetaDebitoList = new ArrayList<>();
|
||||
this.tarjetaDebitoList = tarjetaDebitoList;
|
||||
public void setTarjetaDebito(TarjetaDebito tarjetaDebito) {
|
||||
this.tarjetaDebito = tarjetaDebito;
|
||||
if(this.tarjetaDebito.getCliente() != this)
|
||||
this.tarjetaDebito.setCliente(this);
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<TarjetaCredito> getTarjetaCreditoList() {
|
||||
return tarjetaCreditoList;
|
||||
public TarjetaCredito getTarjetaCredito() {
|
||||
return tarjetaCredito;
|
||||
}
|
||||
|
||||
public void setTarjetaCreditoList(List<TarjetaCredito> tarjetaCreditoList) {
|
||||
if (tarjetaCreditoList == null)
|
||||
tarjetaCreditoList = new ArrayList<>();
|
||||
this.tarjetaCreditoList = tarjetaCreditoList;
|
||||
}
|
||||
|
||||
public LineaSobregiro getLineaSobregiro() {
|
||||
return lineaSobregiro;
|
||||
}
|
||||
|
||||
public void setLineaSobregiro(LineaSobregiro lineaSobregiro) {
|
||||
this.lineaSobregiro = lineaSobregiro;
|
||||
public void setTarjetaCredito(TarjetaCredito tarjetaCredito) {
|
||||
this.tarjetaCredito = tarjetaCredito;
|
||||
if(this.tarjetaCredito.getCliente() != this)
|
||||
this.tarjetaCredito.setCliente(this);
|
||||
}
|
||||
|
||||
public Usuario getUsuario() {
|
||||
@@ -172,6 +132,8 @@ public class Cliente implements Serializable {
|
||||
|
||||
public void setUsuario(Usuario usuario) {
|
||||
this.usuario = usuario;
|
||||
if(this.usuario.getCliente() != this)
|
||||
this.usuario.setCliente(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -188,14 +150,11 @@ public class Cliente implements Serializable {
|
||||
return false;
|
||||
}
|
||||
Cliente other = (Cliente) object;
|
||||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
|
||||
return false;
|
||||
return true;
|
||||
return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "entities.Cliente[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Basic;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
@@ -15,58 +9,39 @@ import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.PrePersist;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ryuuji
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "compra_tarjeta_credito")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "CompraTarjetaCredito.findAll", query = "SELECT c FROM CompraTarjetaCredito c")
|
||||
, @NamedQuery(name = "CompraTarjetaCredito.findById", query = "SELECT c FROM CompraTarjetaCredito c WHERE c.id = :id")
|
||||
, @NamedQuery(name = "CompraTarjetaCredito.findByMonto", query = "SELECT c FROM CompraTarjetaCredito c WHERE c.monto = :monto")
|
||||
, @NamedQuery(name = "CompraTarjetaCredito.findByComentario", query = "SELECT c FROM CompraTarjetaCredito c WHERE c.comentario = :comentario")
|
||||
, @NamedQuery(name = "CompraTarjetaCredito.findByInsertedAt", query = "SELECT c FROM CompraTarjetaCredito c WHERE c.insertedAt = :insertedAt")})
|
||||
public class CompraTarjetaCredito implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "monto")
|
||||
private int monto;
|
||||
|
||||
@Column(name = "comentario")
|
||||
private String comentario;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "tipo")
|
||||
private String tipo;
|
||||
|
||||
@Column(name = "inserted_at")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date insertedAt;
|
||||
@JoinColumn(name = "tarjeta_credito", referencedColumnName = "id")
|
||||
private LocalDateTime insertedAt;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "tarjeta_credito")
|
||||
private TarjetaCredito tarjetaCredito;
|
||||
|
||||
public CompraTarjetaCredito() {
|
||||
}
|
||||
|
||||
public CompraTarjetaCredito(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public CompraTarjetaCredito(Integer id, int monto, Date insertedAt) {
|
||||
this.id = id;
|
||||
this.monto = monto;
|
||||
this.insertedAt = insertedAt;
|
||||
@PrePersist
|
||||
public void onPersist() {
|
||||
this.insertedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
@@ -93,11 +68,20 @@ public class CompraTarjetaCredito implements Serializable {
|
||||
this.comentario = comentario;
|
||||
}
|
||||
|
||||
public Date getInsertedAt() {
|
||||
public String getTipo() {
|
||||
return tipo;
|
||||
}
|
||||
|
||||
public void setTipo(String tipo) {
|
||||
this.tipo = tipo;
|
||||
}
|
||||
|
||||
|
||||
public LocalDateTime getInsertedAt() {
|
||||
return insertedAt;
|
||||
}
|
||||
|
||||
public void setInsertedAt(Date insertedAt) {
|
||||
public void setInsertedAt(LocalDateTime insertedAt) {
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
@@ -107,6 +91,8 @@ public class CompraTarjetaCredito implements Serializable {
|
||||
|
||||
public void setTarjetaCredito(TarjetaCredito tarjetaCredito) {
|
||||
this.tarjetaCredito = tarjetaCredito;
|
||||
if(!this.tarjetaCredito.getCompraList().contains(this))
|
||||
this.tarjetaCredito.getCompraList().add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,9 +109,7 @@ public class CompraTarjetaCredito implements Serializable {
|
||||
return false;
|
||||
}
|
||||
CompraTarjetaCredito other = (CompraTarjetaCredito) object;
|
||||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
|
||||
return false;
|
||||
return true;
|
||||
return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
@@ -17,56 +13,38 @@ import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.PrePersist;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ryuuji
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "compra_tarjeta_debito")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "CompraTarjetaDebito.findAll", query = "SELECT c FROM CompraTarjetaDebito c")
|
||||
, @NamedQuery(name = "CompraTarjetaDebito.findById", query = "SELECT c FROM CompraTarjetaDebito c WHERE c.id = :id")
|
||||
, @NamedQuery(name = "CompraTarjetaDebito.findByMonto", query = "SELECT c FROM CompraTarjetaDebito c WHERE c.monto = :monto")
|
||||
, @NamedQuery(name = "CompraTarjetaDebito.findByComentario", query = "SELECT c FROM CompraTarjetaDebito c WHERE c.comentario = :comentario")
|
||||
, @NamedQuery(name = "CompraTarjetaDebito.findByInsertedAt", query = "SELECT c FROM CompraTarjetaDebito c WHERE c.insertedAt = :insertedAt")})
|
||||
public class CompraTarjetaDebito implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "monto")
|
||||
private int monto;
|
||||
|
||||
@Column(name = "comentario")
|
||||
private String comentario;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "inserted_at")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date insertedAt;
|
||||
@JoinColumn(name = "tarjeta_debito", referencedColumnName = "id")
|
||||
@ManyToOne(optional = false)
|
||||
private LocalDateTime insertedAt;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "tarjeta_debito")
|
||||
private TarjetaDebito tarjetaDebito;
|
||||
|
||||
public CompraTarjetaDebito() {
|
||||
}
|
||||
|
||||
public CompraTarjetaDebito(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public CompraTarjetaDebito(Integer id, int monto, Date insertedAt) {
|
||||
this.id = id;
|
||||
this.monto = monto;
|
||||
this.insertedAt = insertedAt;
|
||||
@PrePersist
|
||||
public void onPersist() {
|
||||
this.insertedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
@@ -93,11 +71,11 @@ public class CompraTarjetaDebito implements Serializable {
|
||||
this.comentario = comentario;
|
||||
}
|
||||
|
||||
public Date getInsertedAt() {
|
||||
public LocalDateTime getInsertedAt() {
|
||||
return insertedAt;
|
||||
}
|
||||
|
||||
public void setInsertedAt(Date insertedAt) {
|
||||
public void setInsertedAt(LocalDateTime insertedAt) {
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
@@ -107,6 +85,8 @@ public class CompraTarjetaDebito implements Serializable {
|
||||
|
||||
public void setTarjetaDebito(TarjetaDebito tarjetaDebito) {
|
||||
this.tarjetaDebito = tarjetaDebito;
|
||||
if(!this.tarjetaDebito.getCompraList().contains(this))
|
||||
this.tarjetaDebito.getCompraList().add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,9 +103,7 @@ public class CompraTarjetaDebito implements Serializable {
|
||||
return false;
|
||||
}
|
||||
CompraTarjetaDebito other = (CompraTarjetaDebito) object;
|
||||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
|
||||
return false;
|
||||
return true;
|
||||
return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,80 +1,60 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
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.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.PrePersist;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ryuuji
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "cuenta_corriente")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "CuentaCorriente.findAll", query = "SELECT c FROM CuentaCorriente c")
|
||||
, @NamedQuery(name = "CuentaCorriente.findById", query = "SELECT c FROM CuentaCorriente c WHERE c.id = :id")
|
||||
, @NamedQuery(name = "CuentaCorriente.findBySaldo", query = "SELECT c FROM CuentaCorriente c WHERE c.saldo = :saldo")
|
||||
, @NamedQuery(name = "CuentaCorriente.findByInsertedAt", query = "SELECT c FROM CuentaCorriente c WHERE c.insertedAt = :insertedAt")})
|
||||
public class CuentaCorriente implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "saldo")
|
||||
private int saldo;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "inserted_at")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date insertedAt;
|
||||
@JoinColumn(name = "cliente", referencedColumnName = "id")
|
||||
@ManyToOne(optional = false)
|
||||
private LocalDateTime insertedAt;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "linea_sobregiro")
|
||||
private LineaSobregiro lineaSobregiro;
|
||||
|
||||
@OneToOne(mappedBy = "cuentaCorriente")
|
||||
private Cliente cliente;
|
||||
|
||||
@OneToMany(mappedBy = "cuentaCorriente")
|
||||
private List<DepositoCuentaCorriente> depositoList;
|
||||
|
||||
@OneToMany(mappedBy = "cuentaCorrienteFrom")
|
||||
private List<TransferenciaCuentaCorriente> transferenciaFromList;
|
||||
|
||||
@OneToMany(mappedBy = "cuentaCorrienteTo")
|
||||
private List<TransferenciaCuentaCorriente> transferenciaToList;
|
||||
|
||||
@OneToMany(mappedBy = "cuentaCorriente")
|
||||
private List<GiroCuentaCorriente> giroList;
|
||||
|
||||
public CuentaCorriente() {
|
||||
}
|
||||
|
||||
public CuentaCorriente(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public CuentaCorriente(Integer id, int saldo, Date insertedAt) {
|
||||
this.id = id;
|
||||
this.saldo = saldo;
|
||||
this.insertedAt = insertedAt;
|
||||
@PrePersist
|
||||
public void onPersist() {
|
||||
this.insertedAt = LocalDateTime.now();
|
||||
this.saldo = 0;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
@@ -93,20 +73,32 @@ public class CuentaCorriente implements Serializable {
|
||||
this.saldo = saldo;
|
||||
}
|
||||
|
||||
public Date getInsertedAt() {
|
||||
public LocalDateTime getInsertedAt() {
|
||||
return insertedAt;
|
||||
}
|
||||
|
||||
public void setInsertedAt(Date insertedAt) {
|
||||
public void setInsertedAt(LocalDateTime insertedAt) {
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
public LineaSobregiro getLineaSobregiro() {
|
||||
return lineaSobregiro;
|
||||
}
|
||||
|
||||
public void setLineaSobregiro(LineaSobregiro lineaSobregiro) {
|
||||
this.lineaSobregiro = lineaSobregiro;
|
||||
if (!this.lineaSobregiro.getCuentaCorrienteList().contains(this))
|
||||
this.lineaSobregiro.getCuentaCorrienteList().add(this);
|
||||
}
|
||||
|
||||
public Cliente getCliente() {
|
||||
return cliente;
|
||||
}
|
||||
|
||||
public void setCliente(Cliente cliente) {
|
||||
this.cliente = cliente;
|
||||
if(this.cliente.getCuentaCorriente() != this)
|
||||
this.cliente.setCuentaCorriente(this);
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
@@ -118,6 +110,12 @@ public class CuentaCorriente implements Serializable {
|
||||
this.depositoList = depositoList;
|
||||
}
|
||||
|
||||
public void addDeposito(DepositoCuentaCorriente deposito) {
|
||||
this.depositoList.add(deposito);
|
||||
if (deposito.getCuentaCorriente() != this)
|
||||
deposito.setCuentaCorriente(this);
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<TransferenciaCuentaCorriente> getTransferenciaFromList() {
|
||||
return transferenciaFromList;
|
||||
@@ -127,6 +125,12 @@ public class CuentaCorriente implements Serializable {
|
||||
this.transferenciaFromList = transferenciaFromList;
|
||||
}
|
||||
|
||||
public void addTransferenciaFrom(TransferenciaCuentaCorriente transferenciaFrom) {
|
||||
this.transferenciaFromList.add(transferenciaFrom);
|
||||
if (transferenciaFrom.getCuentaCorrienteFrom() != this)
|
||||
transferenciaFrom.setCuentaCorrienteFrom(this);
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<TransferenciaCuentaCorriente> getTransferenciaToList() {
|
||||
return transferenciaToList;
|
||||
@@ -136,6 +140,12 @@ public class CuentaCorriente implements Serializable {
|
||||
this.transferenciaToList = transferenciaToList;
|
||||
}
|
||||
|
||||
public void addTransferenciaTo(TransferenciaCuentaCorriente transferenciaTo) {
|
||||
this.transferenciaFromList.add(transferenciaTo);
|
||||
if (transferenciaTo.getCuentaCorrienteTo() != this)
|
||||
transferenciaTo.setCuentaCorrienteTo(this);
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<GiroCuentaCorriente> getGiroList() {
|
||||
return giroList;
|
||||
@@ -145,6 +155,12 @@ public class CuentaCorriente implements Serializable {
|
||||
this.giroList = giroList;
|
||||
}
|
||||
|
||||
public void addGiro(GiroCuentaCorriente giro) {
|
||||
this.giroList.add(giro);
|
||||
if (giro.getCuentaCorriente() != this)
|
||||
giro.setCuentaCorriente(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
@@ -168,5 +184,5 @@ public class CuentaCorriente implements Serializable {
|
||||
public String toString() {
|
||||
return "entities.CuentaCorriente[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
@@ -17,59 +13,42 @@ import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.PrePersist;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ryuuji
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "deposito_cuenta_corriente")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "DepositoCuentaCorriente.findAll", query = "SELECT d FROM DepositoCuentaCorriente d")
|
||||
, @NamedQuery(name = "DepositoCuentaCorriente.findById", query = "SELECT d FROM DepositoCuentaCorriente d WHERE d.id = :id")
|
||||
, @NamedQuery(name = "DepositoCuentaCorriente.findByMonto", query = "SELECT d FROM DepositoCuentaCorriente d WHERE d.monto = :monto")
|
||||
, @NamedQuery(name = "DepositoCuentaCorriente.findByComentario", query = "SELECT d FROM DepositoCuentaCorriente d WHERE d.comentario = :comentario")
|
||||
, @NamedQuery(name = "DepositoCuentaCorriente.findByInsertedAt", query = "SELECT d FROM DepositoCuentaCorriente d WHERE d.insertedAt = :insertedAt")})
|
||||
public class DepositoCuentaCorriente implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "monto")
|
||||
private int monto;
|
||||
|
||||
@Column(name = "comentario")
|
||||
private String comentario;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "inserted_at")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date insertedAt;
|
||||
@JoinColumn(name = "metodo", referencedColumnName = "id")
|
||||
private LocalDateTime insertedAt;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "metodo")
|
||||
private Metodo metodo;
|
||||
@JoinColumn(name = "cuenta_corriente", referencedColumnName = "id")
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "cuenta_corriente")
|
||||
private CuentaCorriente cuentaCorriente;
|
||||
|
||||
public DepositoCuentaCorriente() {
|
||||
}
|
||||
|
||||
public DepositoCuentaCorriente(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public DepositoCuentaCorriente(Integer id, int monto, Date insertedAt) {
|
||||
this.id = id;
|
||||
this.monto = monto;
|
||||
this.insertedAt = insertedAt;
|
||||
@PrePersist
|
||||
public void onPersist() {
|
||||
this.insertedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
@@ -96,11 +75,11 @@ public class DepositoCuentaCorriente implements Serializable {
|
||||
this.comentario = comentario;
|
||||
}
|
||||
|
||||
public Date getInsertedAt() {
|
||||
public LocalDateTime getInsertedAt() {
|
||||
return insertedAt;
|
||||
}
|
||||
|
||||
public void setInsertedAt(Date insertedAt) {
|
||||
public void setInsertedAt(LocalDateTime insertedAt) {
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
@@ -110,6 +89,8 @@ public class DepositoCuentaCorriente implements Serializable {
|
||||
|
||||
public void setMetodo(Metodo metodo) {
|
||||
this.metodo = metodo;
|
||||
if(!metodo.getDepositoCuentaCorrienteList().contains(this))
|
||||
metodo.getDepositoCuentaCorrienteList().add(this);
|
||||
}
|
||||
|
||||
public CuentaCorriente getCuentaCorriente() {
|
||||
@@ -118,6 +99,8 @@ public class DepositoCuentaCorriente implements Serializable {
|
||||
|
||||
public void setCuentaCorriente(CuentaCorriente cuentaCorriente) {
|
||||
this.cuentaCorriente = cuentaCorriente;
|
||||
if(!this.cuentaCorriente.getDepositoList().contains(this))
|
||||
this.cuentaCorriente.getDepositoList().add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,14 +117,12 @@ public class DepositoCuentaCorriente implements Serializable {
|
||||
return false;
|
||||
}
|
||||
DepositoCuentaCorriente other = (DepositoCuentaCorriente) object;
|
||||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
|
||||
return false;
|
||||
return true;
|
||||
return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "entities.DepositoCuentaCorriente[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Basic;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
@@ -15,63 +9,42 @@ import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.PrePersist;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ryuuji
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "deposito_tarjeta_debito")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "DepositoTarjetaDebito.findAll", query = "SELECT d FROM DepositoTarjetaDebito d")
|
||||
, @NamedQuery(name = "DepositoTarjetaDebito.findById", query = "SELECT d FROM DepositoTarjetaDebito d WHERE d.id = :id")
|
||||
, @NamedQuery(name = "DepositoTarjetaDebito.findByMonto", query = "SELECT d FROM DepositoTarjetaDebito d WHERE d.monto = :monto")
|
||||
, @NamedQuery(name = "DepositoTarjetaDebito.findByComentario", query = "SELECT d FROM DepositoTarjetaDebito d WHERE d.comentario = :comentario")
|
||||
, @NamedQuery(name = "DepositoTarjetaDebito.findByInsertedAt", query = "SELECT d FROM DepositoTarjetaDebito d WHERE d.insertedAt = :insertedAt")})
|
||||
public class DepositoTarjetaDebito implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "monto")
|
||||
private int monto;
|
||||
|
||||
@Column(name = "comentario")
|
||||
private String comentario;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "inserted_at")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date insertedAt;
|
||||
@JoinColumn(name = "metodo", referencedColumnName = "id")
|
||||
private LocalDateTime insertedAt;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "metodo")
|
||||
private Metodo metodo;
|
||||
@JoinColumn(name = "tarjeta_debito", referencedColumnName = "id")
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "tarjeta_debito")
|
||||
private TarjetaDebito tarjetaDebito;
|
||||
|
||||
public DepositoTarjetaDebito() {
|
||||
@PrePersist
|
||||
public void onPersist() {
|
||||
this.insertedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
public DepositoTarjetaDebito(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public DepositoTarjetaDebito(Integer id, int monto, Date insertedAt) {
|
||||
this.id = id;
|
||||
this.monto = monto;
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -96,11 +69,11 @@ public class DepositoTarjetaDebito implements Serializable {
|
||||
this.comentario = comentario;
|
||||
}
|
||||
|
||||
public Date getInsertedAt() {
|
||||
public LocalDateTime getInsertedAt() {
|
||||
return insertedAt;
|
||||
}
|
||||
|
||||
public void setInsertedAt(Date insertedAt) {
|
||||
public void setInsertedAt(LocalDateTime insertedAt) {
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
@@ -110,6 +83,8 @@ public class DepositoTarjetaDebito implements Serializable {
|
||||
|
||||
public void setMetodo(Metodo metodo) {
|
||||
this.metodo = metodo;
|
||||
if(!this.metodo.getDepositoTarjetaDebitoList().contains(this))
|
||||
this.metodo.getDepositoTarjetaDebitoList().add(this);
|
||||
}
|
||||
|
||||
public TarjetaDebito getTarjetaDebito() {
|
||||
@@ -118,6 +93,8 @@ public class DepositoTarjetaDebito implements Serializable {
|
||||
|
||||
public void setTarjetaDebito(TarjetaDebito tarjetaDebito) {
|
||||
this.tarjetaDebito = tarjetaDebito;
|
||||
if(!this.tarjetaDebito.getDepositoList().contains(this))
|
||||
this.tarjetaDebito.getDepositoList().add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -143,5 +120,5 @@ public class DepositoTarjetaDebito implements Serializable {
|
||||
public String toString() {
|
||||
return "entities.DepositoTarjetaDebito[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Basic;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
@@ -15,63 +9,42 @@ import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.PrePersist;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ryuuji
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "giro_cuenta_corriente")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "GiroCuentaCorriente.findAll", query = "SELECT g FROM GiroCuentaCorriente g")
|
||||
, @NamedQuery(name = "GiroCuentaCorriente.findById", query = "SELECT g FROM GiroCuentaCorriente g WHERE g.id = :id")
|
||||
, @NamedQuery(name = "GiroCuentaCorriente.findByMonto", query = "SELECT g FROM GiroCuentaCorriente g WHERE g.monto = :monto")
|
||||
, @NamedQuery(name = "GiroCuentaCorriente.findByComentario", query = "SELECT g FROM GiroCuentaCorriente g WHERE g.comentario = :comentario")
|
||||
, @NamedQuery(name = "GiroCuentaCorriente.findByInsertedAt", query = "SELECT g FROM GiroCuentaCorriente g WHERE g.insertedAt = :insertedAt")})
|
||||
public class GiroCuentaCorriente implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "monto")
|
||||
private int monto;
|
||||
|
||||
@Column(name = "comentario")
|
||||
private String comentario;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "inserted_at")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date insertedAt;
|
||||
@JoinColumn(name = "metodo", referencedColumnName = "id")
|
||||
private LocalDateTime insertedAt;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "metodo")
|
||||
private Metodo metodo;
|
||||
@JoinColumn(name = "cuenta_corriente", referencedColumnName = "id")
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "cuenta_corriente")
|
||||
private CuentaCorriente cuentaCorriente;
|
||||
|
||||
public GiroCuentaCorriente() {
|
||||
@PrePersist
|
||||
public void onPersist() {
|
||||
this.insertedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
public GiroCuentaCorriente(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public GiroCuentaCorriente(Integer id, int monto, Date insertedAt) {
|
||||
this.id = id;
|
||||
this.monto = monto;
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -96,11 +69,11 @@ public class GiroCuentaCorriente implements Serializable {
|
||||
this.comentario = comentario;
|
||||
}
|
||||
|
||||
public Date getInsertedAt() {
|
||||
public LocalDateTime getInsertedAt() {
|
||||
return insertedAt;
|
||||
}
|
||||
|
||||
public void setInsertedAt(Date insertedAt) {
|
||||
public void setInsertedAt(LocalDateTime insertedAt) {
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
@@ -110,6 +83,8 @@ public class GiroCuentaCorriente implements Serializable {
|
||||
|
||||
public void setMetodo(Metodo metodo) {
|
||||
this.metodo = metodo;
|
||||
if(!this.metodo.getGiroCuentaCorrienteList().contains(this))
|
||||
this.metodo.getGiroCuentaCorrienteList().add(this);
|
||||
}
|
||||
|
||||
public CuentaCorriente getCuentaCorriente() {
|
||||
@@ -118,6 +93,8 @@ public class GiroCuentaCorriente implements Serializable {
|
||||
|
||||
public void setCuentaCorriente(CuentaCorriente cuentaCorriente) {
|
||||
this.cuentaCorriente = cuentaCorriente;
|
||||
if(!this.cuentaCorriente.getGiroList().contains(this))
|
||||
this.cuentaCorriente.getGiroList().add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,9 +111,7 @@ public class GiroCuentaCorriente implements Serializable {
|
||||
return false;
|
||||
}
|
||||
GiroCuentaCorriente other = (GiroCuentaCorriente) object;
|
||||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
|
||||
return false;
|
||||
return true;
|
||||
return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
@@ -17,61 +13,43 @@ import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.PrePersist;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ryuuji
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "giro_tarjeta_debito")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "GiroTarjetaDebito.findAll", query = "SELECT g FROM GiroTarjetaDebito g")
|
||||
, @NamedQuery(name = "GiroTarjetaDebito.findById", query = "SELECT g FROM GiroTarjetaDebito g WHERE g.id = :id")
|
||||
, @NamedQuery(name = "GiroTarjetaDebito.findByMonto", query = "SELECT g FROM GiroTarjetaDebito g WHERE g.monto = :monto")
|
||||
, @NamedQuery(name = "GiroTarjetaDebito.findByComentario", query = "SELECT g FROM GiroTarjetaDebito g WHERE g.comentario = :comentario")
|
||||
, @NamedQuery(name = "GiroTarjetaDebito.findByInsertedAt", query = "SELECT g FROM GiroTarjetaDebito g WHERE g.insertedAt = :insertedAt")})
|
||||
public class GiroTarjetaDebito implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "monto")
|
||||
private int monto;
|
||||
|
||||
@Column(name = "comentario")
|
||||
private String comentario;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "inserted_at")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date insertedAt;
|
||||
@JoinColumn(name = "tarjeta_debito", referencedColumnName = "id")
|
||||
private LocalDateTime insertedAt;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "tarjeta_debito")
|
||||
private TarjetaDebito tarjetaDebito;
|
||||
@JoinColumn(name = "metodo", referencedColumnName = "id")
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "metodo")
|
||||
private Metodo metodo;
|
||||
|
||||
public GiroTarjetaDebito() {
|
||||
@PrePersist
|
||||
public void onPersis() {
|
||||
this.insertedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
public GiroTarjetaDebito(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public GiroTarjetaDebito(Integer id, int monto, Date insertedAt) {
|
||||
this.id = id;
|
||||
this.monto = monto;
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -96,20 +74,22 @@ public class GiroTarjetaDebito implements Serializable {
|
||||
this.comentario = comentario;
|
||||
}
|
||||
|
||||
public Date getInsertedAt() {
|
||||
public LocalDateTime getInsertedAt() {
|
||||
return insertedAt;
|
||||
}
|
||||
|
||||
public void setInsertedAt(Date insertedAt) {
|
||||
public void setInsertedAt(LocalDateTime insertedAt) {
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
|
||||
public TarjetaDebito getTarjetaDebito() {
|
||||
return tarjetaDebito;
|
||||
}
|
||||
|
||||
public void setTarjetaDebito(TarjetaDebito tarjetaDebito) {
|
||||
this.tarjetaDebito = tarjetaDebito;
|
||||
if(!this.tarjetaDebito.getGiroList().contains(this))
|
||||
this.tarjetaDebito.getGiroList().add(this);
|
||||
}
|
||||
|
||||
public Metodo getMetodo() {
|
||||
@@ -118,6 +98,8 @@ public class GiroTarjetaDebito implements Serializable {
|
||||
|
||||
public void setMetodo(Metodo metodo) {
|
||||
this.metodo = metodo;
|
||||
if(!this.metodo.getGiroTarjetaDebitoList().contains(this))
|
||||
this.metodo.getGiroTarjetaDebitoList().add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,14 +116,12 @@ public class GiroTarjetaDebito implements Serializable {
|
||||
return false;
|
||||
}
|
||||
GiroTarjetaDebito other = (GiroTarjetaDebito) object;
|
||||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
|
||||
return false;
|
||||
return true;
|
||||
return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "entities.GiroTarjetaDebito[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,73 +1,48 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.CascadeType;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.PrePersist;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ryuuji
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "linea_sobregiro")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "LineaSobregiro.findAll", query = "SELECT l FROM LineaSobregiro l")
|
||||
, @NamedQuery(name = "LineaSobregiro.findById", query = "SELECT l FROM LineaSobregiro l WHERE l.id = :id")
|
||||
, @NamedQuery(name = "LineaSobregiro.findBySobregiro", query = "SELECT l FROM LineaSobregiro l WHERE l.sobregiro = :sobregiro")
|
||||
, @NamedQuery(name = "LineaSobregiro.findByLimite", query = "SELECT l FROM LineaSobregiro l WHERE l.limite = :limite")
|
||||
, @NamedQuery(name = "LineaSobregiro.findByInsertedAt", query = "SELECT l FROM LineaSobregiro l WHERE l.insertedAt = :insertedAt")})
|
||||
public class LineaSobregiro implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@Basic(optional = false)
|
||||
@Column(name = "sobregiro")
|
||||
|
||||
@Column(name = "sobregiro", nullable = false)
|
||||
private int sobregiro;
|
||||
@Basic(optional = false)
|
||||
@Column(name = "limite")
|
||||
|
||||
@Column(name = "limite", nullable = false)
|
||||
private int limite;
|
||||
@Basic(optional = false)
|
||||
@Column(name = "inserted_at")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date insertedAt;
|
||||
@OneToOne(cascade = CascadeType.ALL, mappedBy = "lineaSobregiro")
|
||||
private Cliente cliente;
|
||||
|
||||
public LineaSobregiro() {
|
||||
}
|
||||
@Column(name = "inserted_at", nullable = false)
|
||||
private LocalDateTime insertedAt;
|
||||
|
||||
public LineaSobregiro(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
@OneToMany(mappedBy = "lineaSobregiro")
|
||||
private List<CuentaCorriente> cuentaCorrienteList;
|
||||
|
||||
public LineaSobregiro(Integer id, int sobregiro, int limite, Date insertedAt) {
|
||||
this.id = id;
|
||||
this.sobregiro = sobregiro;
|
||||
this.limite = limite;
|
||||
this.insertedAt = insertedAt;
|
||||
@OneToMany(mappedBy = "lineaSobregiro")
|
||||
private List<TarjetaCredito> tarjetaCreditoList;
|
||||
|
||||
@PrePersist
|
||||
public void onPersist() {
|
||||
this.insertedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
@@ -94,22 +69,42 @@ public class LineaSobregiro implements Serializable {
|
||||
this.limite = limite;
|
||||
}
|
||||
|
||||
public Date getInsertedAt() {
|
||||
public List<CuentaCorriente> getCuentaCorrienteList() {
|
||||
return cuentaCorrienteList;
|
||||
}
|
||||
|
||||
public void setCuentaCorrienteList(List<CuentaCorriente> cuentaCorrienteList) {
|
||||
this.cuentaCorrienteList = cuentaCorrienteList;
|
||||
}
|
||||
|
||||
public void addCuentaCorriente(CuentaCorriente cuentaCorriente){
|
||||
this.cuentaCorrienteList.add(cuentaCorriente);
|
||||
if(cuentaCorriente.getLineaSobregiro() != this)
|
||||
cuentaCorriente.setLineaSobregiro(this);
|
||||
}
|
||||
|
||||
public List<TarjetaCredito> getTarjetaCreditoList() {
|
||||
return tarjetaCreditoList;
|
||||
}
|
||||
|
||||
public void setTarjetaCreditoList(List<TarjetaCredito> tarjetaCreditoList) {
|
||||
this.tarjetaCreditoList = tarjetaCreditoList;
|
||||
}
|
||||
|
||||
public void addTarjetaCredito(TarjetaCredito tarjetaCredito){
|
||||
this.tarjetaCreditoList.add(tarjetaCredito);
|
||||
if(tarjetaCredito.getLineaSobregiro() != this)
|
||||
tarjetaCredito.setLineaSobregiro(this);
|
||||
}
|
||||
|
||||
public LocalDateTime getInsertedAt() {
|
||||
return insertedAt;
|
||||
}
|
||||
|
||||
public void setInsertedAt(Date insertedAt) {
|
||||
public void setInsertedAt(LocalDateTime insertedAt) {
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
public Cliente getCliente() {
|
||||
return cliente;
|
||||
}
|
||||
|
||||
public void setCliente(Cliente cliente) {
|
||||
this.cliente = cliente;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
@@ -119,19 +114,16 @@ public class LineaSobregiro implements Serializable {
|
||||
|
||||
@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 LineaSobregiro)) {
|
||||
return false;
|
||||
}
|
||||
LineaSobregiro other = (LineaSobregiro) object;
|
||||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
|
||||
return false;
|
||||
return true;
|
||||
return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "entities.LineaSobregiro[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,75 +1,51 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
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.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.PrePersist;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ryuuji
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "metodo")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "Metodo.findAll", query = "SELECT m FROM Metodo m")
|
||||
, @NamedQuery(name = "Metodo.findById", query = "SELECT m FROM Metodo m WHERE m.id = :id")
|
||||
, @NamedQuery(name = "Metodo.findByNombre", query = "SELECT m FROM Metodo m WHERE m.nombre = :nombre")
|
||||
, @NamedQuery(name = "Metodo.findByInsertedAt", query = "SELECT m FROM Metodo m WHERE m.insertedAt = :insertedAt")})
|
||||
public class Metodo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "nombre")
|
||||
private String nombre;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "inserted_at")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date insertedAt;
|
||||
@OneToMany(mappedBy = "metodo")
|
||||
private List<DepositoCuentaCorriente> depositoCuentaCorrienteList;
|
||||
@OneToMany(mappedBy = "metodo")
|
||||
private List<DepositoTarjetaDebito> depositoTarjetaDebitoList;
|
||||
@OneToMany(mappedBy = "metodo")
|
||||
private List<GiroTarjetaDebito> giroTarjetaDebitoList;
|
||||
private LocalDateTime insertedAt;
|
||||
|
||||
@OneToMany(mappedBy = "metodo")
|
||||
private List<GiroCuentaCorriente> giroCuentaCorrienteList;
|
||||
|
||||
public Metodo() {
|
||||
}
|
||||
@OneToMany(mappedBy = "metodo")
|
||||
private List<DepositoCuentaCorriente> depositoCuentaCorrienteList;
|
||||
|
||||
public Metodo(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
@OneToMany(mappedBy = "metodo")
|
||||
private List<DepositoTarjetaDebito> depositoTarjetaDebitoList;
|
||||
|
||||
public Metodo(Integer id, String nombre, Date insertedAt) {
|
||||
this.id = id;
|
||||
this.nombre = nombre;
|
||||
this.insertedAt = insertedAt;
|
||||
@OneToMany(mappedBy = "metodo")
|
||||
private List<GiroTarjetaDebito> giroTarjetaDebitoList;
|
||||
|
||||
@PrePersist
|
||||
public void onPersist() {
|
||||
this.insertedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
@@ -88,11 +64,11 @@ public class Metodo implements Serializable {
|
||||
this.nombre = nombre;
|
||||
}
|
||||
|
||||
public Date getInsertedAt() {
|
||||
public LocalDateTime getInsertedAt() {
|
||||
return insertedAt;
|
||||
}
|
||||
|
||||
public void setInsertedAt(Date insertedAt) {
|
||||
public void setInsertedAt(LocalDateTime insertedAt) {
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
@@ -105,6 +81,12 @@ public class Metodo implements Serializable {
|
||||
this.depositoCuentaCorrienteList = depositoCuentaCorrienteList;
|
||||
}
|
||||
|
||||
public void addDepositoCuentaCorriente(DepositoCuentaCorriente depositoCuentaCorriente) {
|
||||
this.depositoCuentaCorrienteList.add(depositoCuentaCorriente);
|
||||
if (depositoCuentaCorriente.getMetodo() != this)
|
||||
depositoCuentaCorriente.setMetodo(this);
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<DepositoTarjetaDebito> getDepositoTarjetaDebitoList() {
|
||||
return depositoTarjetaDebitoList;
|
||||
@@ -114,6 +96,13 @@ public class Metodo implements Serializable {
|
||||
this.depositoTarjetaDebitoList = depositoTarjetaDebitoList;
|
||||
}
|
||||
|
||||
public void addDepositoTarjetaDebito(DepositoTarjetaDebito depositoTarjetaDebito) {
|
||||
this.depositoTarjetaDebitoList.add(depositoTarjetaDebito);
|
||||
if (depositoTarjetaDebito.getMetodo() != this) {
|
||||
depositoTarjetaDebito.setMetodo(this);
|
||||
}
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<GiroTarjetaDebito> getGiroTarjetaDebitoList() {
|
||||
return giroTarjetaDebitoList;
|
||||
@@ -123,6 +112,12 @@ public class Metodo implements Serializable {
|
||||
this.giroTarjetaDebitoList = giroTarjetaDebitoList;
|
||||
}
|
||||
|
||||
public void addGiroTarjetaDebito(GiroTarjetaDebito giroTarjetaDebito) {
|
||||
this.giroTarjetaDebitoList.add(giroTarjetaDebito);
|
||||
if (giroTarjetaDebito.getMetodo() != this)
|
||||
giroTarjetaDebito.setMetodo(this);
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<GiroCuentaCorriente> getGiroCuentaCorrienteList() {
|
||||
return giroCuentaCorrienteList;
|
||||
@@ -132,6 +127,13 @@ public class Metodo implements Serializable {
|
||||
this.giroCuentaCorrienteList = giroCuentaCorrienteList;
|
||||
}
|
||||
|
||||
public void addGiroCuentaCorriente(GiroCuentaCorriente giroCuentaCorriente) {
|
||||
this.giroCuentaCorrienteList.add(giroCuentaCorriente);
|
||||
if (giroCuentaCorriente.getMetodo() != this) {
|
||||
giroCuentaCorriente.setMetodo(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
@@ -146,14 +148,12 @@ public class Metodo implements Serializable {
|
||||
return false;
|
||||
}
|
||||
Metodo other = (Metodo) object;
|
||||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
|
||||
return false;
|
||||
return true;
|
||||
return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "entities.Metodo[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
@@ -15,58 +10,39 @@ import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.PrePersist;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ryuuji
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "pago_tarjeta_credito")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "PagoTarjetaCredito.findAll", query = "SELECT p FROM PagoTarjetaCredito p")
|
||||
, @NamedQuery(name = "PagoTarjetaCredito.findById", query = "SELECT p FROM PagoTarjetaCredito p WHERE p.id = :id")
|
||||
, @NamedQuery(name = "PagoTarjetaCredito.findByMonto", query = "SELECT p FROM PagoTarjetaCredito p WHERE p.monto = :monto")
|
||||
, @NamedQuery(name = "PagoTarjetaCredito.findByComentario", query = "SELECT p FROM PagoTarjetaCredito p WHERE p.comentario = :comentario")
|
||||
, @NamedQuery(name = "PagoTarjetaCredito.findByInsertedAt", query = "SELECT p FROM PagoTarjetaCredito p WHERE p.insertedAt = :insertedAt")})
|
||||
public class PagoTarjetaCredito implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "monto")
|
||||
private int monto;
|
||||
|
||||
@Column(name = "comentario")
|
||||
private String comentario;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "tipo")
|
||||
private String tipo;
|
||||
|
||||
@Column(name = "inserted_at")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date insertedAt;
|
||||
@JoinColumn(name = "tarjeta_credito", referencedColumnName = "id")
|
||||
private LocalDateTime insertedAt;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "tarjeta_credito", referencedColumnName = "id")
|
||||
private TarjetaCredito tarjetaCredito;
|
||||
|
||||
public PagoTarjetaCredito() {
|
||||
}
|
||||
|
||||
public PagoTarjetaCredito(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public PagoTarjetaCredito(Integer id, int monto, Date insertedAt) {
|
||||
this.id = id;
|
||||
this.monto = monto;
|
||||
this.insertedAt = insertedAt;
|
||||
@PrePersist
|
||||
public void onPersist() {
|
||||
this.insertedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
@@ -93,20 +69,32 @@ public class PagoTarjetaCredito implements Serializable {
|
||||
this.comentario = comentario;
|
||||
}
|
||||
|
||||
public Date getInsertedAt() {
|
||||
public String getTipo() {
|
||||
return tipo;
|
||||
}
|
||||
|
||||
public void setTipo(String tipo) {
|
||||
this.tipo = tipo;
|
||||
}
|
||||
|
||||
|
||||
public LocalDateTime getInsertedAt() {
|
||||
return insertedAt;
|
||||
}
|
||||
|
||||
public void setInsertedAt(Date insertedAt) {
|
||||
public void setInsertedAt(LocalDateTime insertedAt) {
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
|
||||
public TarjetaCredito getTarjetaCredito() {
|
||||
return tarjetaCredito;
|
||||
}
|
||||
|
||||
public void setTarjetaCredito(TarjetaCredito tarjetaCredito) {
|
||||
this.tarjetaCredito = tarjetaCredito;
|
||||
if(!this.tarjetaCredito.getPagoList().contains(this))
|
||||
this.tarjetaCredito.getPagoList().add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,9 +111,7 @@ public class PagoTarjetaCredito implements Serializable {
|
||||
return false;
|
||||
}
|
||||
PagoTarjetaCredito other = (PagoTarjetaCredito) object;
|
||||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
|
||||
return false;
|
||||
return true;
|
||||
return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
@@ -16,72 +10,56 @@ import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.PrePersist;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ryuuji
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "tarjeta_credito")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "TarjetaCredito.findAll", query = "SELECT t FROM TarjetaCredito t")
|
||||
, @NamedQuery(name = "TarjetaCredito.findById", query = "SELECT t FROM TarjetaCredito t WHERE t.id = :id")
|
||||
, @NamedQuery(name = "TarjetaCredito.findByLimiteNacional", query = "SELECT t FROM TarjetaCredito t WHERE t.limiteNacional = :limiteNacional")
|
||||
, @NamedQuery(name = "TarjetaCredito.findByLimiteInternacional", query = "SELECT t FROM TarjetaCredito t WHERE t.limiteInternacional = :limiteInternacional")
|
||||
, @NamedQuery(name = "TarjetaCredito.findByInsertedAt", query = "SELECT t FROM TarjetaCredito t WHERE t.insertedAt = :insertedAt")})
|
||||
public class TarjetaCredito implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@Basic(optional = false)
|
||||
@Column(name = "limite_nacional")
|
||||
|
||||
@Column(name = "limite_nacional", nullable = false)
|
||||
private int limiteNacional;
|
||||
@Basic(optional = false)
|
||||
@Column(name = "limite_internacional")
|
||||
|
||||
@Column(name = "limite_internacional", nullable = false)
|
||||
private int limiteInternacional;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "deuda_nacional")
|
||||
private int deudaNacional;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "deuda_internacional")
|
||||
private int deudaInternacional;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "inserted_at")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date insertedAt;
|
||||
@JoinColumn(name = "cliente", referencedColumnName = "id")
|
||||
@ManyToOne(optional = false)
|
||||
private LocalDateTime insertedAt;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "linea_sobregiro")
|
||||
private LineaSobregiro lineaSobregiro;
|
||||
|
||||
@OneToOne(mappedBy = "tarjetaCredito")
|
||||
private Cliente cliente;
|
||||
|
||||
@OneToMany(mappedBy = "tarjetaCredito")
|
||||
private List<PagoTarjetaCredito> pagoList;
|
||||
|
||||
@OneToMany(mappedBy = "tarjetaCredito")
|
||||
private List<CompraTarjetaCredito> compraList;
|
||||
|
||||
public TarjetaCredito() {
|
||||
}
|
||||
|
||||
public TarjetaCredito(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public TarjetaCredito(Integer id, int limiteNacional, int limiteInternacional, Date insertedAt) {
|
||||
this.id = id;
|
||||
this.limiteNacional = limiteNacional;
|
||||
this.limiteInternacional = limiteInternacional;
|
||||
this.insertedAt = insertedAt;
|
||||
@PrePersist
|
||||
public void onPersist() {
|
||||
this.insertedAt = LocalDateTime.now();
|
||||
this.deudaNacional = 0;
|
||||
this.deudaInternacional = 0;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
@@ -116,11 +94,11 @@ public class TarjetaCredito implements Serializable {
|
||||
return deudaInternacional;
|
||||
}
|
||||
|
||||
public Date getInsertedAt() {
|
||||
public LocalDateTime getInsertedAt() {
|
||||
return insertedAt;
|
||||
}
|
||||
|
||||
public void setInsertedAt(Date insertedAt) {
|
||||
public void setInsertedAt(LocalDateTime insertedAt) {
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
@@ -130,6 +108,8 @@ public class TarjetaCredito implements Serializable {
|
||||
|
||||
public void setCliente(Cliente cliente) {
|
||||
this.cliente = cliente;
|
||||
if(this.cliente.getTarjetaCredito() != this)
|
||||
this.cliente.setTarjetaCredito(this);
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
@@ -140,6 +120,12 @@ public class TarjetaCredito implements Serializable {
|
||||
public void setPagoList(List<PagoTarjetaCredito> pagoList) {
|
||||
this.pagoList = pagoList;
|
||||
}
|
||||
|
||||
public void addPago(PagoTarjetaCredito pago) {
|
||||
this.pagoList.add(pago);
|
||||
if(pago.getTarjetaCredito() != this)
|
||||
pago.setTarjetaCredito(this);
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<CompraTarjetaCredito> getCompraList() {
|
||||
@@ -149,6 +135,12 @@ public class TarjetaCredito implements Serializable {
|
||||
public void setCompraList(List<CompraTarjetaCredito> compraList) {
|
||||
this.compraList = compraList;
|
||||
}
|
||||
|
||||
public void addCompra(CompraTarjetaCredito compra) {
|
||||
this.compraList.add(compra);
|
||||
if(compra.getTarjetaCredito() != this)
|
||||
compra.setTarjetaCredito(this);
|
||||
}
|
||||
|
||||
public void setDeudaNacional(int deudaNacional) {
|
||||
this.deudaNacional = deudaNacional;
|
||||
@@ -158,7 +150,16 @@ public class TarjetaCredito implements Serializable {
|
||||
this.deudaInternacional = deudaInternacional;
|
||||
}
|
||||
|
||||
|
||||
public LineaSobregiro getLineaSobregiro() {
|
||||
return lineaSobregiro;
|
||||
}
|
||||
|
||||
public void setLineaSobregiro(LineaSobregiro lineaSobregiro) {
|
||||
this.lineaSobregiro = lineaSobregiro;
|
||||
if(!lineaSobregiro.getTarjetaCreditoList().contains(this))
|
||||
lineaSobregiro.getTarjetaCreditoList().add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
@@ -173,14 +174,12 @@ public class TarjetaCredito implements Serializable {
|
||||
return false;
|
||||
}
|
||||
TarjetaCredito other = (TarjetaCredito) object;
|
||||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
|
||||
return false;
|
||||
return true;
|
||||
return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "entities.TarjetaCredito[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
@@ -17,68 +10,51 @@ import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.PrePersist;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ryuuji
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "tarjeta_debito")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "TarjetaDebito.findAll", query = "SELECT t FROM TarjetaDebito t")
|
||||
, @NamedQuery(name = "TarjetaDebito.findById", query = "SELECT t FROM TarjetaDebito t WHERE t.id = :id")
|
||||
, @NamedQuery(name = "TarjetaDebito.findBySaldo", query = "SELECT t FROM TarjetaDebito t WHERE t.saldo = :saldo")
|
||||
, @NamedQuery(name = "TarjetaDebito.findByInsertedAt", query = "SELECT t FROM TarjetaDebito t WHERE t.insertedAt = :insertedAt")})
|
||||
public class TarjetaDebito implements Serializable {
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "tarjetaDebito")
|
||||
private List<CompraTarjetaDebito> compraList;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "saldo")
|
||||
private int saldo;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "inserted_at")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date insertedAt;
|
||||
@JoinColumn(name = "cliente", referencedColumnName = "id")
|
||||
@ManyToOne(optional = false)
|
||||
private LocalDateTime insertedAt;
|
||||
|
||||
@OneToOne(mappedBy = "tarjetaDebito")
|
||||
private Cliente cliente;
|
||||
|
||||
@OneToMany(mappedBy = "tarjetaDebitoFrom")
|
||||
private List<TransferenciaTarjetaDebito> transferenciaFromList;
|
||||
|
||||
@OneToMany(mappedBy = "tarjetaDebitoTo")
|
||||
private List<TransferenciaTarjetaDebito> transferenciaToList;
|
||||
|
||||
@OneToMany(mappedBy = "tarjetaDebito")
|
||||
private List<DepositoTarjetaDebito> depositoList;
|
||||
|
||||
@OneToMany(mappedBy = "tarjetaDebito")
|
||||
private List<GiroTarjetaDebito> giroList;
|
||||
|
||||
public TarjetaDebito() {
|
||||
}
|
||||
@OneToMany(mappedBy = "tarjetaDebito")
|
||||
private List<CompraTarjetaDebito> compraList;
|
||||
|
||||
public TarjetaDebito(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public TarjetaDebito(Integer id, int saldo, Date insertedAt) {
|
||||
this.id = id;
|
||||
this.saldo = saldo;
|
||||
this.insertedAt = insertedAt;
|
||||
@PrePersist
|
||||
public void onPersist() {
|
||||
this.insertedAt = LocalDateTime.now();
|
||||
this.saldo = 0;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
@@ -97,11 +73,11 @@ public class TarjetaDebito implements Serializable {
|
||||
this.saldo = saldo;
|
||||
}
|
||||
|
||||
public Date getInsertedAt() {
|
||||
public LocalDateTime getInsertedAt() {
|
||||
return insertedAt;
|
||||
}
|
||||
|
||||
public void setInsertedAt(Date insertedAt) {
|
||||
public void setInsertedAt(LocalDateTime insertedAt) {
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
@@ -111,24 +87,8 @@ public class TarjetaDebito implements Serializable {
|
||||
|
||||
public void setCliente(Cliente cliente) {
|
||||
this.cliente = cliente;
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<TransferenciaTarjetaDebito> getTransferenciaFromList() {
|
||||
return transferenciaFromList;
|
||||
}
|
||||
|
||||
public void setTransferenciaFromList(List<TransferenciaTarjetaDebito> transferenciaFromList) {
|
||||
this.transferenciaFromList = transferenciaFromList;
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<TransferenciaTarjetaDebito> getTransferenciaToList() {
|
||||
return transferenciaToList;
|
||||
}
|
||||
|
||||
public void setTransferenciaToList(List<TransferenciaTarjetaDebito> transferenciaToList) {
|
||||
this.transferenciaToList = transferenciaToList;
|
||||
if(this.cliente.getTarjetaDebito() != this)
|
||||
this.cliente.setTarjetaDebito(this);
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
@@ -140,6 +100,42 @@ public class TarjetaDebito implements Serializable {
|
||||
this.depositoList = depositoList;
|
||||
}
|
||||
|
||||
public void addDeposito(DepositoTarjetaDebito deposito) {
|
||||
this.depositoList.add(deposito);
|
||||
if (deposito.getTarjetaDebito()!= this)
|
||||
deposito.setTarjetaDebito(this);
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<TransferenciaTarjetaDebito> getTransferenciaFromList() {
|
||||
return transferenciaFromList;
|
||||
}
|
||||
|
||||
public void setTransferenciaFromList(List<TransferenciaTarjetaDebito> transferenciaFromList) {
|
||||
this.transferenciaFromList = transferenciaFromList;
|
||||
}
|
||||
|
||||
public void addTransferenciaFrom(TransferenciaTarjetaDebito transferenciaFrom) {
|
||||
this.transferenciaFromList.add(transferenciaFrom);
|
||||
if (transferenciaFrom.getTarjetaDebitoFrom()!= this)
|
||||
transferenciaFrom.setTarjetaDebitoFrom(this);
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<TransferenciaTarjetaDebito> getTransferenciaToList() {
|
||||
return transferenciaToList;
|
||||
}
|
||||
|
||||
public void setTransferenciaToList(List<TransferenciaTarjetaDebito> transferenciaToList) {
|
||||
this.transferenciaToList = transferenciaToList;
|
||||
}
|
||||
|
||||
public void addTransferenciaTo(TransferenciaTarjetaDebito transferenciaTo) {
|
||||
this.transferenciaFromList.add(transferenciaTo);
|
||||
if (transferenciaTo.getTarjetaDebitoTo() != this)
|
||||
transferenciaTo.setTarjetaDebitoTo(this);
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<GiroTarjetaDebito> getGiroList() {
|
||||
return giroList;
|
||||
@@ -149,6 +145,27 @@ public class TarjetaDebito implements Serializable {
|
||||
this.giroList = giroList;
|
||||
}
|
||||
|
||||
public void addGiro(GiroTarjetaDebito giro) {
|
||||
this.giroList.add(giro);
|
||||
if (giro.getTarjetaDebito()!= this)
|
||||
giro.setTarjetaDebito(this);
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<CompraTarjetaDebito> getCompraList() {
|
||||
return compraList;
|
||||
}
|
||||
|
||||
public void setCompraList(List<CompraTarjetaDebito> compraList) {
|
||||
this.compraList = compraList;
|
||||
}
|
||||
|
||||
public void addCompra(CompraTarjetaDebito compra) {
|
||||
this.compraList.add(compra);
|
||||
if(compra.getTarjetaDebito() != this)
|
||||
compra.setTarjetaDebito(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
@@ -163,23 +180,11 @@ public class TarjetaDebito implements Serializable {
|
||||
return false;
|
||||
}
|
||||
TarjetaDebito other = (TarjetaDebito) object;
|
||||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
|
||||
return false;
|
||||
return true;
|
||||
return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "entities.TarjetaDebito[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public List<CompraTarjetaDebito> getCompraList() {
|
||||
return compraList;
|
||||
}
|
||||
|
||||
public void setCompraList(List<CompraTarjetaDebito> compraList) {
|
||||
this.compraList = compraList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
@@ -17,59 +13,42 @@ import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.PrePersist;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ryuuji
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "transferencia_cuenta_corriente")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "TransferenciaCuentaCorriente.findAll", query = "SELECT t FROM TransferenciaCuentaCorriente t")
|
||||
, @NamedQuery(name = "TransferenciaCuentaCorriente.findById", query = "SELECT t FROM TransferenciaCuentaCorriente t WHERE t.id = :id")
|
||||
, @NamedQuery(name = "TransferenciaCuentaCorriente.findByMonto", query = "SELECT t FROM TransferenciaCuentaCorriente t WHERE t.monto = :monto")
|
||||
, @NamedQuery(name = "TransferenciaCuentaCorriente.findByComentario", query = "SELECT t FROM TransferenciaCuentaCorriente t WHERE t.comentario = :comentario")
|
||||
, @NamedQuery(name = "TransferenciaCuentaCorriente.findByInsertedAt", query = "SELECT t FROM TransferenciaCuentaCorriente t WHERE t.insertedAt = :insertedAt")})
|
||||
public class TransferenciaCuentaCorriente implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "monto")
|
||||
private int monto;
|
||||
|
||||
@Column(name = "comentario")
|
||||
private String comentario;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "inserted_at")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date insertedAt;
|
||||
@JoinColumn(name = "cuenta_corriente_from", referencedColumnName = "id")
|
||||
private LocalDateTime insertedAt;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "cuenta_corriente_from")
|
||||
private CuentaCorriente cuentaCorrienteFrom;
|
||||
@JoinColumn(name = "cuenta_corriente_to", referencedColumnName = "id")
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "cuenta_corriente_to")
|
||||
private CuentaCorriente cuentaCorrienteTo;
|
||||
|
||||
public TransferenciaCuentaCorriente() {
|
||||
}
|
||||
|
||||
public TransferenciaCuentaCorriente(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public TransferenciaCuentaCorriente(Integer id, int monto, Date insertedAt) {
|
||||
this.id = id;
|
||||
this.monto = monto;
|
||||
this.insertedAt = insertedAt;
|
||||
@PrePersist
|
||||
public void onPersist() {
|
||||
this.insertedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
@@ -96,13 +75,14 @@ public class TransferenciaCuentaCorriente implements Serializable {
|
||||
this.comentario = comentario;
|
||||
}
|
||||
|
||||
public Date getInsertedAt() {
|
||||
public LocalDateTime getInsertedAt() {
|
||||
return insertedAt;
|
||||
}
|
||||
|
||||
public void setInsertedAt(Date insertedAt) {
|
||||
public void setInsertedAt(LocalDateTime insertedAt) {
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
|
||||
public CuentaCorriente getCuentaCorrienteFrom() {
|
||||
return cuentaCorrienteFrom;
|
||||
@@ -110,6 +90,8 @@ public class TransferenciaCuentaCorriente implements Serializable {
|
||||
|
||||
public void setCuentaCorrienteFrom(CuentaCorriente cuentaCorrienteFrom) {
|
||||
this.cuentaCorrienteFrom = cuentaCorrienteFrom;
|
||||
if(!this.cuentaCorrienteFrom.getTransferenciaFromList().contains(this))
|
||||
this.cuentaCorrienteFrom.getTransferenciaFromList().add(this);
|
||||
}
|
||||
|
||||
public CuentaCorriente getCuentaCorrienteTo() {
|
||||
@@ -118,6 +100,8 @@ public class TransferenciaCuentaCorriente implements Serializable {
|
||||
|
||||
public void setCuentaCorrienteTo(CuentaCorriente cuentaCorrienteTo) {
|
||||
this.cuentaCorrienteTo = cuentaCorrienteTo;
|
||||
if(!this.cuentaCorrienteTo.getTransferenciaToList().contains(this))
|
||||
this.cuentaCorrienteTo.getTransferenciaToList().add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,14 +118,12 @@ public class TransferenciaCuentaCorriente implements Serializable {
|
||||
return false;
|
||||
}
|
||||
TransferenciaCuentaCorriente other = (TransferenciaCuentaCorriente) object;
|
||||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
|
||||
return false;
|
||||
return true;
|
||||
return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "entities.TransferenciaCuentaCorriente[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
@@ -17,59 +13,42 @@ import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.PrePersist;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ryuuji
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "transferencia_tarjeta_debito")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "TransferenciaTarjetaDebito.findAll", query = "SELECT t FROM TransferenciaTarjetaDebito t")
|
||||
, @NamedQuery(name = "TransferenciaTarjetaDebito.findById", query = "SELECT t FROM TransferenciaTarjetaDebito t WHERE t.id = :id")
|
||||
, @NamedQuery(name = "TransferenciaTarjetaDebito.findByMonto", query = "SELECT t FROM TransferenciaTarjetaDebito t WHERE t.monto = :monto")
|
||||
, @NamedQuery(name = "TransferenciaTarjetaDebito.findByComentario", query = "SELECT t FROM TransferenciaTarjetaDebito t WHERE t.comentario = :comentario")
|
||||
, @NamedQuery(name = "TransferenciaTarjetaDebito.findByInsertedAt", query = "SELECT t FROM TransferenciaTarjetaDebito t WHERE t.insertedAt = :insertedAt")})
|
||||
public class TransferenciaTarjetaDebito implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "monto")
|
||||
private int monto;
|
||||
|
||||
@Column(name = "comentario")
|
||||
private String comentario;
|
||||
@Basic(optional = false)
|
||||
|
||||
@Column(name = "inserted_at")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date insertedAt;
|
||||
@JoinColumn(name = "tarjeta_debito_from", referencedColumnName = "id")
|
||||
private LocalDateTime insertedAt;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "tarjeta_debito_from")
|
||||
private TarjetaDebito tarjetaDebitoFrom;
|
||||
@JoinColumn(name = "tarjeta_debito_to", referencedColumnName = "id")
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "tarjeta_debito_to")
|
||||
private TarjetaDebito tarjetaDebitoTo;
|
||||
|
||||
public TransferenciaTarjetaDebito() {
|
||||
}
|
||||
|
||||
public TransferenciaTarjetaDebito(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public TransferenciaTarjetaDebito(Integer id, int monto, Date insertedAt) {
|
||||
this.id = id;
|
||||
this.monto = monto;
|
||||
this.insertedAt = insertedAt;
|
||||
@PrePersist
|
||||
public void onPersis() {
|
||||
this.insertedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
@@ -96,11 +75,11 @@ public class TransferenciaTarjetaDebito implements Serializable {
|
||||
this.comentario = comentario;
|
||||
}
|
||||
|
||||
public Date getInsertedAt() {
|
||||
public LocalDateTime getInsertedAt() {
|
||||
return insertedAt;
|
||||
}
|
||||
|
||||
public void setInsertedAt(Date insertedAt) {
|
||||
public void setInsertedAt(LocalDateTime insertedAt) {
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
@@ -110,6 +89,8 @@ public class TransferenciaTarjetaDebito implements Serializable {
|
||||
|
||||
public void setTarjetaDebitoFrom(TarjetaDebito tarjetaDebitoFrom) {
|
||||
this.tarjetaDebitoFrom = tarjetaDebitoFrom;
|
||||
if (!this.tarjetaDebitoFrom.getTransferenciaFromList().contains(this))
|
||||
this.tarjetaDebitoFrom.getTransferenciaFromList().add(this);
|
||||
}
|
||||
|
||||
public TarjetaDebito getTarjetaDebitoTo() {
|
||||
@@ -118,6 +99,8 @@ public class TransferenciaTarjetaDebito implements Serializable {
|
||||
|
||||
public void setTarjetaDebitoTo(TarjetaDebito tarjetaDebitoTo) {
|
||||
this.tarjetaDebitoTo = tarjetaDebitoTo;
|
||||
if (!this.tarjetaDebitoTo.getTransferenciaToList().contains(this))
|
||||
this.tarjetaDebitoTo.getTransferenciaToList().add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,14 +117,12 @@ public class TransferenciaTarjetaDebito implements Serializable {
|
||||
return false;
|
||||
}
|
||||
TransferenciaTarjetaDebito other = (TransferenciaTarjetaDebito) object;
|
||||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
|
||||
return false;
|
||||
return true;
|
||||
return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "entities.TransferenciaTarjetaDebito[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package entities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.CascadeType;
|
||||
@@ -15,74 +11,49 @@ import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Lob;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.PrePersist;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ryuuji
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "usuario")
|
||||
@XmlRootElement
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "Usuario.findAll", query = "SELECT u FROM Usuario u")
|
||||
, @NamedQuery(name = "Usuario.findById", query = "SELECT u FROM Usuario u WHERE u.id = :id")
|
||||
, @NamedQuery(name = "Usuario.findByNombre", query = "SELECT u FROM Usuario u WHERE u.nombre = :nombre")
|
||||
, @NamedQuery(name = "Usuario.findByRole", query = "SELECT u FROM Usuario u WHERE u.role = :role")
|
||||
, @NamedQuery(name = "Usuario.findByInsertedAt", query = "SELECT u FROM Usuario u WHERE u.insertedAt = :insertedAt")})
|
||||
public class Usuario implements Serializable {
|
||||
|
||||
@Basic(optional = false)
|
||||
@Lob
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "nombre")
|
||||
private String nombre;
|
||||
|
||||
@Column(name = "password")
|
||||
private byte[] password;
|
||||
@Basic(optional = false)
|
||||
@Lob
|
||||
|
||||
@Column(name = "salt")
|
||||
private byte[] salt;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@Basic(optional = false)
|
||||
@Column(name = "nombre")
|
||||
private String nombre;
|
||||
@Basic(optional = false)
|
||||
@Column(name = "role")
|
||||
private String role;
|
||||
@Basic(optional = false)
|
||||
@Column(name = "inserted_at")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date insertedAt;
|
||||
@OneToOne(cascade = CascadeType.ALL, mappedBy = "usuario")
|
||||
@Column(name = "rol")
|
||||
private String rol;
|
||||
|
||||
@OneToOne(mappedBy = "usuario")
|
||||
private Cliente cliente;
|
||||
|
||||
@Column(name = "inserted_at")
|
||||
private LocalDateTime insertedAt;
|
||||
|
||||
@Transient
|
||||
private String transientPassword;
|
||||
|
||||
public Usuario() {
|
||||
}
|
||||
|
||||
public Usuario(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Usuario(Integer id, String nombre, byte[] password, byte[] salt, String role, Date insertedAt) {
|
||||
this.id = id;
|
||||
this.nombre = nombre;
|
||||
this.password = password;
|
||||
this.salt = salt;
|
||||
this.role = role;
|
||||
this.insertedAt = insertedAt;
|
||||
@PrePersist
|
||||
public void onPersist() {
|
||||
this.insertedAt = LocalDateTime.now();
|
||||
this.rol = "Cliente";
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
@@ -101,20 +72,19 @@ public class Usuario implements Serializable {
|
||||
this.nombre = nombre;
|
||||
}
|
||||
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
public String getRol() {
|
||||
return rol;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
public void setRol(String rol) {
|
||||
this.rol = rol;
|
||||
}
|
||||
|
||||
public Date getInsertedAt() {
|
||||
public LocalDateTime getInsertedAt() {
|
||||
return insertedAt;
|
||||
}
|
||||
|
||||
public void setInsertedAt(Date insertedAt) {
|
||||
public void setInsertedAt(LocalDateTime insertedAt) {
|
||||
this.insertedAt = insertedAt;
|
||||
}
|
||||
|
||||
@@ -124,6 +94,24 @@ public class Usuario implements Serializable {
|
||||
|
||||
public void setCliente(Cliente cliente) {
|
||||
this.cliente = cliente;
|
||||
if(this.cliente.getUsuario() != this)
|
||||
this.cliente.setUsuario(this);
|
||||
}
|
||||
|
||||
public byte[] getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(byte[] password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public byte[] getSalt() {
|
||||
return salt;
|
||||
}
|
||||
|
||||
public void setSalt(byte[] salt) {
|
||||
this.salt = salt;
|
||||
}
|
||||
|
||||
public String getTransientPassword() {
|
||||
@@ -148,9 +136,7 @@ public class Usuario implements Serializable {
|
||||
return false;
|
||||
}
|
||||
Usuario other = (Usuario) object;
|
||||
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
|
||||
return false;
|
||||
return true;
|
||||
return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -158,20 +144,4 @@ public class Usuario implements Serializable {
|
||||
return "entities.Usuario[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
public byte[] getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(byte[] password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public byte[] getSalt() {
|
||||
return salt;
|
||||
}
|
||||
|
||||
public void setSalt(byte[] salt) {
|
||||
this.salt = salt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user