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

EA-186 - Loosen providermanagement to an aware_of dependency #230

Merged
merged 17 commits into from
May 30, 2024
Merged

Conversation

mseaton
Copy link
Member

@mseaton mseaton commented May 29, 2024

No description provided.

@mseaton mseaton requested review from mogoodrich, dkayiwa and ibacher May 29, 2024 22:15
@@ -1,6 +1,6 @@
package org.openmrs.module.emrapi.account;

import org.openmrs.module.providermanagement.Provider;
import org.openmrs.Provider;
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a backwards-incompatible change to the ProviderIdentifierGenerator interface, though it now supports a broader, not narrower object, so should not pose any problems.

/**
* Provides an abstraction over Provider services
*/
@OpenmrsProfile(modules = {"!providermanagement"})
Copy link
Member Author

Choose a reason for hiding this comment

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

Provides an implementation of provider-related methods that are used when providermanagement is not installed. This would be where we'd implement logic to support setting roles on the core Provider object as Concept role, but that can be added in a separate PR if desired since that was not pre-existing functionality here.

@@ -0,0 +1,97 @@
package org.openmrs.module.emrapi.account.provider;
Copy link
Member Author

Choose a reason for hiding this comment

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

Provides an implementation of provider-related methods that are used when providermanagement is installed. This allows us to keep any references to providermanagement hidden behind this conditionally loaded bean. The setProviderRole method is the way it is as the method signature changed from ProviderRole to Object, and this allows supporting a wide range of possible values including bind parameters in controller requests.

@@ -125,21 +122,23 @@ public Provider getProvider() {
return provider;
}

public void setProviderRole(ProviderRole providerRole) {

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a necessary backwards-incompatibility on the get/set providerRole methods by broadening to Object as ProviderRole is not available when the providermanagement module is not installed.


import java.io.File;

public abstract class EmrApiContextSensitiveTest extends BaseModuleContextSensitiveTest {
Copy link
Member Author

Choose a reason for hiding this comment

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

For now, I just made all of the context-sensitive unit tests in the module extend this, which adds the providermanagement module in so that the module-specific version of the facade is activated, as the existing unit tests expect that to be there. If there is a straightforward to support both variations in the same unit test suite, please let me know. I was not able to get it working.

Copy link
Member

Choose a reason for hiding this comment

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

Just like you created BaseReportingTest in the previous pull request, shouldn't you rename this to something like BaseProvidermanagementTest?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because I make this the superclass of every context-sensitive test in the module, it felt more appropriate to name it this way.


@Override
public Object getProviderRole(Provider provider) {
return null;
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this also throw the same exception as setProviderRole?

Copy link
Member Author

Choose a reason for hiding this comment

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

The way I was seeing it, provider role is always null if the providermanagement module is not running. So why throw an exception? The setter is a different situation - the user is trying to set something and the module is unable to accommodate.

import static java.util.Collections.EMPTY_LIST;
import static java.util.Collections.reverseOrder;
import static java.util.Collections.sort;
import static java.util.Collections.*;
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Strange, I feel like my version of IntelliJ started doing wildcard imports again as well after I turned it off years ago.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

import static java.util.Collections.EMPTY_LIST;
import static java.util.Collections.reverseOrder;
import static java.util.Collections.sort;
import static java.util.Collections.*;
Copy link
Member

Choose a reason for hiding this comment

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

Strange, I feel like my version of IntelliJ started doing wildcard imports again as well after I turned it off years ago.

@mseaton mseaton merged commit 346b207 into master May 30, 2024
1 check passed
@mseaton mseaton deleted the EA-186 branch May 30, 2024 15:29
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