New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue calling search methods using the annotation client #14

Closed
t106uhn opened this Issue Aug 27, 2014 · 5 comments

Comments

Projects
None yet
2 participants
@t106uhn

t106uhn commented Aug 27, 2014

I created a ResourceProvider and client with the following two search method signatures:

@Search
public List search(
@OptionalParam(name=Location.SP_NAME) StringParam theName,
) {}

@Search
public List searchById(
@RequiredParam(name = "_id") StringParam theId,
) {}

When calling "searchById" in the client, the fhir server ended up executing the "search" method. When I changed the name of the "search" method in the client and the ResourceProvider to something else (e.g. "seachByName") the issue went away. Note, the queryName search annotation attribute was not used. I think the fhir server gets confused when the method has a name of "search" and or when the parameter types are the same across multiple methods.

@t106uhn t106uhn changed the title from Issue with calling search methods with annotation client to Issue calling search methods using the annotation client Aug 27, 2014

@jamesagnew

This comment has been minimized.

Owner

jamesagnew commented Aug 27, 2014

Interesting.. Looks like if a method only has optional parameters, it will match any requests, even if they have parameters that aren't a part of the method's signature.

Will investigate.

@jamesagnew

This comment has been minimized.

Owner

jamesagnew commented Aug 27, 2014

Oh- even more, it's ignoring id because it ignores all parameters that start with "", since usually those have no bearing on which method to call (_format, _pretty, etc.)

No, how to fix this..... hmm.....

@t106uhn

This comment has been minimized.

t106uhn commented Aug 27, 2014

Hmm, interesting but how some it all works when I changed the method name from 'search' to something else?

From: James Agnew [mailto:notifications@github.com]
Sent: Wednesday, August 27, 2014 10:42 AM
To: jamesagnew/hapi-fhir
Cc: Acharya, Neal
Subject: Re: [hapi-fhir] Issue calling search methods using the annotation client (#14)

Oh- even more, it's ignoring id because it ignores all parameters that start with "", since usually those have no bearing on which method to call (_format, _pretty, etc.)

No, how to fix this..... hmm.....


Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-53582282.

This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient.
Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited.
If you have received this e-mail in error, please contact the sender and delete all copies.
Opinions, conclusions or other information contained in this e-mail may not be that of the organization.

@jamesagnew

This comment has been minimized.

Owner

jamesagnew commented Aug 27, 2014

The idea there is that once you have a query name associated with the method, it knows not to call that method unless the query name in the request matches.

Without the query name, the "search" method has only an optional parameter. That means that it will match URLs with that parameter, and URLs with no parameters. HAPI was treating any parameters with _ at the start as not existing (since search should still match URLs with _format or _pretty). Now it only ignores _format, _pretty, etc. instead of ignoring anything starting with _)

@t106uhn

This comment has been minimized.

t106uhn commented Aug 27, 2014

Just to be clear, I wasn't talking about the queryName annotation attribute. In my example neither method had it specified. But for some reason when I changed the method name from "search(...)" to "searchByName(...)" that seemed to solve the problem.

From: James Agnew [mailto:notifications@github.com]
Sent: Wednesday, August 27, 2014 1:38 PM
To: jamesagnew/hapi-fhir
Cc: Acharya, Neal
Subject: Re: [hapi-fhir] Issue calling search methods using the annotation client (#14)

The idea there is that once you have a query name associated with the method, it knows not to call that method unless the query name in the request matches.

Without the query name, the "search" method has only an optional parameter. That means that it will match URLs with that parameter, and URLs with no parameters. HAPI was treating any parameters with _ at the start as not existing (since search should still match URLs with _format or _pretty). Now it only ignores _format, _pretty, etc. instead of ignoring anything starting with _)


Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-53611168.

This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient.
Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited.
If you have received this e-mail in error, please contact the sender and delete all copies.
Opinions, conclusions or other information contained in this e-mail may not be that of the organization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment