bug #7438
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@55984 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
a37a5c7f1f
commit
d83a9f94fe
|
@ -7,6 +7,7 @@ package com.rjconsultores.ventaboletos.entidad;
|
|||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -26,6 +27,11 @@ import javax.persistence.Table;
|
|||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
import org.hibernate.annotations.LazyCollection;
|
||||
import org.hibernate.annotations.LazyCollectionOption;
|
||||
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rafius
|
||||
|
@ -90,20 +96,26 @@ public class TipoEventoExtra implements Serializable {
|
|||
private String natureza;
|
||||
@Column(name = "CONTACONTABIL")
|
||||
private String contaContabil;
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "TIPOEVENTOEXTRA_ID", referencedColumnName = "TIPOEVENTOEXTRA_ID")
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoeventoextra")
|
||||
@LazyCollection(LazyCollectionOption.FALSE)
|
||||
private List<TipoEventoExtraEmpresa> empresas;
|
||||
@Column(name = "INDCONFERENCIAFISICACOMISSAO")
|
||||
private Boolean indconferenciafisicacomissao;
|
||||
|
||||
// @Column(name = "FORMAPAGO_ID")
|
||||
// private Integer formapagoId;
|
||||
// @Column(name = "PARAMARTICULO2_ID")
|
||||
// private Integer paramarticulo2Id;
|
||||
// @Column(name = "FORMAPAGO2_ID")
|
||||
// private Integer formapago2Id;
|
||||
// @Column(name = "PARAMARTICULO_ID")
|
||||
// private Integer paramarticuloId;
|
||||
public TipoEventoExtraEmpresa addEmpresa(Empresa e) {
|
||||
TipoEventoExtraEmpresa t = new TipoEventoExtraEmpresa();
|
||||
t.setEmpresa(e);
|
||||
t.setTipoeventoextra(this);
|
||||
t.setActivo(Boolean.TRUE);
|
||||
t.setFecmodif(Calendar.getInstance().getTime());
|
||||
t.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
this.empresas.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
public void removeEmpresa(TipoEventoExtraEmpresa t) {
|
||||
this.empresas.remove(t);
|
||||
}
|
||||
|
||||
public String getDescTipoEvento() {
|
||||
return descTipoEvento;
|
||||
|
@ -129,16 +141,6 @@ public class TipoEventoExtra implements Serializable {
|
|||
private ParamArticulo paramArticulo2;
|
||||
|
||||
public TipoEventoExtra() {
|
||||
empresas = new ArrayList<TipoEventoExtraEmpresa>();
|
||||
}
|
||||
|
||||
public void addTipoEventoExtraEmpresa(TipoEventoExtraEmpresa tipoEventoExtraEmpresa){
|
||||
tipoEventoExtraEmpresa.setTipoeventoextra(this);
|
||||
empresas.add(tipoEventoExtraEmpresa);
|
||||
}
|
||||
|
||||
public void removeTipoEventoExtraEmpresa(TipoEventoExtraEmpresa tipoEventoExtraEmpresa){
|
||||
empresas.remove(tipoEventoExtraEmpresa);
|
||||
}
|
||||
|
||||
public TipoEventoExtra(Integer tipoeventoextraId) {
|
||||
|
@ -358,7 +360,13 @@ public class TipoEventoExtra implements Serializable {
|
|||
}
|
||||
|
||||
public List<TipoEventoExtraEmpresa> getEmpresas() {
|
||||
return empresas;
|
||||
List<TipoEventoExtraEmpresa> lista = new ArrayList<TipoEventoExtraEmpresa>();
|
||||
for (TipoEventoExtraEmpresa t : empresas) {
|
||||
if (t.getActivo()) {
|
||||
lista.add(t);
|
||||
}
|
||||
}
|
||||
return lista;
|
||||
}
|
||||
|
||||
public void setEmpresas(List<TipoEventoExtraEmpresa> empresas) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.rjconsultores.ventaboletos.entidad;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
@ -10,6 +12,8 @@ import javax.persistence.JoinColumn;
|
|||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
@Entity
|
||||
@Table(name = "TIPO_EVENTO_EXTRA_EMPRESA")
|
||||
|
@ -20,13 +24,21 @@ public class TipoEventoExtraEmpresa {
|
|||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_EVENTO_EXTRA_EMPRESA_SEQ")
|
||||
@Column(name = "TIPOEVENTOEXTRAEMPRESA_ID")
|
||||
private Integer tipoeventoextraempresaId;
|
||||
@JoinColumn(name = "TIPOEVENTOEXTRA_ID")
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "TIPOEVENTOEXTRA_ID")
|
||||
private TipoEventoExtra tipoeventoextra;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "EMPRESA_ID")
|
||||
private Empresa empresa;
|
||||
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecmodif;
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
|
||||
public Integer getTipoeventoextraempresaId() {
|
||||
return tipoeventoextraempresaId;
|
||||
}
|
||||
|
@ -50,4 +62,43 @@ public class TipoEventoExtraEmpresa {
|
|||
public String toString() {
|
||||
return empresa.getNombempresa();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
hash += (tipoeventoextraempresaId != null ? tipoeventoextraempresaId.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
// TODO: Warning - this method won't work in the case the id fields are not set
|
||||
if (!(object instanceof TipoEventoExtraEmpresa)) {
|
||||
return false;
|
||||
}
|
||||
TipoEventoExtraEmpresa other = (TipoEventoExtraEmpresa) object;
|
||||
if ((this.tipoeventoextraempresaId == null && other.tipoeventoextraempresaId != null) || (this.tipoeventoextraempresaId != null && !this.tipoeventoextraempresaId.equals(other.tipoeventoextraempresaId))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public Date getFecmodif() {
|
||||
return fecmodif;
|
||||
}
|
||||
public void setFecmodif(Date fecmodif) {
|
||||
this.fecmodif = fecmodif;
|
||||
}
|
||||
public Integer getUsuarioId() {
|
||||
return usuarioId;
|
||||
}
|
||||
public void setUsuarioId(Integer usuarioId) {
|
||||
this.usuarioId = usuarioId;
|
||||
}
|
||||
public Boolean getActivo() {
|
||||
return activo;
|
||||
}
|
||||
public void setActivo(Boolean activo) {
|
||||
this.activo = activo;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,4 +57,5 @@ public interface EmpresaService {
|
|||
|
||||
public void removerComissaoTipoEventoExtra(ComEmpTipoEventoExtra comEmpTipoEventoExtra);
|
||||
|
||||
public List<Empresa> obtenerTodosIncluindoEmpresaTodas();
|
||||
}
|
||||
|
|
|
@ -2,11 +2,12 @@ package com.rjconsultores.ventaboletos.service;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.SecretariaEmpresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra;
|
||||
import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraEmpresa;
|
||||
import com.rjconsultores.ventaboletos.exception.ValidacionCampoException;
|
||||
|
||||
public interface TipoEventoExtraEmpresaService {
|
||||
public interface TipoEventoExtraEmpresaService extends GenericService<TipoEventoExtraEmpresa, Integer> {
|
||||
public List<TipoEventoExtraEmpresa> buscarPorTipoEventoExtra(TipoEventoExtra tipoeventoextra);
|
||||
public TipoEventoExtraEmpresa suscribir(TipoEventoExtraEmpresa entidad);
|
||||
}
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.TipoEventoExtraEmpresaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra;
|
||||
import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraEmpresa;
|
||||
import com.rjconsultores.ventaboletos.service.TipoEventoExtraEmpresaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
@Service("tipoEventoExtraEmpresaService")
|
||||
public class TipoEventoExtraEmpresaServiceImpl implements TipoEventoExtraEmpresaService {
|
||||
|
@ -20,11 +23,40 @@ public class TipoEventoExtraEmpresaServiceImpl implements TipoEventoExtraEmpresa
|
|||
return tipoEventoExtraEmpresaDAO.buscarPorTipoEventoExtra(tipoeventoextra);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public TipoEventoExtraEmpresa suscribir(TipoEventoExtraEmpresa entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return tipoEventoExtraEmpresaDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TipoEventoExtraEmpresa> obtenerTodos() {
|
||||
return tipoEventoExtraEmpresaDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TipoEventoExtraEmpresa obtenerID(Integer id) {
|
||||
return tipoEventoExtraEmpresaDAO.obtenerID(id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public TipoEventoExtraEmpresa actualizacion(TipoEventoExtraEmpresa entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return tipoEventoExtraEmpresaDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void borrar(TipoEventoExtraEmpresa entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.FALSE);
|
||||
|
||||
tipoEventoExtraEmpresaDAO.actualizacion(entidad);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue