Skip to content

Allow registering multiple InvoicedItemsProcessingService impls#1102

Open
labkey-adam wants to merge 5 commits intodevelopfrom
fb_pg_support
Open

Allow registering multiple InvoicedItemsProcessingService impls#1102
labkey-adam wants to merge 5 commits intodevelopfrom
fb_pg_support

Conversation

@labkey-adam
Copy link
Contributor

@labkey-adam labkey-adam commented Feb 14, 2026

Rationale

https://github.com/LabKey/kanban/issues/1577

We need to allow multiple modules to register a InvoicedItemsProcessingService impl. Provide a module at registration time and a container at retrieval time. Determine the impl to return based on active modules in the container.

Related Pull Requests

Copy link
Contributor

@labkey-martyp labkey-martyp left a comment

Choose a reason for hiding this comment

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

Not sure if you were ready for code review on this. We'll need register calls then in the client repos?

protected BillingTask(Factory factory, PipelineJob job)
{
super(factory, job);
_processingService = InvoicedItemsProcessingService.get(job.getContainer());
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we'll want to use EHR_BillingManager.get().getBillingContainer(getJob().getContainer());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we'll want to use EHR_BillingManager.get().getBillingContainer(getJob().getContainer());

Okay, I'll make that change. Not needed in EHR_BillingController.java?

Does relying on the registration module being active in the billing container make sense to you? IMO, this is more reliable than using folder type (which the old comment had suggested).

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah probably should use the billing container as described above in the controller too. I don't think it will matter on a production server, but will probably matter on our test servers.

I think using the active modules in that container makes sense for production and test. Production will probably set that module property site wide, but tests will need to set it at the container level.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then I should probably just move the EHR_BillingManager.get().getBillingContainer() call into get()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

...except that the interface can't see the manager. So never mind.

@labkey-adam
Copy link
Contributor Author

Not sure if you were ready for code review on this. We'll need register calls then in the client repos?

Yes, this PR references PRs in WNPRC and TNPRC that adjust registration. I've assigned you as reviewer to those.

-- ehr.Project.Created and ehr.Project.Modified are NULL on SQL Server but NOT NULL on PostgreSQL. Set the NULL values
-- and switch the columns to NOT NULL to match PostgreSQL.
UPDATE ehr.Project SET Created = diCreated WHERE Created IS NULL;
UPDATE ehr.Project SET Modified = diModified WHERE Modified IS NULL;
Copy link
Contributor

Choose a reason for hiding this comment

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

We could fall back on GETDATE() if the di columns are null. Unless we want to hard-fail the upgrade on a server that might not have values as a way of assessing real-world data.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. I added use of your favorite function, COALESCE().

{
return ServiceRegistry.get().getService(InvoicedItemsProcessingService.class);
// Return the service implementation based on the registering module being active in the provided container
return REGISTRATION_LIST.stream()
Copy link
Contributor

Choose a reason for hiding this comment

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

In some other EHR contexts, we use a module-dependency ordering to choose between something provided by the core EHR module and a center-specific module.

Here, I believe that the core EHR module would startup first, and therefore have register things first. Then center-specific modules would register. findFirst() means we'd resolve the core EHR version, if present. Consider switching to reverse the list or otherwise choose the other version.

Copy link
Contributor

Choose a reason for hiding this comment

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

I assumed we were just registering this in the center specific modules (not in any core EHR modules) so there would be just one service registered in the billing container for each center's project. I believe that would work for the test server with multiple EHR projects.

Copy link
Contributor

Choose a reason for hiding this comment

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

I assumed we were just registering this in the center specific modules (not in any core EHR modules) so there would be just one service registered in the billing container for each center's project. I believe that would work for the test server with multiple EHR projects.

I believe that's the current state in terms of what needs to be registered, but I'm advocating that we consider being consistent so we don't have to remember which one will win in scenarios like this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it. Makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Instead of reversing the list or stream every time, registration now uses addFirst()

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