com.xpn.xwiki.plugin.applicationmanager.core.doc.objects.classes
Interface XClassManager<T extends XObjectDocument>

Type Parameters:
T - the item class extending XObjectDocument.
All Known Implementing Classes:
AbstractXClassManager, XWikiApplicationClass

public interface XClassManager<T extends XObjectDocument>

Interface that give way to manage a XWiki class.

Since:
Application Manager 1.0RC1
Version:
$Id: ec2b386c53774828f92df66f77f6006db291f83d $

Field Summary
static String XWIKI_CLASS_SPACE_PREFIX
          Default prefix for a document's space containing a class.
static String XWIKI_CLASS_SPACE_SUFFIX
          Default suffix for a document's space containing a class.
static String XWIKI_CLASS_SUFFIX
          Default suffix for the document containing the class.
static String XWIKI_CLASSSHEET_SPACE_SUFFIX
          Default suffix for a document's space containing a class sheet.
static String XWIKI_CLASSSHEET_SUFFIX
          Default suffix for a document containing a class sheet.
static String XWIKI_CLASSTEMPLATE_SPACE_SUFFIX
          Default suffix for a document's space containing a class template.
static String XWIKI_CLASSTEMPLATE_SUFFIX
          Default suffix for a document containing a class template.
 
Method Summary
 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.
 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 getClassFullName().
 T newXObjectDocument(XWikiContext context)
          Create new super document containing object of class getClassFullName().
 T newXObjectDocument(XWikiDocument doc, int objId, XWikiContext context)
          Create new super document containing object of class getClassFullName().
 List<T> newXObjectDocumentList(List<XWikiDocument> documents, XWikiContext context)
          Create new super document for each object of class getClassFullName() of each XWikiDocument in the list and return it.
 List<T> newXObjectDocumentList(XWikiDocument documents, XWikiContext context)
          Create new super documents for each object of class getClassFullName() for provided XWikiDocument and return it.
 

Field Detail

XWIKI_CLASS_SUFFIX

static final String XWIKI_CLASS_SUFFIX
Default suffix for the document containing the class.

See Also:
Constant Field Values

XWIKI_CLASSSHEET_SUFFIX

static final String XWIKI_CLASSSHEET_SUFFIX
Default suffix for a document containing a class sheet.

See Also:
Constant Field Values

XWIKI_CLASSTEMPLATE_SUFFIX

static final String XWIKI_CLASSTEMPLATE_SUFFIX
Default suffix for a document containing a class template.

See Also:
Constant Field Values

XWIKI_CLASS_SPACE_PREFIX

static final String XWIKI_CLASS_SPACE_PREFIX
Default prefix for a document's space containing a class.

See Also:
Constant Field Values

XWIKI_CLASS_SPACE_SUFFIX

static final String XWIKI_CLASS_SPACE_SUFFIX
Default suffix for a document's space containing a class.

See Also:
Constant Field Values

XWIKI_CLASSSHEET_SPACE_SUFFIX

static final String XWIKI_CLASSSHEET_SPACE_SUFFIX
Default suffix for a document's space containing a class sheet.

See Also:
Constant Field Values

XWIKI_CLASSTEMPLATE_SPACE_SUFFIX

static final String XWIKI_CLASSTEMPLATE_SPACE_SUFFIX
Default suffix for a document's space containing a class template.

See Also:
Constant Field Values
Method Detail

getClassSpacePrefix

String getClassSpacePrefix()
Returns:
the space prefix name of the document containing the class.

getClassPrefix

String getClassPrefix()
Returns:
the prefix name of the document containing the class. Usually extracted from : ClassSpace.ClassPrefixXWIKI_CLASS_SUFFIX.
See Also:
getClassSpace()

getClassSpace

String getClassSpace()
Returns:
the space name of the document containing the class. Usually class space is : SpacePrefixXWIKI_CLASS_SPACE_SUFFIX.
See Also:
getClassSpacePrefix(), XWIKI_CLASS_SPACE_SUFFIX

getClassName

String getClassName()
Returns:
the name of the document containing the class. Usually class name is : ClassPrefixXWIKI_CLASS_SUFFIX.
See Also:
getClassFullName(), getClassPrefix(), XWIKI_CLASS_SUFFIX

getClassFullName

String getClassFullName()
Returns:
the full name of the document containing the class. Usually class full name is : ClassSpace.ClassName.
See Also:
getClassName(), getClassSpace()

getClassTemplateSpace

String getClassTemplateSpace()
Returns:
the space name of the document containing the class template. Usually class template space name is : ClassSpacePrefixXWIKI_CLASSTEMPLATE_SPACE_SUFFIX.
See Also:
getClassPrefix(), XWIKI_CLASSTEMPLATE_SPACE_SUFFIX

getClassTemplateName

String getClassTemplateName()
Returns:
the name of the document containing the class template. Usually class template name is : ClassPrefixClassXWIKI_CLASSTEMPLATE_SUFFIX.
See Also:
getClassPrefix(), getClassTemplateFullName(), XWIKI_CLASSTEMPLATE_SUFFIX

getClassTemplateFullName

String getClassTemplateFullName()
Returns:
the full name of the document containing the class template. Usually class template full name is : ClassTemplateSpace.ClassTemplateName.
See Also:
getClassTemplateSpace(), getClassTemplateName()

getClassSheetSpace

String getClassSheetSpace()
Returns:
the space name of the document containing the class sheet. Usually class sheet space name is : ClassSpacePrefixXWIKI_CLASSSHEET_SPACE_SUFFIX.
See Also:
getClassSpacePrefix(), XWIKI_CLASSSHEET_SPACE_SUFFIX

getClassSheetName

String getClassSheetName()
Returns:
the name of the document containing the class sheet. Usually class sheet name is : ClassPrefixXWIKI_CLASSSHEET_SUFFIX.
See Also:
getClassPrefix(), getClassSheetFullName(), XWIKI_CLASSSHEET_SUFFIX

getClassSheetFullName

String getClassSheetFullName()
Returns:
the full name of the document containing the class sheet. Usually class sheet full name is : ClassSheetSpace.ClassSheetName.
See Also:
getClassSheetSpace(), getClassSheetName()

forceValidDocumentName

boolean forceValidDocumentName()
Returns:
indicate if the document names has to respect the default generated name style. This is used in the search to limit to valid results.

getBaseClass

BaseClass getBaseClass()
Returns:
the BaseClass managed by this SuperClass.

getClassDocument

Document getClassDocument(XWikiContext context)
                          throws XWikiException
Get the document containing the class in this context's database.

Parameters:
context - the XWiki context.
Returns:
the document containing the class for this context.
Throws:
XWikiException - error when getting class document from the database.

getClassSheetDefaultContent

String getClassSheetDefaultContent()
Returns:
the default content to add in a new class sheet document.

getClassSheetDocument

Document getClassSheetDocument(XWikiContext context)
                               throws XWikiException
Get the document containing the class sheet for this context's database.

Parameters:
context - the XWiki context.
Returns:
the document containing the class sheet for this context.
Throws:
XWikiException - error when getting class sheet document from the database.

getClassTemplateDefaultContent

String getClassTemplateDefaultContent()
Returns:
the default content to add in a new class template document.

getClassTemplateDocument

Document getClassTemplateDocument(XWikiContext context)
                                  throws XWikiException
Get the document containing the class template for this context's database.

Parameters:
context - the XWiki context.
Returns:
the class template document for this context.
Throws:
XWikiException - error when getting class template document from the database.

isInstance

boolean isInstance(XWikiDocument doc)
Determines if the specified doc is compatible with this xwiki class (if he contains class object).

Parameters:
doc - the XWikidocument to test.
Returns:
true if doc support this class, false otherwise.

isInstance

boolean isInstance(Document doc)
Determines if the specified doc is compatible with this xwiki class (if he contains class object).

Parameters:
doc - the XWikidocument to test.
Returns:
true if doc support this class, false otherwise.

isValidName

boolean isValidName(String fullName)
Parameters:
fullName - the full name of the document
Returns:
true if the document name follow the default rule

getItemDocumentDefaultName

String getItemDocumentDefaultName(String itemName,
                                  XWikiContext context)
Get document name from item name item. Usually a Document name is DocumentTypeItemName.

Parameters:
itemName - the name of the item to find.
context - the XWiki context.
Returns:
the name of the document.
See Also:
getItemDocumentDefaultFullName(String, XWikiContext), getItemDefaultName(String)

getItemDocumentDefaultFullName

String getItemDocumentDefaultFullName(String itemName,
                                      XWikiContext context)
Get document full name from item name item. Usually a Document full name is Space.DocumentTypeItemName.

Parameters:
itemName - the name of the item.
context - the XWiki context.
Returns:
the full name of the document.
See Also:
getItemDocumentDefaultName(String, XWikiContext), getItemDefaultName(String)

getItemDefaultName

String getItemDefaultName(String docFullName)
Get item name extracted from document full name. Usually a Document full name is Space.DocumentTypeItemName.

Parameters:
docFullName - the full name of the document.
Returns:
the item name extracted from document name.
See Also:
getItemDocumentDefaultFullName(String, XWikiContext)

getXObjectDocument

T getXObjectDocument(String itemName,
                     int objectId,
                     boolean validate,
                     XWikiContext context)
                                             throws XWikiException
Get document by full name from item name itemName.

Parameters:
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.
Returns:
the document.
Throws:
XWikiException - error when getting document from the database.
See Also:
getItemDefaultName(String), getItemDocumentDefaultFullName(String, XWikiContext)

createWhereClause

String createWhereClause(Object[][] fieldDescriptors,
                         List<Object> parameterValues)
Construct HQL where clause to use with XWikiStoreInterface "searchDocuments" methods.

Parameters:
fieldDescriptors - the list of fields name/value constraints. Format : [[fieldName1, typeField1, valueField1][fieldName2, typeField2, valueField2]].
parameterValues - the where clause values filled by the method that replace the question marks (?).
Returns:
a HQL where clause.

newXObjectDocument

T newXObjectDocument(XWikiDocument doc,
                     int objId,
                     XWikiContext context)
                                             throws XWikiException
Create new super document containing object of class getClassFullName(). If document already exist it is returned with new object if it does not contains any.

Parameters:
doc - the XWiki document to manage.
objId - the id of the XWiki object included in the document to manage.
context - the XWiki context.
Returns:
a new XObjectDocument instance.
Throws:
XWikiException - error when calling XObjectDocument implementation constructor.

newXObjectDocument

T newXObjectDocument(XWikiContext context)
                                             throws XWikiException
Create new super document containing object of class getClassFullName(). If document already exist it is returned with new object if it does not contains any.

Parameters:
context - the XWiki context.
Returns:
a new T instance.
Throws:
XWikiException - error when calling T constructor.

newXObjectDocument

T newXObjectDocument(String docFullName,
                     int objId,
                     XWikiContext context)
                                             throws XWikiException
Create new super document containing object of class getClassFullName(). If document already exist it is returned with new object if it does not contains any.

Parameters:
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.
Returns:
a new XObjectDocument instance.
Throws:
XWikiException - error when calling T constructor.
See Also:
getClassFullName()

newXObjectDocumentList

List<T> newXObjectDocumentList(XWikiDocument documents,
                               XWikiContext context)
                                                       throws XWikiException
Create new super documents for each object of class getClassFullName() for provided XWikiDocument and return it.

Parameters:
documents - the list of XWikiDocument.
context - the XWiki context.
Returns:
the list of T.
Throws:
XWikiException - error when calling XObjectDocument implementation constructor.

newXObjectDocumentList

List<T> newXObjectDocumentList(List<XWikiDocument> documents,
                               XWikiContext context)
                                                       throws XWikiException
Create new super document for each object of class getClassFullName() of each XWikiDocument in the list and return it.

Parameters:
documents - the list of XWikiDocument.
context - the XWiki context.
Returns:
the list of T.
Throws:
XWikiException - error when calling XObjectDocument implementation constructor.


Copyright © 2004-2013 XWiki. All Rights Reserved.