Package org.xwiki.extension.xar.script
Class XarExtensionScriptService
- java.lang.Object
-
- org.xwiki.extension.script.AbstractExtensionScriptService
-
- org.xwiki.extension.xar.script.XarExtensionScriptService
-
- All Implemented Interfaces:
org.xwiki.script.service.ScriptService
@Component @Named("extension.xar") @Singleton public class XarExtensionScriptService extends AbstractExtensionScriptService
Various XAR oriented APIs for scripts.- Since:
- 5.3M1
- Version:
- $Id: d2d980ddd5e21f1d1f0477c126ca7c07c944b72c $
-
-
Field Summary
-
Fields inherited from class org.xwiki.extension.script.AbstractExtensionScriptService
authorization, documentAccessBridge, execution, EXTENSIONERROR_KEY, jobExecutor, PROPERTY_CALLERREFERENCE, PROPERTY_CHECKRIGHTS, PROPERTY_CONTEXT_ACTION, PROPERTY_CONTEXT_WIKI, PROPERTY_USERREFERENCE, scriptProvider, WIKI_NAMESPACE_PREFIX, xcontextProvider
-
-
Constructor Summary
Constructors Constructor Description XarExtensionScriptService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.xwiki.job.Job
diff(String feature, String wiki)
Computes the differences, in unified format, between the documents of an installed XAR extension and the document from the wiki.ConflictQuestion.ConflictType[]
getConflictTypes()
ProtectionLevel
getDeleteSecurityLevel(DocumentReference userReference, DocumentReference documentReference)
List<String>
getDiffJobId(String feature, String namespace)
Get the id of the previously (or currently) computed differences, in unified format, between the documents of an installed XAR extension and the document from the wiki..ProtectionLevel
getEditSecurityLevel(DocumentReference userReference, DocumentReference documentReference)
Document
getInstalledExtensionDocument(DocumentReference reference)
Document
getInstalledExtensionDocument(DocumentReference reference, org.xwiki.extension.ExtensionId extensionId)
Document
getInstalledExtensionDocument(DocumentReference reference, org.xwiki.extension.xar.internal.repository.XarInstalledExtension extension)
Collection<org.xwiki.extension.InstalledExtension>
getInstalledExtensions(DocumentReference reference)
Boolean
isCustomizedExtensionDocument(DocumentReference documentReference)
boolean
isDeleteAllowed(DocumentReference documentReference)
boolean
isEditAllowed(DocumentReference documentReference)
Boolean
isExtensionDocument(DocumentReference documentReference)
org.xwiki.job.Job
repairInstalledExtension(String id, String version, String wiki)
Make sure the provided XAR extension properly is registered in the installed extensions index.boolean
reset(DocumentReference reference, List<String> jobId)
boolean
reset(DocumentReference reference, org.xwiki.extension.ExtensionId extensionId, List<String> jobId)
-
Methods inherited from class org.xwiki.extension.script.AbstractExtensionScriptService
contextualize, fromWikitoNamespace, getCallerDocument, getJobStatus, getLastError, safe, safeWrapError, setError, setRightsProperties, toWikiId, wrapError
-
-
-
-
Method Detail
-
repairInstalledExtension
public org.xwiki.job.Job repairInstalledExtension(String id, String version, String wiki)
Make sure the provided XAR extension properly is registered in the installed extensions index.Start an asynchronous Job.
- Parameters:
id
- the extension identifierversion
- the extension versionwiki
- the wiki where the extension is installed- Returns:
- the
Job
object which can be used to monitor the progress of the installation process, ornull
in case of failure
-
getDiffJobId
public List<String> getDiffJobId(String feature, String namespace)
Get the id of the previously (or currently) computed differences, in unified format, between the documents of an installed XAR extension and the document from the wiki..- Parameters:
feature
- the identifier of a XAR extension (or one of its features)namespace
- the namespace where the XAR extension is installed- Returns:
- the id of the
Job
- Since:
- 9.3RC1
-
diff
public org.xwiki.job.Job diff(String feature, String wiki)
Computes the differences, in unified format, between the documents of an installed XAR extension and the document from the wiki.- Parameters:
feature
- the identifier of a XAR extension (or one of its features)wiki
- the wiki where the XAR extension is installed- Returns:
- the
Job
object which can be used to monitor the progress while the differences are being computed, ornull
in case of failure - Since:
- 7.0RC1
-
getConflictTypes
public ConflictQuestion.ConflictType[] getConflictTypes()
- Returns:
- the possible conflicts
- Since:
- 9.2RC1
-
reset
public boolean reset(DocumentReference reference, org.xwiki.extension.ExtensionId extensionId, List<String> jobId)
- Parameters:
reference
- the reference of the document to reset to its standard state (what it looks like in the extension XAR)extensionId
- the installed extension from which to get the standard version of the documentjobId
- the id of the job which computed the diff if any- Returns:
- true if the reset actually did something, false otherwise (any produced error can be accessed using
AbstractExtensionScriptService.getLastError()
) - Since:
- 9.3RC1
-
reset
public boolean reset(DocumentReference reference, List<String> jobId)
- Parameters:
reference
- the reference of the document to reset to its standard state (what it looks like in the extension XAR)jobId
- the id of the job which computed the diff if any- Returns:
- true if the reset actually did something, false otherwise (any produced error can be accessed using
AbstractExtensionScriptService.getLastError()
) - Since:
- 9.3RC1
-
getInstalledExtensions
public Collection<org.xwiki.extension.InstalledExtension> getInstalledExtensions(DocumentReference reference)
- Parameters:
reference
- the reference of the document- Returns:
- the installed XAR extensions in which this document can be found
- Since:
- 9.3RC1
-
getInstalledExtensionDocument
public Document getInstalledExtensionDocument(DocumentReference reference) throws XarExtensionException
- Parameters:
reference
- the reference of the document- Returns:
- a Document instance of passed document when extracted from the standard extension matching this reference. Null if none could be found.
- Throws:
XarExtensionException
- when failing to get the document- Since:
- 9.3RC1
-
getInstalledExtensionDocument
public Document getInstalledExtensionDocument(DocumentReference reference, org.xwiki.extension.ExtensionId extensionId) throws XarExtensionException
- Parameters:
reference
- the reference of the documentextensionId
- the id of the extension from which to get the standard version of the document- Returns:
- a Document instance of passed document when extracted from the standard extension matching this reference. Null if none could be found.
- Throws:
XarExtensionException
- when failing to get the document- Since:
- 9.3RC1
-
getInstalledExtensionDocument
public Document getInstalledExtensionDocument(DocumentReference reference, org.xwiki.extension.xar.internal.repository.XarInstalledExtension extension) throws XarExtensionException
- Parameters:
reference
- the reference of the documentextension
- the extension from which to get the standard version of the document- Returns:
- a Document instance of passed document when extracted from the standard extension matching this reference. Null if none could be found.
- Throws:
XarExtensionException
- when failing to get the document- Since:
- 9.3RC1
-
isEditAllowed
public boolean isEditAllowed(DocumentReference documentReference)
- Parameters:
documentReference
- the reference of the document- Returns:
- true if edit is allowed on the passed document
- Since:
- 10.3
-
isDeleteAllowed
public boolean isDeleteAllowed(DocumentReference documentReference)
- Parameters:
documentReference
- the reference of the document- Returns:
- true if edit is allowed on the passed document
- Since:
- 10.3
-
getEditSecurityLevel
public ProtectionLevel getEditSecurityLevel(DocumentReference userReference, DocumentReference documentReference)
- Parameters:
userReference
- the reference of the userdocumentReference
- the reference of the document- Returns:
- the protection level
- Since:
- 10.5RC1
-
getDeleteSecurityLevel
public ProtectionLevel getDeleteSecurityLevel(DocumentReference userReference, DocumentReference documentReference)
- Parameters:
userReference
- the reference of the userdocumentReference
- the reference of the document- Returns:
- the protection level
- Since:
- 10.5RC1
-
isExtensionDocument
public Boolean isExtensionDocument(DocumentReference documentReference)
- Parameters:
documentReference
- a document reference- Returns:
true
if the specified document belongs to an installed extension (either part of a XAR or generated by a mandatory document initializer)- Since:
- 11.10
-
isCustomizedExtensionDocument
public Boolean isCustomizedExtensionDocument(DocumentReference documentReference)
- Parameters:
documentReference
- a document reference- Returns:
true
if the specified document is an extension document that has customizations (e.g. compared with the version from the XAR)- Since:
- 11.10
-
-