-
-
Notifications
You must be signed in to change notification settings - Fork 563
XWIKI-21417: BaseObject#set always set the metadata dirty flag of the owner doc to true #4064
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
base: master
Are you sure you want to change the base?
Conversation
… owner doc to true * Provide a new API to retrieve current property or create a new one, use that call in all fromString and fromStringArray methods
...m-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/objects/classes/PropertyClass.java
Outdated
Show resolved
Hide resolved
… owner doc to true * Introduce new generic APIs allowing to set given BaseProperty values and provide implementations
* Retrieve the already existing base property based on current name, or create a new one. | ||
* | ||
* @return the existing {@link BaseProperty} or a new one. | ||
* @since 17.3.0RC1 |
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.
To be updated.
@@ -366,7 +366,7 @@ public void set(String fieldname, java.lang.Object value, XWikiContext context) | |||
PropertyClass pclass = (PropertyClass) bclass.get(fieldname); | |||
BaseProperty prop = (BaseProperty) safeget(fieldname); | |||
if ((value instanceof String) && (pclass != null)) { | |||
prop = pclass.fromString((String) value); | |||
prop = pclass.fromString((String) value, prop); |
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 not sure it's really the cleanest code in general, it's good to reuse the property, but it's a bit strange to re-put it in the object.
@Unstable | ||
protected BaseProperty getCurrentOrNewProperty(BaseProperty property) | ||
{ | ||
return (property != null) ? property : newProperty(); |
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.
It might be outside the scope of this issue, but I'm wondering if the xclass should "auto-repair" the property if it does not have the right type. Right now, the following code might fail if getCurrentOrNewProperty
gives a property of the wrong type (compared to the previous situation where that code was expecting to always get a new property).
Jira URL
Changes
Description
Clarifications
Screenshots & Video
Executed Tests
Ran
mvn clean install -Pquality
on both oldcore and legacy-oldcore and executed docker test inxwiki-platform-appwithinminutes-test-docker
.Expected merging strategy