Skip to content

Commit 20f88e1

Browse files
committed
Issue #3 - old and deprecated FQL examples removed
1 parent 7a17504 commit 20f88e1

File tree

2 files changed

+1
-84
lines changed

2 files changed

+1
-84
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<dependency>
6363
<groupId>com.restfb</groupId>
6464
<artifactId>restfb</artifactId>
65-
<version>1.18.1</version>
65+
<version>1.32.0</version>
6666
</dependency>
6767
</dependencies>
6868

src/main/java/com/restfb/example/GraphReaderExample.java

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public class GraphReaderExample extends Example {
4848
* RestFB Graph API client.
4949
*/
5050
private final FacebookClient facebookClient23;
51-
private final FacebookClient facebookClient20;
5251

5352
/**
5453
* Entry point. You must provide a single argument on the command line: a valid Graph API access token.
@@ -68,7 +67,6 @@ public static void main(String[] args) {
6867

6968
GraphReaderExample(String accessToken) {
7069
facebookClient23 = new DefaultFacebookClient(accessToken, Version.VERSION_2_3);
71-
facebookClient20 = new DefaultFacebookClient(accessToken, Version.VERSION_2_0);
7270
}
7371

7472
void runEverything() {
@@ -77,8 +75,6 @@ void runEverything() {
7775
fetchObjectsAsJsonObject();
7876
fetchConnections();
7977
fetchDifferentDataTypesAsJsonObject();
80-
query();
81-
multiquery();
8278
search();
8379
metadata();
8480
paging();
@@ -141,12 +137,6 @@ void fetchDifferentDataTypesAsJsonObject() {
141137
String firstPhotoUrl = photosConnectionData.getJsonObject(0).getString("source");
142138
out.println(firstPhotoUrl);
143139
}
144-
145-
String query = "SELECT uid, name FROM user WHERE uid=4 or uid=11";
146-
List<JsonObject> queryResults = facebookClient20.executeFqlQuery(query, JsonObject.class);
147-
148-
if (!queryResults.isEmpty())
149-
out.println(queryResults.get(0).getString("name"));
150140
}
151141

152142
/**
@@ -172,85 +162,12 @@ void fetchConnections() {
172162
out.println("First item in my feed: " + myFeed.getData().get(0).getMessage());
173163
}
174164

175-
void query() {
176-
out.println("* FQL Query *");
177-
178-
List<FqlUser> users =
179-
facebookClient20.executeFqlQuery("SELECT uid, name FROM user WHERE uid=4 or uid=11", FqlUser.class);
180-
181-
out.println("User: " + users);
182-
}
183-
184-
void multiquery() {
185-
out.println("* FQL Multiquery *");
186-
187-
Map<String, String> queries = new HashMap<String, String>();
188-
queries.put("users", "SELECT uid, name FROM user WHERE uid=4 OR uid=11");
189-
queries.put("likers", "SELECT user_id FROM like WHERE object_id=122788341354");
190-
191-
MultiqueryResults multiqueryResults = facebookClient20.executeFqlMultiquery(queries, MultiqueryResults.class);
192-
193-
out.println("Users: " + multiqueryResults.users);
194-
out.println("People who liked: " + multiqueryResults.likers);
195-
}
196-
197-
/**
198-
* Holds results from an "executeQuery" call.
199-
* <p>
200-
* Be aware that FQL fields don't always map to Graph API Object fields.
201-
*/
202-
public static class FqlUser {
203-
@Facebook
204-
String uid;
205-
206-
@Facebook
207-
String name;
208-
209-
@Override
210-
public String toString() {
211-
return format("%s (%s)", name, uid);
212-
}
213-
}
214-
215-
/**
216-
* Holds results from an "executeQuery" call.
217-
* <p>
218-
* Be aware that FQL fields don't always map to Graph API Object fields.
219-
*/
220-
public static class FqlLiker {
221-
@Facebook("user_id")
222-
String userId;
223-
224-
@Override
225-
public String toString() {
226-
return userId;
227-
}
228-
}
229-
230-
/**
231-
* Holds results from a "multiquery" call.
232-
*/
233-
public static class MultiqueryResults {
234-
@Facebook
235-
List<FqlUser> users;
236-
237-
@Facebook
238-
List<FqlLiker> likers;
239-
}
240-
241165
void search() {
242166
out.println("* Searching connections *");
243167

244-
// Connection<Post> publicSearch =
245-
// facebookClient23.fetchConnection("search", Post.class, Parameter.with("q", "watermelon"),
246-
// Parameter.with("type", "post"));
247-
248168
Connection<User> targetedSearch = facebookClient23.fetchConnection("search", User.class,
249169
Parameter.with("q", "Mark"), Parameter.with("type", "user"));
250170

251-
// if (publicSearch.getData().size() > 0)
252-
// out.println("Public search: " + publicSearch.getData().get(0).getMessage());
253-
254171
out.println("Posts on my wall by friends named Mark: " + targetedSearch.getData().size());
255172
}
256173

0 commit comments

Comments
 (0)