Package com.lbslocal.api.utils.CommonRest

Examples of com.lbslocal.api.utils.CommonRest.ObjectsHelper


       
        Point point = (Point) cr.getObjectFromXML(ph.XMLFile, "point", Point.class, null);
       
        ObjectsHelper[] mapOptionsDependencyObjects = new ObjectsHelper[4];
       
        mapOptionsDependencyObjects[0] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[0].object = new MapSize();
        mapOptionsDependencyObjects[0].alias = "mapSize";
       
        mapOptionsDependencyObjects[1] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[1].object = new Icon[0];
        mapOptionsDependencyObjects[1].alias = "icon";
       
        mapOptionsDependencyObjects[2] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[2].object = new Icon();
        mapOptionsDependencyObjects[2].alias = "Icon";
       
        mapOptionsDependencyObjects[3] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[3].object = new Point();
        mapOptionsDependencyObjects[3].alias = "point";
 
        MapOptions mo = (MapOptions) cr.getObjectFromXML(ph.XMLFile, "mo", MapOptions.class, mapOptionsDependencyObjects);
       
        String routeId = cr.getFieldFromXML(ph.XMLFile, "routeId");
        int radius = Integer.valueOf(cr.getFieldFromXML(ph.XMLFile, "radius"));
       
        try
        {
          mi = cMr.getZoomRadius(routeId, point, radius, mo, id_licenca, mapType);
        }
        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 Extent();
        dependencyObjects[0].alias = "extent";
       
        dependencyObjects[1] = cr.new ObjectsHelper();
        dependencyObjects[1].object = new MapInfo();
        dependencyObjects[1].alias = "MapInfo";

        response.getWriter().write("<?xml version='1.0' encoding='UTF-8'?>\n" + cr.getXMLFromObject(mi, dependencyObjects) + "");
      }
      if (ph.fields[0].equals("getMap"))
      {
        MapInfo mi = new MapInfo();
       
        String mapType = cr.getFieldFromXML(ph.XMLFile, "maptype");
       
        if (!mapType.toLowerCase().equals("gif") && !mapType.toLowerCase().equals("png") && !mapType.toLowerCase().equals("jpg") ){
          mapType = "png";
        }
       
        Extent extent = (Extent) cr.getObjectFromXML(ph.XMLFile, "extent", Extent.class, null);
       
        ObjectsHelper[] mapOptionsDependencyObjects = new ObjectsHelper[4];
       
        mapOptionsDependencyObjects[0] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[0].object = new MapSize();
        mapOptionsDependencyObjects[0].alias = "mapSize";
       
        mapOptionsDependencyObjects[1] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[1].object = new Icon[0];
        mapOptionsDependencyObjects[1].alias = "icon";
       
        mapOptionsDependencyObjects[2] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[2].object = new Icon();
        mapOptionsDependencyObjects[2].alias = "Icon";
       
        mapOptionsDependencyObjects[3] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[3].object = new Point();
        mapOptionsDependencyObjects[3].alias = "point";
 
        MapOptions mo = (MapOptions) cr.getObjectFromXML(ph.XMLFile, "mo", MapOptions.class, mapOptionsDependencyObjects);
       
        String routeId = cr.getFieldFromXML(ph.XMLFile, "routeId");

       
        try
        {
          mi = cMr.getMap(routeId, extent, mo, id_licenca, mapType);
        }
        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 Extent();
        dependencyObjects[0].alias = "extent";
       
        dependencyObjects[1] = cr.new ObjectsHelper();
        dependencyObjects[1].object = new MapInfo();
        dependencyObjects[1].alias = "MapInfo";

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


      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);
View Full Code Here

      if (ph.fields[0].equals("findAddress")) {
        AddressInfo ai = new AddressInfo();

        ObjectsHelper[] addressDependencyObjects = new ObjectsHelper[1];

        addressDependencyObjects[0] = cr.new ObjectsHelper();
        addressDependencyObjects[0].object = new City();
        addressDependencyObjects[0].alias = "city";

        ObjectsHelper[] addressOptionsDependencyObjects = new ObjectsHelper[1];

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

        Address address = (Address) cr.getObjectFromXML(ph.XMLFile, "address", Address.class, addressDependencyObjects);
        AddressOptions ao = (AddressOptions) cr.getObjectFromXML(ph.XMLFile, "ao", AddressOptions.class, addressOptionsDependencyObjects);

        try {
          ai = cAf.findAddress(address, 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 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"));
      }
      if (ph.fields[0].equals("getIntersection")) {

        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";

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

       
        RouteInfo ri = new RouteInfo();
       
        ObjectsHelper[] routeStopDependencyObjects = new ObjectsHelper[3];
       
        routeStopDependencyObjects[0] = cr.new ObjectsHelper();
        routeStopDependencyObjects[0].object = new Point();
        routeStopDependencyObjects[0].alias = "point";
       
        routeStopDependencyObjects[1] = cr.new ObjectsHelper();
        routeStopDependencyObjects[1].object = new RouteStop();
        routeStopDependencyObjects[1].alias = "RouteStop";
       
        routeStopDependencyObjects[2] = cr.new ObjectsHelper();
        routeStopDependencyObjects[2].object = new RouteStop[0];
        routeStopDependencyObjects[2].alias = "rs";
       
        ObjectsHelper[] routeOptionsDependencyObjects = new ObjectsHelper[7];
       
        routeOptionsDependencyObjects[0] = cr.new ObjectsHelper();
        routeOptionsDependencyObjects[0].object = new RouteDetails();
        routeOptionsDependencyObjects[0].alias = "routeDetails";
       
        routeOptionsDependencyObjects[1] = cr.new ObjectsHelper();
        routeOptionsDependencyObjects[1].object = new Vehicle();
        routeOptionsDependencyObjects[1].alias = "vehicle";
       
        routeOptionsDependencyObjects[2] = cr.new ObjectsHelper();
        routeOptionsDependencyObjects[2].object = new RouteLine[0];
        routeOptionsDependencyObjects[2].alias = "routeLine";
       
        routeOptionsDependencyObjects[3] = cr.new ObjectsHelper();
        routeOptionsDependencyObjects[3].object = new RouteLine();
        routeOptionsDependencyObjects[3].alias = "RouteLine";
       
        routeOptionsDependencyObjects[4] = cr.new ObjectsHelper();
        routeOptionsDependencyObjects[4].object = new Point[0];
        routeOptionsDependencyObjects[4].alias = "barrierPoints";
       
        routeOptionsDependencyObjects[5] = cr.new ObjectsHelper();
        routeOptionsDependencyObjects[5].object = new String[0];
        routeOptionsDependencyObjects[5].alias = "barriersList";
       
        routeOptionsDependencyObjects[6] = cr.new ObjectsHelper();
        routeOptionsDependencyObjects[6].object = new String[0];
        routeOptionsDependencyObjects[6].alias = "poiRoute";
       
        RouteStop[] rs = (RouteStop[]) cr.getObjectFromXML(ph.XMLFile, "rs", RouteStop.class, routeStopDependencyObjects);
        RouteOptions ro = (RouteOptions) cr.getObjectFromXML(ph.XMLFile, "ro", RouteOptions.class, routeOptionsDependencyObjects);
       
        try
        {
          ri = cRoute.getRoute(rs, ro, id_licenca);
          if (fullCoords.equals("true")){
            ri.setCoords(cRoute.getRouteFullCoords(ri.getRouteId()));
          }
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
       
        response.setContentType("text/xml");
        response.setCharacterEncoding("UTF-8");
       
        ObjectsHelper[] dependencyObjects = new ObjectsHelper[6];
       
        dependencyObjects[0] = cr.new ObjectsHelper();
        dependencyObjects[0].object = new MapInfo();
        dependencyObjects[0].alias = "MapInfo";
       
        dependencyObjects[1] = cr.new ObjectsHelper();
        dependencyObjects[1].object = new SegmentDescription();
        dependencyObjects[1].alias = "SegmentDescription";
       
        dependencyObjects[2] = cr.new ObjectsHelper();
        dependencyObjects[2].object = new RouteTotals();
        dependencyObjects[2].alias = "routeTotals";
       
        dependencyObjects[3] = cr.new ObjectsHelper();
        dependencyObjects[3].object = new RouteSummary();
        dependencyObjects[3].alias = "routeSummary";
       
        dependencyObjects[4] = cr.new ObjectsHelper();
        dependencyObjects[4].object = new RoadType();
        dependencyObjects[4].alias = "roadType";
       
        dependencyObjects[5] = cr.new ObjectsHelper();
        dependencyObjects[5].object = new RouteInfo();
        dependencyObjects[5].alias = "RouteInfo";

       
        response.getWriter().write("<?xml version='1.0' encoding='UTF-8'?>\n" + cr.getXMLFromObject(ri, dependencyObjects) + "");
View Full Code Here

TOP

Related Classes of com.lbslocal.api.utils.CommonRest.ObjectsHelper

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.