Access class created in core from a module.

Hello, everyone!

I have created a package in core, added some classes and I wish to access them from the adminui-module.
One attempt I used is changing the version of openmrs in adminui-module pom file to <openMRSVersion>2.5.0-SNAPSHOT</openMRSVersion>
This seams to work, but it calls for the need to refactor some method logic and classes.

Is there any other way of accessing those classes in adminui module as above without changing the OpennmrVersion in the module.
Thank you so much.

cc @ibacher @sharif @kdaud @reagan

Which methods and classes for example? Could they have been deprecated?

1 Like

Actually, @reagan I am trying to migrate the class CurrentUsers.java to core. I have changed the class to map a string to a list of HttpSession objects.

None of the classes or methods has the @Deprecated annotation.
Thank you!

Adminui module is depending on openmrs-module-adminui/pom.xml at master · openmrs/openmrs-module-adminui · GitHub platform version, i guess when you have new classes in 2.5.0-snapshot version, you might not be able to access them in current adminui module.

Have you tried to increase platform version in adminui module and see if you can access those methods

You will need to upgrade the openmrsVersion in adminui module to be able to access those methods.

Yes, this really works but only 2.5.0-Snapshot works for me. How i wish there was another alternative.

Is there a limitation for you using that option, Not exactly sure whether you can depend on a module without using the versioning dependency approach. cc @dkayiwa @reagan

The only limitation around is refactoring almost all classes… I was just inquiring if there is another better solution

Would this strategy help you? RESTWS-835: Add LoggedInUsersController2_0 (#497) · openmrs/openmrs-module-webservices.rest@d2d8f41 · GitHub

2 Likes

Thank you for the example @dkayiwa RESTWS-835: Add LoggedInUsersController2_0 (#497) · openmrs/openmrs-module-webservices.rest@d2d8f41 · GitHub has really helped me coming up with MM-918: Close all user sessions after password change and on logout by jnsereko · Pull Request #171 · openmrs/openmr