com.xpn.xwiki.plugin.applicationmanager.core.doc.objects.classes
Class AbstractSuperClass

java.lang.Object
  extended by com.xpn.xwiki.plugin.applicationmanager.core.doc.objects.classes.AbstractSuperClass
All Implemented Interfaces:
SuperClass
Direct Known Subclasses:
XWikiApplicationClass

public abstract class AbstractSuperClass
extends java.lang.Object
implements SuperClass

Abstract implementation of SuperClass.

This class has to be extended with at least :

Version:
$Id: $
See Also:
SuperClass

Field Summary
 
Fields inherited from interface com.xpn.xwiki.plugin.applicationmanager.core.doc.objects.classes.SuperClass
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 AbstractSuperClass(java.lang.String prefix)
          Constructor for AbstractSuperClass.
protected AbstractSuperClass(java.lang.String spaceprefix, java.lang.String prefix)
          Constructor for AbstractSuperClass.
protected AbstractSuperClass(java.lang.String spaceprefix, java.lang.String prefix, boolean dispatch)
          Constructor for AbstractSuperClass.
 
Method Summary
protected  void check(com.xpn.xwiki.XWikiContext context)
          Check if all necessary documents for manage this class in this context exists and update.
 java.lang.String createWhereClause(java.lang.String[][] fieldDescriptors, java.util.List parameterValues)
          Construct HQL where clause to use with XWikiStoreInterface "searchDocuments" methods.
 com.xpn.xwiki.objects.classes.BaseClass getBaseClass()
          
 com.xpn.xwiki.api.Document getClassDocument(com.xpn.xwiki.XWikiContext context)
          Get the document containing the class in this context's database.
 java.lang.String getClassFullName()
          
 java.lang.String getClassName()
          
 java.lang.String getClassPrefix()
          
 java.lang.String getClassSheetDefaultContent()
          
 com.xpn.xwiki.api.Document getClassSheetDocument(com.xpn.xwiki.XWikiContext context)
          Get the document containing the class sheet for this context's database.
 java.lang.String getClassSheetFullName()
          
 java.lang.String getClassSheetName()
          
 java.lang.String getClassSheetSpace()
          
 java.lang.String getClassSpace()
          
 java.lang.String getClassSpacePrefix()
          
 java.lang.String getClassTemplateDefaultContent()
          
 com.xpn.xwiki.api.Document getClassTemplateDocument(com.xpn.xwiki.XWikiContext context)
          Get the document containing the class template for this context's database.
 java.lang.String getClassTemplateFullName()
          
 java.lang.String getClassTemplateName()
          
 java.lang.String getClassTemplateSpace()
          
 java.lang.String getItemDefaultName(java.lang.String docFullName)
          Get item name extracted from document full name.
 java.lang.String getItemDocumentDefaultFullName(java.lang.String itemName, com.xpn.xwiki.XWikiContext context)
          Get document full name from item name item.
 java.lang.String getItemDocumentDefaultName(java.lang.String itemName, com.xpn.xwiki.XWikiContext context)
          Get document name from item name item.
 SuperDocument getSuperDocument(java.lang.String itemName, int objectId, boolean validate, com.xpn.xwiki.XWikiContext context)
          Get document by full name from item name itemName.
 boolean isInstance(com.xpn.xwiki.api.Document doc)
          Determines if the specified doc is compatible with this xwiki class (if he contains class object).
 boolean isInstance(com.xpn.xwiki.doc.XWikiDocument doc)
          Determines if the specified doc is compatible with this xwiki class (if he contains class object).
 SuperDocument newSuperDocument(java.lang.String docFullName, int objId, com.xpn.xwiki.XWikiContext context)
          Create new super document containing object of class SuperClass.getClassFullName().
 SuperDocument newSuperDocument(com.xpn.xwiki.XWikiContext context)
          Create new super document containing object of class SuperClass.getClassFullName().
 SuperDocument newSuperDocument(com.xpn.xwiki.doc.XWikiDocument doc, int objId, com.xpn.xwiki.XWikiContext context)
          Create new super document containing object of class SuperClass.getClassFullName().
 java.util.List newSuperDocumentList(java.util.List documents, com.xpn.xwiki.XWikiContext context)
          Create new super document for each object of class SuperClass.getClassFullName() of each XWikiDocument in the list and return it.
 java.util.List newSuperDocumentList(com.xpn.xwiki.doc.XWikiDocument document, com.xpn.xwiki.XWikiContext context)
          Create new super documents for each object of class SuperClass.getClassFullName() for provided XWikiDocument and return it.
 java.util.List searchSuperDocuments(com.xpn.xwiki.XWikiContext context)
          Find all XWikiDocument containing object of this XWiki class.
 java.util.List searchSuperDocumentsByField(java.lang.String fieldName, java.lang.String fieldValue, java.lang.String fieldType, com.xpn.xwiki.XWikiContext context)
          Search in instances of this document class.
 java.util.List searchSuperDocumentsByFields(java.lang.String[][] fieldDescriptors, com.xpn.xwiki.XWikiContext context)
          Search in instances of this document class.
protected  boolean updateBaseClass(com.xpn.xwiki.objects.classes.BaseClass baseClass)
          Configure BaseClass.
protected  boolean updateClassTemplateDocument(com.xpn.xwiki.doc.XWikiDocument doc)
          Initialize template document with default content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSuperClass

protected AbstractSuperClass(java.lang.String prefix)
Constructor for AbstractSuperClass.

Parameters:
prefix - the prefix of class document.
See Also:
AbstractSuperClass(String, String), AbstractSuperClass(String, String, boolean)

AbstractSuperClass

protected AbstractSuperClass(java.lang.String spaceprefix,
                             java.lang.String prefix)
Constructor for AbstractSuperClass.

Parameters:
spaceprefix - the space prefix of class document.
prefix - the prefix of class document.
See Also:
AbstractSuperClass(String), AbstractSuperClass(String, String, boolean)

AbstractSuperClass

protected AbstractSuperClass(java.lang.String spaceprefix,
                             java.lang.String prefix,
                             boolean dispatch)
Constructor for AbstractSuperClass.

Parameters:
spaceprefix - the space of class document.
prefix - the prefix of class document.
dispatch - Indicate if it had to use standard XWiki applications space names.
See Also:
AbstractSuperClass(String), AbstractSuperClass(String, String)
Method Detail

getClassSpacePrefix

public java.lang.String getClassSpacePrefix()

Specified by:
getClassSpacePrefix in interface SuperClass
Returns:
the space prefix name of the document containing the class.
See Also:
SuperClass.getClassSpacePrefix()

getClassSpace

public java.lang.String getClassSpace()

Specified by:
getClassSpace in interface SuperClass
Returns:
the space name of the document containing the class. Usually class space is : SpacePrefixXWIKI_CLASS_SPACE_SUFFIX.
See Also:
SuperClass.getClassSpace()

getClassPrefix

public java.lang.String getClassPrefix()

Specified by:
getClassPrefix in interface SuperClass
Returns:
the prefix name of the document containing the class. Usually extracted from : ClassSpace.ClassPrefixXWIKI_CLASS_SUFFIX.
See Also:
SuperClass.getClassPrefix()

getClassName

public java.lang.String getClassName()

Specified by:
getClassName in interface SuperClass
Returns:
the name of the document containing the class. Usually class name is : ClassPrefixXWIKI_CLASS_SUFFIX.
See Also:
SuperClass.getClassName()

getClassFullName

public java.lang.String getClassFullName()

Specified by:
getClassFullName in interface SuperClass
Returns:
the full name of the document containing the class. Usually class full name is : ClassSpace.ClassName.
See Also:
SuperClass.getClassFullName()

getClassTemplateSpace

public java.lang.String getClassTemplateSpace()

Specified by:
getClassTemplateSpace in interface SuperClass
Returns:
the space name of the document containing the class template. Usually class template space name is : ClassSpacePrefixXWIKI_CLASSTEMPLATE_SPACE_SUFFIX.
See Also:
SuperClass.getClassTemplateName()

getClassTemplateName

public java.lang.String getClassTemplateName()

Specified by:
getClassTemplateName in interface SuperClass
Returns:
the name of the document containing the class template. Usually class template name is : ClassPrefixClassXWIKI_CLASSTEMPLATE_SUFFIX.
See Also:
SuperClass.getClassTemplateName()

getClassTemplateFullName

public java.lang.String getClassTemplateFullName()

Specified by:
getClassTemplateFullName in interface SuperClass
Returns:
the full name of the document containing the class template. Usually class template full name is : ClassTemplateSpace.ClassTemplateName.
See Also:
SuperClass.getClassTemplateFullName()

getClassSheetSpace

public java.lang.String getClassSheetSpace()

Specified by:
getClassSheetSpace in interface SuperClass
Returns:
the space name of the document containing the class sheet. Usually class sheet space name is : ClassSpacePrefixXWIKI_CLASSSHEET_SPACE_SUFFIX.
See Also:
SuperClass.getClassSheetName()

getClassSheetName

public java.lang.String getClassSheetName()

Specified by:
getClassSheetName in interface SuperClass
Returns:
the name of the document containing the class sheet. Usually class sheet name is : ClassPrefixXWIKI_CLASSSHEET_SUFFIX.
See Also:
SuperClass.getClassSheetName()

getClassSheetFullName

public java.lang.String getClassSheetFullName()

Specified by:
getClassSheetFullName in interface SuperClass
Returns:
the full name of the document containing the class sheet. Usually class sheet full name is : ClassSheetSpace.ClassSheetName.
See Also:
SuperClass.getClassSheetFullName()

check

protected void check(com.xpn.xwiki.XWikiContext context)
              throws com.xpn.xwiki.XWikiException
Check if all necessary documents for manage this class in this context exists and update. Create if not exists. Thread safe.

Parameters:
context - the XWiki context.
Throws:
com.xpn.xwiki.XWikiException - error when saving documents.
See Also:
checkClassDocument(XWikiContext)

getClassSheetDefaultContent

public java.lang.String getClassSheetDefaultContent()

Specified by:
getClassSheetDefaultContent in interface SuperClass
Returns:
the default content to add in a new class sheet document.
See Also:
SuperClass.getClassSheetDefaultContent()

getClassTemplateDefaultContent

public java.lang.String getClassTemplateDefaultContent()

Specified by:
getClassTemplateDefaultContent in interface SuperClass
Returns:
the default content to add in a new class template document.
See Also:
SuperClass.getClassTemplateDefaultContent()

updateClassTemplateDocument

protected boolean updateClassTemplateDocument(com.xpn.xwiki.doc.XWikiDocument doc)
Initialize template document with default content.

Parameters:
doc - the class template document that will be saved.
Returns:
true if doc modified.

updateBaseClass

protected boolean updateBaseClass(com.xpn.xwiki.objects.classes.BaseClass baseClass)
Configure BaseClass.

Parameters:
baseClass - the baseClass to configure.
Returns:
true if baseClass modified.

getBaseClass

public com.xpn.xwiki.objects.classes.BaseClass getBaseClass()

Specified by:
getBaseClass in interface SuperClass
Returns:
the BaseClass managed by this SuperClass.
See Also:
SuperClass.getBaseClass()

getClassDocument

public com.xpn.xwiki.api.Document getClassDocument(com.xpn.xwiki.XWikiContext context)
                                            throws com.xpn.xwiki.XWikiException
Get the document containing the class in this context's database.

Specified by:
getClassDocument in interface SuperClass
Parameters:
context - the XWiki context.
Returns:
the document containing the class for this context.
Throws:
com.xpn.xwiki.XWikiException - error when getting class document from the database.
See Also:
SuperClass.getClassDocument(com.xpn.xwiki.XWikiContext)

getClassSheetDocument

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

Specified by:
getClassSheetDocument in interface SuperClass
Parameters:
context - the XWiki context.
Returns:
the document containing the class sheet for this context.
Throws:
com.xpn.xwiki.XWikiException - error when getting class sheet document from the database.
See Also:
SuperClass.getClassSheetDocument(com.xpn.xwiki.XWikiContext)

getClassTemplateDocument

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

Specified by:
getClassTemplateDocument in interface SuperClass
Parameters:
context - the XWiki context.
Returns:
the class template document for this context.
Throws:
com.xpn.xwiki.XWikiException - error when getting class template document from the database.
See Also:
SuperClass.getClassTemplateDocument(com.xpn.xwiki.XWikiContext)

isInstance

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

Specified by:
isInstance in interface SuperClass
Parameters:
doc - the XWikidocument to test.
Returns:
true if doc support this class, false otherwise.
See Also:
SuperClass.isInstance(com.xpn.xwiki.doc.XWikiDocument)

isInstance

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

Specified by:
isInstance in interface SuperClass
Parameters:
doc - the XWikidocument to test.
Returns:
true if doc support this class, false otherwise.
See Also:
SuperClass.isInstance(com.xpn.xwiki.doc.XWikiDocument)

getItemDocumentDefaultName

public java.lang.String getItemDocumentDefaultName(java.lang.String itemName,
                                                   com.xpn.xwiki.XWikiContext context)
Get document name from item name item. Usually a Document name is DocumentTypeItemName.

Specified by:
getItemDocumentDefaultName in interface SuperClass
Parameters:
itemName - the name of the item to find.
context - the XWiki context.
Returns:
the name of the document.
See Also:
SuperClass.getItemDocumentDefaultName(java.lang.String, XWikiContext)

getItemDocumentDefaultFullName

public java.lang.String getItemDocumentDefaultFullName(java.lang.String itemName,
                                                       com.xpn.xwiki.XWikiContext context)
Get document full name from item name item. Usually a Document full name is Space.DocumentTypeItemName.

Specified by:
getItemDocumentDefaultFullName in interface SuperClass
Parameters:
itemName - the name of the item.
context - the XWiki context.
Returns:
the full name of the document.
See Also:
SuperClass.getItemDocumentDefaultFullName(java.lang.String, XWikiContext)

getItemDefaultName

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

Specified by:
getItemDefaultName in interface SuperClass
Parameters:
docFullName - the full name of the document.
Returns:
the item name extracted from document name.
See Also:
SuperClass.getItemDefaultName(java.lang.String)

getSuperDocument

public SuperDocument getSuperDocument(java.lang.String itemName,
                                      int objectId,
                                      boolean validate,
                                      com.xpn.xwiki.XWikiContext context)
                               throws com.xpn.xwiki.XWikiException
Get document by full name from item name itemName.

Specified by:
getSuperDocument in interface SuperClass
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 SuperDocument or throw exception if wiki descriptor does not exist.
context - the XWiki context.
Returns:
the document.
Throws:
com.xpn.xwiki.XWikiException - error when getting document from the database.
See Also:
SuperClass.getSuperDocument(java.lang.String, int, boolean, com.xpn.xwiki.XWikiContext)

createWhereClause

public java.lang.String createWhereClause(java.lang.String[][] fieldDescriptors,
                                          java.util.List parameterValues)
Construct HQL where clause to use with XWikiStoreInterface "searchDocuments" methods.

Specified by:
createWhereClause in interface SuperClass
Parameters:
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 (?).
Returns:
a HQL where clause.

searchSuperDocuments

public java.util.List searchSuperDocuments(com.xpn.xwiki.XWikiContext context)
                                    throws com.xpn.xwiki.XWikiException
Find all XWikiDocument containing object of this XWiki class.

Parameters:
context - the XWiki context.
Returns:
the list of found SuperDocument.
Throws:
com.xpn.xwiki.XWikiException - error when searching for document in database.
See Also:
getClassFullName()

searchSuperDocumentsByField

public java.util.List searchSuperDocumentsByField(java.lang.String fieldName,
                                                  java.lang.String fieldValue,
                                                  java.lang.String fieldType,
                                                  com.xpn.xwiki.XWikiContext context)
                                           throws com.xpn.xwiki.XWikiException
Search in instances of this document class.

Parameters:
fieldName - the name of field.
fieldValue - the value of field.
fieldType - the type of field.
context - the XWiki context.
Returns:
the list of found SuperDocument.
Throws:
com.xpn.xwiki.XWikiException - error when searching for documents from in database.

searchSuperDocumentsByFields

public java.util.List searchSuperDocumentsByFields(java.lang.String[][] fieldDescriptors,
                                                   com.xpn.xwiki.XWikiContext context)
                                            throws com.xpn.xwiki.XWikiException
Search in instances of this document class.

Parameters:
fieldDescriptors - the list of fields name/value constraints. Format : [[fieldName1, typeField1, valueField1][fieldName2, typeField2, valueField2]].
context - the XWiki context.
Returns:
the list of found SuperDocument.
Throws:
com.xpn.xwiki.XWikiException - error when searching for documents from in database.

newSuperDocument

public SuperDocument newSuperDocument(com.xpn.xwiki.doc.XWikiDocument doc,
                                      int objId,
                                      com.xpn.xwiki.XWikiContext context)
                               throws com.xpn.xwiki.XWikiException
Create new super document containing object of class SuperClass.getClassFullName(). If document already exist it is returned with new object if it does not contains any.

Specified by:
newSuperDocument in interface SuperClass
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 SuperDocument instance.
Throws:
com.xpn.xwiki.XWikiException - error when calling SuperDocument implementation constructor.
See Also:
SuperClass.newSuperDocument(com.xpn.xwiki.doc.XWikiDocument, int, com.xpn.xwiki.XWikiContext)

newSuperDocument

public SuperDocument newSuperDocument(java.lang.String docFullName,
                                      int objId,
                                      com.xpn.xwiki.XWikiContext context)
                               throws com.xpn.xwiki.XWikiException
Create new super document containing object of class SuperClass.getClassFullName(). If document already exist it is returned with new object if it does not contains any.

Specified by:
newSuperDocument in interface SuperClass
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 SuperDocument instance.
Throws:
com.xpn.xwiki.XWikiException - error when calling SuperDocument implementation constructor.
See Also:
SuperClass.newSuperDocument(java.lang.String, int, com.xpn.xwiki.XWikiContext)

newSuperDocument

public SuperDocument newSuperDocument(com.xpn.xwiki.XWikiContext context)
                               throws com.xpn.xwiki.XWikiException
Create new super document containing object of class SuperClass.getClassFullName(). If document already exist it is returned with new object if it does not contains any.

Specified by:
newSuperDocument in interface SuperClass
Parameters:
context - the XWiki context.
Returns:
a new SuperDocument instance.
Throws:
com.xpn.xwiki.XWikiException - error when calling SuperDocument implementation constructor.
See Also:
SuperClass.newSuperDocument(com.xpn.xwiki.XWikiContext)

newSuperDocumentList

public java.util.List newSuperDocumentList(com.xpn.xwiki.doc.XWikiDocument document,
                                           com.xpn.xwiki.XWikiContext context)
                                    throws com.xpn.xwiki.XWikiException
Create new super documents for each object of class SuperClass.getClassFullName() for provided XWikiDocument and return it.

Specified by:
newSuperDocumentList in interface SuperClass
Parameters:
document - the list of XWikiDocument.
context - the XWiki context.
Returns:
the list of SuperDocument.
Throws:
com.xpn.xwiki.XWikiException - error when calling SuperDocument implementation constructor.
See Also:
SuperClass.newSuperDocumentList(com.xpn.xwiki.doc.XWikiDocument, com.xpn.xwiki.XWikiContext)

newSuperDocumentList

public java.util.List newSuperDocumentList(java.util.List documents,
                                           com.xpn.xwiki.XWikiContext context)
                                    throws com.xpn.xwiki.XWikiException
Create new super document for each object of class SuperClass.getClassFullName() of each XWikiDocument in the list and return it.

Specified by:
newSuperDocumentList in interface SuperClass
Parameters:
documents - the list of XWikiDocument.
context - the XWiki context.
Returns:
the list of SuperDocument.
Throws:
com.xpn.xwiki.XWikiException - error when calling SuperDocument implementation constructor.
See Also:
SuperClass.newSuperDocumentList(java.util.List, com.xpn.xwiki.XWikiContext)


Copyright ? 2004-2008 XWiki. All Rights Reserved.