Class RefactoringScriptService

  • All Implemented Interfaces:
    org.xwiki.script.service.ScriptService

    @Component
    @Named("refactoring")
    @Singleton
    public class RefactoringScriptService
    extends Object
    implements org.xwiki.script.service.ScriptService
    Provides refactoring-specific scripting APIs.
    Since:
    7.2M1
    Version:
    $Id: e6418a7a87bdc08933ca66262bd0c47e2023303e $
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.xwiki.job.Job changeDocumentAuthor​(org.xwiki.model.reference.DocumentReference oldAuthorReference, org.xwiki.model.reference.DocumentReference newAuthorReference)
      Schedules an asynchronous job for replacing the author and the content author of the existing wiki pages.
      org.xwiki.job.Job convertToNestedDocument​(org.xwiki.model.reference.DocumentReference documentReference)
      Schedules an asynchronous job to convert the specified terminal document to a nested document (that can have child documents).
      org.xwiki.job.Job convertToTerminalDocument​(org.xwiki.model.reference.DocumentReference documentReference)
      Schedules an asynchronous job to convert the specified nested document to a terminal document (that can't have child documents).
      org.xwiki.job.Job copy​(Collection<org.xwiki.model.reference.EntityReference> sources, org.xwiki.model.reference.EntityReference destination)
      Schedules an asynchronous job to copy the specified source entities to the specified destination entity.
      org.xwiki.job.Job copy​(org.xwiki.model.reference.EntityReference source, org.xwiki.model.reference.EntityReference destination)
      Schedules an asynchronous job to copy the specified source entity to the specified destination entity.
      org.xwiki.job.Job copy​(CopyRequest request)
      Schedules an asynchronous job to perform the given copy request.
      org.xwiki.job.Job copyAs​(org.xwiki.model.reference.EntityReference reference, String copyName)
      Schedules an asynchronous job to copy the specified entity with a different name.
      org.xwiki.job.Job copyAs​(org.xwiki.model.reference.EntityReference sourceReference, org.xwiki.model.reference.EntityReference copyReference)
      Schedules an asynchronous job to copy the specified entity with a different reference.
      org.xwiki.job.Job copyAs​(CopyRequest request)
      Schedules an asynchronous job to perform the given copy-as request.
      org.xwiki.job.Job create​(Collection<org.xwiki.model.reference.EntityReference> entityReferences)
      Schedules an asynchronous job to create the specified entities.
      org.xwiki.job.Job create​(org.xwiki.model.reference.EntityReference entityReference)
      Schedules an asynchronous job to create the specified entity.
      org.xwiki.job.Job create​(CreateRequest request)
      Schedules an asynchronous job to perform the given create request.
      org.xwiki.job.Job delete​(Collection<org.xwiki.model.reference.EntityReference> entityReferences)
      Schedules an asynchronous job to delete the specified entities.
      org.xwiki.job.Job delete​(org.xwiki.model.reference.EntityReference entityReference)
      Schedules an asynchronous job to delete the specified entity.
      org.xwiki.job.Job delete​(EntityRequest request)
      Schedules an asynchronous job to perform the given delete request.
      Exception getLastError()
      Get the error generated while performing the previously called action.
      RequestFactory getRequestFactory()  
      boolean isRecycleBinSkippingAllowed()  
      org.xwiki.job.Job move​(Collection<org.xwiki.model.reference.EntityReference> sources, org.xwiki.model.reference.EntityReference destination)
      Schedules an asynchronous job to move the specified source entities to the specified destination entity (which becomes their new parent).
      org.xwiki.job.Job move​(org.xwiki.model.reference.EntityReference source, org.xwiki.model.reference.EntityReference destination)
      Schedules an asynchronous job to move the specified source entity to the specified destination entity (which becomes its new parent).
      org.xwiki.job.Job move​(MoveRequest request)
      Schedules an asynchronous job to perform the given move request.
      org.xwiki.job.Job permanentlyDelete​(String batchId)
      Schedules an asynchronous job for permanently deleting entities.
      org.xwiki.job.Job permanentlyDelete​(List<Long> deletedDocumentIds)
      Schedules an asynchronous job for permanently deleting entities.
      org.xwiki.job.Job permanentlyDelete​(PermanentlyDeleteRequest request)
      Schedules an asynchronous job for permanently deleting entities.
      org.xwiki.job.Job rename​(org.xwiki.model.reference.EntityReference reference, String newName)
      Schedules an asynchronous job to rename the specified entity.
      org.xwiki.job.Job rename​(org.xwiki.model.reference.EntityReference oldReference, org.xwiki.model.reference.EntityReference newReference)
      Schedules an asynchronous job to rename the specified entity.
      org.xwiki.job.Job rename​(MoveRequest request)
      Schedules an asynchronous job to perform the given rename request.
      org.xwiki.job.Job replaceUser​(ReplaceUserRequest request)
      Schedules an asynchronous job to perform the given request.
      org.xwiki.job.Job restore​(String batchId)
      Schedules an asynchronous job for restoring the specified the batchId.
      org.xwiki.job.Job restore​(List<Long> deletedDocumentIds)
      Schedules an asynchronous job for restoring the specified deleted documents.
      org.xwiki.job.Job restore​(RestoreRequest restoreRequest)
      Schedules an asynchronous job for restoring the specified entities.
    • Constructor Detail

      • RefactoringScriptService

        public RefactoringScriptService()
    • Method Detail

      • getRequestFactory

        public RequestFactory getRequestFactory()
        Returns:
        the standard request factory for creating the different refactoring requests.
        Since:
        10.11RC1
      • move

        public org.xwiki.job.Job move​(MoveRequest request)
        Schedules an asynchronous job to perform the given move request.
        Parameters:
        request - the move request to perform
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
      • move

        public org.xwiki.job.Job move​(Collection<org.xwiki.model.reference.EntityReference> sources,
                                      org.xwiki.model.reference.EntityReference destination)
        Schedules an asynchronous job to move the specified source entities to the specified destination entity (which becomes their new parent).
        Parameters:
        sources - specifies the entities to be moved
        destination - specifies the place where to move the entities (their new parent entity)
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
      • move

        public org.xwiki.job.Job move​(org.xwiki.model.reference.EntityReference source,
                                      org.xwiki.model.reference.EntityReference destination)
        Schedules an asynchronous job to move the specified source entity to the specified destination entity (which becomes its new parent).
        Parameters:
        source - specifies the entity to be moved
        destination - specifies the place where to move the entity (its new parent entity)
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
      • rename

        public org.xwiki.job.Job rename​(MoveRequest request)
        Schedules an asynchronous job to perform the given rename request.
        Parameters:
        request - the rename request to perform
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
      • rename

        public org.xwiki.job.Job rename​(org.xwiki.model.reference.EntityReference oldReference,
                                        org.xwiki.model.reference.EntityReference newReference)
        Schedules an asynchronous job to rename the specified entity.
        Parameters:
        oldReference - the entity to rename
        newReference - the new entity reference after the rename
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
      • rename

        public org.xwiki.job.Job rename​(org.xwiki.model.reference.EntityReference reference,
                                        String newName)
        Schedules an asynchronous job to rename the specified entity.
        Parameters:
        reference - the entity to rename
        newName - the new entity name
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
      • convertToNestedDocument

        public org.xwiki.job.Job convertToNestedDocument​(org.xwiki.model.reference.DocumentReference documentReference)
        Schedules an asynchronous job to convert the specified terminal document to a nested document (that can have child documents). E.g. the document Space1.Space2.Name is converted to Space1.Space2.Name.WebHome .
        Parameters:
        documentReference - the terminal document to convert to a nested document (that can have child documents)
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
      • convertToTerminalDocument

        public org.xwiki.job.Job convertToTerminalDocument​(org.xwiki.model.reference.DocumentReference documentReference)
        Schedules an asynchronous job to convert the specified nested document to a terminal document (that can't have child documents). E.g. the document One.Two.WebHome is converted to One.Two .
        Parameters:
        documentReference - the nested document to convert to a terminal document (that can't have child documents)
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
      • copy

        public org.xwiki.job.Job copy​(CopyRequest request)
        Schedules an asynchronous job to perform the given copy request.
        Parameters:
        request - the copy request to perform
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
        Since:
        10.11RC1
      • copy

        public org.xwiki.job.Job copy​(Collection<org.xwiki.model.reference.EntityReference> sources,
                                      org.xwiki.model.reference.EntityReference destination)
        Schedules an asynchronous job to copy the specified source entities to the specified destination entity.
        Parameters:
        sources - specifies the entities to be copied
        destination - specifies the place where to copy the entities
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
      • copy

        public org.xwiki.job.Job copy​(org.xwiki.model.reference.EntityReference source,
                                      org.xwiki.model.reference.EntityReference destination)
        Schedules an asynchronous job to copy the specified source entity to the specified destination entity.
        Parameters:
        source - specifies the entity to be copied
        destination - specifies the place where to copy the entity
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
      • copyAs

        public org.xwiki.job.Job copyAs​(CopyRequest request)
        Schedules an asynchronous job to perform the given copy-as request.
        Parameters:
        request - the copy-as request to perform
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
      • copyAs

        public org.xwiki.job.Job copyAs​(org.xwiki.model.reference.EntityReference sourceReference,
                                        org.xwiki.model.reference.EntityReference copyReference)
        Schedules an asynchronous job to copy the specified entity with a different reference.
        Parameters:
        sourceReference - the entity to copy
        copyReference - the reference to use for the copy
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
      • copyAs

        public org.xwiki.job.Job copyAs​(org.xwiki.model.reference.EntityReference reference,
                                        String copyName)
        Schedules an asynchronous job to copy the specified entity with a different name.
        Parameters:
        reference - the entity to copy
        copyName - the name to use for the copy
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
      • delete

        public org.xwiki.job.Job delete​(EntityRequest request)
        Schedules an asynchronous job to perform the given delete request.
        Parameters:
        request - the delete request to perform
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
      • delete

        public org.xwiki.job.Job delete​(Collection<org.xwiki.model.reference.EntityReference> entityReferences)
        Schedules an asynchronous job to delete the specified entities.
        Parameters:
        entityReferences - the entities to delete
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
      • delete

        public org.xwiki.job.Job delete​(org.xwiki.model.reference.EntityReference entityReference)
        Schedules an asynchronous job to delete the specified entity.
        Parameters:
        entityReference - the entity to delete
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
      • create

        public org.xwiki.job.Job create​(CreateRequest request)
        Schedules an asynchronous job to perform the given create request.
        Parameters:
        request - the create request to perform
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
        Since:
        7.4M2
      • create

        public org.xwiki.job.Job create​(Collection<org.xwiki.model.reference.EntityReference> entityReferences)
        Schedules an asynchronous job to create the specified entities.
        Parameters:
        entityReferences - the entities to create
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
        Since:
        7.4M2
      • create

        public org.xwiki.job.Job create​(org.xwiki.model.reference.EntityReference entityReference)
        Schedules an asynchronous job to create the specified entity.
        Parameters:
        entityReference - the entity to create
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
        Since:
        7.4M2
      • getLastError

        public Exception getLastError()
        Get the error generated while performing the previously called action.
        Returns:
        an eventual exception or null if no exception was thrown
      • restore

        public org.xwiki.job.Job restore​(RestoreRequest restoreRequest)
        Schedules an asynchronous job for restoring the specified entities.
        Parameters:
        restoreRequest - the information of the restore to do
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
        Since:
        10.10RC1
      • restore

        public org.xwiki.job.Job restore​(String batchId)
        Schedules an asynchronous job for restoring the specified the batchId.
        Parameters:
        batchId - the batchId corresponding to the entities to restore
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
        Since:
        10.10RC1
      • restore

        public org.xwiki.job.Job restore​(List<Long> deletedDocumentIds)
        Schedules an asynchronous job for restoring the specified deleted documents.
        Parameters:
        deletedDocumentIds - the ids of the deleted documents to restore
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
        Since:
        10.10RC1
      • permanentlyDelete

        public org.xwiki.job.Job permanentlyDelete​(PermanentlyDeleteRequest request)
        Schedules an asynchronous job for permanently deleting entities.
        Parameters:
        request - the request to run.
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
        Since:
        10.10RC1
      • permanentlyDelete

        public org.xwiki.job.Job permanentlyDelete​(String batchId)
        Schedules an asynchronous job for permanently deleting entities.
        Parameters:
        batchId - the batchId with the entities to permanently delete
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
        Since:
        10.10RC1
      • permanentlyDelete

        public org.xwiki.job.Job permanentlyDelete​(List<Long> deletedDocumentIds)
        Schedules an asynchronous job for permanently deleting entities.
        Parameters:
        deletedDocumentIds - the list of document ids to delete
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
        Since:
        10.10RC1
      • changeDocumentAuthor

        public org.xwiki.job.Job changeDocumentAuthor​(org.xwiki.model.reference.DocumentReference oldAuthorReference,
                                                      org.xwiki.model.reference.DocumentReference newAuthorReference)
        Schedules an asynchronous job for replacing the author and the content author of the existing wiki pages. If the old author is from the main wiki then the entire wiki farm is updated. Otherwise only the subwiki of the old author is updated.
        Parameters:
        oldAuthorReference - the old author reference
        newAuthorReference - the new author reference
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
        Since:
        11.8RC1
      • replaceUser

        public org.xwiki.job.Job replaceUser​(ReplaceUserRequest request)
        Schedules an asynchronous job to perform the given request.
        Parameters:
        request - the request to perform (specifies the old user reference and the new user reference)
        Returns:
        the job that has been scheduled and that can be used to monitor the progress of the operation, null in case of failure
        Since:
        11.8RC1
      • isRecycleBinSkippingAllowed

        public boolean isRecycleBinSkippingAllowed()
        Returns:
        true if the current user can be given the option to choose between sending a document to the recycle bin or deleting it permanently. false otherwise.
        Since:
        12.8RC1