public abstract class BaseCollection<R extends EntityReference> extends BaseElement<R> implements ObjectInterface, Cloneable
Modifier and Type | Field and Description |
---|---|
protected DocumentReferenceResolver<EntityReference> |
currentReferenceDocumentReferenceResolver
Used to normalize references.
|
protected Map<String,Object> |
fields
List of properties (eg XClass properties, XObject properties, etc).
|
protected List<Object> |
fieldsToRemove |
protected int |
number
The meaning of this reference fields depends on the element represented.
|
protected EntityReferenceResolver<String> |
relativeEntityReferenceResolver
Used to resolve XClass references in the way they are stored externally (database, xml, etc), ie relative or
absolute.
|
documentReference, ownerDocument, referenceCache
Constructor and Description |
---|
BaseCollection() |
Modifier and Type | Method and Description |
---|---|
void |
addField(String name,
PropertyInterface element) |
void |
addPropertyForRemoval(PropertyInterface field)
Marks a field as scheduled for removal when saving this entity.
|
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.
|
BaseCollection |
clone() |
boolean |
equals(Object coll) |
PropertyInterface |
get(String name) |
String |
getClassName()
Deprecated.
since 2.2M2 use
getXClassReference() instead |
protected DocumentReferenceResolver<EntityReference> |
getCurrentReferenceDocumentReferenceResolver() |
Map<String,Object> |
getCustomMappingMap() |
Date |
getDateValue(String name) |
List<ObjectDiff> |
getDiff(Object oldObject,
XWikiContext context) |
double |
getDoubleValue(String name) |
PropertyInterface |
getField(String name) |
Collection |
getFieldList() |
List |
getFieldsToRemove() |
float |
getFloatValue(String name) |
int |
getIntValue(String name) |
int |
getIntValue(String name,
int default_value) |
String |
getLargeStringValue(String name) |
List |
getListValue(String name) |
long |
getLongValue(String name) |
int |
getNumber() |
Object[] |
getProperties() |
Set<String> |
getPropertyList() |
String[] |
getPropertyNames() |
protected EntityReferenceResolver<String> |
getRelativeEntityReferenceResolver() |
EntityReference |
getRelativeXClassReference()
Get the actual reference to the XClass as stored in this instance.
|
Set<?> |
getSetValue(String name) |
Iterator |
getSortedIterator()
Return an iterator that will operate on a collection of values (as would be returned by getProperties or
getFieldList) sorted by their name (ElementInterface.getName()).
|
String |
getStringValue(String name) |
BaseClass |
getXClass(XWikiContext context) |
DocumentReference |
getXClassReference()
Get the absolute reference of the XClass.
|
void |
merge(BaseObject object) |
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 |
mergeField(PropertyInterface currentElement,
ElementInterface previousElement,
ElementInterface newElement,
MergeConfiguration configuration,
XWikiContext context,
MergeResult mergeResult) |
void |
put(String name,
PropertyInterface property) |
void |
removeField(String name) |
PropertyInterface |
safeget(String name) |
void |
safeput(String name,
PropertyInterface property) |
void |
setClassName(String name)
Deprecated.
since 2.2.3 use
setXClassReference(EntityReference) ()} instead |
void |
setDateValue(String name,
Date value) |
void |
setDBStringListValue(String name,
List value) |
void |
setDocumentReference(DocumentReference reference) |
void |
setDoubleValue(String name,
double value) |
void |
setFields(Map fields) |
void |
setFieldsToRemove(List fieldsToRemove) |
void |
setFloatValue(String name,
float value) |
void |
setIntValue(String name,
int value) |
void |
setLargeStringValue(String name,
String value) |
void |
setLongValue(String name,
long value) |
void |
setNumber(int number) |
void |
setOwnerDocument(XWikiDocument ownerDocument)
Set the owner document of this base object.
|
void |
setSetValue(String name,
Set<?> value) |
void |
setStringListValue(String name,
List value) |
void |
setStringValue(String name,
String value) |
void |
setXClassReference(EntityReference xClassReference)
Set the reference to the XClass (used for an XObject).
|
org.dom4j.Element |
toXML() |
org.dom4j.Element |
toXML(BaseClass bclass)
Deprecated.
since 9.0RC1, use
toXML() instead |
String |
toXMLString()
Return a XML version of this collection.
|
createReference, fromXML, fromXML, getDocumentReference, getId, getLocalEntityReferenceSerializer, getLocalization, getLocalKey, getLocalUidStringEntityReferenceSerializer, getMergeManager, getName, getOwnerDocument, getPrettyName, getReference, getXWikiContext, hashCode, localizePlain, localizePlainOrKey, setId, setName, setPrettyName, toString, toXMLString
finalize, getClass, notify, notifyAll, wait, wait, wait
getDocumentReference, getName, getReference, setName, toString
protected Map<String,Object> fields
protected int number
protected EntityReferenceResolver<String> relativeEntityReferenceResolver
protected DocumentReferenceResolver<EntityReference> currentReferenceDocumentReferenceResolver
protected EntityReferenceResolver<String> getRelativeEntityReferenceResolver()
protected DocumentReferenceResolver<EntityReference> getCurrentReferenceDocumentReferenceResolver()
public int getNumber()
public void setNumber(int number)
public void addPropertyForRemoval(PropertyInterface field)
removeField(String)
to actually remove a field.field
- the field to remove, must belong to this entityremoveField(String)
public DocumentReference getXClassReference()
public EntityReference getRelativeXClassReference()
@Deprecated public String getClassName()
getXClassReference()
insteadpublic void setXClassReference(EntityReference xClassReference)
Note that absolute reference are not supported for xclasses which mean that the wiki part (whatever the wiki is) of the reference will be systematically removed.
xClassReference
- the reference to the XClass of this XObject.@Deprecated public void setClassName(String name)
setXClassReference(EntityReference)
()} insteadpublic PropertyInterface safeget(String name)
safeget
in interface ObjectInterface
public PropertyInterface get(String name) throws XWikiException
get
in interface ObjectInterface
XWikiException
public void safeput(String name, PropertyInterface property)
safeput
in interface ObjectInterface
public void put(String name, PropertyInterface property) throws XWikiException
put
in interface ObjectInterface
XWikiException
public BaseClass getXClass(XWikiContext context)
getXClass
in interface ObjectInterface
public int getIntValue(String name)
public int getIntValue(String name, int default_value)
public void setIntValue(String name, int value)
public long getLongValue(String name)
public void setLongValue(String name, long value)
public float getFloatValue(String name)
public void setFloatValue(String name, float value)
public double getDoubleValue(String name)
public void setDoubleValue(String name, double value)
public void setFields(Map fields)
public PropertyInterface getField(String name)
public void addField(String name, PropertyInterface element)
public void removeField(String name)
public Collection getFieldList()
public Object[] getProperties()
public String[] getPropertyNames()
public Iterator getSortedIterator()
public boolean equals(Object coll)
equals
in class BaseElement<R extends EntityReference>
public BaseCollection clone()
clone
in class BaseElement<R extends EntityReference>
public void merge(BaseObject object)
public List<ObjectDiff> getDiff(Object oldObject, XWikiContext context)
public List getFieldsToRemove()
public void setFieldsToRemove(List fieldsToRemove)
public org.dom4j.Element toXML()
toXML
in class BaseElement<R extends EntityReference>
@Deprecated public org.dom4j.Element toXML(BaseClass bclass)
toXML()
insteadtoXML
in interface ObjectInterface
public String toXMLString()
The XML is not formated. to get formatted XML you can use BaseElement.toXMLString(boolean)
instead.
public Map<String,Object> getCustomMappingMap() throws XWikiException
XWikiException
public void setDocumentReference(DocumentReference reference)
setDocumentReference
in interface ElementInterface
setDocumentReference
in class BaseElement<R extends EntityReference>
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
merge
in class BaseElement<R extends EntityReference>
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 reportprotected void mergeField(PropertyInterface currentElement, ElementInterface previousElement, ElementInterface newElement, MergeConfiguration configuration, XWikiContext context, MergeResult mergeResult)
public boolean apply(ElementInterface newElement, boolean clean)
ElementInterface
apply
in interface ElementInterface
apply
in class BaseElement<R extends EntityReference>
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)
setOwnerDocument
in class BaseElement<R extends EntityReference>
ownerDocument
- The owner document.Copyright © 2004–2022 XWiki. All rights reserved.