You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rave.apache.org by "Fernando Pinhati (JIRA)" <ji...@apache.org> on 2012/05/08 16:37:51 UTC

[jira] [Resolved] (RAVE-599) OpenSocial query for listing viewer friends returns always zero results

     [ https://issues.apache.org/jira/browse/RAVE-599?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Fernando Pinhati resolved RAVE-599.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 0.12
                   0.11

patch already commited (r1334111).
                
> OpenSocial query for listing viewer friends returns always zero results
> -----------------------------------------------------------------------
>
>                 Key: RAVE-599
>                 URL: https://issues.apache.org/jira/browse/RAVE-599
>             Project: Rave
>          Issue Type: Bug
>          Components: rave-opensocial-provider
>    Affects Versions: 0.11
>         Environment: Windows 7, Tomcat 7
>            Reporter: Fernando Pinhati
>            Priority: Minor
>              Labels: opensocial
>             Fix For: 0.11, 0.12
>
>
> OSAPI query for retrieving friends is not returning any records.
> It seems to be a problem between DefaultPersonService and its connections with PersonRepository and Person classes. Inside the DefaultPersonService, the userID (instead of the username) is passed as the USERNAME parameter, necessary to the named query Person.FIND_FRIENDS_BY_USERNAME. Hence, the query will always results in an empty dataset.
> I've fixed it passing the username to the PersonRepository findFriends method, but I don't know if it's the better solution (I've started to study Rave about a week ago).
> See the example bellow:
> JS call:
>      osapi.people.get({userId: '@viewer', groupId: '@friends'}).execute(listFriends);
> calls DefaultPersonService.getUniqueListOfFriends method:
>       for (UserId id : userIds) {
>             //ORIGINAL CODE: passes the userID to the repository object
>             //CollectionUtils.addUniqueValues(getFriendsFromRepository(collectionOptions, token.getAppId(), id.getUserId(token)), people);
>             
>             //MY WORKARROUND CODE...: passes the username to the repository object
>             org.apache.rave.portal.model.Person person = this.getPersonForId(id, token);
>             CollectionUtils.addUniqueValues(getFriendsFromRepository(collectionOptions, token.getAppId(), person.getUsername()), people);
>         }
> NamedQuery called:
>        @NamedQuery(name = Person.FIND_FRIENDS_BY_USERNAME, query = "select a.followed from PersonAssociation a where a.follower.username = :username")
>      

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira