fixes bug#13720
dev:alberto qua:junia git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@90331 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
2c9a38fa29
commit
9ab6fc0c8f
|
@ -6,6 +6,7 @@ package com.rjconsultores.ventaboletos.dao.hibernate;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SessionFactory;
|
||||
|
@ -29,11 +30,23 @@ import com.rjconsultores.ventaboletos.entidad.Via;
|
|||
public class TramoServicioHibernateDAO extends GenericHibernateDAO<TramoServicio, Integer>
|
||||
implements TramoServicioDAO {
|
||||
|
||||
private static Logger log = Logger.getLogger(TramoServicioHibernateDAO.class);
|
||||
|
||||
@Autowired
|
||||
public TramoServicioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TramoServicio suscribir(TramoServicio entity) {
|
||||
|
||||
log.info(String.format("suscribir TramoServicio: %s " , entity.toStringComplete()));
|
||||
|
||||
return super.suscribir(entity);
|
||||
}
|
||||
|
||||
|
||||
public List<TramoServicio> buscarPorTramo(Tramo tramo) {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
|
@ -62,8 +75,25 @@ public class TramoServicioHibernateDAO extends GenericHibernateDAO<TramoServicio
|
|||
cTramo.add(Restrictions.eq("via", via));
|
||||
cTramo.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
c.add(Restrictions.eq("claseServicio", clase));
|
||||
|
||||
/**
|
||||
* FIXME: O trecho de código abaixo foi adicionado para tentar identificar um problema de duplicidade no
|
||||
* tramoServicio.
|
||||
*
|
||||
* Deve ser temporario.
|
||||
*/
|
||||
|
||||
return (TramoServicio) c.uniqueResult();
|
||||
@SuppressWarnings("unchecked")
|
||||
List<TramoServicio> list = c.list();
|
||||
if (list.size() > 1){
|
||||
|
||||
for(TramoServicio ts : list){
|
||||
log.error(String.format("Erro tramoServicio duplicado:%s", ts.toStringComplete() ));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return list.isEmpty()?null:list.get(0);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -330,8 +330,15 @@ public class Tramo implements Serializable {
|
|||
public void setIndKMEntradaSaidaOrigem(Boolean indKMEntradaSaidaOrigem) {
|
||||
this.indKMEntradaSaidaOrigem = indKMEntradaSaidaOrigem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getDesctramo().concat(" - ").concat(this.getVia().getNombvia());
|
||||
}
|
||||
|
||||
public String toStringComplete() {
|
||||
return "Tramo [tramoId=" + tramoId + ", desctramo=" + desctramo + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + ", via=" + via + ", origem=" + origem + ", destino=" + destino + ", rutaSecuenciaList=" + rutaSecuenciaList + ", rutaCombinacionList=" + rutaCombinacionList + ", lsTramoTiempo=" + lsTramoTiempo + ", tramoServicioList=" + tramoServicioList + ", kmPagoConductor=" + kmPagoConductor + ", kmReal=" + kmReal + ", tramoKms=" + tramoKms + ", lsOrgaoTramo=" + lsOrgaoTramo + ", kmEntradaSaida=" + kmEntradaSaida + ", kmEntradaSaidaDestino=" + kmEntradaSaidaDestino + ", indKMEntradaSaidaOrigem=" + indKMEntradaSaidaOrigem + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -142,8 +142,14 @@ public class TramoServicio implements Serializable {
|
|||
return hash;
|
||||
}
|
||||
|
||||
|
||||
public String toStringComplete() {
|
||||
return "TramoServicio [tramoservicioId=" + tramoservicioId + ", tiemporecorrido=" + tiemporecorrido + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + ", tramo=[" + (tramo == null?"-":tramo.toStringComplete()) + "], claseServicio=" + claseServicio + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "teste.TramoServicio[tramoservicioId=" + tramoservicioId + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue