public abstract class BaseElement<R extends EntityReference> extends Object implements ElementInterface, Serializable
| Modifier and Type | Field and Description |
|---|---|
protected DocumentReference |
documentReference
Reference to the document in which this element is defined (for elements where this make sense, for example for
an XClass or a XObject).
|
protected XWikiDocument |
ownerDocument
The owner document, if this element was obtained from a document.
|
protected R |
referenceCache
Full reference of this element.
|
| Constructor and Description |
|---|
BaseElement() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
apply(ElementInterface newElement,
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.
|
BaseElement |
clone() |
protected R |
createReference() |
boolean |
equals(Object el) |
protected void |
fromXML(org.dom4j.Element oel) |
void |
fromXML(String source) |
DocumentReference |
getDocumentReference() |
long |
getId()
Return an truncated MD5 hash of the local key computed in
getLocalKey(). |
protected EntityReferenceSerializer<String> |
getLocalEntityReferenceSerializer() |
protected ContextualLocalizationManager |
getLocalization() |
protected String |
getLocalKey() |
protected EntityReferenceSerializer<String> |
getLocalUidStringEntityReferenceSerializer() |
protected MergeManager |
getMergeManager() |
String |
getName() |
XWikiDocument |
getOwnerDocument() |
String |
getPrettyName() |
R |
getReference() |
protected XWikiContext |
getXWikiContext()
Get XWiki context from execution context.
|
int |
hashCode() |
protected String |
localizePlain(String key,
Object... parameters) |
protected String |
localizePlainOrKey(String key,
Object... parameters) |
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.
|
void |
setDocumentReference(DocumentReference reference) |
void |
setId(long id)
Dummy function, do hibernate is always happy.
|
void |
setName(String name) |
void |
setOwnerDocument(XWikiDocument ownerDocument)
Set the owner document of this element.
|
void |
setPrettyName(String name) |
String |
toString() |
protected org.dom4j.Element |
toXML() |
String |
toXMLString(boolean format) |
protected R extends EntityReference referenceCache
protected DocumentReference documentReference
protected transient XWikiDocument ownerDocument
protected MergeManager getMergeManager()
public R getReference()
getReference in interface ElementInterfaceprotected R createReference()
public DocumentReference getDocumentReference()
getDocumentReference in interface ElementInterfacepublic String getName()
Note that this method is used by Hibernate for saving an element.
getName in interface ElementInterfaceBaseProperty).ElementInterface.getName()public void setDocumentReference(DocumentReference reference)
setDocumentReference in interface ElementInterfacepublic void setName(String name)
Note that this method is used by Hibernate for loading an element.
setName in interface ElementInterfaceElementInterface.setName(java.lang.String)public String getPrettyName()
public void setPrettyName(String name)
protected EntityReferenceSerializer<String> getLocalUidStringEntityReferenceSerializer()
protected EntityReferenceSerializer<String> getLocalEntityReferenceSerializer()
protected ContextualLocalizationManager getLocalization()
protected String getLocalKey()
hashCode().public long getId()
getLocalKey().public void setId(long id)
id - the identifier assigned by hibernate.public BaseElement clone()
public void merge(ElementInterface previousElement, ElementInterface newElement, MergeConfiguration configuration, XWikiContext context, MergeResult mergeResult)
ElementInterfaceAll 3 elements are supposed to have the same class and reference.
merge in interface ElementInterfacepreviousElement - 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 reportpublic boolean apply(ElementInterface newElement, boolean clean)
ElementInterfaceapply in interface ElementInterfacenewElement - 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 void setOwnerDocument(XWikiDocument ownerDocument)
ownerDocument - The owner document.public XWikiDocument getOwnerDocument()
protected XWikiContext getXWikiContext()
protected void fromXML(org.dom4j.Element oel)
throws XWikiException
XWikiExceptionpublic void fromXML(String source) throws XWikiException
source - the XML to readXWikiException - when failing to parse XMLprotected org.dom4j.Element toXML()
public String toXMLString(boolean format)
format - true if the XML should be formatedpublic String toString()
toString in interface ElementInterfacetoString in class ObjectCopyright © 2004–2021 XWiki. All rights reserved.