public static List<ServidorRota> listar() throws VoxPersistenceException { try { logger.entering(new Object[0]); List servidorRota = getDAO().listar(); logger.exiting(new Object[0]); return servidorRota; } catch (JPAUtilityException e) { logger.exception(e.getMessage(), e); throw e; } catch (VoxPersistenceException e) { logger.exception(e.getMessage(), e); throw e; } }
public static ServidorRota consulta(Integer pk) throws VoxPersistenceException { try { logger.entering(new Object[0]); ServidorRota servidorRota = (ServidorRota) getDAO().get(pk); logger.exiting(new Object[0]); return servidorRota; } catch (JPAUtilityException e) { logger.exception(e.getMessage(), e); throw e; } catch (VoxPersistenceException e) { logger.exception(e.getMessage(), e); throw e; } }
private static boolean servidorExiste(Integer id, String host) throws VoxPersistenceException { try { logger.entering(new Object[0]); Map map = new HashMap(); if (id != null) { map.put("id", id); } map.put("host", host); List servidoresRotas = getDAO().consultar(map); if (servidoresRotas.isEmpty()) { logger.exiting(new Object[0]); return false; } if (id != null) { if (id.equals(((ServidorRota) servidoresRotas.get(0)).getId())) { logger.exiting(new Object[0]); return false; } } else { logger.exiting(new Object[0]); return true; } logger.exiting(new Object[0]); return false; } catch (JPAUtilityException e) { logger.exception(e.getMessage(), e); throw e; } catch (VoxPersistenceException e) { logger.exception(e.getMessage(), e); throw e; } }