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

Controlled Vocabulary: Provide ability to store the id of a controlled vocabulary node and offer localized labels using cv.xml files per locale #9318

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

mahnkong
Copy link

@mahnkong mahnkong commented Feb 9, 2024

References

Add references/links to any related issues or PRs. These may include:

Description

This PR fixes #9317. With this PR it is possible to use localized controlled vocabularies by having a controlled vocabulary file per locale (and fallback to english in case the current locale was not supported) Additionally, this PR provides the feature to store the id of a controlled vocabulary node instead of the label (configurable per controlled vocabulary)

Instructions for Reviewers

List of changes in this PR:

  • First, with this PR it is possible to use localized controlled vocabularies by having a controlled vocabulary file per locale (and fallback to english in case the current locale was not supported)
    In order to support the localized controlled vocabularies, the init method of the class org.dspace.content.authority.DSpaceControlledVocabulary was enhanced to receive the current locale. (The public methods of that class already received the locale, so we simply pass the value to init) Inside the init method, a logic similar to DSpace6 was implemented. The method checks for existance of a file named <CONTROLLED_VOCABULARY>_<LOCALE>.xml - where <CONTROLLED_VOCABULARY> is the name of the controlled vocabulary and <LOCALE> is the current locale. If that file exists, it is used to contruct the controlled vocabulary. Otherwise, a fallback to the "standard" controlled vocabulary file <CONTROLLED_VOCABULARY>.xml is made.

  • Second, In order to support the optional storage of id instead of label value, a new configuration option per controlled vocabulary was introduced: vocabulary.plugin.<CONTROLLED_VOCABULARY>.storeIDs - where <CONTROLLED_VOCABULARY> is the name of the controlled vocabulary. The class org.dspace.content.authority.DSpaceControlledVocabulary was enhanced to consider the new configuration option and use id attribute instead of label attribute when constructing the choice based on the xml node.

Include guidance for how to test or review your PR. This may include: steps to reproduce a bug, screenshots or description of a new feature, or reasons behind specific changes.

The DSpaceControlledVocabularyTest test class was updated with test methods covering the PR changes. This, together with the change description above covers the configurations required to use the PR changes.

Checklist

This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome). If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!

  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & integration tests). Exceptions may be made if previously agreed upon.
  • My PR passes Checkstyle validation based on the Code Style Guide.
  • My PR includes Javadoc for all new (or modified) public methods and classes. It also includes Javadoc for large or complex private methods.
  • My PR passes all tests and includes new/updated Unit or Integration Tests based on the Code Testing Guide.
  • If my PR includes new libraries/dependencies (in any pom.xml), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR modifies REST API endpoints, I've opened a separate REST Contract PR related to this change.
  • If my PR includes new configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

…er localized labels using cv.xml files per locale
@tdonohue tdonohue added component: controlled vocabulary Related to internal controlled vocabulary system improvement labels Feb 9, 2024
@mahnkong mahnkong marked this pull request as ready for review February 9, 2024 16:14
@github-actions github-actions bot added the merge conflict PR has a merge conflict that needs resolution label Feb 29, 2024
Copy link

Hi @mahnkong,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

@github-actions github-actions bot added merge conflict PR has a merge conflict that needs resolution and removed merge conflict PR has a merge conflict that needs resolution labels Mar 1, 2024
Copy link

github-actions bot commented Mar 4, 2024

Hi @mahnkong,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

@github-actions github-actions bot removed the merge conflict PR has a merge conflict that needs resolution label Mar 6, 2024
@mahnkong mahnkong force-pushed the issue-9317 branch 2 times, most recently from 4cae55b to 97bb9e2 Compare March 19, 2024 12:07
Copy link
Contributor

@paulo-graca paulo-graca left a comment

Choose a reason for hiding this comment

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

Thank you @mahnkong, for adding this!

@mahnkong
Copy link
Author

just merged latest main into feature branch and corrected errors due to new changes in DSpaceControlledVocabulary.java which required adjustments to be compatible to changes introduced in this feature branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: controlled vocabulary Related to internal controlled vocabulary system improvement
Projects
Status: 👀 Under Review
3 participants