@Override public List<WChannel> availableChannels(WUser u) throws IllegalArgumentException { JsonAvailableChannelRequest request = new JsonAvailableChannelRequest(u.getToken(), serverUrl); JsonAvailableChannelResponse response = new JsonAvailableChannelResponse(); response.parseJson(request.doRequest()); List<WChannel> channels = new ArrayList<WChannel>(); for (int i = 0; i < response.getChannels().size(); i++) { WChannel channel = JGeoConnector.toWChannel(response.getChannels().get(i)); channels.add(channel); } return channels; }
@Override public List<WMark> getTags(WUser u, WChannel ch, int amount) throws IllegalArgumentException { JsonFilterChannelRequest request = new JsonFilterChannelRequest(u.getToken(), ch.getName(), amount, serverUrl); JsonFilterChannelResponse response = new JsonFilterChannelResponse(); response.parseJson(request.doRequest()); List<WMark> marks = new ArrayList<WMark>(); for (int i = 0; i < response.getChannels().size(); i++) { for (int j = 0; j < response.getChannels().get(i).getMarks().size(); j++) { WMark mark = JGeoConnector.toWTag(response.getChannels().get(i).getMarks().get(j)); marks.add(mark); } } return marks; }
@Override public List<WMark> getTags(WUser u, double latitude, double longitude, double radius) throws IllegalArgumentException { JsonLoadTagsRequest request = new JsonLoadTagsRequest(u.getToken(), latitude, longitude, radius, serverUrl); JsonLoadTagsResponse response = new JsonLoadTagsResponse(); response.parseJson(request.doRequest()); List<WMark> marks = new ArrayList<WMark>(); for (int i = 0; i < response.getChannels().size(); i++) { for (int j = 0; j < response.getChannels().get(i).getMarks().size(); j++) { WMark mark = JGeoConnector.toWTag(response.getChannels().get(i).getMarks().get(j)); marks.add(mark); } } return marks; }