-
-
Notifications
You must be signed in to change notification settings - Fork 599
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,10 +191,28 @@ public String toString(BaseProperty property) | |
|
||
@Override | ||
public BaseProperty fromString(String value) | ||
{ | ||
return fromString(value, null); | ||
} | ||
|
||
@Override | ||
public BaseProperty fromString(String value, BaseProperty baseProperty) | ||
{ | ||
return null; | ||
} | ||
|
||
/** | ||
* 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 commentThe reason will be displayed to describe this comment to others. Learn more. To be updated. |
||
*/ | ||
@Unstable | ||
protected BaseProperty getCurrentOrNewProperty(BaseProperty property) | ||
{ | ||
return (property != null) ? property : newProperty(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
} | ||
|
||
public BaseProperty newPropertyfromXML(Element ppcel) | ||
{ | ||
String value = ppcel.getText(); | ||
|
@@ -696,7 +714,12 @@ public void setDisabled(boolean disabled) | |
|
||
public BaseProperty fromStringArray(String[] strings) | ||
{ | ||
return fromString(strings[0]); | ||
return fromStringArray(strings, null); | ||
} | ||
|
||
public BaseProperty fromStringArray(String[] strings, BaseProperty baseProperty) | ||
{ | ||
return fromString(strings[0], baseProperty); | ||
} | ||
|
||
public boolean isValidColumnTypes(Property hibprop) | ||
|
@@ -707,7 +730,13 @@ public boolean isValidColumnTypes(Property hibprop) | |
@Override | ||
public BaseProperty fromValue(Object value) | ||
{ | ||
BaseProperty property = newProperty(); | ||
return fromValue(value, null); | ||
} | ||
|
||
@Override | ||
public BaseProperty fromValue(Object value, BaseProperty baseProperty) | ||
{ | ||
BaseProperty property = getCurrentOrNewProperty(baseProperty); | ||
if (property != null) { | ||
property.setValue(value); | ||
return property; | ||
|
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.