Skip to content
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

META-224:Exporting metadata packages on-the-fly should not require yo… #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

reagan-meant
Copy link
Contributor

META-224:Exporting metadata packages on-the-fly should not require you to specify ids/uuids of existing items. Left legacy compatibility when they are specified
https://issues.openmrs.org/browse/META-224

@@ -226,7 +227,18 @@ public void getNewPackage(@RequestParam(required = false)
}
}
}
}
if(uuids==null && ids==null && modifiedSince!=null) {
Copy link
Member

@mozzy11 mozzy11 Oct 31, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reagan-meant , wont you also need to check whether type is not null ??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mozzy11 type has to always be specified...it isn't optional

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we actually can allow modifiedSince to be null... in which case it would fetch all objects of a certain type.

}
if(uuids==null && ids==null && modifiedSince!=null) {
List<Object> items=Handler.getItems(type, true, null, null, null);
if (items != null) {
Copy link
Member

@mozzy11 mozzy11 Oct 31, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you have to hard code the boolean includeRetired to true ? . i would think we could have it as a variable that has a default behaviour may be false
but can also optionally be configurable via the URL ie

http://localhost:8080/openmrs/ws/rest/metadatasharing/package/new.form?type=org.openmrs.Concept&modifiedSince=01/01/2012&IncludeRetired=True

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mozzy11 That makes sense...I will change to that...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mozzy11 How is this now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya looks fine

@reagan-meant reagan-meant force-pushed the META-224 branch 2 times, most recently from 295dad4 to fc0cc85 Compare November 3, 2019 10:21
Copy link
Member

@mogoodrich mogoodrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment, but generally looks good me!

Also, do we currently have a "real-world" user for this use case? It would be good to have someone test it will real data.

@@ -226,7 +227,18 @@ public void getNewPackage(@RequestParam(required = false)
}
}
}
}
if(uuids==null && ids==null && modifiedSince!=null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we actually can allow modifiedSince to be null... in which case it would fetch all objects of a certain type.

@reagan-meant
Copy link
Contributor Author

@mogoodrich I have included your new suggestion of modifiedSince being null and given a detailed description in the issue's comments

Copy link
Member

@mogoodrich mogoodrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks @mozzy11 !

I can go ahead and merge if there are no objections?

@mozzy11
Copy link
Member

mozzy11 commented Nov 14, 2019

sure look fine. no objections

@reagan-meant
Copy link
Contributor Author

I am delighted to hear that and thanks for the guidance too @mogoodrich @mozzy11

Copy link
Member

@mogoodrich mogoodrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, took me a while to get to this... I made one suggestion for an optimization, but otherwise looks good to me! Thanks @reagan-meant !

List<Object> items=Handler.getItems(type, includeRetired, null, null, null);
if (items != null) {
for(Object item: items ) {
if (OpenmrsUtil.compareWithNullAsEarliest(Handler.getDateChanged(item),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we modify this test to be if "modifiedSince == null || OpenmrsUtil.compareWithNullAsEarliest...". Then we should be able to get rid of the second block (lines 241 thru 248) entirely?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mogoodrich I will make the changes shortly...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @reagan-meant !

@reagan-meant
Copy link
Contributor Author

@mogoodrich Does this suffice?

Copy link
Member

@mogoodrich mogoodrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @reagan-meant !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants