public class BaseClass extends BaseCollection<DocumentReference> implements ClassInterface
BaseCollection
is of type
PropertyClass
and defines a single XClass property.currentReferenceDocumentReferenceResolver, fields, fieldsToRemove, number, relativeEntityReferenceResolver
documentReference, ownerDocument, referenceCache
Constructor and Description |
---|
BaseClass() |
Modifier and Type | Method and Description |
---|---|
boolean |
addBooleanField(String fieldName,
String fieldPrettyName) |
boolean |
addBooleanField(String fieldName,
String fieldPrettyName,
String displayType) |
boolean |
addBooleanField(String fieldName,
String fieldPrettyName,
String displayType,
Boolean def) |
boolean |
addBooleanField(String fieldName,
String fieldPrettyName,
String formType,
String displayType,
Boolean def) |
boolean |
addDateField(String fieldName,
String fieldPrettyName) |
boolean |
addDateField(String fieldName,
String fieldPrettyName,
String dformat) |
boolean |
addDateField(String fieldName,
String fieldPrettyName,
String dformat,
int emptyIsToday) |
boolean |
addDBListField(String fieldName,
String fieldPrettyName,
int size,
boolean multiSelect,
boolean relationalStorage,
String sql) |
boolean |
addDBListField(String fieldName,
String fieldPrettyName,
int size,
boolean multiSelect,
String sql) |
boolean |
addDBListField(String fieldName,
String fieldPrettyName,
String sql) |
boolean |
addDBTreeListField(String fieldName,
String fieldPrettyName,
int size,
boolean multiSelect,
boolean relationalStorage,
String sql) |
boolean |
addDBTreeListField(String fieldName,
String fieldPrettyName,
int size,
boolean multiSelect,
String sql) |
boolean |
addDBTreeListField(String fieldName,
String fieldPrettyName,
String sql) |
boolean |
addEmailField(String fieldName,
String fieldPrettyName,
int size) |
void |
addField(String name,
PropertyInterface element) |
boolean |
addGroupsField(String fieldName,
String fieldPrettyName) |
boolean |
addGroupsField(String fieldName,
String fieldPrettyName,
int size) |
boolean |
addLevelsField(String fieldName,
String fieldPrettyName) |
boolean |
addLevelsField(String fieldName,
String fieldPrettyName,
int size) |
boolean |
addNumberField(String fieldName,
String fieldPrettyName,
int size,
String type) |
boolean |
addPageField(String fieldName,
String fieldPrettyName,
int size)
Adds a page field to the class.
|
boolean |
addPageField(String fieldName,
String fieldPrettyName,
int size,
boolean multiSelect)
Adds a page field to the class.
|
boolean |
addPageField(String fieldName,
String fieldPrettyName,
int size,
boolean multiSelect,
boolean relationalStorage,
String hqlQuery)
Adds a page field to the class.
|
boolean |
addPageField(String fieldName,
String fieldPrettyName,
int size,
boolean multiSelect,
boolean relationalStorage,
String hqlQuery,
String className,
String displayType,
boolean hasPicker,
String freeText)
Adds a page field to the class.
|
boolean |
addPasswordField(String fieldName,
String fieldPrettyName,
int size) |
boolean |
addPasswordField(String fieldName,
String fieldPrettyName,
int size,
String storageType) |
StaticListClass |
addStaticListField(String fieldName)
Adds a new Static List xproperty to this xclass.
|
boolean |
addStaticListField(String fieldName,
String fieldPrettyName,
int size,
boolean multiSelect,
boolean relationalStorage,
String values,
String displayType,
String separators) |
boolean |
addStaticListField(String fieldName,
String fieldPrettyName,
int size,
boolean multiSelect,
boolean relationalStorage,
String values,
String displayType,
String separators,
String defaultValue) |
boolean |
addStaticListField(String fieldName,
String fieldPrettyName,
int size,
boolean multiSelect,
boolean relationalStorage,
String values,
String displayType,
String separators,
String defaultValue,
String freeText,
boolean largeStorage) |
boolean |
addStaticListField(String fieldName,
String fieldPrettyName,
int size,
boolean multiSelect,
String values) |
boolean |
addStaticListField(String fieldName,
String fieldPrettyName,
int size,
boolean multiSelect,
String values,
String displayType) |
boolean |
addStaticListField(String fieldName,
String fieldPrettyName,
int size,
boolean multiSelect,
String values,
String displayType,
String separators) |
boolean |
addStaticListField(String fieldName,
String fieldPrettyName,
String values) |
boolean |
addStaticListField(String fieldName,
String fieldPrettyName,
String values,
String defaultValue) |
boolean |
addTemplateField(String fieldName,
String fieldPrettyName) |
boolean |
addTextAreaField(String fieldName,
String fieldPrettyName,
int cols,
int rows) |
boolean |
addTextAreaField(String fieldName,
String fieldPrettyName,
int cols,
int rows,
String editor) |
boolean |
addTextAreaField(String fieldName,
String fieldPrettyName,
int cols,
int rows,
String editor,
String contenttype) |
boolean |
addTextAreaField(String fieldName,
String fieldPrettyName,
int cols,
int rows,
TextAreaClass.ContentType contentType) |
boolean |
addTextAreaField(String fieldName,
String fieldPrettyName,
int cols,
int rows,
TextAreaClass.EditorType editorType) |
boolean |
addTextAreaField(String fieldName,
String fieldPrettyName,
int cols,
int rows,
TextAreaClass.EditorType editorType,
TextAreaClass.ContentType contentType) |
boolean |
addTextField(String fieldName,
String fieldPrettyName,
int size) |
boolean |
addTimezoneField(String fieldName,
String fieldPrettyName,
int size) |
boolean |
addUsersField(String fieldName,
String fieldPrettyName) |
boolean |
addUsersField(String fieldName,
String fieldPrettyName,
boolean multiSelect) |
boolean |
addUsersField(String fieldName,
String fieldPrettyName,
int size) |
boolean |
addUsersField(String fieldName,
String fieldPrettyName,
int size,
boolean multiSelect) |
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.
|
BaseClass |
clone() |
void |
disableField(String name)
Mark a property as disabled.
|
void |
enableField(String name)
Re-enable a property.
|
boolean |
equals(Object obj) |
void |
flushCache() |
BaseCollection |
fromMap(Map<String,?> map,
BaseCollection object) |
BaseCollection |
fromMap(Map<String,?> map,
XWikiContext context)
Deprecated.
since 2.2.3 use
fromMap(java.util.Map, com.xpn.xwiki.objects.BaseCollection) |
BaseProperty |
fromString(String value) |
BaseCollection |
fromValueMap(Map<String,?> map,
BaseCollection object) |
void |
fromXML(org.dom4j.Element element) |
void |
fromXML(String xml) |
PropertyInterface |
get(String name) |
String |
getCustomClass() |
String |
getCustomMapping() |
List<String> |
getCustomMappingPropertyList(XWikiContext context) |
String |
getDefaultEditSheet() |
String |
getDefaultViewSheet() |
String |
getDefaultWeb() |
List<BaseProperty> |
getDeprecatedObjectProperties(BaseObject object)
Retrieves deprecated properties of the given object compared to the class.
|
List<ObjectDiff> |
getDiff(Object oldObject,
XWikiContext context) |
List<PropertyClass> |
getDisabledObjectProperties(BaseObject object)
Get the list of disabled properties that exist in a given object.
|
List<PropertyClass> |
getDisabledProperties()
Get the list of disabled property definitions that exist in this class.
|
List<PropertyClass> |
getEnabledProperties()
Get the list of enabled (the default, normal state) property definitions that exist in this class.
|
String |
getName()
Deprecated.
since 2.2M2 use
BaseElement.getDocumentReference() |
String |
getNameField() |
DocumentReference |
getReference() |
String |
getValidationScript() |
boolean |
hasCustomMapping() |
boolean |
hasExternalCustomMapping() |
boolean |
hasInternalCustomMapping() |
boolean |
isCustomMappingValid(String custommapping,
XWikiContext context) |
boolean |
isCustomMappingValid(XWikiContext context) |
void |
merge(BaseClass bclass) |
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.
|
BaseObject |
newCustomClassInstance(boolean fallback) |
static BaseObject |
newCustomClassInstance(DocumentReference classReference,
boolean fallback,
XWikiContext context) |
static BaseObject |
newCustomClassInstance(DocumentReference classReference,
XWikiContext context) |
static BaseObject |
newCustomClassInstance(String className,
XWikiContext context)
Deprecated.
since 2.2.3 use
newCustomClassInstance(DocumentReference, XWikiContext) |
BaseObject |
newCustomClassInstance(XWikiContext context) |
BaseCollection |
newObject(XWikiContext context)
Deprecated.
|
void |
put(String name,
PropertyInterface property) |
void |
setCustomClass(String customClass) |
void |
setCustomMapping(String customMapping) |
void |
setDefaultEditSheet(String defaultEditSheet) |
void |
setDefaultViewSheet(String defaultViewSheet) |
void |
setDefaultWeb(String defaultWeb) |
void |
setDirty(boolean isDirty) |
void |
setName(String name)
Deprecated.
|
void |
setNameField(String nameField) |
void |
setOwnerDocument(XWikiDocument ownerDocument)
Set the owner document of this base property.
|
void |
setValidationScript(String validationScript) |
boolean |
validateObject(BaseObject obj,
XWikiContext context) |
addPropertyForRemoval, getClassName, getCurrentReferenceDocumentReferenceResolver, getCustomMappingMap, getDateValue, getDoubleValue, getField, getFieldList, getFieldsToRemove, getFloatValue, getIntValue, getIntValue, getLargeStringValue, getListValue, getLongValue, getNumber, getProperties, getPropertyList, getPropertyNames, getRelativeEntityReferenceResolver, getRelativeXClassReference, getSetValue, getSortedIterator, getStringValue, getXClass, getXClassReference, merge, mergeField, removeField, safeget, safeput, setClassName, setDateValue, setDBStringListValue, setDocumentReference, setDoubleValue, setFields, setFieldsToRemove, setFloatValue, setIntValue, setLargeStringValue, setLongValue, setNumber, setSetValue, setStringListValue, setStringValue, setXClassReference, toXML, toXML, toXMLString
createReference, getDocumentReference, getId, getLocalEntityReferenceSerializer, getLocalization, getLocalKey, getLocalUidStringEntityReferenceSerializer, getMergeManager, getOwnerDocument, getPrettyName, getXWikiContext, hashCode, localizePlain, localizePlainOrKey, setId, setPrettyName, toString, toXMLString
finalize, getClass, notify, notifyAll, wait, wait, wait
getXClass, safeget, safeput, toXML
getDocumentReference, setDocumentReference, toString
public DocumentReference getReference()
getReference
in interface ElementInterface
getReference
in class BaseElement<DocumentReference>
@Deprecated public String getName()
BaseElement.getDocumentReference()
Note that this method is used by Hibernate for saving an element.
Note: This method is overridden to add the deprecation warning so that code using is can see it's deprecated.
getName
in interface ElementInterface
getName
in class BaseElement<DocumentReference>
BaseProperty
).ElementInterface.getName()
@Deprecated public void setName(String name)
BaseCollection.setDocumentReference(org.xwiki.model.reference.DocumentReference)
Note that this method is used by Hibernate for loading an element.
Note: BaseElement#setName() does not support setting reference anymore since 2.4M2. This was broken and has been replaced by this overridden method. See XWIKI-5285
setName
in interface ElementInterface
setName
in class BaseElement<DocumentReference>
ElementInterface.setName(java.lang.String)
public void addField(String name, PropertyInterface element)
This insures natural ordering between properties.
addField
in class BaseCollection<DocumentReference>
BaseCollection.addField(java.lang.String, com.xpn.xwiki.objects.PropertyInterface)
public void disableField(String name)
name
- the name of the property to disablepublic void enableField(String name)
name
- the name of the property to enablepublic PropertyInterface get(String name)
get
in interface ObjectInterface
get
in class BaseCollection<DocumentReference>
public void put(String name, PropertyInterface property)
put
in interface ObjectInterface
put
in class BaseCollection<DocumentReference>
public List<PropertyClass> getEnabledProperties()
PropertyClass.isDisabled()
public List<PropertyClass> getDisabledProperties()
PropertyClass.isDisabled()
public List<PropertyClass> getDisabledObjectProperties(BaseObject object)
object
- the instance of this class where the disabled properties must existPropertyClass.isDisabled()
public List<BaseProperty> getDeprecatedObjectProperties(BaseObject object)
object
- the instance of this class where to look for undefined propertiespublic BaseProperty fromString(String value)
@Deprecated public BaseCollection newObject(XWikiContext context) throws XWikiException
XWikiDocument.newXObject(org.xwiki.model.reference.EntityReference, com.xpn.xwiki.XWikiContext)
XWikiException
@Deprecated public BaseCollection fromMap(Map<String,?> map, XWikiContext context) throws XWikiException
fromMap(java.util.Map, com.xpn.xwiki.objects.BaseCollection)
XWikiException
public BaseCollection fromMap(Map<String,?> map, BaseCollection object)
public BaseCollection fromValueMap(Map<String,?> map, BaseCollection object)
public BaseClass clone()
clone
in class BaseCollection<DocumentReference>
public boolean equals(Object obj)
equals
in class BaseCollection<DocumentReference>
public void merge(BaseClass bclass)
public void fromXML(org.dom4j.Element element) throws XWikiException
fromXML
in class BaseElement<DocumentReference>
XWikiException
public void fromXML(String xml) throws XWikiException
fromXML
in class BaseElement<DocumentReference>
xml
- the XML to readXWikiException
- when failing to parse XMLpublic boolean addPasswordField(String fieldName, String fieldPrettyName, int size)
public boolean addPasswordField(String fieldName, String fieldPrettyName, int size, String storageType)
public boolean addTimezoneField(String fieldName, String fieldPrettyName, int size)
public boolean addBooleanField(String fieldName, String fieldPrettyName)
public boolean addBooleanField(String fieldName, String fieldPrettyName, String displayType)
public boolean addBooleanField(String fieldName, String fieldPrettyName, String displayType, Boolean def)
public boolean addBooleanField(String fieldName, String fieldPrettyName, String formType, String displayType, Boolean def)
public boolean addUsersField(String fieldName, String fieldPrettyName, boolean multiSelect)
public boolean addUsersField(String fieldName, String fieldPrettyName, int size, boolean multiSelect)
public boolean addTextAreaField(String fieldName, String fieldPrettyName, int cols, int rows)
public boolean addTextAreaField(String fieldName, String fieldPrettyName, int cols, int rows, TextAreaClass.EditorType editorType)
public boolean addTextAreaField(String fieldName, String fieldPrettyName, int cols, int rows, String editor)
public boolean addTextAreaField(String fieldName, String fieldPrettyName, int cols, int rows, TextAreaClass.ContentType contentType)
public boolean addTextAreaField(String fieldName, String fieldPrettyName, int cols, int rows, TextAreaClass.EditorType editorType, TextAreaClass.ContentType contentType)
public boolean addTextAreaField(String fieldName, String fieldPrettyName, int cols, int rows, String editor, String contenttype)
public boolean addStaticListField(String fieldName, String fieldPrettyName, String values)
public boolean addStaticListField(String fieldName, String fieldPrettyName, String values, String defaultValue)
public boolean addStaticListField(String fieldName, String fieldPrettyName, int size, boolean multiSelect, String values)
public boolean addStaticListField(String fieldName, String fieldPrettyName, int size, boolean multiSelect, String values, String displayType)
public boolean addStaticListField(String fieldName, String fieldPrettyName, int size, boolean multiSelect, String values, String displayType, String separators)
public boolean addStaticListField(String fieldName, String fieldPrettyName, int size, boolean multiSelect, boolean relationalStorage, String values, String displayType, String separators)
public boolean addStaticListField(String fieldName, String fieldPrettyName, int size, boolean multiSelect, boolean relationalStorage, String values, String displayType, String separators, String defaultValue)
public boolean addStaticListField(String fieldName, String fieldPrettyName, int size, boolean multiSelect, boolean relationalStorage, String values, String displayType, String separators, String defaultValue, String freeText, boolean largeStorage)
public StaticListClass addStaticListField(String fieldName)
StaticListClass
.fieldName
- the id of the Static List xproperty to addpublic boolean addNumberField(String fieldName, String fieldPrettyName, int size, String type)
public boolean addDateField(String fieldName, String fieldPrettyName, String dformat, int emptyIsToday)
public boolean addDBListField(String fieldName, String fieldPrettyName, int size, boolean multiSelect, String sql)
public boolean addDBListField(String fieldName, String fieldPrettyName, int size, boolean multiSelect, boolean relationalStorage, String sql)
public boolean addDBTreeListField(String fieldName, String fieldPrettyName, String sql)
public boolean addDBTreeListField(String fieldName, String fieldPrettyName, int size, boolean multiSelect, String sql)
public boolean addDBTreeListField(String fieldName, String fieldPrettyName, int size, boolean multiSelect, boolean relationalStorage, String sql)
public boolean addPageField(String fieldName, String fieldPrettyName, int size)
The input has no multiselect by default.
fieldName
- the field namefieldPrettyName
- the shown namesize
- size of the inputpublic boolean addPageField(String fieldName, String fieldPrettyName, int size, boolean multiSelect)
fieldName
- the field namefieldPrettyName
- the shown namesize
- size of the inputmultiSelect
- specifies if there can be several valuespublic boolean addPageField(String fieldName, String fieldPrettyName, int size, boolean multiSelect, boolean relationalStorage, String hqlQuery)
fieldName
- the field namefieldPrettyName
- the shown namesize
- size of the inputmultiSelect
- specifies if there can be several valuesrelationalStorage
- sets the PageClass
relationalStorage
property metadata with the
specified value. See ListClass.setRelationalStorage(boolean)
for more detailshqlQuery
- the optional HQL query to execute to return allowed document references. If null or empty, the
implicit page query builder
is usedpublic boolean addPageField(String fieldName, String fieldPrettyName, int size, boolean multiSelect, boolean relationalStorage, String hqlQuery, String className, String displayType, boolean hasPicker, String freeText)
fieldName
- the field namefieldPrettyName
- the shown namesize
- size of the inputmultiSelect
- specifies if there can be several valuesrelationalStorage
- sets the PageClass
relationalStorage
property metadata with the
specified value. See ListClass.setRelationalStorage(boolean)
for more detailshqlQuery
- the optional HQL query to execute to return allowed document references. If null or empty, the
implicit page query builder
is usedclassName
- optional class name used to filter suggested documents containing an object of this classdisplayType
- either ListClass.DISPLAYTYPE_CHECKBOX
, ListClass.DISPLAYTYPE_INPUT
,
ListClass.DISPLAYTYPE_RADIO
or ListClass.DISPLAYTYPE_SELECT
hasPicker
- enables auto suggestion displayfreeText
- indicate how non document reference values are handled (forbidden, discouraged or allowed)public void setCustomMapping(String customMapping)
public String getCustomMapping()
public boolean hasCustomMapping()
public boolean hasExternalCustomMapping()
public boolean hasInternalCustomMapping()
public boolean isCustomMappingValid(XWikiContext context) throws XWikiException
XWikiException
public boolean isCustomMappingValid(String custommapping, XWikiContext context) throws XWikiException
XWikiException
public List<String> getCustomMappingPropertyList(XWikiContext context)
public void setCustomClass(String customClass)
public String getCustomClass()
public BaseObject newCustomClassInstance(XWikiContext context) throws XWikiException
XWikiException
public BaseObject newCustomClassInstance(boolean fallback) throws XWikiException
fallback
- if true, fallback on BaseObject if there is any problem with the configured custom classXWikiException
- if there is a problem when creating an new instance and fallback
is falsepublic static BaseObject newCustomClassInstance(DocumentReference classReference, XWikiContext context) throws XWikiException
XWikiException
public static BaseObject newCustomClassInstance(DocumentReference classReference, boolean fallback, XWikiContext context) throws XWikiException
classReference
- the reference of the document containing the XWiki class for which to create a new objectfallback
- if true, fallback on BaseObject if there is any problem with the configured custom classcontext
- the XWiki context used to load the BaseClass
XWikiException
- if there is a problem when creating an new instance and fallback
is false@Deprecated public static BaseObject newCustomClassInstance(String className, XWikiContext context) throws XWikiException
newCustomClassInstance(DocumentReference, XWikiContext)
XWikiException
public String getDefaultWeb()
public void setDefaultWeb(String defaultWeb)
public String getDefaultViewSheet()
public void setDefaultViewSheet(String defaultViewSheet)
public String getDefaultEditSheet()
public void setDefaultEditSheet(String defaultEditSheet)
public String getNameField()
public void setNameField(String nameField)
public void setValidationScript(String validationScript)
public String getValidationScript()
public boolean validateObject(BaseObject obj, XWikiContext context) throws XWikiException
XWikiException
public void flushCache()
public List<ObjectDiff> getDiff(Object oldObject, XWikiContext context)
getDiff
in class BaseCollection<DocumentReference>
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 BaseCollection<DocumentReference>
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
apply
in class BaseCollection<DocumentReference>
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 BaseCollection<DocumentReference>
ownerDocument
- The owner document.public void setDirty(boolean isDirty)
isDirty
- Indicate if the dirty flag should be set or cleared.Copyright © 2004–2022 XWiki. All rights reserved.