Package es.emergya.bbdd.bean

Examples of es.emergya.bbdd.bean.HistoricoGPS


            throws MessageProcessingException {
        /*
         * BODY = LATITUD | LONGITUD
         */
        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()) {
View Full Code Here


  }

  @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = Throwable.class)
  public void processPosicionActual(Inbox entrada, Geometry geom)
      throws MessageProcessingException {
    HistoricoGPS historicoGPS = new HistoricoGPS();
    historicoGPS.setMarcaTemporal(entrada.getMarcaTemporal());

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

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

      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.saveServer(historicoGPS);
      RecursoAdmin.updateLastGpsSQL(historicoGPS, recurso.getId());
      // recurso.setHistoricoGps(historicoGPS);
      // RecursoAdmin.saveOrUpdate(recurso);
View Full Code Here

TOP

Related Classes of es.emergya.bbdd.bean.HistoricoGPS

Copyright © 2018 www.massapicom. 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.