Class LongRunningTaskMovePageCommandDecorator
- java.lang.Object
-
- com.atlassian.core.task.longrunning.AbstractLongRunningTask
-
- com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask
-
- com.atlassian.confluence.content.service.page.LongRunningTaskMovePageCommandDecorator
-
- All Implemented Interfaces:
MovePageCommand
,ServiceCommand
,com.atlassian.core.task.longrunning.LongRunningTask
,Runnable
public class LongRunningTaskMovePageCommandDecorator extends ConfluenceAbstractLongRunningTask implements MovePageCommand
A Decorator for existing MovePageCommands to be run synchronously as a LongRunningTask.- Since:
- 7.9
-
-
Field Summary
-
Fields inherited from class com.atlassian.core.task.longrunning.AbstractLongRunningTask
log, METRIC_NAME, progress, TASK_CLASSNAME_TAG, TASK_NAME_TAG
-
Fields inherited from interface com.atlassian.confluence.content.service.page.MovePageCommand
POSITION_ABOVE, POSITION_APPEND, POSITION_BELOW, POSITION_TOP_LEVEL
-
-
Constructor Summary
Constructors Constructor Description LongRunningTaskMovePageCommandDecorator(MovePageCommand commandDelegate, LongRunningTaskManagerInternal longRunningTaskManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute()
Execute the command.MovePageCommand
getCommandDelegate()
String
getName()
Page
getPage()
Collection<ValidationError>
getValidationErrors()
Gets the list of errors that are preventing the command from being executed.boolean
isAuthorized()
Determine if the current user is authorized to execute this command.boolean
isValid()
Determine if the command is in a valid state to be executed.protected void
runInternal()
Run the long running process.-
Methods inherited from class com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask
getResourceBundle, run
-
-
-
-
Constructor Detail
-
LongRunningTaskMovePageCommandDecorator
public LongRunningTaskMovePageCommandDecorator(MovePageCommand commandDelegate, LongRunningTaskManagerInternal longRunningTaskManager)
-
-
Method Detail
-
getCommandDelegate
public MovePageCommand getCommandDelegate()
-
getPage
public Page getPage()
- Specified by:
getPage
in interfaceMovePageCommand
- Returns:
- the page which will be moved (or which has been moved, if the command has been executed)
-
isValid
public boolean isValid()
Description copied from interface:ServiceCommand
Determine if the command is in a valid state to be executed. If this method returns true, thenServiceCommand.execute()
is be expected to perform successfully (unless prevented by some system error). If this method returns false,execute
will fail with aNotValidException
.This method should be called after checking
ServiceCommand.isAuthorized()
. If the current user is not authorized to execute this command, this method must throw aNotAuthorizedException
.If this method returns false, then
ServiceCommand.getValidationErrors()
must return a non-empty list of errors explaining why the command was not valid. If this method returns true, the collection returned bygetValidationErrors()
must be empty.- Specified by:
isValid
in interfaceServiceCommand
- Returns:
- true if the command is in a valid state to be executed, false otherwise
-
getValidationErrors
public Collection<ValidationError> getValidationErrors()
Description copied from interface:ServiceCommand
Gets the list of errors that are preventing the command from being executed. Calling this method before callingServiceCommand.isValid()
will always return an empty collection.- Specified by:
getValidationErrors
in interfaceServiceCommand
- Returns:
- a collection of
ValidationError
objects describing why command validation failed
-
isAuthorized
public boolean isAuthorized()
Description copied from interface:ServiceCommand
Determine if the current user is authorized to execute this command. The "current user" for a command is the user returned byAuthenticatedUserThreadLocal.get()
.- Specified by:
isAuthorized
in interfaceServiceCommand
- Returns:
- true if the current user is authorized to execute this command, false otherwise.
-
runInternal
protected void runInternal()
Description copied from class:ConfluenceAbstractLongRunningTask
Run the long running process. When this method exits, the process should be complete.- Specified by:
runInternal
in classConfluenceAbstractLongRunningTask
-
execute
public void execute()
Description copied from interface:ServiceCommand
Execute the command. After execution, the command should offer any indication of the results or products of the command as implementation-specific getter methods.- Specified by:
execute
in interfaceServiceCommand
-
getName
public String getName()
- Specified by:
getName
in interfacecom.atlassian.core.task.longrunning.LongRunningTask
-
-