From 233989ea1c455c6d0aed538001c09dd9eb7b772e Mon Sep 17 00:00:00 2001 From: leonardo Date: Wed, 18 Jun 2014 19:42:40 +0000 Subject: [PATCH] =?UTF-8?q?Novas=20Informa=C3=A7=C3=A3o=20=C3=94nibus=20(f?= =?UTF-8?q?ixed=20bug=20#5391)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@36109 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../ventaboletos/dao/AutobusDocDAO.java | 10 ++ .../ventaboletos/dao/MarcaAutobusDAO.java | 9 ++ .../ventaboletos/dao/TipoDocAutobusDAO.java | 7 + .../dao/hibernate/AutobusDocHibernateDAO.java | 43 ++++++ .../hibernate/MarcaAutobusHibernateDAO.java | 31 ++++ .../hibernate/TipoDocAutobusHibernateDAO.java | 18 +++ .../ventaboletos/entidad/Autobus.java | 138 +++++++++++++++++- .../ventaboletos/entidad/AutobusDoc.java | 99 +++++++++++++ .../ventaboletos/entidad/MarcaAutobus.java | 69 +++++++++ .../ventaboletos/entidad/TipoDocAutobus.java | 72 +++++++++ .../service/AutobusDocService.java | 10 ++ .../service/MarcaAutobusService.java | 7 + .../service/TipoDocAutobusService.java | 6 + .../service/impl/AutobusDocServiceImpl.java | 62 ++++++++ .../service/impl/MarcaAutobusServiceImpl.java | 55 +++++++ .../impl/TipoDocAutobusServiceImpl.java | 58 ++++++++ 16 files changed, 691 insertions(+), 3 deletions(-) create mode 100644 src/com/rjconsultores/ventaboletos/dao/AutobusDocDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MarcaAutobusDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoDocAutobusDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AutobusDocHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaAutobusHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoDocAutobusHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AutobusDoc.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MarcaAutobus.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoDocAutobus.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AutobusDocService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MarcaAutobusService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoDocAutobusService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AutobusDocServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MarcaAutobusServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoDocAutobusServiceImpl.java diff --git a/src/com/rjconsultores/ventaboletos/dao/AutobusDocDAO.java b/src/com/rjconsultores/ventaboletos/dao/AutobusDocDAO.java new file mode 100644 index 000000000..b3e8073c0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AutobusDocDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.AutobusDoc; + +public interface AutobusDocDAO extends GenericDAO { + public List obtenerPorAutobus(Autobus autobus); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MarcaAutobusDAO.java b/src/com/rjconsultores/ventaboletos/dao/MarcaAutobusDAO.java new file mode 100644 index 000000000..f1dff5dba --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MarcaAutobusDAO.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.MarcaAutobus; + + +public interface MarcaAutobusDAO extends GenericDAO { + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoDocAutobusDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoDocAutobusDAO.java new file mode 100644 index 000000000..6250e7bd2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoDocAutobusDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoDocAutobus; + +public interface TipoDocAutobusDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AutobusDocHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AutobusDocHibernateDAO.java new file mode 100644 index 000000000..1fbeb96f5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AutobusDocHibernateDAO.java @@ -0,0 +1,43 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AutobusDocDAO; +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.AutobusDoc; + +@Repository("autobusDocDAO") +public class AutobusDocHibernateDAO extends GenericHibernateDAO +implements AutobusDocDAO { + + @Autowired + public AutobusDocHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List obtenerPorAutobus(Autobus autobus) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("autobus", autobus)); + + return c.list(); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaAutobusHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaAutobusHibernateDAO.java new file mode 100644 index 000000000..6ab67b944 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaAutobusHibernateDAO.java @@ -0,0 +1,31 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.MarcaAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.MarcaAutobus; + +@Repository("marcaAutobusDAO") +public class MarcaAutobusHibernateDAO extends GenericHibernateDAO +implements MarcaAutobusDAO { + + @Autowired + public MarcaAutobusHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoDocAutobusHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoDocAutobusHibernateDAO.java new file mode 100644 index 000000000..476db4676 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoDocAutobusHibernateDAO.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TipoDocAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.TipoDocAutobus; + +@Repository("tipoDocAutobusDAO") +public class TipoDocAutobusHibernateDAO extends GenericHibernateDAO +implements TipoDocAutobusDAO { + @Autowired + public TipoDocAutobusHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Autobus.java b/src/com/rjconsultores/ventaboletos/entidad/Autobus.java index fdc83c879..6532bf45c 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Autobus.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Autobus.java @@ -7,6 +7,7 @@ package com.rjconsultores.ventaboletos.entidad; import java.io.Serializable; import java.util.Date; import java.util.List; + import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; @@ -38,6 +39,22 @@ public class Autobus implements Serializable { private Integer autobusId; @Column(name = "NUMAUTOBUS") private String numautobus; + @Column(name = "CANTPARADOS") + private Integer cantparados; + @Column(name = "DESCMODELO") + private String descmodelo; + @Column(name = "ANO") + private Integer ano; + @Column(name = "INDBANO") + private Boolean indbano; + @Column(name = "INDVIDEO") + private Boolean indvideo; + @Column(name = "INDAIRE") + private Boolean indaire; + @Column(name = "NUMMATRICULA") + private String nummatricula; + @Column(name = "PATRON") + private String patron; @Column(name = "ACTIVO") private Boolean activo; @Column(name = "FECMODIF") @@ -53,7 +70,18 @@ public class Autobus implements Serializable { private DiagramaAutobus diagramaAutobusPiso; @OneToMany(mappedBy = "autobus") private List corridaList; - + @JoinColumn(name = "MARCAAUTOBUS_ID", referencedColumnName = "MARCAAUTOBUS_ID") + @ManyToOne + private MarcaAutobus marcaAutobus; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + @JoinColumn(name = "CIUDAD_ID", referencedColumnName = "CIUDAD_ID") + @ManyToOne + private Ciudad ciudad; + @OneToMany(mappedBy = "autobus") + private List autobusDocList; + public Autobus() { } @@ -125,14 +153,118 @@ public class Autobus implements Serializable { this.diagramaAutobusPiso = diagramaAutobusPiso; } - @Override + public Integer getCantparados() { + return cantparados; + } + + public void setCantparados(Integer cantparados) { + this.cantparados = cantparados; + } + + public String getDescmodelo() { + return descmodelo; + } + + public void setDescmodelo(String descmodelo) { + this.descmodelo = descmodelo; + } + + public Integer getAno() { + return ano; + } + + public void setAno(Integer ano) { + this.ano = ano; + } + + public Boolean getIndbano() { + return indbano; + } + + public void setIndbano(Boolean indbano) { + this.indbano = indbano; + } + + public Boolean getIndvideo() { + return indvideo; + } + + public void setIndvideo(Boolean indvideo) { + this.indvideo = indvideo; + } + + public Boolean getIndaire() { + return indaire; + } + + public void setIndaire(Boolean indaire) { + this.indaire = indaire; + } + + public String getNummatricula() { + return nummatricula; + } + + public void setNummatricula(String nummatricula) { + this.nummatricula = nummatricula; + } + + public String getPatron() { + return patron; + } + + public void setPatron(String patron) { + this.patron = patron; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Ciudad getCiudad() { + return ciudad; + } + + public void setCiudad(Ciudad ciudad) { + this.ciudad = ciudad; + } + + @Override public int hashCode() { int hash = 0; hash += (autobusId != null ? autobusId.hashCode() : 0); return hash; } - @Override + public MarcaAutobus getMarcaAutobus() { + return marcaAutobus; + } + + public void setMarcaAutobus(MarcaAutobus marcaAutobus) { + this.marcaAutobus = marcaAutobus; + } + + public List getAutobusDocList() { + return autobusDocList; + } + + public void setAutobusDocList(List autobusDocList) { + this.autobusDocList = autobusDocList; + } + + public void addDoc(AutobusDoc doc){ + this.autobusDocList.add(doc); + } + + public void removeDoc(AutobusDoc doc){ + this.autobusDocList.remove(doc); + } + + @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 Autobus)) { diff --git a/src/com/rjconsultores/ventaboletos/entidad/AutobusDoc.java b/src/com/rjconsultores/ventaboletos/entidad/AutobusDoc.java new file mode 100644 index 000000000..33b99d0e6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AutobusDoc.java @@ -0,0 +1,99 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "AUTOBUS_DOC_SEQ", sequenceName = "AUTOBUS_DOC_SEQ", allocationSize = 1) +@Table(name = "AUTOBUS_DOC") +public class AutobusDoc { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "AUTOBUSDOC_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "AUTOBUS_DOC_SEQ") + private Integer autobusDocId; + @JoinColumn(name = "AUTOBUS_ID", referencedColumnName = "AUTOBUS_ID") + @ManyToOne + private Autobus autobus; + @JoinColumn(name = "TIPODOCAUTOBUS_ID", referencedColumnName = "TIPODOCAUTOBUS_ID") + @ManyToOne + private TipoDocAutobus tipoDocAutobus; + @Column(name = "FECHACADUCIDAD") + private Date fechaCaducidad; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + public Integer getAutobusDocId() { + return autobusDocId; + } + public void setAutobusDocId(Integer autobusDocId) { + this.autobusDocId = autobusDocId; + } + public Autobus getAutobus() { + return autobus; + } + public void setAutobus(Autobus autobus) { + this.autobus = autobus; + } + public TipoDocAutobus getTipoDocAutobus() { + return tipoDocAutobus; + } + public void setTipoDocAutobus(TipoDocAutobus tipoDocAutobus) { + this.tipoDocAutobus = tipoDocAutobus; + } + public Date getFechaCaducidad() { + return fechaCaducidad; + } + public void setFechaCaducidad(Date fechaCaducidad) { + this.fechaCaducidad = fechaCaducidad; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @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 AutobusDoc)) { + return false; + } + AutobusDoc other = (AutobusDoc) object; + if ((this.autobusDocId == null && other.autobusDocId != null) || (this.autobusDocId != null && !this.autobusDocId.equals(other.autobusDocId))) { + return false; + } + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MarcaAutobus.java b/src/com/rjconsultores/ventaboletos/entidad/MarcaAutobus.java new file mode 100644 index 000000000..19e0dbb4e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MarcaAutobus.java @@ -0,0 +1,69 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "MARCA_AUTOBUS_SEQ", sequenceName = "MARCA_AUTOBUS_SEQ", allocationSize = 1) +@Table(name = "MARCA_AUTOBUS") +public class MarcaAutobus implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MARCA_AUTOBUS_SEQ") + @Column(name = "MARCAAUTOBUS_ID") + private Long marcaAutobusId; + @Column(name = "DESCMARCA") + private String descmarca; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getMarcaAutobusId() { + return marcaAutobusId; + } + public void setMarcaAutobusId(Long marcaAutobusId) { + this.marcaAutobusId = marcaAutobusId; + } + public String getDescmarca() { + return descmarca; + } + public void setDescmarca(String descmarca) { + this.descmarca = descmarca; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoDocAutobus.java b/src/com/rjconsultores/ventaboletos/entidad/TipoDocAutobus.java new file mode 100644 index 000000000..abaac449a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoDocAutobus.java @@ -0,0 +1,72 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "TIPO_DOC_AUTOBUS_SEQ", sequenceName = "TIPO_DOC_AUTOBUS_SEQ", allocationSize = 1) +@Table(name = "TIPO_DOC_AUTOBUS") +public class TipoDocAutobus { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "TIPODOCAUTOBUS_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_DOC_AUTOBUS_SEQ") + private Integer tipoDocAutobusId; + @Column(name = "DESCDOC") + private String descDoc; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + public Integer getTipoDocAutobusId() { + return tipoDocAutobusId; + } + public void setTipoDocAutobusId(Integer tipoDocAutobusId) { + this.tipoDocAutobusId = tipoDocAutobusId; + } + public String getDescDoc() { + return descDoc; + } + public void setDescDoc(String descDoc) { + this.descDoc = descDoc; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString(){ + return this.descDoc; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/AutobusDocService.java b/src/com/rjconsultores/ventaboletos/service/AutobusDocService.java new file mode 100644 index 000000000..f7e38687e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AutobusDocService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.AutobusDoc; + +public interface AutobusDocService extends GenericService { + public List obtenerPorAutobus(Autobus autobus); +} diff --git a/src/com/rjconsultores/ventaboletos/service/MarcaAutobusService.java b/src/com/rjconsultores/ventaboletos/service/MarcaAutobusService.java new file mode 100644 index 000000000..45de9ad5f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MarcaAutobusService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.MarcaAutobus; + +public interface MarcaAutobusService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoDocAutobusService.java b/src/com/rjconsultores/ventaboletos/service/TipoDocAutobusService.java new file mode 100644 index 000000000..ccd9a3819 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoDocAutobusService.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoDocAutobus; + +public interface TipoDocAutobusService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AutobusDocServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AutobusDocServiceImpl.java new file mode 100644 index 000000000..91092089b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AutobusDocServiceImpl.java @@ -0,0 +1,62 @@ +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.AutobusDocDAO; +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.AutobusDoc; +import com.rjconsultores.ventaboletos.service.AutobusDocService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("autobusDocService") +public class AutobusDocServiceImpl implements AutobusDocService { + + @Autowired + private AutobusDocDAO autobusDocDAO; + + public List obtenerTodos() { + return autobusDocDAO.obtenerTodos(); + } + + public AutobusDoc obtenerID(Integer id) { + return autobusDocDAO.obtenerID(id); + } + + public List obtenerPorAutobus(Autobus autobus){ + return autobusDocDAO.obtenerPorAutobus(autobus); + } + + @Transactional + public AutobusDoc suscribir(AutobusDoc entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return autobusDocDAO.suscribir(entidad); + } + + @Transactional + public AutobusDoc actualizacion(AutobusDoc entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return autobusDocDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(AutobusDoc entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + autobusDocDAO.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MarcaAutobusServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MarcaAutobusServiceImpl.java new file mode 100644 index 000000000..f20d26705 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MarcaAutobusServiceImpl.java @@ -0,0 +1,55 @@ +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.MarcaAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.MarcaAutobus; +import com.rjconsultores.ventaboletos.service.MarcaAutobusService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("marcaAutobusService") +public class MarcaAutobusServiceImpl implements MarcaAutobusService { + + @Autowired + private MarcaAutobusDAO marcaAutobusDAO; + + public List obtenerTodos() { + return marcaAutobusDAO.obtenerTodos(); + } + + public MarcaAutobus obtenerID(Integer id) { + return marcaAutobusDAO.obtenerID(id); + } + + @Transactional + public MarcaAutobus suscribir(MarcaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return marcaAutobusDAO.suscribir(entidad); + } + + @Transactional + public MarcaAutobus actualizacion(MarcaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return marcaAutobusDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MarcaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + marcaAutobusDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoDocAutobusServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoDocAutobusServiceImpl.java new file mode 100644 index 000000000..0cc3136a1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoDocAutobusServiceImpl.java @@ -0,0 +1,58 @@ +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.TipoDocAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.TipoDocAutobus; +import com.rjconsultores.ventaboletos.service.TipoDocAutobusService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tipoDocAutobusService") +public class TipoDocAutobusServiceImpl implements TipoDocAutobusService { + + @Autowired + private TipoDocAutobusDAO tipoDocAutobusDAO; + + @Override + public List obtenerTodos() { + return tipoDocAutobusDAO.obtenerTodos(); + } + + @Override + public TipoDocAutobus obtenerID(Integer id) { + return tipoDocAutobusDAO.obtenerID(id); + } + + @Transactional + public TipoDocAutobus suscribir(TipoDocAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoDocAutobusDAO.suscribir(entidad); + } + + @Transactional + public TipoDocAutobus actualizacion(TipoDocAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoDocAutobusDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoDocAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoDocAutobusDAO.actualizacion(entidad); + } + +}