-
-
Notifications
You must be signed in to change notification settings - Fork 554
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
XWIKI-22702: Provide parentType information in EntityReference #3698
Conversation
...c/main/java/org/xwiki/model/internal/reference/AbstractReferenceEntityReferenceResolver.java
Outdated
Show resolved
Hide resolved
...-model/xwiki-platform-model-api/src/main/java/org/xwiki/model/reference/EntityReference.java
Outdated
Show resolved
Hide resolved
...-model/xwiki-platform-model-api/src/main/java/org/xwiki/model/reference/EntityReference.java
Show resolved
Hide resolved
...-model/xwiki-platform-model-api/src/main/java/org/xwiki/model/reference/EntityReference.java
Outdated
Show resolved
Hide resolved
...est/java/org/xwiki/model/internal/reference/DefaultReferenceEntityReferenceResolverTest.java
Outdated
Show resolved
Hide resolved
7ab07dd
to
f9bf262
Compare
this.parameters = null; | ||
} | ||
} | ||
} | ||
|
||
private void setParentTypeParameter(Serializable value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that I hesitated here between silently ignoring the arguments or throwing an IllegalArgumentException when there was a parent or when the value wasn't an allowed parent type. I decided to go for the silent solution because it's easier to create a reference by using EntityReference#replaceParent (which is what we use in the resolver): the parameter is just automatically ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also perform this kind of silent ignore for the locale parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
silent ignore for the locale parameter
Not really, if the format of the locale String is wrong, you will get an IllegalArgumentException
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I improved a bit the method to have more checks. Note that I'm still skipping setting the parameter value is parent != null, but this check remains silent. wdyt @tmortagne ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with the silent ignore when value != null && getParent() == null
.
* Provide EntityReference#getParentType * Use it in AbstractReferenceEntityReferenceResolver * Provide a new test
* Use the new information in RelativeStringEntityReferenceResolver * Fix tests
f9bf262
to
1835f09
Compare
* revert some changes from last commit * add more explanatory tests
* Change the parameter name * Improve a bit the checks when setting the fallbackParentType parameter value
...-model/xwiki-platform-model-api/src/main/java/org/xwiki/model/reference/EntityReference.java
Outdated
Show resolved
Hide resolved
* use back parentType parameter key name
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-stable-16.10.x stable-16.10.x
# Navigate to the new working tree
cd .worktrees/backport-stable-16.10.x
# Create a new branch
git switch --create backport-3698-to-stable-16.10.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 c5b9c6051462122a37d8e7001c4776abed599ea8
# Push it to GitHub
git push --set-upstream origin backport-3698-to-stable-16.10.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-stable-16.10.x Then, create a pull request where the |
* Provide EntityReference#getParentType * Use it in AbstractReferenceEntityReferenceResolver * Provide a new test * add more explanatory tests * Improve a bit the checks when setting the fallbackParentType parameter value * use back parentType parameter key name (cherry picked from commit c5b9c60)
* Provide EntityReference#getParentType * Use it in AbstractReferenceEntityReferenceResolver * Provide a new test * add more explanatory tests * Improve a bit the checks when setting the fallbackParentType parameter value * use back parentType parameter key name (cherry picked from commit c5b9c60)
Jira URL
https://jira.xwiki.org/browse/XWIKI-22702
Changes
Description
Clarifications
Screenshots & Video
Executed Tests
Expected merging strategy
*