Package com.xpn.xwiki.objects
Class BaseProperty<R extends EntityReference>
- java.lang.Object
-
- com.xpn.xwiki.objects.BaseElement<R>
-
- 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: b31e1026e08bde7d6e565ab61099916326ceda0e $
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.xpn.xwiki.objects.BaseElement
documentReference, ownerDocument, referenceCache
-
-
Constructor Summary
Constructors Constructor Description BaseProperty()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanapply(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 voidcloneInternal(BaseProperty clone)Subclasses override this to copy values during cloning.protected RcreateReference()booleanequals(Object el)StringgetClassType()ObjectgetCustomMappingValue()longgetId()Return an truncated MD5 hash of the local key computed inBaseElement.getLocalKey().BaseCollectiongetObject()PropertyClassgetPropertyClass(XWikiContext xcontext)ObjectgetValue()inthashCode()booleanisValueDirty()MergeManagerResult<ElementInterface,Object>merge(ElementInterface previousElement, ElementInterface newElement, MergeConfiguration configuration, XWikiContext context)Apply a 3 ways merge on the current element based on provided previous and new version of the element.voidmerge(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 MergeManagerResult<Object,Object>mergeValue(Object previousValue, Object newValue, MergeConfiguration mergeConfiguration)Try to apply 3 ways merge on property value.protected voidmergeValue(Object previousValue, Object newValue, MergeResult mergeResult)Deprecated.voidsetClassType(String type)voidsetId(long id)Dummy function, do hibernate is always happy.voidsetObject(BaseCollection object)voidsetOwnerDocument(XWikiDocument ownerDocument)Set the owner document of this base property.voidsetValue(Object value)voidsetValueDirty(boolean valueDirty)protected voidsetValueDirty(Object newValue)Set the dirty flag if the new value isn't equal to the old value.StringtoFormString()StringtoText()org.dom4j.ElementtoXML()StringtoXMLString()Return a XML version of this collection.-
Methods inherited from class com.xpn.xwiki.objects.BaseElement
fromXML, fromXML, getDocumentReference, getLocalEntityReferenceSerializer, getLocalization, getLocalKey, getLocalUidStringEntityReferenceSerializer, getMergeManager, getName, getOwnerDocument, getPrettyName, getReference, getXWikiContext, localizePlain, localizePlainOrKey, setDocumentReference, setName, setPrettyName, toString, toXMLString
-
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, toString
-
-
-
-
Method Detail
-
createReference
protected R createReference()
- Overrides:
createReferencein classBaseElement<R extends EntityReference>
-
getObject
public BaseCollection getObject()
- Specified by:
getObjectin interfacePropertyInterface
-
setObject
public void setObject(BaseCollection object)
- Specified by:
setObjectin interfacePropertyInterface
-
equals
public boolean equals(Object el)
- Overrides:
equalsin classBaseElement<R extends EntityReference>
-
getId
public long getId()
Description copied from class:BaseElementReturn an truncated MD5 hash of the local key computed inBaseElement.getLocalKey().- Specified by:
getIdin interfacePropertyInterface- Overrides:
getIdin classBaseElement<R extends EntityReference>- Returns:
- the identifier used by hibernate for storage.
-
setId
public void setId(long id)
Description copied from class:BaseElementDummy function, do hibernate is always happy.- Specified by:
setIdin interfacePropertyInterface- Overrides:
setIdin classBaseElement<R extends EntityReference>- Parameters:
id- the identifier assigned by hibernate.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classBaseElement<R extends EntityReference>
-
getClassType
public String getClassType()
-
setClassType
public void setClassType(String type)
-
clone
public BaseProperty<R> clone()
- Specified by:
clonein interfacePropertyInterface- Overrides:
clonein classBaseElement<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:
toXMLin interfacePropertyInterface- Overrides:
toXMLin classBaseElement<R extends EntityReference>
-
toFormString
public String toFormString()
- Specified by:
toFormStringin interfacePropertyInterface
-
toText
public String toText()
-
toXMLString
public String toXMLString()
Return a XML version of this collection.The XML is not formated. to get formatted XML you can use
BaseElement.toXMLString(boolean)instead.- Returns:
- the XML as a String
-
getCustomMappingValue
public Object getCustomMappingValue()
-
merge
public void merge(ElementInterface previousElement, ElementInterface newElement, MergeConfiguration configuration, XWikiContext context, MergeResult mergeResult)
Description copied from interface:ElementInterfaceApply 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:
mergein interfaceElementInterface- Overrides:
mergein classBaseElement<R extends EntityReference>- Parameters:
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 report
-
merge
public MergeManagerResult<ElementInterface,Object> merge(ElementInterface previousElement, ElementInterface newElement, MergeConfiguration configuration, XWikiContext context)
Description copied from interface:ElementInterfaceApply 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.
Note that the current element is modified only if
MergeConfiguration.isProvidedVersionsModifiables()returnstrue.- Specified by:
mergein interfaceElementInterface- Overrides:
mergein classBaseElement<R extends EntityReference>- Parameters:
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 context
-
mergeValue
@Deprecated(since="14.10.7,15.2RC1") protected void mergeValue(Object previousValue, Object newValue, MergeResult mergeResult)
Deprecated.Try to apply 3 ways merge on property value. Note that this method modifies the internal value of the property.- Parameters:
previousValue- the previous version of the valuenewValue- the new version of the valuemergeResult- merge report- Since:
- 3.2M1
-
mergeValue
@Unstable protected MergeManagerResult<Object,Object> mergeValue(Object previousValue, Object newValue, MergeConfiguration mergeConfiguration)
Try to apply 3 ways merge on property value. Note that this method does not modify the internal value of the property.- Parameters:
previousValue- the previous version of the valuenewValue- the new version of the valuemergeConfiguration- the merge configuration to use- Since:
- 15.2RC1, 14.10.7
-
apply
public boolean apply(ElementInterface newProperty, boolean clean)
Description copied from interface:ElementInterfaceApply 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:
applyin interfaceElementInterface- Overrides:
applyin classBaseElement<R extends EntityReference>- Parameters:
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)- 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.- Overrides:
setOwnerDocumentin classBaseElement<R extends EntityReference>- Parameters:
ownerDocument- The owner document.- Since:
- 4.3M2
-
getPropertyClass
public PropertyClass getPropertyClass(XWikiContext xcontext)
- Parameters:
xcontext- the XWiki Context- Returns:
- the definition of the property
- Since:
- 8.3M1
-
-