public class BaseProperty<R extends EntityReference> extends BaseElement<R> implements PropertyInterface, Serializable, Cloneable
documentReference, ownerDocument, referenceCache
Constructor and Description |
---|
BaseProperty() |
Modifier and Type | Method and Description |
---|---|
boolean |
apply(ElementInterface newProperty,
boolean clean)
Apply the provided element so that the current one contains the same informations and indicate if it was
necessary to modify it in any way.
|
BaseProperty<R> |
clone() |
protected void |
cloneInternal(BaseProperty clone)
Subclasses override this to copy values during cloning.
|
protected R |
createReference() |
boolean |
equals(Object el) |
String |
getClassType() |
Object |
getCustomMappingValue() |
long |
getId()
Return an truncated MD5 hash of the local key computed in
BaseElement.getLocalKey() . |
BaseCollection |
getObject() |
PropertyClass |
getPropertyClass(XWikiContext xcontext) |
Object |
getValue() |
int |
hashCode() |
boolean |
isValueDirty() |
void |
merge(ElementInterface previousElement,
ElementInterface newElement,
MergeConfiguration configuration,
XWikiContext context,
MergeResult mergeResult)
Apply a 3 ways merge on the current element based on provided previous and new version of the element.
|
protected void |
mergeValue(Object previousValue,
Object newValue,
MergeResult mergeResult)
Try to apply 3 ways merge on property value.
|
void |
setClassType(String type) |
void |
setId(long id)
Dummy function, do hibernate is always happy.
|
void |
setObject(BaseCollection object) |
void |
setOwnerDocument(XWikiDocument ownerDocument)
Set the owner document of this base property.
|
void |
setValue(Object value) |
void |
setValueDirty(boolean valueDirty) |
protected void |
setValueDirty(Object newValue)
Set the dirty flag if the new value isn't equal to the old value.
|
String |
toFormString() |
String |
toText() |
org.dom4j.Element |
toXML() |
String |
toXMLString()
Return a XML version of this collection.
|
fromXML, fromXML, getDocumentReference, getLocalEntityReferenceSerializer, getLocalization, getLocalKey, getLocalUidStringEntityReferenceSerializer, getMergeManager, getName, getOwnerDocument, getPrettyName, getReference, getXWikiContext, localizePlain, localizePlainOrKey, setDocumentReference, setName, setPrettyName, toString, toXMLString
finalize, getClass, notify, notifyAll, wait, wait, wait
getDocumentReference, getName, getReference, setDocumentReference, setName, toString
protected R createReference()
createReference
in class BaseElement<R extends EntityReference>
public BaseCollection getObject()
getObject
in interface PropertyInterface
public void setObject(BaseCollection object)
setObject
in interface PropertyInterface
public boolean equals(Object el)
equals
in class BaseElement<R extends EntityReference>
public long getId()
BaseElement
BaseElement.getLocalKey()
.getId
in interface PropertyInterface
getId
in class BaseElement<R extends EntityReference>
public void setId(long id)
BaseElement
setId
in interface PropertyInterface
setId
in class BaseElement<R extends EntityReference>
id
- the identifier assigned by hibernate.public int hashCode()
hashCode
in class BaseElement<R extends EntityReference>
public String getClassType()
public void setClassType(String type)
public BaseProperty<R> clone()
clone
in interface PropertyInterface
clone
in class BaseElement<R extends EntityReference>
protected void cloneInternal(BaseProperty clone)
clone
- The cloned value.public Object getValue()
public void setValue(Object value)
public org.dom4j.Element toXML()
toXML
in interface PropertyInterface
toXML
in class BaseElement<R extends EntityReference>
public String toFormString()
toFormString
in interface PropertyInterface
public String toText()
public String toXMLString()
The XML is not formated. to get formatted XML you can use BaseElement.toXMLString(boolean)
instead.
public Object getCustomMappingValue()
public void merge(ElementInterface previousElement, ElementInterface newElement, MergeConfiguration configuration, XWikiContext context, MergeResult mergeResult)
ElementInterface
All 3 elements are supposed to have the same class and reference.
merge
in interface ElementInterface
merge
in class BaseElement<R extends EntityReference>
previousElement
- the previous version of the elementnewElement
- the next version of the elementconfiguration
- the configuration of the merge Indicate how to deal with some conflicts use cases, etc.context
- the XWiki contextmergeResult
- the merge reportprotected void mergeValue(Object previousValue, Object newValue, MergeResult mergeResult)
previousValue
- the previous version of the valuenewValue
- the new version of the valuemergeResult
- merge reportpublic boolean apply(ElementInterface newProperty, boolean clean)
ElementInterface
apply
in interface ElementInterface
apply
in class BaseElement<R extends EntityReference>
newProperty
- the element to applyclean
- true if informations that are not in the new element should be removed (for example class properties
not in the new class)public boolean isValueDirty()
protected void setValueDirty(Object newValue)
newValue
- The new value.public void setValueDirty(boolean valueDirty)
valueDirty
- Indicate if the dirty flag should be set or cleared.public void setOwnerDocument(XWikiDocument ownerDocument)
setOwnerDocument
in class BaseElement<R extends EntityReference>
ownerDocument
- The owner document.public PropertyClass getPropertyClass(XWikiContext xcontext)
xcontext
- the XWiki ContextCopyright © 2004–2022 XWiki. All rights reserved.