Skip to content

Commit c00ae71

Browse files
author
boncey
committed
Remove XML attributes that are no longer returned by the API
1 parent 72a2104 commit c00ae71

File tree

1 file changed

+28
-46
lines changed

1 file changed

+28
-46
lines changed

Flickr4Java/src/main/java/com/flickr4java/flickr/places/PlacesInterface.java

Lines changed: 28 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
package com.flickr4java.flickr.places;
22

3-
import java.text.DateFormat;
4-
import java.util.ArrayList;
5-
import java.util.Date;
6-
import java.util.HashMap;
7-
import java.util.Map;
8-
9-
import org.w3c.dom.Element;
10-
import org.w3c.dom.NodeList;
11-
12-
import com.flickr4java.flickr.Flickr;
133
import com.flickr4java.flickr.FlickrException;
144
import com.flickr4java.flickr.Response;
155
import com.flickr4java.flickr.Transport;
@@ -18,6 +8,15 @@
188
import com.flickr4java.flickr.util.StringUtilities;
199
import com.flickr4java.flickr.util.XMLUtilities;
2010

11+
import org.w3c.dom.Element;
12+
import org.w3c.dom.NodeList;
13+
14+
import java.text.DateFormat;
15+
import java.util.ArrayList;
16+
import java.util.Date;
17+
import java.util.HashMap;
18+
import java.util.Map;
19+
2120
/**
2221
* Lookup Flickr Places.
2322
* <p>
@@ -412,7 +411,7 @@ public ArrayList<PlaceType> getPlaceTypes() throws FlickrException {
412411
* @throws FlickrException
413412
*/
414413
public ShapeDataList<ShapeData> getShapeHistory(String placeId, String woeId) throws FlickrException {
415-
ShapeDataList<ShapeData> shapeList = new ShapeDataList<ShapeData>();
414+
ShapeDataList<ShapeData> shapeList = new ShapeDataList<ShapeData>();
416415
Map<String, Object> parameters = new HashMap<String, Object>();
417416
parameters.put("method", METHOD_GET_SHAPEHISTORY);
418417

@@ -435,22 +434,22 @@ public ShapeDataList<ShapeData> getShapeHistory(String placeId, String woeId) th
435434
shapeList.setPlaceTypeId(Integer.parseInt(shapeElements.getAttribute("place_type_id")));
436435
NodeList shapeNodes = shapeElements.getElementsByTagName("shape");
437436
for (int i = 0; i < shapeNodes.getLength(); i++) {
438-
Element shapeElement = (Element) shapeNodes.item(i);
439-
ShapeData data = new ShapeData();
440-
data.setAlpha( Double.parseDouble(shapeElement.getAttribute("alpha")) );
441-
data.setCountEdges(Integer.parseInt(shapeElement.getAttribute("count_edges")));
442-
data.setCountPoints(Integer.parseInt(shapeElement.getAttribute("count_points")));
443-
data.setCreated(shapeElement.getAttribute("created"));
444-
data.setIsDonutHole("1".equals(shapeElement.getAttribute("is_donuthole")));
445-
data.setHasDonuthole("1".equals(shapeElement.getAttribute("has_donuthole")));
446-
447-
Element polyElement = XMLUtilities.getChild(shapeElement , "polylines");
448-
data.setPolyline(XMLUtilities.getChildValue(polyElement, "polyline"));
449-
Element urlElement = XMLUtilities.getChild(shapeElement, "urls");
450-
data.setShapefile(XMLUtilities.getChildValue(urlElement, "shapefile"));
451-
shapeList.add(data);
452-
}
453-
437+
Element shapeElement = (Element) shapeNodes.item(i);
438+
ShapeData data = new ShapeData();
439+
data.setAlpha(Double.parseDouble(shapeElement.getAttribute("alpha")));
440+
data.setCountEdges(Integer.parseInt(shapeElement.getAttribute("count_edges")));
441+
data.setCountPoints(Integer.parseInt(shapeElement.getAttribute("count_points")));
442+
data.setCreated(shapeElement.getAttribute("created"));
443+
data.setIsDonutHole("1".equals(shapeElement.getAttribute("is_donuthole")));
444+
data.setHasDonuthole("1".equals(shapeElement.getAttribute("has_donuthole")));
445+
446+
Element polyElement = XMLUtilities.getChild(shapeElement, "polylines");
447+
data.setPolyline(XMLUtilities.getChildValue(polyElement, "polyline"));
448+
Element urlElement = XMLUtilities.getChild(shapeElement, "urls");
449+
data.setShapefile(XMLUtilities.getChildValue(urlElement, "shapefile"));
450+
shapeList.add(data);
451+
}
452+
454453
return shapeList;
455454
}
456455

@@ -642,7 +641,7 @@ public PlacesList<Place> placesForContacts(int placeType, String placeId, String
642641
* @throws FlickrException
643642
*/
644643
public PlacesList<Place> placesForTags(int placeTypeId, String woeId, String placeId, String threshold, String[] tags, String tagMode, String machineTags,
645-
String machineTagMode, Date minUploadDate, Date maxUploadDate, Date minTakenDate, Date maxTakenDate) throws FlickrException{
644+
String machineTagMode, Date minUploadDate, Date maxUploadDate, Date minTakenDate, Date maxTakenDate) throws FlickrException {
646645
Map<String, Object> parameters = new HashMap<String, Object>();
647646
PlacesList<Place> placesList = new PlacesList<Place>();
648647
parameters.put("method", METHOD_PLACES_FOR_TAGS);
@@ -909,24 +908,7 @@ private Location parseLocation(Element locationElement) {
909908
}
910909
location.setRegion(parseLocationPlace(regionElement, Place.TYPE_REGION));
911910
location.setCountry(parseLocationPlace(countryElement, Place.TYPE_COUNTRY));
912-
913-
ShapeData data = new ShapeData();
914-
915-
Element shapeElement = XMLUtilities.getChild(locationElement, "shapedata");
916-
data.setAlpha( Double.parseDouble(shapeElement.getAttribute("alpha")) );
917-
data.setCountEdges(Integer.parseInt(shapeElement.getAttribute("count_edges")));
918-
data.setCountPoints(Integer.parseInt(shapeElement.getAttribute("count_points")));
919-
data.setCreated(shapeElement.getAttribute("created"));
920-
data.setIsDonutHole("1".equals(shapeElement.getAttribute("is_donuthole")));
921-
data.setHasDonuthole("1".equals(shapeElement.getAttribute("has_donuthole")));
922-
923-
Element polyElement = XMLUtilities.getChild(locationElement, "polylines");
924-
data.setPolyline(XMLUtilities.getChildValue(polyElement, "polyline"));
925-
Element urlElement = XMLUtilities.getChild(locationElement, "urls");
926-
data.setShapefile(XMLUtilities.getChildValue(urlElement, "shapefile"));
927-
928-
location.setShapedata(data);
929-
911+
930912
return location;
931913
}
932914

0 commit comments

Comments
 (0)