I think the handler is wrong.
Although the URL is pointing to the person profile of the current user /people/@me/@self The query is selecting the friend collection within that person and filtering it by the supplied user ID.

ie is someUserId one of the current users friends ?

The implementation is just getting the person object and completely ignoring the filter on the friends collection.
IMHO, the PersonHandler needs to be fixed.

Naturally the bare url should return the person, so getPerson() is valid.

In the light of the above, the PersonService might also be lacking, I hope to get some time soon to do some 0.9 work.

Ian


On 6 Feb 2009, at 09:10, Ben Smith wrote:

Been thinking about this some more (and talking it over with Chico).

I can see why you need getPeople() and getPerson() methods exposed from the PersonService, as these help adhere to the response specifications for a single person object and a collection of entities.

Therefore, to adhere to the spec, we need to be able to pass down the CollectionOptions to the getPerson() function so that the PersonService can filter the output. It would be a little confusing to pass down 'Collection' options to something that returns a single object, so I guess that object should be renamed. You could split off the collection related options and filter options, but I think that would just be annoying.

Anyone have an opinion?

Cheers,
Ben Smith
BBC

On 5/2/09 13:39, Ben Smith wrote:
I'm currently getting our service layer to comply with the filtering options described: http://opensocial-resources.googlecode.com/svn/spec/draft/REST-API.xml#standardQueryParameters

This is particularly because I need to be able to support calls like: /people/@me/@self? filter...@friends&filterOp=contains&filterValue=<someUserId>

The problem is that PersonService defines a getPerson method that does not use CollectionOptions and PersonHandler will always call getPerson for that URL:
if (userIds.size() == 1) {
     if (optionalPersonId.isEmpty()) {
       if (groupId.getType() == GroupId.Type.self) {
return personService.getPerson(userIds.iterator().next(), fields, request.getToken());

Does anyone have a strategy for dealing with this? Would it be such a bad thing if PersonService only exposed getPeople()?

Cheers,
Ben Smith
BBC


Reply via email to