Examples of AddressLocation


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

    }

    if (tolerance < 10)
      tolerance = 10;

    AddressLocation al = new AddressLocation();
    String response = "";

    TCPClientDecarta tcpDecarta = new TCPClientDecarta(_server, _port);
    String sendToDeCarta = "S2LN|%CUST=" + idLicenca + ":" + methodID + "%LL=" + point.getY() + "," + point.getX() + "|%RAD=m"
        + (int) (tolerance) + "%INTERPADDR%ALLATTRS%LL%DS=" + _dataSourceRevGeo + "||";
    try {
      response = tcpDecarta.Send(sendToDeCarta);
    } catch (Exception e) {
      throw e;
    }
    try {
      String[] part = response.split("%");

      for (int x = 0; x < part.length; x++) {
        if (part[x].indexOf("LL=") >= 0) {
          Point point1 = new Point();

          point1.setY(Double.parseDouble(part[x].replace("LL=", "").replace("||", "").split(",")[0].replace(",", ".")));
          point1.setX(Double.parseDouble(part[x].replace("LL=", "").replace("||", "").split(",")[1].replace(",", ".")));
          al.setPoint(point1);
        }

        if (part[x].indexOf("S2=") >= 0) {
          if (al.getAddress().getStreet().isEmpty()) {
            al.getAddress().setStreet(Functions.CamelCase(part[x].replace("S2=", "")));

            if (al.getAddress().getStreet().isEmpty())
              al.getAddress().setStreet("Sem nome");
          } else {
            if (al.getAddress().getCity().getName().isEmpty()) {
              al.getAddress().setDistrict(Functions.CamelCase(part[x].replace("S2=", "").split("\\\\")[0]));

              al.getAddress().getCity().setName(Functions.CamelCase(part[x].replace("S2=", "").split("\\\\")[1]));
              al.getAddress().getCity().setState(part[x].replace("S2=", "").split("\\\\")[3]);
            }
          }
        }

        if (part[x].indexOf("S1=") >= 0 && part[x].indexOf("\\") > 0) {
          if (!part[x].replace("S1=", "").split("\\\\")[1].isEmpty() && al.getAddress().getZip().isEmpty()) {
            al.getAddress().setZip(
                part[x].replace("S1=", "").split("\\\\")[1].substring(0, 5) + "-"
                    + part[x].replace("S1=", "").split("\\\\")[1].substring(5));
            al.setZipL(part[x].replace("S1=", "").split("\\\\")[1].substring(0, 5) + "-"
                + part[x].replace("S1=", "").split("\\\\")[1].substring(5));
            al.setZipR(part[x].replace("S1=", "").split("\\\\")[1].substring(0, 5) + "-"
                + part[x].replace("S1=", "").split("\\\\")[1].substring(5));
          } else {
            al.getAddress().setZip("");
            al.setZipL("");
            al.setZipR("");
          }

          if (al.getAddress().getCity().getCountry().isEmpty())
            al.getAddress().getCity().setCountry(Functions.convertCountry(part[x].replace("S1=", "").split("\\\\")[0].substring(0, 2)));
        }

        if (part[x].indexOf("INTERPADDR=") >= 0)
          al.getAddress().setHouseNumber(part[x].replace("INTERPADDR=", "").replace("||", "").trim());
      }

      al.setCarAccess(true);

      if (al.getAddress().getStreet().isEmpty() && count < 3) {
        count++;
        tolerance += 3000;
        al = getAddress(point, tolerance, idLicenca, methodID, count);
      }
View Full Code Here

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

          if (pg.getRecordsInitial() <= TotalRecords) {
            al = new AddressLocation[(pg.getRecordsFinal() - pg.getRecordsInitial()) + 1];
            for (int intI = pg.getRecordsInitial(); intI <= pg.getRecordsFinal(); intI++) {
              if (rs1.absolute(intI)) {
                al[iCount] = new AddressLocation();
                al[iCount].setZipL(rs1.getString("CEPL"));
                al[iCount].setZipR(rs1.getString("CEPR"));
                al[iCount].setCarAccess(rs1.getBoolean("ROTAPE"));

                // classe address
                al[iCount].getAddress().setStreet(rs1.getString("LOGRAC"));
                al[iCount].getAddress().setDistrict(rs1.getString("BAIRRO"));
                al[iCount].getAddress().getCity().setName(rs1.getString("MUNICIPIO"));
                al[iCount].getAddress().getCity().setCountry(country);
                // al[iCount].getAddress().setZone(rs1.getString("REGIAO"));

                if (!country.toLowerCase().equals("brasil"))
                  al[iCount].getAddress().getCity().setState(state);
                else
                  al[iCount].getAddress().getCity().setState(rs1.getString("TABELA").substring(0, 2).toUpperCase());

                if (!al[iCount].getZipL().equals(""))
                  al[iCount].getAddress().setZip(al[iCount].getZipL());
                if (!al[iCount].getZipR().equals(""))
                  al[iCount].getAddress().setZip(al[iCount].getZipR());

                al[iCount].getAddress().setHouseNumber(rs1.getString("MEDIA"));

                try {
                  al[iCount].setPoint(Functions.getGeocodeSQL(rs1.getInt("L_F_ADD"), rs1.getInt("L_T_ADD"), rs1.getInt("R_F_ADD"),
                      rs1.getInt("R_T_ADD"), al[iCount].getAddress().getHouseNumber(), rs1.getString("COORDS")));
                } catch (Exception ex) {
                  al[iCount].getPoint().setX(0.0);
                  al[iCount].getPoint().setY(0.0);
                }

                iCount++;
              }

            }

            ai.setRecordCount((int) pg.getRecordCount());
            ai.setPageCount(pg.getPageCount());
          } else {
            al = new AddressLocation[0];
            // throw (new
            // Exception("Endere�o n�o encontrado em nossa base de dados!"));
          }

          ai.setAddressLocation(al);
        }
      } else {
        if (address.getStreet() == "" && (!Functions.IsNullOrEmpty(address.getZip()))) {
          String cmd = " select CEP, CORREIO_ENDERECO AS ENDERECO, CORREIO_MUNICIPIO AS CIDADE, CORREIO_UF AS ESTADO, "
              + "  COALESCE(X,0) as X, COALESCE(Y,0) as Y, COALESCE(CORREIO_BAIRRO_INI,'') AS BAIRRO " + "  FROM TB_CEP_BRASIL "
              + " WHERE CEP = REPLACE('" + address.getZip() + "','-','') " + " AND X IS NOT NULL".toUpperCase();

          con = dataBase.getConnection(dataB);

          Statement st = con.createStatement();

          ResultSet rr = st.executeQuery(cmd);

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

          if (crs.size() == 0) {
            crs.next();

            al = new AddressLocation[1];
            al[0] = new AddressLocation();

            al[0].setAddress(new Address());
            al[0].getAddress().setStreet(crs.getString("Endereco"));
            al[0].getAddress().setZip(crs.getString("CEP"));
            al[0].getAddress().setDistrict(crs.getString("BAIRRO"));
View Full Code Here

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

    CommonRest cr = new CommonRest();

    Point point = new Point(Double.parseDouble(request.getParameter("lng")), Double.parseDouble(request.getParameter("lat")));
    Double tolerance = 50D;
    AddressLocation al = new AddressLocation();

    try {
      al = cAf.getAddress(point, tolerance, Integer.parseInt(cm.getAppSettings("ID")));
    } catch (Exception e) {
      e.printStackTrace();
    }

    ObjectsHelper[] dependencyObjects = new ObjectsHelper[3];

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

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

    dependencyObjects[2] = cr.new ObjectsHelper();
    dependencyObjects[2].object = new AddressLocation();
    dependencyObjects[2].alias = "AddressLocation";

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

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

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

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

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

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

      if (ph.fields[0].equals("findCity")) {
        CityLocationInfo ci = new CityLocationInfo();

        ObjectsHelper[] addressOptionsDependencyObjects = new ObjectsHelper[1];

        addressOptionsDependencyObjects[0] = cr.new ObjectsHelper();
        addressOptionsDependencyObjects[0].object = new ResultRange();
        addressOptionsDependencyObjects[0].alias = "resultRange";

        City city = (City) cr.getObjectFromXML(ph.XMLFile, "cidade", City.class, null);
        AddressOptions ao = (AddressOptions) cr.getObjectFromXML(ph.XMLFile, "ao", AddressOptions.class, addressOptionsDependencyObjects);

        try {
          ci = cAf.findCity(city, ao, id_licenca);
        } catch (Exception e) {
          e.printStackTrace();
        }
       
        response.setContentType("text/xml");
        response.setCharacterEncoding("UTF-8");

        ObjectsHelper[] dependencyObjects = new ObjectsHelper[2];

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

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

        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")) {
        AddressLocation al = new AddressLocation();

       
       
        Double tolerance = Double.valueOf(cr.getFieldFromXML(ph.XMLFile, "tolerance"));
        Point point = (Point) cr.getObjectFromXML(ph.XMLFile, "point", Point.class, null);

        try {
          al = cAf.getAddress(point, tolerance, id_licenca);
        } catch (Exception e) {
          e.printStackTrace();
        }

        ObjectsHelper[] dependencyObjects = new ObjectsHelper[3];

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

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

        dependencyObjects[2] = cr.new ObjectsHelper();
        dependencyObjects[2].object = new AddressLocation();
        dependencyObjects[2].alias = "AddressLocation";

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

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

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

  }

  public AddressLocation getAddress(Point point, double tolerance, int idLicenca) throws Exception {
    iniDate = System.currentTimeMillis();

    AddressLocation al = new AddressLocation();

    try {
      al = ca.getAddress(point, tolerance, idLicenca, CommonAddress._getAddress, 0);
      Functions.gravarLogUnique(idLicenca, CommonAddress._getAddress, 0, iniDate, 0);
    } catch (Exception e) {
View Full Code Here

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

      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());
      respostaWs = Common.SerializeJSObject(al);
      break;
    case findCitiesByState:
      o = Common.getArrayByJSon(proxy.getParameters("tjss"), new Class[] { String.class });
      City city = new City("", (String) o[0]);
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.