Class BaseElement<R extends EntityReference>

    • Field Detail

      • referenceCache

        protected R extends EntityReference referenceCache
        Full reference of this element.
        Since:
        3.2M1
      • documentReference

        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).
        Since:
        5.3M1
      • ownerDocument

        protected transient XWikiDocument ownerDocument
        The owner document, if this element was obtained from a document.
        Since:
        5.3M1
    • Constructor Detail

      • BaseElement

        public BaseElement()
    • Method Detail

      • getMergeManager

        protected MergeManager getMergeManager()
        Returns:
        a merge manager instance.
        Since:
        11.8RC1
      • createReference

        protected R createReference()
        Since:
        3.2M1
      • getDocumentReference

        public DocumentReference getDocumentReference()
        Specified by:
        getDocumentReference in interface ElementInterface
        Returns:
        the reference to the document in which this element is defined (for elements where this make sense, for example for an XClass or a XObject).
      • getPrettyName

        public String getPrettyName()
      • setPrettyName

        public void setPrettyName​(String name)
      • getLocalUidStringEntityReferenceSerializer

        protected EntityReferenceSerializer<String> getLocalUidStringEntityReferenceSerializer()
        Returns:
        the component used to build uid string for the getId() hash
        Since:
        4.0M1
      • getLocalEntityReferenceSerializer

        protected EntityReferenceSerializer<String> getLocalEntityReferenceSerializer()
        Returns:
        the component used to convert a proper Document Reference to a string but without the wiki name.
        Since:
        6.3M1
      • localizePlainOrKey

        protected String localizePlainOrKey​(String key,
                                            Object... parameters)
      • getLocalKey

        protected String getLocalKey()
        Returns:
        a unique identifier representing this element reference to be used for hashCode().
        Since:
        4.0M1
      • getId

        public long getId()
        Return an truncated MD5 hash of the local key computed in getLocalKey().
        Returns:
        the identifier used by hibernate for storage.
        Since:
        4.0M1
      • setId

        public void setId​(long id)
        Dummy function, do hibernate is always happy.
        Parameters:
        id - the identifier assigned by hibernate.
        Since:
        4.0M1
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • merge

        public void merge​(ElementInterface previousElement,
                          ElementInterface newElement,
                          MergeConfiguration configuration,
                          XWikiContext context,
                          MergeResult mergeResult)
        Description copied from interface: ElementInterface
        Apply a 3 ways merge on the current element based on provided previous and new version of the element.

        All 3 elements are supposed to have the same class and reference.

        Specified by:
        merge in interface ElementInterface
        Parameters:
        previousElement - the previous version of the element
        newElement - the next version of the element
        configuration - the configuration of the merge Indicate how to deal with some conflicts use cases, etc.
        context - the XWiki context
        mergeResult - the merge report
      • apply

        public boolean apply​(ElementInterface newElement,
                             boolean clean)
        Description copied from interface: ElementInterface
        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.
        Specified by:
        apply in interface ElementInterface
        Parameters:
        newElement - the element to apply
        clean - true if informations that are not in the new element should be removed (for example class properties not in the new class)
        Returns:
        true if the element has been modified
      • setOwnerDocument

        public void setOwnerDocument​(XWikiDocument ownerDocument)
        Set the owner document of this element.
        Parameters:
        ownerDocument - The owner document.
        Since:
        5.3M1
      • getOwnerDocument

        public XWikiDocument getOwnerDocument()
        Returns:
        the owner document of this element.
        Since:
        5.3M1
      • getXWikiContext

        protected XWikiContext getXWikiContext()
        Get XWiki context from execution context.
        Returns:
        the XWiki context for the current thread
        Since:
        9.0RC1
      • toXML

        protected org.dom4j.Element toXML()
      • toXMLString

        public String toXMLString​(boolean format)
        Parameters:
        format - true if the XML should be formated
        Returns:
        the XML as a String
        Since:
        9.0RC1