Skip to content

Comments

Update util classes#7657

Merged
kcondon merged 20 commits intoIQSS:developfrom
GlobalDataverseCommunityConsortium:SPO/7649_micro
Mar 23, 2021
Merged

Update util classes#7657
kcondon merged 20 commits intoIQSS:developfrom
GlobalDataverseCommunityConsortium:SPO/7649_micro

Conversation

@qqmyers
Copy link
Member

@qqmyers qqmyers commented Mar 5, 2021

What this PR does / why we need it: Gives BrandingUtil, MailUtil and JsonPrinter access to services they require instead of having to have callers send the services or the results of the calls (such as the root dataverse name) to the server as method parameters. This is basically clean-up but also preparation for #7387.

Most of the PR is making the simplifications possible made possible by that - i.e. dropping method params that aren't needed. One additional change was to remove local code to find the rootDataverseName in DatasetVersion and JsonPrinter that were only used to get the name so it could be passed to BrandingUtil.

Also added the same design to OREMap to avoid having to send settingsService through the ExportService.

There are also changes to update tests - removing parameters and adding mock services.

Which issue(s) this PR closes:

Closes #7649

Special notes for your reviewer: FWIW: I think the lack of mocks in tests initially made me think that I couldn't keep static methods, but injecting a static service does work and I was able to avoid having to inject the util classes everywhere (as discussed in the issue)

Suggestions on how to test this: This should change anything w.r.t. functionality, and it shouldn't add new functionality (a PR for #7387 needs the changes here and will add new functionality). The one potential issue I can see would be that some calls to get the root dataverse name that were done by traversing the chain of owners are now replaced with a call to find the root Dataverse from the db. If that results in a measurable performance difference, adding some simple caching to the call to get the name could be done. (I didn't want to add that to this PR without reason, but it could be added here or as a quick follow-on PR.)

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

Is there a release notes update needed for this change?:

Additional documentation:

@qqmyers qqmyers added the GDCC: SciencesPO related to GDCC work for Sciences PO label Mar 5, 2021
@scolapasta scolapasta self-assigned this Mar 5, 2021
Copy link
Contributor

@scolapasta scolapasta left a comment

Choose a reason for hiding this comment

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

Overall, looks as we discussed. Just had one comment and one question.

qqmyers added 4 commits March 6, 2021 11:37
Note - a similar test will reappear when BrandingUtil supports a
property that can replace the rootDataverseName for
getInstallationBrandName()
@qqmyers
Copy link
Member Author

qqmyers commented Mar 6, 2021

@scolapasta - FYI - I made similar changes to avoid settingsService getting passed through the ExportService since you last looked at this. With that I think this is done.


//Convenience to access root name without injecting dataverseService (e.g. in DatasetVersion)
public static String getRootDataverseCollectionName() {
return dataverseService.getRootDataverseName();
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we do this more consistent then and go for changing the function in DataverseServiceBean, too? (I am aware of the consequences)

@scolapasta scolapasta self-assigned this Mar 15, 2021
Copy link
Contributor

@scolapasta scolapasta left a comment

Choose a reason for hiding this comment

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

Discussed with @qqmyers. Longer term we want to get rid of the Helpers and make these Stateless EJBs, but for this contains several big steps getting us there AND unblocks SciencesPO work. So we'll move forward and create an issue for the next steps.

@scolapasta scolapasta removed their assignment Mar 22, 2021
@kcondon kcondon self-assigned this Mar 23, 2021
@kcondon
Copy link
Contributor

kcondon commented Mar 23, 2021

Suggested regression testing places were:m where root dv name is fetched and excluding email from export. Have found email exclude is not working. root name is.

@kcondon kcondon assigned qqmyers and unassigned kcondon Mar 23, 2021
@kcondon kcondon merged commit c86dae5 into IQSS:develop Mar 23, 2021
@kcondon kcondon assigned kcondon and unassigned qqmyers Mar 23, 2021
@djbrooke djbrooke added this to the 5.4 milestone Mar 23, 2021
@qqmyers qqmyers changed the title @Singleton util classes Update util classes Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GDCC: SciencesPO related to GDCC work for Sciences PO

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace static calls with @Inject-able classes

5 participants