AdmMono/src/com/rjconsultores/ventaboletos/service/impl/MensajeServiceImpl.java

48 lines
1.3 KiB
Java

package com.rjconsultores.ventaboletos.service.impl;
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.MensajeDAO;
import com.rjconsultores.ventaboletos.entidad.Mensaje;
import com.rjconsultores.ventaboletos.exception.BusinessException;
import com.rjconsultores.ventaboletos.service.MensajeService;
@Service("mensajeService")
public class MensajeServiceImpl implements MensajeService {
@Autowired
private MensajeDAO mensajeDAO;
@Override
public List<Mensaje> obtenerTodos() {
return mensajeDAO.obtenerTodos();
}
@Override
public Mensaje obtenerID(Integer id) {
return mensajeDAO.obtenerID(id);
}
@Override
@Transactional(rollbackFor = BusinessException.class)
public void borrar(Mensaje entidad) {
entidad.setActivo(Boolean.FALSE);
mensajeDAO.actualizacion(entidad);
}
@Override
@Transactional(rollbackFor = BusinessException.class)
public Mensaje suscribirActualizar(Mensaje entidad) throws BusinessException {
if (entidad.getMensajeId() == null) {
return mensajeDAO.suscribir(entidad);
} else {
return mensajeDAO.actualizacion(entidad);
}
}
}