Package com.xpn.xwiki.web
Class CreateActionRequestHandler
- java.lang.Object
-
- com.xpn.xwiki.web.CreateActionRequestHandler
-
public class CreateActionRequestHandler extends Object
Helper class used to handle one individual create action request.- Version:
- $Id: 7fde51fd2b13c44fd5120c13f4f5177188f6398c $
-
-
Constructor Summary
Constructors Constructor Description CreateActionRequestHandler(XWikiContext context)
-
Method Summary
-
-
-
Constructor Detail
-
CreateActionRequestHandler
public CreateActionRequestHandler(XWikiContext context)
- Parameters:
context
- the XWikiContext for which to handle the request.
-
-
Method Detail
-
processRequest
public void processRequest() throws XWikiException
Process the request and extract from the given parameters the data needed to create the new document.- Throws:
XWikiException
- if problems occur
-
getNewDocumentReference
public DocumentReference getNewDocumentReference()
- Returns:
- the document reference of the new document to be created,
null
if a no document can be created (because the conditions are not met)
-
hasTemplate
public boolean hasTemplate()
- Returns:
- if a template or a template provider have been set (it can be empty however)
-
isTemplateProviderAllowedToCreateInCurrentSpace
public boolean isTemplateProviderAllowedToCreateInCurrentSpace()
Verifies if the creation inside the specified spaceReference is allowed by the current template provider. If the creation is not allowed, an exception will be set on the context.- Returns:
true
if the creation is allowed,false
otherwise
-
isDocumentAlreadyExisting
public boolean isDocumentAlreadyExisting(XWikiDocument newDocument)
- Parameters:
newDocument
- the new document to check if it already exists- Returns:
- true if the document already exists (i.e. is not usable) and set an exception in the velocity context; false otherwise.
-
isDocumentPathTooLong
public boolean isDocumentPathTooLong(DocumentReference reference)
- Parameters:
reference
- the new document reference to check- Returns:
- true if the serialized document path is too long according to the limitation provided by
XWikiDocument.getLocalReferenceMaxLength()
. - Since:
- 11.4RC1
-
getVelocityContext
@Deprecated public org.apache.velocity.VelocityContext getVelocityContext()
Deprecated.since 8.3M1, usegetCurrentScriptContext()
instead- Returns:
- the
VelocityContext
for the context we are handling
-
getAuthManager
protected ContextualAuthorizationManager getAuthManager()
- Returns:
- the authorization manager
- Since:
- 9.11
-
getCurrentScriptContext
protected ScriptContext getCurrentScriptContext()
- Returns:
- the current script context
- Since:
- 8.3M1
-
getSpaceReference
public SpaceReference getSpaceReference()
- Returns:
- the space reference where the new document will be created
-
isSpace
public boolean isSpace()
- Returns:
- true if the new document is a space (i.e. Nested Document and the name means space name) or false if it's a terminal regular document (i.e. Nested Spaces document and the name means document name)
-
getAvailableTemplateProviders
public List<Document> getAvailableTemplateProviders()
- Returns:
- the available template providers for the space from where we are creating the new document
-
getRecommendedTemplateProviders
public List<Document> getRecommendedTemplateProviders()
- Returns:
- the recommended template providers, from the list of available ones
-
getTemplateProvider
public BaseObject getTemplateProvider()
- Returns:
- the currently used template provider read from the request, or
null
if none was set
-
getType
public String getType()
- Returns:
- the type of document to create, read from the request, or
null
if none was set - Since:
- 7.2
-
-