Class AbstractMandatoryDocumentInitializer

    • Constructor Detail

      • AbstractMandatoryDocumentInitializer

        public AbstractMandatoryDocumentInitializer​(EntityReference reference)
        Parameters:
        reference - the reference of the document to update. Can be either local or absolute depending if the document is associated to a specific wiki or not
      • AbstractMandatoryDocumentInitializer

        public AbstractMandatoryDocumentInitializer​(EntityReference reference,
                                                    String title)
        Parameters:
        reference - the reference of the document to update. Can be either local or absolute depending if the document is associated to a specific wiki or not
        title - the title of the document
    • Method Detail

      • initialize

        public void initialize()
                        throws org.xwiki.component.phase.InitializationException
        Specified by:
        initialize in interface org.xwiki.component.phase.Initializable
        Throws:
        org.xwiki.component.phase.InitializationException
      • updateTitle

        protected boolean updateTitle​(XWikiDocument document)
      • getTitle

        protected String getTitle()
      • isMainWikiOnly

        protected boolean isMainWikiOnly()
        Returns:
        true if the passed reference should be resolved to the main wiki instead of the local one. The default is false. This is ignored if the passed reference already contains the wiki information.
      • updateDocumentFields

        protected boolean updateDocumentFields​(XWikiDocument document,
                                               String title)
        Set the fields of the document passed as parameter. Can generate content for both XWiki Syntax 1.0 and XWiki Syntax 2.0. If new documents are set to be created in XWiki Syntax 1.0 then generate XWiki 1.0 Syntax otherwise generate XWiki Syntax 2.0.
        Parameters:
        document - the document
        title - the page title to set (if null or blank the title won't be set)
        Returns:
        true if the document has been modified, false otherwise
      • intFromBoolean

        protected int intFromBoolean​(Boolean value)
        Parameters:
        value - the Boolean value to convert.
        Returns:
        the converted int value.