Hi Fernando
Thanks for looking into it. Please submit a patch on the Review Board and someone from the team will look into it and get back to you. Thanks Venkat On 5/2/12 8:38 AM, "Fernando Pinhati (JIRA)" <[email protected]> wrote: >Fernando Pinhati created RAVE-599: >------------------------------------- > > Summary: 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 > > >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 above: >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(collectionOptio >ns, 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 > >
