com.xpn.xwiki.objects
Class BaseProperty<R extends EntityReference>

java.lang.Object
  extended by com.xpn.xwiki.objects.BaseElement<R>
      extended by com.xpn.xwiki.objects.BaseProperty<R>
All Implemented Interfaces:
ElementInterface, PropertyInterface, Serializable, Cloneable
Direct Known Subclasses:
BaseStringProperty, DateProperty, ListProperty, NumberProperty

public class BaseProperty<R extends EntityReference>
extends BaseElement<R>
implements PropertyInterface, Serializable, Cloneable

Version:
$Id: b73e8d6abb3337d9bf57b5d16eb46254abead744 $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.xpn.xwiki.objects.BaseElement
localEntityReferenceSerializer, referenceCache
 
Constructor Summary
BaseProperty()
           
 
Method Summary
 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 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()
           
 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 toString()
           
 String toText()
           
 org.dom4j.Element toXML()
           
 String toXMLString()
           
 
Methods inherited from class com.xpn.xwiki.objects.BaseElement
getDocumentReference, getLocalKey, getLocalUidStringEntityReferenceSerializer, getName, getPrettyName, getReference, setDocumentReference, setName, setPrettyName
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.xpn.xwiki.objects.ElementInterface
getDocumentReference, getName, getReference, setDocumentReference, setName
 

Constructor Detail

BaseProperty

public BaseProperty()
Method Detail

createReference

protected R createReference()
Overrides:
createReference in class BaseElement<R extends EntityReference>

getObject

public BaseCollection getObject()
Specified by:
getObject in interface PropertyInterface

setObject

public void setObject(BaseCollection object)
Specified by:
setObject in interface PropertyInterface

equals

public boolean equals(Object el)
Overrides:
equals in class BaseElement<R extends EntityReference>

getId

public long getId()
Description copied from class: BaseElement
Return an truncated MD5 hash of the local key computed in BaseElement.getLocalKey().

Specified by:
getId in interface PropertyInterface
Overrides:
getId in class BaseElement<R extends EntityReference>
Returns:
the identifier used by hibernate for storage.

setId

public void setId(long id)
Description copied from class: BaseElement
Dummy function, do hibernate is always happy.

Specified by:
setId in interface PropertyInterface
Overrides:
setId in class BaseElement<R extends EntityReference>
Parameters:
id - the identifier assigned by hibernate.

hashCode

public int hashCode()
Overrides:
hashCode in class BaseElement<R extends EntityReference>

getClassType

public String getClassType()

setClassType

public void setClassType(String type)

clone

public BaseProperty clone()
Specified by:
clone in interface PropertyInterface
Overrides:
clone in class BaseElement<R extends EntityReference>

cloneInternal

protected void cloneInternal(BaseProperty clone)
Subclasses override this to copy values during cloning.

Parameters:
clone - The cloned value.

getValue

public Object getValue()

setValue

public void setValue(Object value)

toXML

public org.dom4j.Element toXML()
Specified by:
toXML in interface PropertyInterface

toFormString

public String toFormString()
Specified by:
toFormString in interface PropertyInterface

toText

public String toText()

toXMLString

public String toXMLString()

toString

public String toString()
Specified by:
toString in interface ElementInterface
Overrides:
toString in class Object

getCustomMappingValue

public Object getCustomMappingValue()

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
Overrides:
merge in class BaseElement<R extends EntityReference>
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

mergeValue

protected void mergeValue(Object previousValue,
                          Object newValue,
                          MergeResult mergeResult)
Try to apply 3 ways merge on property value.

Parameters:
previousValue - the previous version of the value
newValue - the new version of the value
mergeResult - merge report
Since:
3.2M1

apply

public boolean apply(ElementInterface newProperty,
                     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
Overrides:
apply in class BaseElement<R extends EntityReference>
Parameters:
newProperty - 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

isValueDirty

public boolean isValueDirty()
Returns:
true if the property value doesn't match the value in the database.
Since:
4.3M2

setValueDirty

protected void setValueDirty(Object newValue)
Set the dirty flag if the new value isn't equal to the old value.

Parameters:
newValue - The new value.

setValueDirty

public void setValueDirty(boolean valueDirty)
Parameters:
valueDirty - Indicate if the dirty flag should be set or cleared.
Since:
4.3M2

setOwnerDocument

public void setOwnerDocument(XWikiDocument ownerDocument)
Set the owner document of this base property.

Parameters:
ownerDocument - The owner document.
Since:
4.3M2


Copyright © 2004-2013 XWiki. All Rights Reserved.