|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.xpn.xwiki.objects.BaseElement<R>
public abstract class BaseElement<R extends EntityReference>
Base class for representing an element having a name (either a reference of a free form name) and a pretty name.
Field Summary | |
---|---|
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 EntityReferenceSerializer<String> |
localEntityReferenceSerializer
Used to convert a proper Document Reference to a string but without the wiki name. |
protected XWikiDocument |
ownerDocument
The owner document, if this element was obtained from a document. |
protected R |
referenceCache
Full reference of this element. |
Constructor Summary | |
---|---|
BaseElement()
|
Method Summary | |
---|---|
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)
|
DocumentReference |
getDocumentReference()
|
long |
getId()
Return an truncated MD5 hash of the local key computed in getLocalKey() . |
protected String |
getLocalKey()
|
protected EntityReferenceSerializer<String> |
getLocalUidStringEntityReferenceSerializer()
|
String |
getName()
Note that this method is used by Hibernate for saving an element. |
XWikiDocument |
getOwnerDocument()
|
String |
getPrettyName()
|
R |
getReference()
|
int |
hashCode()
|
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)
Note that this method is used by Hibernate for loading an element. |
void |
setOwnerDocument(XWikiDocument ownerDocument)
Set the owner document of this element. |
void |
setPrettyName(String name)
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.xpn.xwiki.objects.ElementInterface |
---|
toString |
Field Detail |
---|
protected R extends EntityReference referenceCache
protected DocumentReference documentReference
protected transient XWikiDocument ownerDocument
protected EntityReferenceSerializer<String> localEntityReferenceSerializer
Constructor Detail |
---|
public BaseElement()
Method Detail |
---|
public R getReference()
getReference
in interface ElementInterface
protected R createReference()
public DocumentReference getDocumentReference()
getDocumentReference
in interface ElementInterface
public String getName()
getName
in interface ElementInterface
BaseProperty
).ElementInterface.getName()
public void setDocumentReference(DocumentReference reference)
setDocumentReference
in interface ElementInterface
public void setName(String name)
setName
in interface ElementInterface
ElementInterface.setName(java.lang.String)
public String getPrettyName()
public void setPrettyName(String name)
protected EntityReferenceSerializer<String> getLocalUidStringEntityReferenceSerializer()
protected String getLocalKey()
hashCode()
.public long getId()
getLocalKey()
.
public void setId(long id)
id
- the identifier assigned by hibernate.public int hashCode()
hashCode
in class Object
public boolean equals(Object el)
equals
in class Object
public BaseElement clone()
clone
in class Object
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
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 reportpublic boolean apply(ElementInterface newElement, boolean clean)
ElementInterface
apply
in interface ElementInterface
newElement
- 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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |