Some strange behavior in the uiframework

When I was testing the fix for UIFR-199 and I noticed the following issues in the uiframework,

  • The framework doesn’t seem to work without the legacy ui module when running platform 2.0+ versions, why is this so? I would imagine it should given that we intend to throw away the legacy ui module some day.

  • Seems like I can’t have different copies of a controller, gsp, js or css file in different sub projects hoping the appropriate one will be loaded at runtime depending on the platform version.

This is not intentional. I guess that nobody had tested this scenario yet. I imagine there’s a small fix like conditionally loading some Spring MVC beans if the openmrs-core version is >=2.0 and the legacyui module is not running.

I wonder if the owa module has this same problem.

I’ll create a ticket so that the ui framework doesn’t need the legacy ui module when running 2.0+.

@darius any response about bullet 2 in my original post?

Not really. If UI Framework isn’t respecting conditionally-loaded beans or resources, that’s a problem. But I have no particular idea about where to look to fix it.

I want to think it’s a result of the module class loader implementation, the module class loader seems to return the first item it finds when loading classes/resources, meaning If have 2 controller versions with one in the 1.11.x sub project and the other in the 2.x sub project, it loads one of the 2 and not both and it would be the one it found first rather than a specific one. You would think annotating the classes with @OpenmrsProfile or conditional resource loading in the config.xml file would be a way to get around it but it didn’t work when I tried it.

I think we would also have to add a 2.0 sub project to uiframework because there is a certain class in the legacy UI module that registers some url mappings to the core openmrs servlet that are required to hook in the spring mvc framework stuff for it to work.

I would think the owas don’t work since they consume the rest api which is built around the spring MVC which I doubt that it works in 2.0 and uiframework without the legacy ui module.

@wyclif regarding bullet 2 in your original post, do you mean that https://github.com/openmrs/openmrs-module-allergyui/blob/master/web-1.9/src/main/java/org/openmrs/module/allergyui/page/controller/AllergiesPageController.java will be loaded when on platform 2.x instead of this? https://github.com/openmrs/openmrs-module-allergyui/blob/master/web-2.0/src/main/java/org/openmrs/module/allergyui/page/controller/AllergiesPageController.java

Yes, that’s what am implying, i tested this with a gsp, js and css and I think the same might be true for the controller, will have to test again and confirm.