Skip to content

Commit f9df102

Browse files
author
Craig Walls
committed
Update for Facebook v2.0
1 parent dec08b6 commit f9df102

File tree

159 files changed

+4334
-4719
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+4334
-4719
lines changed

build.gradle

+16-4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ configure(allprojects - docProjects) {
4444
testCompile "org.springframework:spring-test:$springVersion"
4545
}
4646

47+
ext.javadocLinks = [
48+
"http://docs.oracle.com/javase/7/docs/api/",
49+
"http://docs.oracle.com/javaee/7/api/",
50+
"http://docs.spring.io/spring/docs/${springVersion}/javadoc-api/",
51+
"http://docs.jboss.org/jbossas/javadoc/4.0.5/connector/"
52+
] as String[]
53+
4754
// servlet-api (2.5) and tomcat-servlet-api (3.0) classpath entries should not be
4855
// exported to dependent projects in Eclipse to avoid false compilation errors due
4956
// to changing APIs across these versions
@@ -62,10 +69,6 @@ configure(allprojects - docProjects) {
6269
}
6370
}
6471

65-
ext.javadocLinks = [
66-
"http://docs.jboss.org/jbossas/javadoc/4.0.5/connector"
67-
] as String[]
68-
6972
configure(subprojects - docProjects) { subproject ->
7073
apply from: "${rootProject.projectDir}/publish-maven.gradle"
7174

@@ -82,9 +85,15 @@ configure(subprojects - docProjects) { subproject ->
8285
}
8386

8487
javadoc {
88+
description = "Generates project-level javadoc for use in -javadoc jar"
89+
8590
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
8691
options.author = true
8792
options.header = project.name
93+
options.links(project.ext.javadocLinks)
94+
if (JavaVersion.current().isJava8Compatible()) {
95+
options.addStringOption('Xdoclint:none', '-quiet')
96+
}
8897
//options.overview = "${projectDir}/src/main/java/overview.html"
8998
}
9099

@@ -195,6 +204,9 @@ configure(rootProject) {
195204
options.header = rootProject.description
196205
options.overview = "src/api/overview.html"
197206
options.links(project.ext.javadocLinks)
207+
if (JavaVersion.current().isJava8Compatible()) {
208+
options.addStringOption('Xdoclint:none', '-quiet')
209+
}
198210

199211
source subprojects.collect { project ->
200212
project.sourceSets.main.allJava

spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/CanvasSignInController.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public CanvasSignInController(ConnectionFactoryLocator connectionFactoryLocator,
8484

8585
/**
8686
* The URL or path to redirect to after successful canvas authorization.
87-
* Defaults to "/".
87+
* @param postSignInUrl the url to redirect to after successful canvas authorization. Defaults to "/".
8888
*/
8989
public void setPostSignInUrl(String postSignInUrl) {
9090
this.postSignInUrl = postSignInUrl;
@@ -94,15 +94,15 @@ public void setPostSignInUrl(String postSignInUrl) {
9494
* The URL or path to redirect to if a user declines authorization.
9595
* The redirect will happen in the top-level window.
9696
* If you want the redirect to happen in the canvas iframe, then override the {@link #postDeclineView()} method to return a different implementation of {@link View}.
97-
* Defaults to "http://www.facebook.com".
97+
* @param postDeclineUrl the url to redirect to after a user declines authorization. Defaults to "http://www.facebook.com".
9898
*/
9999
public void setPostDeclineUrl(String postDeclineUrl) {
100100
this.postDeclineUrl = postDeclineUrl;
101101
}
102102

103103
/**
104104
* The scope to request during authorization.
105-
* Defaults to null (no scope will be requested; Facebook will offer their default scope).
105+
* @param scope the scope to request. Defaults to null (no scope will be requested; Facebook will offer their default scope).
106106
*/
107107
public void setScope(String scope) {
108108
this.scope = scope;
@@ -160,6 +160,7 @@ public View error(@RequestParam("error") String error, @RequestParam("error_desc
160160
/**
161161
* View that redirects the top level window to the URL defined in postDeclineUrl property after user declines to authorize application.
162162
* May be overridden for custom views, particularly in the case where the post-decline view should be rendered in-canvas.
163+
* @return a view to display after a user declines authoriation. Defaults as a redirect to postDeclineUrl
163164
*/
164165
protected View postDeclineView() {
165166
return new TopLevelWindowRedirect() {

spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/FacebookCookieParser.java

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ public class FacebookCookieParser {
3535

3636
/**
3737
* Looks for a Facebook cookie for the given API Key and returns its data as key/value pairs in a Map.
38+
* @param cookies an array of Cookie objects
39+
* @param appId the application's Facebook App ID
40+
* @param appSecret the application's Facebook App Secret
41+
* @return a Map containing the Facebook cookie data
3842
*/
3943
public static Map<String, String> getFacebookCookieData(Cookie[] cookies, String appId, String appSecret) {
4044
if (cookies != null) {

spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/FacebookCookieValue.java

+2
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@
3333

3434
/**
3535
* The specific element of the cookie to be bound (e.g., "uid", "expires", etc)
36+
* @return the cookie element name
3637
*/
3738
public String value() default "";
3839

3940
/**
4041
* Whether the Facebook cookie value is required.
4142
* Default is true, leading to an exception being thrown in case the Facebook cookie is missing or if the value can't be found in the cookie.
4243
* Switch this to false if you prefer a null in case of the missing cookie/value.
44+
* @return true if the cookie value is required
4345
*/
4446
boolean required() default true;
4547
}

spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/FacebookInitTag.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class FacebookInitTag extends TagSupport {
3131

3232
/**
3333
* Sets the application's Facebook ID.
34-
* @param appId
34+
* @param appId the applicatin's Facebook App ID
3535
*/
3636
public void setAppId(String appId) {
3737
this.appId = appId;

spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/FacebookWebArgumentResolver.java

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public class FacebookWebArgumentResolver implements WebArgumentResolver {
4141
/**
4242
* Construct a FacebookWebArgumentResolver given the Facebook app id and secret.
4343
* The application secret will be used to verify the cookie signature.
44+
* @param appId the application's Facebook App ID
45+
* @param appSecret the application's Facebook App Secret
4446
*/
4547
public FacebookWebArgumentResolver(String appId, String appSecret) {
4648
this.appId = appId;

spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/RealTimeUpdate.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ public class RealTimeUpdate {
3535
private List<Entry> entries;
3636

3737
/**
38-
* The object type that changed (e.g., "user", "page", etc).
38+
* @return the object type that changed (e.g., "user", "page", etc).
3939
*/
4040
public String getObject() {
4141
return object;
4242
}
4343

4444
/**
45-
* Entries that changed. Multiple change entries for multiple objects may be given in a single update.
45+
* @return the entries that changed. Multiple change entries for multiple objects may be given in a single update.
4646
*/
4747
public List<Entry> getEntries() {
4848
return entries;
@@ -63,22 +63,21 @@ public static class Entry {
6363
private List<String> changedFields;
6464

6565
/**
66-
* The ID of the object that changed (e.g., if the object is a "user", then this is the user's Facebook ID).
66+
* @return the ID of the object that changed (e.g., if the object is a "user", then this is the user's Facebook ID).
6767
*/
6868
public long getId() {
6969
return id;
7070
}
7171

7272
/**
73-
* The time of the change in seconds since Jan 1, 1970.
73+
* @return the time of the change in seconds since Jan 1, 1970.
7474
*/
7575
public long getTime() {
7676
return time;
7777
}
7878

7979
/**
80-
* A list of the fields that changed on the object.
81-
* {@link UpdateHandler} implementations may use this as a clue to know what data to fetch to see the details of the change.
80+
* @return a list of the fields that changed on the object. {@link UpdateHandler} implementations may use this as a clue to know what data to fetch to see the details of the change.
8281
*/
8382
public List<String> getChangedFields() {
8483
return changedFields;

spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/RealTimeUpdateController.java

+3
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public class RealTimeUpdateController {
6262
* Constructs a RealTimeUpdateController.
6363
* @param tokens A map of subscription names to verification tokens.
6464
* @param updateHandlers A list of {@link UpdateHandler} implementations to handle incoming updates.
65+
* @param applicationSecret the application's Facebook App Secret
6566
*/
6667
public RealTimeUpdateController(Map<String, String> tokens, List<UpdateHandler> updateHandlers, String applicationSecret) {
6768
this.tokens = tokens;
@@ -90,6 +91,8 @@ public RealTimeUpdateController(Map<String, String> tokens, List<UpdateHandler>
9091
* @param subscription The subscription name.
9192
* @param payload The request body payload.
9293
* @param signature The SHA1 signature of the request.
94+
* @return a String with the response back to Facebook
95+
* @throws Exception an Exception if anything goes wrong while processing the update
9396
*/
9497
@RequestMapping(value="/{subscription}", method=POST)
9598
public @ResponseBody String receiveUpdate(

spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/SignedRequest.java

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
* Whether the signed_request parameter is required.
3434
* Default is true, leading to an exception being thrown in case signed_request is missing.
3535
* Switch this to false if you prefer a null in case of a missing signed_request parameter.
36+
* @return true if the parameter is required
3637
*/
3738
boolean required() default true;
3839
}

spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/SignedRequestDecoder.java

+3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public SignedRequestDecoder(String secret) {
5454
* Decodes a signed request, returning the payload of the signed request as a Map
5555
* @param signedRequest the value of the signed_request parameter sent by Facebook.
5656
* @return the payload of the signed request as a Map
57+
* @throws SignedRequestException if there is an error decoding the signed request
5758
*/
5859
@SuppressWarnings("unchecked")
5960
public Map<String, ?> decodeSignedRequest(String signedRequest) throws SignedRequestException {
@@ -64,7 +65,9 @@ public SignedRequestDecoder(String secret) {
6465
* Decodes a signed request, returning the payload of the signed request as a specified type.
6566
* @param signedRequest the value of the signed_request parameter sent by Facebook.
6667
* @param type the type to bind the signed_request to.
68+
* @param <T> the Java type to bind the signed_request to.
6769
* @return the payload of the signed request as an object
70+
* @throws SignedRequestException if there is an error decoding the signed request
6871
*/
6972
public <T> T decodeSignedRequest(String signedRequest, Class<T> type) throws SignedRequestException {
7073
String[] split = signedRequest.split("\\.");

spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Account.java

+12-12
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,20 @@
1515
*/
1616
package org.springframework.social.facebook.api;
1717

18+
import java.util.List;
19+
1820
public class Account extends FacebookObject {
1921

20-
private final String id;
22+
private String id;
2123

22-
private final String name;
24+
private String name;
2325

24-
private final String category;
26+
private String category;
27+
28+
private String accessToken;
29+
30+
private List<String> permissions;
2531

26-
private final String accessToken;
27-
28-
public Account(String id, String name, String category, String accessToken) {
29-
this.id = id;
30-
this.name = name;
31-
this.category = category;
32-
this.accessToken = accessToken;
33-
}
34-
3532
public String getId() {
3633
return id;
3734
}
@@ -48,4 +45,7 @@ public String getAccessToken() {
4845
return accessToken;
4946
}
5047

48+
public List<String> getPermissions() {
49+
return permissions;
50+
}
5151
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* Copyright 2014 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.social.facebook.api;
17+
18+
import java.util.Date;
19+
20+
/**
21+
* Model class representing an achievement.
22+
* @author Craig Walls
23+
* @since 2.0
24+
*/
25+
public class Achievement extends FacebookObject {
26+
27+
private final String id;
28+
29+
private final Reference from;
30+
31+
private final Date publishTime;
32+
33+
private final ApplicationReference application;
34+
35+
private AchievementData data;
36+
37+
private final String type;
38+
39+
private final boolean noFeedStory;
40+
41+
public Achievement(String id, Reference from, Date publishTime, ApplicationReference application, AchievementData data, String type, boolean noFeedStory) {
42+
this.id = id;
43+
this.from = from;
44+
this.publishTime = publishTime;
45+
this.application = application;
46+
this.data = data;
47+
this.type = type;
48+
this.noFeedStory = noFeedStory;
49+
}
50+
51+
public String getId() {
52+
return id;
53+
}
54+
55+
public Reference getFrom() {
56+
return from;
57+
}
58+
59+
public Date getPublishTime() {
60+
return publishTime;
61+
}
62+
63+
public ApplicationReference getApplication() {
64+
return application;
65+
}
66+
67+
public AchievementType getAchievementType() {
68+
return data.achievement;
69+
}
70+
71+
public int getImportance() {
72+
return data.importance;
73+
}
74+
75+
public String getType() {
76+
return type;
77+
}
78+
79+
public boolean isNoFeedStory() {
80+
return noFeedStory;
81+
}
82+
83+
public static class AchievementData {
84+
private AchievementType achievement;
85+
private int importance;
86+
87+
public AchievementType getAchievement() {
88+
return this.achievement;
89+
}
90+
91+
public int getImportance() {
92+
return importance;
93+
}
94+
}
95+
96+
}

0 commit comments

Comments
 (0)