Examples of POIInfo


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

      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

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

        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

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

  }

  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

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

      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
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.