Examples of Recurso


Examples of es.emergya.bbdd.bean.Recurso

        try {
            HistoricoGPS historicoGPS = new HistoricoGPS();

            historicoGPS.setMarcaTemporal(entrada.getMarcaTemporal());

            final Recurso recurso = RecursoConsultas.getbyDispositivo(entrada.getOrigen());
            if (recurso == null) {
                throw new MessageProcessingException("No encuentro el recurso "
                        + entrada.getOrigen());
            }

            if (recurso.getHabilitado()) {
                historicoGPS.setTipoRecurso(recurso.getTipo());
                if (recurso.getFlotas() == null) {
                    throw new MessageProcessingException("El recurso "
                            + recurso + " no tiene asignada ninguna flota.");
                }
                historicoGPS.setSubflota(recurso.getFlotas().getNombre());
                historicoGPS.setRecurso(recurso.getIdentificador());

                Double y = new Double(campos[2].substring(0, campos[2].indexOf(',')));
                Double x = new Double(campos[3].substring(0, campos[3].indexOf(',')));

                // Las posiciones 0.0 se descartan.
                // Deshabilitado por instrucciones de MCGarcia.
//                if (x.equals(0.0d) || y.equals(0.0d)) {
//                    if (log.isTraceEnabled()) {
//                        log.trace("Posicón 0.0N,0.0W recibida de " + recurso.getDispositivo() + "recibida y descartada.");
//                    }
//                    return;
//                }

                if (campos[2].endsWith("S")) {
                    y = -y;
                }
                if (campos[3].endsWith("W")) {
                    x = -x;
                }

                final GeometryFactory factory = new GeometryFactory();
                final com.vividsolutions.jts.geom.Geometry geom = factory.createPoint(new Coordinate(x, y));
                geom.setSRID(4326);
                //
                // final String sourceSRID = "EPSG:4326";
                // final String targetSRID = "EPSG:3395";
                //
                // Geometry geom = transform(geom, sourceSRID, targetSRID);

                historicoGPS.setGeom(geom);
                historicoGPS.setPosX(geom.getCentroid().getX());
                historicoGPS.setPosY(geom.getCentroid().getY());

                HistoricoGPSAdmin.saveOrUpdate(historicoGPS);
                recurso.setHistoricoGps(historicoGPS);
                RecursoAdmin.saveOrUpdate(recurso);
                if (log.isDebugEnabled()) {
                    log.debug("Guardada posicion" + historicoGPS);
                }
            } else {
View Full Code Here

Examples of es.emergya.bbdd.bean.Recurso

         * BODY = PATRULLA
         */
        String confirmacion = LogicConstants.get("SDS_NO",
                "Error al asignar el recurso.");
        TipoMensaje tmensaje = null;
        Recurso recurso = null;
        MessageProcessingException exception = null;
        try {
            tmensaje = TipoMensajeConsultas.getTipoByCode(SDS_CODE);
            recurso = RecursoConsultas.getbyDispositivo(entrada.getOrigen());
            if (recurso == null) {
                throw new MessageProcessingException("No encuentro el recurso "
                        + entrada.getOrigen());
            }

            if (!recurso.getHabilitado()) {
                throw new MessageProcessingException(
                        "El recurso está deshabilitado ('"
                        + recurso.getDispositivo() + "')");
            }
            recurso.setMalAsignado(true);

            Patrulla p = PatrullaConsultas.find(campos[2]);
            if (p == null) {
                throw new MessageProcessingException(
                        "No encuentro la patrulla " + campos[2]);
            }

            recurso.setPatrullas(p);
            recurso.setMalAsignado(false);
            confirmacion = LogicConstants.get("SDS_SI", "Recurso asignado.");

        } catch (Throwable t) {
            log.error(t, t);
            exception = new MessageProcessingException(
View Full Code Here

Examples of es.emergya.bbdd.bean.Recurso

      "LONGITUD_ISSI", 8);
  private final Recurso filter;

  public RecursoHome() {
    super(Recurso.class);
    filter = new Recurso();
    filter.setHabilitado(true);
  }
View Full Code Here

Examples of es.emergya.bbdd.bean.Recurso

  }

  @Transactional(readOnly = true, rollbackFor = Throwable.class, propagation = Propagation.REQUIRES_NEW)
  public Recurso get2(Long id) {
    try {
      Recurso uniqueResult = this.get(id);
      if (uniqueResult != null) {
        this.getSession().refresh(uniqueResult);
        if (uniqueResult.getPatrullas() != null) {
          uniqueResult.getPatrullas().getId();
        }
        if (uniqueResult.getFlotas() != null) {
          uniqueResult.getFlotas().getId();
        }
        if (uniqueResult.getEstadoEurocop() != null) {
          uniqueResult.getEstadoEurocop().getId();
        }
        if (uniqueResult.getIncidencias() != null) {
          uniqueResult.getIncidencias().getId();
        }
      }
      return uniqueResult;
    } catch (Throwable t) {
      log.error("Estamos buscando un objeto que no existe", t);
View Full Code Here

Examples of es.emergya.bbdd.bean.Recurso

                CustomMarker m = (CustomMarker) marker;
                log.trace("Hemos pinchado en " + marker);

                switch (m.getType()) {
                case RESOURCE:
                  Recurso r = (Recurso) m.getObject();
                  log.trace("Es un recurso: " + r);
                  if (r != null) {
                    menuObjective = r;
                    if (r.getPatrullas() != null) {
                      titulo.setText(i18n
                          .getString(
                              Locale.ROOT,
                              "map.menu.titulo.recursoPatrulla",
                              r.getIdentificador(),
                              r.getPatrullas()));
                    } else {
                      titulo.setText(r.getIdentificador());
                    }
                    gps.setEnabled(true);
                    summary.setEnabled(true);
                  }
                  break;
View Full Code Here

Examples of es.emergya.bbdd.bean.Recurso

  @SuppressWarnings("unchecked")
  @Transactional(readOnly = true, rollbackFor = Throwable.class, propagation = Propagation.REQUIRES_NEW)
  public Recurso[] getNotAsigned(Flota p) {
    Recurso[] res = new Recurso[0];
    if (p == null || p.getId() == null) {
      return getByFilter(new Recurso()).toArray(new Recurso[0]);
    }
    try {
      log.debug("getNotAsigned(" + p.getId() + ")");
      Session currentSession = getSession();
      currentSession.clear();
View Full Code Here

Examples of es.emergya.bbdd.bean.Recurso

    }
    try {
      Session currentSession = getSession();
      currentSession.clear();

      Recurso entity = null;

      if (p.getId() == null
          || (p.getId() != null && this.get(p.getId()) == null)) {
        entity = p;
      } else {
        entity = (Recurso) currentSession.merge(p);
        if (p.getEstadoEurocop() != null
            && p.getEstadoEurocop().getId() != null) {
          entity.setEstadoEurocop((EstadoRecurso) currentSession.get(
              EstadoRecurso.class, p.getEstadoEurocop().getId()));
        }
      }
      if (entity == null) {
        entity = p;
      }

      if (entity != null) {
        entity.setInfoAdicional(p.getInfoAdicional());
        entity.setNombre(p.getNombre());
      }

      Patrulla patrulla = null;
      if (p.getPatrullas() != null) {
        if (p.getPatrullas().getId() != null) {
          patrulla = (Patrulla) currentSession.load(Patrulla.class, p
              .getPatrullas().getId());
        } else {
          patrulla = p.getPatrullas();
        }
      }
      entity.setPatrullas(patrulla);

      if (entity.getEstadoEurocop() == null) {
        entity.setEstadoEurocop((EstadoRecurso) currentSession.get(
            EstadoRecurso.class, 1l));
      }

      entity.setIdentificador(entity.getNombre());
      currentSession.saveOrUpdate(entity);
    } catch (Throwable t) {
      log.error(t, t);
    }
    return true;
View Full Code Here

Examples of es.emergya.bbdd.bean.Recurso

    Session currentSession = getSession();
    try {
      currentSession.clear();
      Criteria criteria = currentSession.createCriteria(Recurso.class)
          .add(Restrictions.eq("identificador", origen));
      final Recurso uniqueResult = (Recurso) criteria.uniqueResult();
      if (uniqueResult != null) {
        if (uniqueResult.getPatrullas() != null) {
          uniqueResult.getPatrullas().getId();
        }
        if (uniqueResult.getFlotas() != null) {
          uniqueResult.getFlotas().getId();
        }
        if (uniqueResult.getEstadoEurocop() != null) {
          uniqueResult.getEstadoEurocop().getId();
        }
        if (uniqueResult.getIncidencias() != null) {
          uniqueResult.getIncidencias().getId();
        }
      }
      return uniqueResult;
    } catch (Throwable t) {
      log.error(t, t);
View Full Code Here

Examples of es.emergya.bbdd.bean.Recurso

    }
  }

  @Transactional(readOnly = true, rollbackFor = Throwable.class, propagation = Propagation.REQUIRED)
  public Recurso getbyDispositivo(Integer disp) {
    Recurso uniqueResult = null;
    try {
      Session currentSession = getSession();
      currentSession.clear();
      Criteria criteria = currentSession.createCriteria(Recurso.class)
          .add(Restrictions.eq("dispositivo", disp));
      uniqueResult = (Recurso) criteria.uniqueResult();
      if (uniqueResult != null) {
        if (uniqueResult.getPatrullas() != null) {
          uniqueResult.getPatrullas().getId();
        }
        if (uniqueResult.getFlotas() != null) {
          uniqueResult.getFlotas().getId();
        }
      }
    } catch (Throwable t) {
      log.error(t, t);
    }
View Full Code Here

Examples of es.emergya.bbdd.bean.Recurso

  }

  @Transactional(readOnly = true, rollbackFor = Throwable.class, propagation = Propagation.REQUIRED)
  public Recurso getbyDispositivoServer(Integer disp) {
    long now = System.currentTimeMillis();
    Recurso res = null;
    Session currentSession = getSession();
    SessionFactory sessionFactory = (SessionFactory) MyBeanFactory
        .getBean("sessionFactory");
    Criteria criteria = currentSession.createCriteria(Recurso.class)
        .add(Restrictions.eq("dispositivo", disp)).setCacheable(true);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.