Package com.lbslocal.cc.objects.v4.addressFinder

Examples of com.lbslocal.cc.objects.v4.addressFinder.CityLocation


        catch (Exception ex)
        {
            throw (new Exception("Falha ao detectar cruzamento."));
        }
       
        return new IntersectionInfo(listIL.toArray(new IntersectionLocation[0]));
  }
View Full Code Here


        City city = (City) cr.getObjectFromXML(ph.XMLFile, "city", City.class, null);

        String street1 =cr.getFieldFromXML(ph.XMLFile, "street1");
        String street2 =cr.getFieldFromXML(ph.XMLFile, "street2");
        IntersectionInfo ii = null;
       
        try {
          ii = cAf.getIntersection(city, street1, street2, id_licenca);
        } catch (Exception e) {
          e.printStackTrace();
        }

        ObjectsHelper[] dependencyObjects = new ObjectsHelper[2];

        dependencyObjects[0] = cr.new ObjectsHelper();
        dependencyObjects[0].object = new IntersectionInfo();
        dependencyObjects[0].alias = "IntersectionInfo";

        dependencyObjects[1] = cr.new ObjectsHelper();
        dependencyObjects[1].object = new IntersectionLocation();
        dependencyObjects[1].alias = "IntersectionLocation";
View Full Code Here

  }

  public IntersectionInfo getIntersection(City city, String street1, String street2, int id_licenca) throws Exception {
    iniDate = System.currentTimeMillis();

    IntersectionInfo ii = new IntersectionInfo();

    try {
      ii = ca.getIntersection(city, street1, street2);
      Functions.gravarLogUnique(id_licenca, CommonAddress._getIntersection, 0, iniDate, 0);
    } catch (Exception e) {
View Full Code Here

              point.setX(Double.parseDouble(xll.split(",")[1]));
            }
          }
          address.setCity(city);
         
          listIL.add(new IntersectionLocation(address, point));
         
        }
      }
        }
        catch (Exception ex)
View Full Code Here

        dependencyObjects[0] = cr.new ObjectsHelper();
        dependencyObjects[0].object = new IntersectionInfo();
        dependencyObjects[0].alias = "IntersectionInfo";

        dependencyObjects[1] = cr.new ObjectsHelper();
        dependencyObjects[1].object = new IntersectionLocation();
        dependencyObjects[1].alias = "IntersectionLocation";

        String valor = "<?xml version='1.0' encoding='UTF-8'?>\n" + cr.getXMLFromObject(ii, dependencyObjects);

        response.getWriter().write(new String(valor.getBytes("UTF-8"), "ISO-8859-1"));
View Full Code Here

      throw new Exception("Não foi possível encontrar dados para estas coordenadas: X=" + point.getX() + ", y=" + point.getY());
    }
  }

  public POIInfo findPOI(String name, City city, ResultRange resultRange, int idLicenca) throws Exception {
    POIInfo poii = new POIInfo();
    Pagination pg;

    int iCount = 0;

    String country;

    if (!Functions.IsNullOrEmpty(city.getCountry()))
      country = city.getCountry();
    else
      country = "BRASIL";

    if (!country.toUpperCase().equals("BRASIL"))
      return poii;

    boolean hasState = (city.getState() != null && city.getState().compareTo("") != 0);

    boolean hasCity = (city.getName() != null && city.getName().compareTo("") != 0);

    if (!hasCity || !hasState) {
      throw (new Exception("Cidade e estado devem ser informados."));
    }

    try {
      Connection con = dataBase.getConnection(Functions.getDataBase(idLicenca, country).getSource());

      CallableStatement cst = con.prepareCall("{call CP_WS_TB_POI_BRASIL(?,?,?)}");
      cst.setString(1, name);
      cst.setString(2, city.getName());
      cst.setString(3, city.getState());

      cst.execute();

      ResultSet rs1 = cst.getResultSet();

      CachedRowSetImpl crs = new CachedRowSetImpl();
      crs.populate(rs1);

      int TotalRecords = crs.size();

      if (TotalRecords > 0) {
        pg = Functions.definePage(TotalRecords, resultRange.getRecordsPerPage(), resultRange.getPageIndex());

        POILocation[] poil;

        if (pg.getRecordsInitial() <= TotalRecords) {
          poil = new POILocation[(pg.getRecordsFinal() - pg.getRecordsInitial()) + 1];

          for (int intI = pg.getRecordsInitial(); intI <= pg.getRecordsFinal(); intI++) {
            if (rs1.absolute(intI)) {
              poil[iCount] = new POILocation();
              poil[iCount].setName(rs1.getString("NOME"));
              poil[iCount].setDistrict(rs1.getString("BAIRRO"));
              poil[iCount].setCarAccess(rs1.getBoolean("ROTAPE"));

              poil[iCount].setPoint(new Point());
              poil[iCount].getPoint().setX(Double.parseDouble(rs1.getString("X")));
              poil[iCount].getPoint().setY(Double.parseDouble(rs1.getString("Y")));

              poil[iCount].setCity(new City());
              poil[iCount].setCity(city);
              poil[iCount].setDataSource(city.getState().toUpperCase());

              iCount++;
            }
          }
        } else {
          poil = new POILocation[0];
        }

        poii.setRecordCount((int) pg.getRecordCount());
        poii.setPageCount(pg.getPageCount());
        poii.setPoiLocations(poil);
      } else {
        poii.setPoiLocations(new POILocation[0]);
      }

      con.close();
      rs1.close();
      crs.close();
View Full Code Here

        response.getWriter().write("<?xml version='1.0' encoding='UTF-8'?>\n" + cr.getXMLFromObject(ci, dependencyObjects) + "");
      }

      if (ph.fields[0].equals("findPOI")) {
        POIInfo pi = new POIInfo();

        String name = cr.getFieldFromXML(ph.XMLFile, "name");
        City city = (City) cr.getObjectFromXML(ph.XMLFile, "city", City.class, null);
        ResultRange resultRange = (ResultRange) cr.getObjectFromXML(ph.XMLFile, "resultRange", ResultRange.class, null);

        try {
          pi = cAf.findPOI(name, city, resultRange, id_licenca);
        } catch (Exception e) {
          e.printStackTrace();
        }

        ObjectsHelper[] dependencyObjects = new ObjectsHelper[2];

        dependencyObjects[0] = cr.new ObjectsHelper();
        dependencyObjects[0].object = new POILocation();
        dependencyObjects[0].alias = "POILocation";

        dependencyObjects[1] = cr.new ObjectsHelper();
        dependencyObjects[1].object = new POIInfo();
        dependencyObjects[1].alias = "POIInfo";

        response.getWriter().write("<?xml version='1.0' encoding='UTF-8'?>\n" + cr.getXMLFromObject(pi, dependencyObjects) + "");
      }
      if (ph.fields[0].equals("getAddress")) {
View Full Code Here

  }

  public POIInfo findPOI(String name, City city, ResultRange resultRange, int idLicenca) throws Exception {
    iniDate = System.currentTimeMillis();

    POIInfo poii = new POIInfo();

    try {
      poii = ca.findPOI(name, city, resultRange, idLicenca);
      Functions.gravarLogUnique(idLicenca, CommonAddress._findPOI, 0, iniDate, 0);
    } catch (Exception e) {
View Full Code Here

      CityLocationInfo cli = addressFinder.findCity((City) o[0], (AddressOptions) o[1], tk.getId());
      respostaWs = Common.SerializeJSObject(cli);
      break;
    case findPOI:
      o = Common.getArrayByJSon(proxy.getParameters("tjss"), new Class[] { String.class, City.class, ResultRange.class });
      POIInfo pi = addressFinder.findPOI((String) o[0], (City) o[1], (ResultRange) o[2], tk.getId());
      respostaWs = Common.SerializeJSObject(pi);
      break;
    case getAddress:
      o = Common.getArrayByJSon(proxy.getParameters("tjss"), new Class[] { Point.class });
      AddressLocation al = addressFinder.getAddress((Point) o[0], 100, tk.getId());
View Full Code Here

        if (pg.getRecordsInitial() <= TotalRecords) {
          poil = new POILocation[(pg.getRecordsFinal() - pg.getRecordsInitial()) + 1];

          for (int intI = pg.getRecordsInitial(); intI <= pg.getRecordsFinal(); intI++) {
            if (rs1.absolute(intI)) {
              poil[iCount] = new POILocation();
              poil[iCount].setName(rs1.getString("NOME"));
              poil[iCount].setDistrict(rs1.getString("BAIRRO"));
              poil[iCount].setCarAccess(rs1.getBoolean("ROTAPE"));

              poil[iCount].setPoint(new Point());
View Full Code Here

TOP

Related Classes of com.lbslocal.cc.objects.v4.addressFinder.CityLocation

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.