public abstract class AbstractMandatoryDocumentInitializer extends Object implements MandatoryDocumentInitializer, org.xwiki.component.phase.Initializable
Modifier and Type | Field and Description |
---|---|
protected SheetBinder |
documentSheetBinder
Used to associate a document with a document sheet.
|
protected DocumentReferenceResolver<EntityReference> |
resolver |
protected WikiDescriptorManager |
wikiDescriptorManager
Used to get the main wiki.
|
DEFAULT_PRIORITY
Constructor and Description |
---|
AbstractMandatoryDocumentInitializer(EntityReference reference) |
AbstractMandatoryDocumentInitializer(EntityReference reference,
String title) |
Modifier and Type | Method and Description |
---|---|
EntityReference |
getDocumentReference() |
protected String |
getTitle() |
void |
initialize() |
protected int |
intFromBoolean(Boolean value) |
protected boolean |
isMainWikiOnly() |
boolean |
updateDocument(XWikiDocument document)
Update the provided document according to the need.
|
protected boolean |
updateDocumentFields(XWikiDocument document,
String title)
Set the fields of the document passed as parameter.
|
protected boolean |
updateTitle(XWikiDocument document) |
@Inject @Named(value="document") protected SheetBinder documentSheetBinder
@Inject protected WikiDescriptorManager wikiDescriptorManager
@Inject protected DocumentReferenceResolver<EntityReference> resolver
public AbstractMandatoryDocumentInitializer(EntityReference reference)
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 notpublic AbstractMandatoryDocumentInitializer(EntityReference reference, String title)
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 nottitle
- the title of the documentpublic void initialize() throws org.xwiki.component.phase.InitializationException
initialize
in interface org.xwiki.component.phase.Initializable
org.xwiki.component.phase.InitializationException
public EntityReference getDocumentReference()
getDocumentReference
in interface MandatoryDocumentInitializer
public boolean updateDocument(XWikiDocument document)
MandatoryDocumentInitializer
updateDocument
in interface MandatoryDocumentInitializer
document
- the existing document to updateprotected boolean updateTitle(XWikiDocument document)
protected String getTitle()
protected boolean isMainWikiOnly()
false
. This is ignored if the passed reference already contains the wiki information.protected boolean updateDocumentFields(XWikiDocument document, String title)
document
- the documenttitle
- the page title to set (if null or blank the title won't be set)Copyright © 2004–2022 XWiki. All rights reserved.