public abstract class AbstractExtensionScriptService extends Object implements org.xwiki.script.service.ScriptService
Modifier and Type | Field and Description |
---|---|
protected org.xwiki.security.authorization.ContextualAuthorizationManager |
authorization |
protected org.xwiki.bridge.DocumentAccessBridge |
documentAccessBridge
Needed for getting the current user reference.
|
protected org.xwiki.context.Execution |
execution
Provides access to the current context.
|
static String |
EXTENSIONERROR_KEY
The key under which the last encountered error is stored in the current execution context.
|
protected org.xwiki.job.JobExecutor |
jobExecutor |
protected static String |
PROPERTY_CALLERREFERENCE |
protected static String |
PROPERTY_CHECKRIGHTS |
protected static String |
PROPERTY_CONTEXT_ACTION
Extension request property that specifies from which document action the job was started.
|
protected static String |
PROPERTY_CONTEXT_WIKI
Extension request property that specifies from which wiki the job was started.
|
protected static String |
PROPERTY_USERREFERENCE |
protected org.xwiki.script.internal.safe.ScriptSafeProvider |
scriptProvider |
protected static String |
WIKI_NAMESPACE_PREFIX
The prefix used for wiki namespace id.
|
protected javax.inject.Provider<XWikiContext> |
xcontextProvider |
Constructor and Description |
---|
AbstractExtensionScriptService() |
Modifier and Type | Method and Description |
---|---|
void |
contextualize(org.xwiki.job.AbstractRequest request)
Add to the job request various information about the current context.
|
protected String |
fromWikitoNamespace(String wiki) |
protected XWikiDocument |
getCallerDocument() |
protected org.xwiki.job.event.status.JobStatus |
getJobStatus(List<String> jobId) |
Exception |
getLastError()
Get the error generated while performing the previously called action.
|
protected <S> S |
safe(Object unsafe) |
protected <R> R |
safeWrapError(Callable<R> callable)
Call the passed callable but try/catch and return null in case of exception (and update the last error).
|
protected void |
setError(Exception e)
Store a caught exception in the context, so that it can be later retrieved using
getLastError() . |
protected <T extends org.xwiki.job.AbstractRequest> |
setRightsProperties(T extensionRequest) |
protected String |
toWikiId(String namespace) |
protected <R> R |
wrapError(Callable<R> callable)
Call the passed callable but try/catch and return null in case of exception (and update the last error).
|
public static final String EXTENSIONERROR_KEY
protected static final String PROPERTY_CONTEXT_WIKI
protected static final String PROPERTY_CONTEXT_ACTION
protected static final String PROPERTY_USERREFERENCE
protected static final String PROPERTY_CALLERREFERENCE
protected static final String PROPERTY_CHECKRIGHTS
protected static final String WIKI_NAMESPACE_PREFIX
@Inject protected org.xwiki.script.internal.safe.ScriptSafeProvider scriptProvider
@Inject protected org.xwiki.context.Execution execution
@Inject protected org.xwiki.bridge.DocumentAccessBridge documentAccessBridge
@Inject protected javax.inject.Provider<XWikiContext> xcontextProvider
@Inject protected org.xwiki.job.JobExecutor jobExecutor
@Inject protected org.xwiki.security.authorization.ContextualAuthorizationManager authorization
protected <S> S safe(Object unsafe)
S
- the type of the safe object versionunsafe
- the unsafe objectprotected <T extends org.xwiki.job.AbstractRequest> void setRightsProperties(T extensionRequest)
protected XWikiDocument getCallerDocument()
protected String toWikiId(String namespace)
namespace
- the namespaceprotected String fromWikitoNamespace(String wiki)
wiki
- the wiki identifierpublic void contextualize(org.xwiki.job.AbstractRequest request)
request
- the job requestpublic Exception getLastError()
null
if no exception was thrownprotected void setError(Exception e)
getLastError()
.e
- the exception to store, can be null
to clear the previously stored exceptiongetLastError()
protected <R> R wrapError(Callable<R> callable)
R
- the result type of method call
callable
- a task that returns a result and may throw an exceptionprotected <R> R safeWrapError(Callable<R> callable)
R
- the result type of method call
callable
- a task that returns a result and may throw an exceptionCopyright © 2004–2022 XWiki. All rights reserved.