-
Notifications
You must be signed in to change notification settings - Fork 521
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
RESTWS-939: DiagnosisResource should support formFieldPath property #609
Conversation
@samuelmale @mseaton @dkayiwa please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My first reaction is that I would you think you could accomplish adding this support without adding a new omod-2.5 submodule. As far as I can see in the code, you never access this property directly, only via reflection (via the string property name). You should be able to simply wrap those statements in a check as to whether version 2.5+ of core is running, rather than have an entire new submodule to support.
If we do find we need to keep the submodule, then I have feedback about changes that would be needed, but I would think we can eliminate it altogether and keep this far simpler with just a few conditional changes to the existing DiagnosisResource2_2
79cabde
to
2c6aa6b
Compare
@@ -98,6 +99,9 @@ public void purge(Diagnosis diagnosis, RequestContext requestContext) throws Res | |||
public DelegatingResourceDescription getRepresentationDescription(Representation representation) { | |||
if (representation instanceof DefaultRepresentation) { | |||
DelegatingResourceDescription description = new DelegatingResourceDescription(); | |||
if (ModuleUtil.isOpenmrsVersionInVersions("2.5.* - 9.*")) { | |||
description.addProperty("formNamespaceAndPath"); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mseaton were you suggesting changes something like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this, yes. Obviously you'd need to test this resource against version < 2.5 and versions >= 2.5 to ensure it works. It would be nice if there were other convenience methods in ModuleUtil that allowed you to just pass in the minimum version, but if this is the best available, that's fine. I'd at least create a convenience method in this class and use that (eg. supportsFormNamespaceAndPath() { return ModuleUtil.isOpenmrsVersionInVersions("2.5.* - 9.*") }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any convenience methods I could use to test this resource against versions >= 2.5?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mseaton please review
fcae774
to
8761201
Compare
@IamMujuziMoses are you still working on this? |
@samuelmale Looks like @IamMujuziMoses asked for a re-review from @mseaton four days ago. However the PIH team is about to be gone all of next week. I think it would be helpful if you, @dkayiwa , @ibacher , or someone else who understands REST WS code could provide a review (including ensuring that the concerns Mike raised are addressed). |
I'm actually going to take the opposite view @mseaton took above. I think we should just create the 2.5 omod and go from there. Two reasons:
|
Code-wise, I think we're better-off exposing the |
05b4100
to
9181cb4
Compare
@ibacher please review |
public DelegatingResourceDescription getRepresentationDescription(Representation rep) { | ||
DelegatingResourceDescription description = super.getRepresentationDescription(rep); | ||
if (description != null) { | ||
description.addProperty("formNamespaceAndPath"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember, we want to expose formNamespace
and formPath
, not formNamespaceAndPath
9181cb4
to
3080439
Compare
3080439
to
35fa006
Compare
@ibacher Could you please re-review when you have the chance? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @IamMujuziMoses
Issue I worked on
see https://issues.openmrs.org/browse/RESTWS-939
Checklist: I completed these to help reviewers :)
My IDE is configured to follow the code style of this project.
No? Unsure? -> configure your IDE, format the code and add the changes with
git add . && git commit --amend
I have added tests to cover my changes. (If you refactored
existing code that was well tested you do not have to add tests)
No? -> write tests and add them to this commit
git add . && git commit --amend
I ran
mvn clean package
right before creating this pull request andadded all formatting changes to my commit.
No? -> execute above command
All new and existing tests passed.
No? -> figure out why and add the fix to your commit. It is your responsibility to make sure your code works.
My pull request is based on the latest changes of the master branch.
No? Unsure? -> execute command
git pull --rebase upstream master