|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.xpn.xwiki.plugin.applicationmanager.core.doc.objects.classes.AbstractXClassManager<T>
T
- the item class extending XObjectDocument
.public abstract class AbstractXClassManager<T extends XObjectDocument>
Abstract implementation of XClassManager.
This class has to be extended with at least :
updateBaseClass(BaseClass)
XClassManager
Field Summary |
---|
Fields inherited from interface com.xpn.xwiki.plugin.applicationmanager.core.doc.objects.classes.XClassManager |
---|
XWIKI_CLASS_SPACE_PREFIX, XWIKI_CLASS_SPACE_SUFFIX, XWIKI_CLASS_SUFFIX, XWIKI_CLASSSHEET_SPACE_SUFFIX, XWIKI_CLASSSHEET_SUFFIX, XWIKI_CLASSTEMPLATE_SPACE_SUFFIX, XWIKI_CLASSTEMPLATE_SUFFIX |
Constructor Summary | |
---|---|
protected |
AbstractXClassManager(String prefix)
Constructor for AbstractXClassManager. |
protected |
AbstractXClassManager(String spaceprefix,
String prefix)
Constructor for AbstractXClassManager. |
protected |
AbstractXClassManager(String spaceprefix,
String prefix,
boolean dispatch)
Constructor for AbstractXClassManager. |
Method Summary | |
---|---|
protected void |
check(XWikiContext context)
Check if all necessary documents for manage this class in this context exists and update. |
protected void |
checkClassDocument(XWikiContext context)
Check if class document exists in this context and update. |
protected void |
checkClassSheetDocument(XWikiContext context)
Check if class sheet document exists in this context and update. |
protected void |
checkClassTemplateDocument(XWikiContext context)
Check if class template document exists in this context and update. |
String |
createWhereClause(Object[][] fieldDescriptors,
List<Object> parameterValues)
Construct HQL where clause to use with XWikiStoreInterface "searchDocuments" methods. |
boolean |
forceValidDocumentName()
|
BaseClass |
getBaseClass()
|
Document |
getClassDocument(XWikiContext context)
Get the document containing the class in this context's database. |
String |
getClassFullName()
|
String |
getClassName()
|
String |
getClassPrefix()
|
String |
getClassSheetDefaultContent()
|
Document |
getClassSheetDocument(XWikiContext context)
Get the document containing the class sheet for this context's database. |
String |
getClassSheetFullName()
|
String |
getClassSheetName()
|
String |
getClassSheetSpace()
|
String |
getClassSpace()
|
String |
getClassSpacePrefix()
|
String |
getClassTemplateDefaultContent()
|
Document |
getClassTemplateDocument(XWikiContext context)
Get the document containing the class template for this context's database. |
String |
getClassTemplateFullName()
|
String |
getClassTemplateName()
|
String |
getClassTemplateSpace()
|
String |
getItemDefaultName(String docFullName)
Get item name extracted from document full name. |
String |
getItemDocumentDefaultFullName(String itemName,
XWikiContext context)
Get document full name from item name item . |
String |
getItemDocumentDefaultName(String itemName,
XWikiContext context)
Get document name from item name item . |
T |
getXObjectDocument(String itemName,
int objectId,
boolean validate,
XWikiContext context)
Get document by full name from item name itemName . |
protected int |
intFromBoolean(Boolean value)
|
boolean |
isInstance(Document doc)
Determines if the specified doc is compatible with this xwiki class (if he contains class object). |
boolean |
isInstance(XWikiDocument doc)
Determines if the specified doc is compatible with this xwiki class (if he contains class object). |
boolean |
isValidName(String fullName)
|
T |
newXObjectDocument(String docFullName,
int objId,
XWikiContext context)
Create new super document containing object of class XClassManager.getClassFullName() . |
T |
newXObjectDocument(XWikiContext context)
Create new super document containing object of class XClassManager.getClassFullName() . |
T |
newXObjectDocument(XWikiDocument doc,
int objId,
XWikiContext context)
Create new super document containing object of class XClassManager.getClassFullName() . |
List<T> |
newXObjectDocumentList(List<XWikiDocument> documents,
XWikiContext context)
Create new super document for each object of class XClassManager.getClassFullName() of each XWikiDocument in
the list and return it. |
List<T> |
newXObjectDocumentList(XWikiDocument document,
XWikiContext context)
Create new super documents for each object of class XClassManager.getClassFullName() for provided
XWikiDocument and return it. |
List<T> |
searchXObjectDocuments(XWikiContext context)
Find all XWikiDocument containing object of this XWiki class. |
List<T> |
searchXObjectDocumentsByField(String fieldName,
Object fieldValue,
String fieldType,
XWikiContext context)
Search in instances of this document class. |
List<T> |
searchXObjectDocumentsByFields(Object[][] fieldDescriptors,
XWikiContext context)
Search in instances of this document class. |
protected boolean |
updateBaseClass(BaseClass baseClass)
Configure BaseClass. |
protected boolean |
updateBooleanClassDefaultValue(BaseClass baseClass,
String fieldName,
Boolean value)
Set the default value of a boolean field of a XWiki class. |
protected boolean |
updateClassTemplateDocument(XWikiDocument doc)
Initialize template document with default content. |
protected boolean |
updateDocBooleanValue(XWikiDocument doc,
String fieldName,
Boolean value)
Set the value of a boolean field in a document. |
protected boolean |
updateDocStringValue(XWikiDocument doc,
String fieldName,
String value)
Set the value of a boolean field in a document. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractXClassManager(String prefix)
prefix
- the prefix of class document.AbstractXClassManager(String, String)
,
AbstractXClassManager(String, String, boolean)
protected AbstractXClassManager(String spaceprefix, String prefix)
spaceprefix
- the space prefix of class document.prefix
- the prefix of class document.AbstractXClassManager(String)
,
AbstractXClassManager(String, String, boolean)
protected AbstractXClassManager(String spaceprefix, String prefix, boolean dispatch)
spaceprefix
- the space of class document.prefix
- the prefix of class document.dispatch
- Indicate if it had to use standard XWiki applications space names.AbstractXClassManager(String)
,
AbstractXClassManager(String, String)
Method Detail |
---|
public String getClassSpacePrefix()
getClassSpacePrefix
in interface XClassManager<T extends XObjectDocument>
public String getClassSpace()
getClassSpace
in interface XClassManager<T extends XObjectDocument>
XClassManager.getClassSpacePrefix()
,
XClassManager.XWIKI_CLASS_SPACE_SUFFIX
public String getClassPrefix()
getClassPrefix
in interface XClassManager<T extends XObjectDocument>
XClassManager.getClassSpace()
public String getClassName()
getClassName
in interface XClassManager<T extends XObjectDocument>
XClassManager.getClassFullName()
,
XClassManager.getClassPrefix()
,
XClassManager.XWIKI_CLASS_SUFFIX
public String getClassFullName()
getClassFullName
in interface XClassManager<T extends XObjectDocument>
XClassManager.getClassName()
,
XClassManager.getClassSpace()
public String getClassTemplateSpace()
getClassTemplateSpace
in interface XClassManager<T extends XObjectDocument>
XClassManager.getClassPrefix()
,
XClassManager.XWIKI_CLASSTEMPLATE_SPACE_SUFFIX
public String getClassTemplateName()
getClassTemplateName
in interface XClassManager<T extends XObjectDocument>
XClassManager.getClassPrefix()
,
XClassManager.getClassTemplateFullName()
,
XClassManager.XWIKI_CLASSTEMPLATE_SUFFIX
public String getClassTemplateFullName()
getClassTemplateFullName
in interface XClassManager<T extends XObjectDocument>
XClassManager.getClassTemplateSpace()
,
XClassManager.getClassTemplateName()
public String getClassSheetSpace()
getClassSheetSpace
in interface XClassManager<T extends XObjectDocument>
XClassManager.getClassSpacePrefix()
,
XClassManager.XWIKI_CLASSSHEET_SPACE_SUFFIX
public String getClassSheetName()
getClassSheetName
in interface XClassManager<T extends XObjectDocument>
XClassManager.getClassPrefix()
,
XClassManager.getClassSheetFullName()
,
XClassManager.XWIKI_CLASSSHEET_SUFFIX
public String getClassSheetFullName()
getClassSheetFullName
in interface XClassManager<T extends XObjectDocument>
XClassManager.getClassSheetSpace()
,
XClassManager.getClassSheetName()
public boolean forceValidDocumentName()
forceValidDocumentName
in interface XClassManager<T extends XObjectDocument>
protected void check(XWikiContext context) throws XWikiException
context
- the XWiki context.
XWikiException
- error when saving documents.checkClassDocument(XWikiContext)
protected void checkClassDocument(XWikiContext context) throws XWikiException
context
- the XWiki context.
XWikiException
- error when saving document.public String getClassSheetDefaultContent()
getClassSheetDefaultContent
in interface XClassManager<T extends XObjectDocument>
protected void checkClassSheetDocument(XWikiContext context) throws XWikiException
context
- the XWiki context.
XWikiException
- error when saving document.public String getClassTemplateDefaultContent()
getClassTemplateDefaultContent
in interface XClassManager<T extends XObjectDocument>
protected void checkClassTemplateDocument(XWikiContext context) throws XWikiException
context
- the XWiki context.
XWikiException
- error when saving document.protected int intFromBoolean(Boolean value)
value
- the Boolean
value to convert.
int
value.protected boolean updateClassTemplateDocument(XWikiDocument doc)
doc
- the class template document that will be saved.
doc
modified.protected boolean updateDocStringValue(XWikiDocument doc, String fieldName, String value)
doc
- the document to modify.fieldName
- the name of the field.value
- the value.
doc
modified.protected boolean updateDocBooleanValue(XWikiDocument doc, String fieldName, Boolean value)
doc
- the document to modify.fieldName
- the name of the field.value
- the value.
doc
modified.protected boolean updateBaseClass(BaseClass baseClass)
baseClass
- the baseClass to configure.
baseClass
modified.protected boolean updateBooleanClassDefaultValue(BaseClass baseClass, String fieldName, Boolean value)
baseClass
- the XWiki class.fieldName
- the name of the field.value
- the default value.
baseClass
modified.public BaseClass getBaseClass()
getBaseClass
in interface XClassManager<T extends XObjectDocument>
public Document getClassDocument(XWikiContext context) throws XWikiException
XClassManager
getClassDocument
in interface XClassManager<T extends XObjectDocument>
context
- the XWiki context.
XWikiException
- error when getting class document from the database.public Document getClassSheetDocument(XWikiContext context) throws XWikiException
XClassManager
getClassSheetDocument
in interface XClassManager<T extends XObjectDocument>
context
- the XWiki context.
XWikiException
- error when getting class sheet document from the database.public Document getClassTemplateDocument(XWikiContext context) throws XWikiException
XClassManager
getClassTemplateDocument
in interface XClassManager<T extends XObjectDocument>
context
- the XWiki context.
XWikiException
- error when getting class template document from the database.public boolean isInstance(XWikiDocument doc)
XClassManager
doc
is compatible with this xwiki class (if he contains class object).
isInstance
in interface XClassManager<T extends XObjectDocument>
doc
- the XWikidocument to test.
doc
support this class, false otherwise.public boolean isInstance(Document doc)
XClassManager
doc
is compatible with this xwiki class (if he contains class object).
isInstance
in interface XClassManager<T extends XObjectDocument>
doc
- the XWikidocument to test.
doc
support this class, false otherwise.public boolean isValidName(String fullName)
isValidName
in interface XClassManager<T extends XObjectDocument>
fullName
- the full name of the document
public String getItemDocumentDefaultName(String itemName, XWikiContext context)
XClassManager
item
. Usually a Document name is DocumentTypeItemName.
getItemDocumentDefaultName
in interface XClassManager<T extends XObjectDocument>
itemName
- the name of the item to find.context
- the XWiki context.
XClassManager.getItemDocumentDefaultFullName(String, XWikiContext)
,
XClassManager.getItemDefaultName(String)
public String getItemDocumentDefaultFullName(String itemName, XWikiContext context)
XClassManager
item
. Usually a Document full name is
Space.DocumentTypeItemName.
getItemDocumentDefaultFullName
in interface XClassManager<T extends XObjectDocument>
itemName
- the name of the item.context
- the XWiki context.
XClassManager.getItemDocumentDefaultName(String, XWikiContext)
,
XClassManager.getItemDefaultName(String)
public String getItemDefaultName(String docFullName)
XClassManager
getItemDefaultName
in interface XClassManager<T extends XObjectDocument>
docFullName
- the full name of the document.
XClassManager.getItemDocumentDefaultFullName(String, XWikiContext)
public T getXObjectDocument(String itemName, int objectId, boolean validate, XWikiContext context) throws XWikiException
XClassManager
itemName
.
getXObjectDocument
in interface XClassManager<T extends XObjectDocument>
itemName
- the full name of the item.objectId
- the id of the XWiki object included in the document to manage.validate
- indicate if it return new T
or throw exception if wiki descriptor does not exist.context
- the XWiki context.
XWikiException
- error when getting document from the database.XClassManager.getItemDefaultName(String)
,
XClassManager.getItemDocumentDefaultFullName(String, XWikiContext)
public String createWhereClause(Object[][] fieldDescriptors, List<Object> parameterValues)
XWikiStoreInterface
"searchDocuments" methods.
createWhereClause
in interface XClassManager<T extends XObjectDocument>
fieldDescriptors
- the list of fields name/value constraints. Format : [[fieldName1, typeField1,
valueField1][fieldName2, typeField2, valueField2]].parameterValues
- the where clause values that replace the question marks (?).
public List<T> searchXObjectDocuments(XWikiContext context) throws XWikiException
context
- the XWiki context.
XObjectDocument
.
XWikiException
- error when searching for document in database.getClassFullName()
public List<T> searchXObjectDocumentsByField(String fieldName, Object fieldValue, String fieldType, XWikiContext context) throws XWikiException
fieldName
- the name of field.fieldValue
- the value of field.fieldType
- the type of field.context
- the XWiki context.
T
.
XWikiException
- error when searching for documents from in database.public List<T> searchXObjectDocumentsByFields(Object[][] fieldDescriptors, XWikiContext context) throws XWikiException
fieldDescriptors
- the list of fields name/value constraints. Format : [[fieldName1, typeField1,
valueField1][fieldName2, typeField2, valueField2]].context
- the XWiki context.
XObjectDocument
.
XWikiException
- error when searching for documents from in database.public T newXObjectDocument(XWikiDocument doc, int objId, XWikiContext context) throws XWikiException
XClassManager
XClassManager.getClassFullName()
. If document already exist it is
returned with new object if it does not contains any.
newXObjectDocument
in interface XClassManager<T extends XObjectDocument>
doc
- the XWiki document to manage.objId
- the id of the XWiki object included in the document to manage.context
- the XWiki context.
XWikiException
- error when calling XObjectDocument implementation constructor.public T newXObjectDocument(String docFullName, int objId, XWikiContext context) throws XWikiException
XClassManager
XClassManager.getClassFullName()
. If document already exist it is
returned with new object if it does not contains any.
newXObjectDocument
in interface XClassManager<T extends XObjectDocument>
docFullName
- the full name of document to manage.objId
- the id of the XWiki object included in the document to manage.context
- the XWiki context.
XWikiException
- error when calling T constructor.XClassManager.getClassFullName()
public T newXObjectDocument(XWikiContext context) throws XWikiException
XClassManager
XClassManager.getClassFullName()
. If document already exist it is
returned with new object if it does not contains any.
newXObjectDocument
in interface XClassManager<T extends XObjectDocument>
context
- the XWiki context.
XWikiException
- error when calling T constructor.public List<T> newXObjectDocumentList(XWikiDocument document, XWikiContext context) throws XWikiException
XClassManager
XClassManager.getClassFullName()
for provided
XWikiDocument
and return it.
newXObjectDocumentList
in interface XClassManager<T extends XObjectDocument>
document
- the list of XWikiDocument
.context
- the XWiki context.
T
.
XWikiException
- error when calling XObjectDocument implementation constructor.public List<T> newXObjectDocumentList(List<XWikiDocument> documents, XWikiContext context) throws XWikiException
XClassManager
XClassManager.getClassFullName()
of each XWikiDocument
in
the list and return it.
newXObjectDocumentList
in interface XClassManager<T extends XObjectDocument>
documents
- the list of XWikiDocument
.context
- the XWiki context.
T
.
XWikiException
- error when calling XObjectDocument implementation constructor.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |