예제 #1
0
 @Override
 public void eliminarAlerta(long idAlerta, long idAV) throws NoExisteElAV {
   String tenant = getTenant(idAV);
   if (tenant != null) {
     avDAOTenant.open(tenant);
     Alerta alerta = avDAOTenant.buscarAlerta(idAlerta);
     avDAOTenant.eliminarAlerta(alerta);
     avDAOTenant.close(tenant);
   } else {
     throw new exceptions.NoExisteElAV();
   }
 }
예제 #2
0
  @Override
  public void marcarNotificacionComoLeida(long idNoti, long idAV) throws Exception {
    String tenant = getTenant(idAV);
    if (tenant != null) {
      avDAOTenant.open(tenant);
      Notificacion noti = avDAOTenant.buscarNotificacion(idNoti, tenant);
      noti.setLeido(true);
      avDAOTenant.actualizarNotificacion(noti, tenant);
      avDAOTenant.close(tenant);

    } else {
      throw new Exception("No existe un AV con id: " + idAV);
    }
  }
예제 #3
0
 @Override
 public void eliminarNotificacion(long idAV, long idNoti) throws Exception {
   if (idAV > 0) {
     String tenant = getTenant(idAV);
     if (tenant != null) {
       avDAOTenant.open(tenant);
       avDAOTenant.eliminarNotificacion(idNoti, tenant);
       avDAOTenant.close(tenant);
     } else {
       throw new Exception("No existe un AV con id: " + idAV);
     }
   } else {
     throw new Exception("Valor de idAV invalido: " + idAV);
   }
 }
예제 #4
0
 @Override
 public List<DataNotificacion> listaNotificacionesNoLeidas(long idAV) throws NoExisteElAV {
   String tenant = getTenant(idAV);
   if (tenant != null) {
     avDAOTenant.open(tenant);
     List<Notificacion> notis = avDAOTenant.buscarNotificacionesNoLeidas();
     List<DataNotificacion> dns = new ArrayList<>();
     for (Notificacion n : notis) {
       dns.add(n.getDataNotificacion());
     }
     avDAOTenant.close(tenant);
     return dns;
   } else {
     throw new exceptions.NoExisteElAV();
   }
 }
예제 #5
0
 @Override
 public void crearNotificacion(String texto, long idAV) throws Exception {
   if (idAV > 0) {
     String tenant = getTenant(idAV);
     if (tenant != null) {
       avDAOTenant.open(tenant);
       Notificacion noti = new Notificacion(texto);
       avDAOTenant.persistirNotificacion(noti, tenant);
       avDAOTenant.close(tenant);
     } else {
       throw new Exception("No existe un AV con id: " + idAV);
     }
   } else {
     throw new Exception("Valor de idAV invalido: " + idAV);
   }
 }
예제 #6
0
 @Override
 public void modificarNotificacion(long idAV, long idNoti, String texto, boolean leido)
     throws Exception {
   if (idAV > 0) {
     String tenant = getTenant(idAV);
     if (tenant != null) {
       avDAOTenant.open(tenant);
       Notificacion noti = avDAOTenant.buscarNotificacion(idNoti, tenant);
       noti.setTexto(texto);
       noti.setLeido(leido);
       avDAOTenant.actualizarNotificacion(noti, tenant);
       avDAOTenant.close(tenant);
     } else {
       throw new Exception("No existe un AV con id: " + idAV);
     }
   } else {
     throw new Exception("Valor de idAV invalido: " + idAV);
   }
 }
예제 #7
0
  @Override
  public List<DataAlerta> listaDeAlertas(long idAV) throws NoExisteElAV {
    List<DataAlerta> da = new ArrayList<>();
    String tenant = getTenant(idAV);
    if (tenant != null) {
      avDAOTenant.open(tenant);
      List<Alerta> alertas = avDAOTenant.getAllAlerta();
      da = new ArrayList<>();

      for (Alerta a : alertas) {
        da.add(a.getDataAlerta());
      }

      avDAOTenant.close(tenant);

    } else {
      throw new exceptions.NoExisteElAV();
    }
    return da;
  }
예제 #8
0
  @Override
  public void crearAlerta(String producto, String condicion, long idAV) throws NoExisteElAV {
    String tenant = getTenant(idAV);
    if (tenant != null) {
      Condicion cond = util.Serializador.convertirCondicionAString(condicion);

      invDAOTenant.open(tenant);
      Producto prod = invDAOTenant.buscarProducto(producto, tenant);

      if (prod != null) {
        Alerta alerta = new Alerta(cond, prod);
        avDAOTenant.open(tenant);
        avDAOTenant.persistirAlerta(alerta);
        avDAOTenant.close(tenant);
      }

      invDAOTenant.close(tenant);
    } else {
      throw new exceptions.NoExisteElAV();
    }
  }
예제 #9
0
  @Override
  public List<DataNotificacion> getNotificaciones(long idAV) throws Exception {
    if (idAV > 0) {
      String tenant = getTenant(idAV);
      if (tenant != null) {
        avDAOTenant.open(tenant);
        List<Object> notis = avDAOTenant.getAllNotificaciones(tenant);
        List<DataNotificacion> datas = new ArrayList<>();

        for (Object o : notis) {
          Notificacion n = (Notificacion) o;
          datas.add(n.getDataNotificacion());
        }
        avDAOTenant.close(tenant);
        return datas;
      } else {
        throw new Exception("No existe un AV con id: " + idAV);
      }
    } else {
      throw new Exception("Valor de idAV invalido: " + idAV);
    }
  }