Class SheetScriptService

  • All Implemented Interfaces:
    org.xwiki.script.service.ScriptService

    @Component
    @Named("sheet")
    @Singleton
    public class SheetScriptService
    extends Object
    implements org.xwiki.script.service.ScriptService
    Exposes SheetManager and SheetBinder to Velocity scripts.
    Since:
    3.2M3
    Version:
    $Id: a711de29f6409093d32f9777ba18e08e40881e3e $
    • Constructor Detail

      • SheetScriptService

        public SheetScriptService()
    • Method Detail

      • getSheets

        public List<DocumentReference> getSheets​(Document document,
                                                 String action)
        Returns the list of sheets associated with a XWiki document.
        Parameters:
        document - the document for which to retrieve the sheets
        action - the action for which to retrieve the sheets ('view', 'edit' etc.)
        Returns:
        the list of sheets available for the specified document on the specified action; these are sheets designed to be displayed when the specified action is performed on the given document; only the sheets that the current user has the right to view are returned
      • getClassSheets

        public List<DocumentReference> getClassSheets​(Document classDocument)
        Retrieves the list of sheets explicitly bound to a XWiki class.
        Parameters:
        classDocument - a document holding a class definition
        Returns:
        the list of sheets explicitly bound to the given class; these are sheets designed to be applied to documents that have objects of the given class; only the sheets that the current user has the right to view are returned
      • bindClassSheet

        public boolean bindClassSheet​(Document classDocument,
                                      DocumentReference sheetReference)
        Binds a sheet to a XWiki class. Changes are not persisted until the class document is saved.
        Parameters:
        classDocument - a document holding a class definition
        sheetReference - a reference to a sheet
        Returns:
        true if the sheet was successfully bound, false otherwise
      • unbindClassSheet

        public boolean unbindClassSheet​(Document classDocument,
                                        DocumentReference sheetReference)
        Removes the binding between a XWiki class and a sheet. Changes are not persisted until the class document is saved.
        Parameters:
        classDocument - a document holding a class definition
        sheetReference - a reference to a sheet
        Returns:
        true if the sheet was successfully unbound, false otherwise
      • getDocumentSheets

        public List<DocumentReference> getDocumentSheets​(Document document)
        Retrieves the list of sheets explicitly bound to a XWiki document.
        Parameters:
        document - a XWiki document
        Returns:
        the list of sheets explicitly bound to the given document; only the sheets that the current user has the right to view are returned
      • bindDocumentSheet

        public boolean bindDocumentSheet​(Document document,
                                         DocumentReference sheetReference)
        Binds a sheet to a XWiki document. Changes are not persisted until the document is saved.
        Parameters:
        document - a XWiki document
        sheetReference - a reference to a sheet
        Returns:
        true if the sheet was successfully bound, false otherwise
      • unbindDocumentSheet

        public boolean unbindDocumentSheet​(Document document,
                                           DocumentReference sheetReference)
        Removes the binding between a XWiki document and a sheet. Changes are not persisted until the document is saved.
        Parameters:
        document - a XWiki document
        sheetReference - a reference to a sheet
        Returns:
        true if the sheet was successfully unbound, false otherwise
      • getDocuments

        public List<DocumentReference> getDocuments​(DocumentReference sheetReference)
        Retrieves the list of documents that have explicitly bound the specified sheet.
        Parameters:
        sheetReference - a reference to a sheet
        Returns:
        the list of documents that have the specified sheet explicitly bound