gleimar 2014-02-13 13:55:42 +00:00
parent 354f4e63a6
commit 86daea938a
1 changed files with 20 additions and 10 deletions

View File

@ -11,6 +11,8 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.zkoss.util.resource.Labels;
import org.zkoss.zul.Messagebox;
import com.rjconsultores.ventaboletos.dao.ParadaDAO; import com.rjconsultores.ventaboletos.dao.ParadaDAO;
import com.rjconsultores.ventaboletos.dao.TramoDAO; import com.rjconsultores.ventaboletos.dao.TramoDAO;
@ -30,6 +32,8 @@ import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@Service("paradaService") @Service("paradaService")
public class ParadaServiceImpl implements ParadaService { public class ParadaServiceImpl implements ParadaService {
private static final int MAX_ANTT = 99999;
@Autowired @Autowired
private ParadaDAO paradaDAO; private ParadaDAO paradaDAO;
@Autowired @Autowired
@ -42,6 +46,13 @@ public class ParadaServiceImpl implements ParadaService {
@Transactional @Transactional
public Parada suscribirActualizar(Parada entidad) throws BusinessException { public Parada suscribirActualizar(Parada entidad) throws BusinessException {
Integer antt = entidad.getCodantt() != null ? entidad.getCodantt() : null;
if (antt != null) {
if (antt.equals(MAX_ANTT)) {
throw new BusinessException("editarCatalogoDeParadaController.MSG.maxAntt");
}
}
List<Parada> lsParadas = paradaDAO.buscar(entidad.getCodantt()); List<Parada> lsParadas = paradaDAO.buscar(entidad.getCodantt());
if (!lsParadas.isEmpty()) { if (!lsParadas.isEmpty()) {
@ -66,7 +77,6 @@ public class ParadaServiceImpl implements ParadaService {
} }
} }
lsParadas = buscarCVE(entidad.getCveparada()); lsParadas = buscarCVE(entidad.getCveparada());
if (!lsParadas.isEmpty()) { if (!lsParadas.isEmpty()) {