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