Hi everyone.
I'm trying to use spring-social-google to search activities in google+, but when i get the activity objects they came with the Content property set to null. Is this a permission problem?
I use OAuth2 to get the permissions. The code is like this:
I get the Access token and Refresh token with no problem, then i made the search with:Code:OAuth2Operations oauthOperations = googleConnectionFactory.getOAuthOperations(); OAuth2Parameters params = new OAuth2Parameters(); params.setRedirectUri(applicationUrl + GOOGLE_REDIRECT_URI); params.setScope("https://www.googleapis.com/auth/plus.me https://www.google.com/m8/feeds/ https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"); params.set("access_type", "offline"); params.set("approval_prompt","force"); String authorizeUrl = oauthOperations.buildAuthorizeUrl( GrantType.AUTHORIZATION_CODE, params );
The transformer contains this transform method:Code:List<Publication> activities = new ArrayList<Publication>(); ActivityQueryBuilder searchResult = google.activityOperations().activityQuery(); searchResult.searchFor(query); ActivitiesPage page = searchResult.getPage(); List<? extends Activity> activityList = page.getItems(); activities.addAll( (List<Publication>) CollectionUtils.collect( activityList, new ActivityToPublicationTransformer() ) );
When I debug the application, the instrucction "activity.getContent()" in the transformer returns me null, but activity.getPublished() or activity.getId() works fine.Code:public Object transform(Object input) { Publication publication = null; if (input instanceof Activity){ User user = new User(); Activity activity = (Activity) input; publication = new Publication(); publication.setPublicationId(activity.getId()); publication.setType( PublicationType.ACTIVITY ); publication.setSocialNetwork( SocialNetwork.GOOGLE ); user.setName(activity.getActor().getDisplayName()); user.setUserId(activity.getActor().getId()); publication.setUser(user); publication.setMessage(activity.getContent()); publication.setCreatedTime(activity.getPublished()); publication.setShares(activity.getResharers()); publication.setComments(activity.getReplies()); publication.setAttentions( new ArrayList<Attention>() ); } return publication; }
Any hint about what am i doing wrong?
Is there any page with the JavaDoc of spring-social-google? I searched it but i didn't find it
P.D. Sorry mi bad english, it's not my natural language.
P.D.2 I just realized I wrote wrong the title, it should begin with "Spring Social Google" not "Spring Social Web", could an admin change the title?


Reply With Quote
