Red Hat Application Migration Toolkit
package mx.com.bcm.banamex.ae.negocio.captura.bo.impl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import mx.com.bcm.banamex.ae.negocio.captura.bo.InicioFinTurnoBOBeanLocal;
import mx.com.bcm.banamex.ae.persistencia.assambler.CajaAssambler;
import mx.com.bcm.banamex.ae.persistencia.assambler.FechaContableAssambler;
import mx.com.bcm.banamex.ae.persistencia.assambler.HistTurnoEnOperacionAssambler;
import mx.com.bcm.banamex.ae.persistencia.assambler.TurnoAssambler;
import mx.com.bcm.banamex.ae.persistencia.dao.CatalogoCajaDAOBeanLocal;
import mx.com.bcm.banamex.ae.persistencia.dao.CatalogoFechasContablesDAOBeanLocal;
import mx.com.bcm.banamex.ae.persistencia.dao.CatalogoSubBovedaDAOBeanLocal;
import mx.com.bcm.banamex.ae.persistencia.dao.CatalogoTurnoDAOBeanLocal;
import mx.com.bcm.banamex.ae.persistencia.dao.HistTurnoEnOperacionDAOBeanLocal;
import mx.com.bcm.banamex.ae.persistencia.exception.EfectivoAplicacionBOException;
import mx.com.bcm.banamex.ae.persistencia.exception.EfectivoAplicacionDAOException;
import mx.com.bcm.banamex.ae.persistencia.helper.DateFormateHelper;
import mx.com.bcm.banamex.ae.persistencia.modelo.Caja;
import mx.com.bcm.banamex.ae.persistencia.modelo.FechaContable;
import mx.com.bcm.banamex.ae.persistencia.modelo.HistTurnoEnOperacion;
import mx.com.bcm.banamex.ae.persistencia.modelo.Turno;
import mx.com.bcm.banamex.ae.persistencia.vo.CajaVO;
import mx.com.bcm.banamex.ae.persistencia.vo.FechaContableVO;
import mx.com.bcm.banamex.ae.persistencia.vo.HistTurnoEnOperacionVO;
import mx.com.bcm.banamex.ae.persistencia.vo.TurnoVO;
@Stateless
public class InicioFinTurnoBOImplBeanLocal implements InicioFinTurnoBOBeanLocal {
@EJB
private CatalogoTurnoDAOBeanLocal turnoDAO;
@EJB
private HistTurnoEnOperacionDAOBeanLocal histTurnoDAO;
@EJB
private CatalogoFechasContablesDAOBeanLocal fechaContable;
@EJB
private CatalogoTurnoDAOBeanLocal turno;
@EJB
private CatalogoSubBovedaDAOBeanLocal subBovedaDAO;
@EJB
private CatalogoCajaDAOBeanLocal cajaDAO;
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
public List obtenerTurnorPorSubBoveda(int subBoveda) {
new ArrayList();
ArrayList listaTurnoVO = new ArrayList();
List listaTurno = this.turnoDAO.buscarTurnoPorSubBoveda(subBoveda);
Iterator var4 = listaTurno.iterator();
while(var4.hasNext()) {
Turno elemento = (Turno)var4.next();
TurnoVO turnoVO = TurnoAssambler.getTurnoIniFinTurnoVO(elemento);
listaTurnoVO.add(turnoVO);
}
return listaTurnoVO;
}
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
public List obtenerHistTurnoEnOperacion(TurnoVO turnoVO) throws EfectivoAplicacionBOException {
new ArrayList();
ArrayList listaHistTurnoVO = new ArrayList();
List listaHistTurno = this.histTurnoDAO.consultarHistTurnoEnOperacion(turnoVO.getTurnoId());
Iterator var4 = listaHistTurno.iterator();
while(var4.hasNext()) {
HistTurnoEnOperacion elemento = (HistTurnoEnOperacion)var4.next();
HistTurnoEnOperacionVO histTurnoVO = HistTurnoEnOperacionAssambler.getHistTurnoEnOperacionVO(elemento);
histTurnoVO.setDescripcionTurno(turnoVO.getTurDescripcion());
listaHistTurnoVO.add(histTurnoVO);
}
return listaHistTurnoVO;
}
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
public List obtnerHistTurno(List listaTurnoVO) throws EfectivoAplicacionBOException {
new ArrayList();
ArrayList listHistTurnoAux2VO = new ArrayList();
Iterator var4 = listaTurnoVO.iterator();
while(var4.hasNext()) {
TurnoVO elemento = (TurnoVO)var4.next();
List listHistTurnoAuxVO = this.obtenerHistTurnoEnOperacion(elemento);
Iterator var6 = listHistTurnoAuxVO.iterator();
while(var6.hasNext()) {
HistTurnoEnOperacionVO elemento2 = (HistTurnoEnOperacionVO)var6.next();
listHistTurnoAux2VO.add(elemento2);
}
}
return listHistTurnoAux2VO;
}
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
public FechaContableVO obtenerFechaContableActual() throws EfectivoAplicacionBOException, EfectivoAplicacionDAOException {
new FechaContable();
new FechaContableVO();
FechaContable fechaContable = this.fechaContable.obtenerFechaContableActiva();
FechaContableVO fechaContableVO = FechaContableAssambler.getFechaContableVO(fechaContable);
return fechaContableVO;
}
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void addHistTurnoEnOperacion(HistTurnoEnOperacionVO histTurnoEnOperacionVO) throws EfectivoAplicacionBOException {
HistTurnoEnOperacion histTurnoEnOperacion = HistTurnoEnOperacionAssambler.getHistTurnoEnOperacion(histTurnoEnOperacionVO);
try {
histTurnoEnOperacion.setFeccontIdn(this.fechaContable.obtenerFechaContableActiva());
} catch (EfectivoAplicacionDAOException var4) {
var4.printStackTrace();
}
histTurnoEnOperacion.setTurno((Turno)this.turno.findById(histTurnoEnOperacionVO.getTurnoId()));
this.histTurnoDAO.persist(histTurnoEnOperacion);
}
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void editHistTurnoEnOperacion(HistTurnoEnOperacionVO histTurnoEnOperacionVO) throws EfectivoAplicacionBOException {
HistTurnoEnOperacion histTurnoEnOperacion = HistTurnoEnOperacionAssambler.getHistTurnoEnOperacion(histTurnoEnOperacionVO);
histTurnoEnOperacion.setFeccontIdn((FechaContable)this.fechaContable.findById(DateFormateHelper.getFechaDate(histTurnoEnOperacionVO.getFeccontIdn())));
histTurnoEnOperacion.setTurno((Turno)this.turno.findById(histTurnoEnOperacionVO.getTurnoId()));
this.histTurnoDAO.merge(histTurnoEnOperacion);
}
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void editTurno(TurnoVO turnoVO, Short subBovedaId) throws EfectivoAplicacionBOException, EfectivoAplicacionDAOException {
Turno turno = TurnoAssambler.getTurno(turnoVO);
turno.setSubBoveda(this.subBovedaDAO.obtenerSubBoveda(subBovedaId.shortValue()));
this.turnoDAO.merge(turno);
}
public List getCajasPorTurnoVO(String turnoId) throws EfectivoAplicacionBOException, EfectivoAplicacionDAOException {
ArrayList listaCajasVO = new ArrayList();
new ArrayList();
List listaCajas = this.cajaDAO.buscarCajasPorTurno(turnoId);
Iterator var4 = listaCajas.iterator();
while(var4.hasNext()) {
Caja elemento = (Caja)var4.next();
CajaVO cajaVO = CajaAssambler.getCajaVOPorTurno(elemento);
listaCajasVO.add(cajaVO);
}
return listaCajasVO;
}
}