Package org.xwiki.attachment.script
Class AttachmentScriptService
- java.lang.Object
-
- org.xwiki.attachment.script.AttachmentScriptService
-
- All Implemented Interfaces:
org.xwiki.script.service.ScriptService
@Component @Singleton @Named("attachment") @Unstable public class AttachmentScriptService extends Object implements org.xwiki.script.service.ScriptService
Provides the operations related to attachments manipulation. In particular regarding the operations to move attachments.- Since:
- 14.0RC1
- Version:
- $Id: f37883c017f5b26e21dc48d2fb383f0cd388ec0c $
-
-
Constructor Summary
Constructors Constructor Description AttachmentScriptService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
backlinksCount(org.xwiki.model.reference.AttachmentReference attachmentReference)
Count the number of backlinks toward a given attachment.org.xwiki.job.Job
createMoveJob(MoveAttachmentRequest request)
Creates an attachment move job from a request.MoveAttachmentRequest
createMoveRequest(org.xwiki.model.reference.DocumentReference sourceLocation, String sourceName, org.xwiki.model.reference.DocumentReference targetLocation, String targetName, org.xwiki.model.reference.DocumentReference userReference, boolean autoRedirect, boolean updateReferences)
Creates an attachment move request.boolean
locationAvailable(org.xwiki.model.reference.DocumentReference documentReference, String attachmentName)
-
-
-
Method Detail
-
createMoveRequest
public MoveAttachmentRequest createMoveRequest(org.xwiki.model.reference.DocumentReference sourceLocation, String sourceName, org.xwiki.model.reference.DocumentReference targetLocation, String targetName, org.xwiki.model.reference.DocumentReference userReference, boolean autoRedirect, boolean updateReferences)
Creates an attachment move request.- Parameters:
sourceLocation
- the location of the document containing the source attachmentsourceName
- the name of the source attachmenttargetLocation
- the target location of the document containing the attachmenttargetName
- the target name of the attachmentuserReference
- the reference of the user making the move requestautoRedirect
- iftrue
a redirection will be set from the source location to the target locationupdateReferences
- iftrue
the references of the attachments will be refactored- Returns:
- the initialized move attachment request
-
createMoveJob
public org.xwiki.job.Job createMoveJob(MoveAttachmentRequest request) throws org.xwiki.job.JobException
Creates an attachment move job from a request.- Parameters:
request
- a move attachment request to start a job from- Returns:
- the initialized move attachment request
- Throws:
org.xwiki.job.JobException
-
locationAvailable
public boolean locationAvailable(org.xwiki.model.reference.DocumentReference documentReference, String attachmentName)
- Parameters:
documentReference
- the document reference containing the attachmentattachmentName
- the name of the attachment- Returns:
true
if the attachment exists or has existed (but was moved with a redirection) at the requested location.
-
backlinksCount
@Unstable public long backlinksCount(org.xwiki.model.reference.AttachmentReference attachmentReference) throws AttachmentException
Count the number of backlinks toward a given attachment.- Parameters:
attachmentReference
- an attachment reference- Returns:
- the number of backlinks to the attachment
- Throws:
AttachmentException
- Since:
- 14.2RC1
-
-