Class MoveDelegator
- java.lang.Object
-
- com.perforce.p4java.impl.mapbased.server.cmd.BaseDelegator
-
- com.perforce.p4java.impl.mapbased.server.cmd.MoveDelegator
-
- All Implemented Interfaces:
IMoveDelegator
public class MoveDelegator extends BaseDelegator implements IMoveDelegator
Implementation to handle the Move command.
-
-
Field Summary
-
Fields inherited from class com.perforce.p4java.impl.mapbased.server.cmd.BaseDelegator
MAX_LIMIT_SUPPORTED_MIN_VERSION, QUERY_EXPRESSIONS_SUPPORTED_MIN_VERSION, USER_RESTRICTIONS_SUPPORTED_MIN_VERSION
-
-
Constructor Summary
Constructors Constructor Description MoveDelegator(IOptionsServer server)
Instantiate a new MoveDelegator, providing the server object that will be used to execute Perforce Helix move commands.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<IFileSpec>
moveFile(int changelistId, boolean listOnly, boolean noClientMove, java.lang.String fileType, IFileSpec fromFile, IFileSpec toFile)
Move a file already opened for edit or add (the fromFile) to the destination file (the toFile).java.util.List<IFileSpec>
moveFile(IFileSpec fromFile, IFileSpec toFile, MoveFileOptions opts)
Move a file already opened for edit or add (the fromFile) to the destination file (the toFile).
-
-
-
Constructor Detail
-
MoveDelegator
public MoveDelegator(IOptionsServer server)
Instantiate a new MoveDelegator, providing the server object that will be used to execute Perforce Helix move commands.- Parameters:
server
- a concrete implementation of a Perforce Helix Server
-
-
Method Detail
-
moveFile
public java.util.List<IFileSpec> moveFile(int changelistId, boolean listOnly, boolean noClientMove, java.lang.String fileType, @Nonnull IFileSpec fromFile, @Nonnull IFileSpec toFile) throws ConnectionException, RequestException, AccessException
Description copied from interface:IMoveDelegator
Move a file already opened for edit or add (the fromFile) to the destination file (the toFile). A file can be moved many times before it is submitted; moving it back to its original location will reopen it for edit. The full semantics of this operation (which can be confusing) are found in the main 'p4 help' documentation.Note that this operation is not supported on servers earlier than 2009.1; any attempt to use this on earlier servers will result in a RequestException with a suitable message. Similarly, not all underlying IServer implementations will work with this either, and will also result in a suitable RequestException.
Note also that the move command is special in that almost alone among Perforce file-based commands, it does not allow full filespecs with version specifiers; these are currently quietly stripped off in the move command implementation here, which may lead to unexpected behaviour if you pass in specific versions expecting them to be honoured.
- Specified by:
moveFile
in interfaceIMoveDelegator
- Parameters:
changelistId
- if not IChangelist.UNKNOWN, the files are opened in the numbered pending changelist instead of the 'default' changelist.listOnly
- if true, don't actually perform the move, just return what would happen if the move was performednoClientMove
- if true, bypasses the client file rename. This option can be used to tell the server that the user has already renamed a file on the client. The use of this option can confuse the server if you are wrong about the client's contents. Only works for 2009.2 and later servers; earlier servers will produce a RequestException if you set this true.fileType
- if not null, the file is reopened as that filetype.fromFile
- the original file; must be already open for edit.toFile
- the target file.- Returns:
- list of IFileSpec objects representing the results of this move
- Throws:
ConnectionException
- if the Perforce server is unreachable or is not connected.RequestException
- if the Perforce server encounters an error during its processing of the requestAccessException
- if the Perforce server denies access to the caller
-
moveFile
public java.util.List<IFileSpec> moveFile(@Nonnull IFileSpec fromFile, @Nonnull IFileSpec toFile, @Nullable MoveFileOptions opts) throws P4JavaException
Description copied from interface:IMoveDelegator
Move a file already opened for edit or add (the fromFile) to the destination file (the toFile). A file can be moved many times before it is submitted; moving it back to its original location will reopen it for edit. The full semantics of this operation (which can be confusing) are found in the main 'p4 help' documentation.Note that this operation is not supported on servers earlier than 2009.1; any attempt to use this on earlier servers will result in a RequestException with a suitable message.
Note also that the move command is special in that almost alone among Perforce file-based commands, it does not allow full filespecs with version specifiers; these are currently quietly stripped off in the move command implementation here, which may lead to unexpected behaviour if you pass in specific versions expecting them to be honoured.
- Specified by:
moveFile
in interfaceIMoveDelegator
- Parameters:
fromFile
- the original file; must be already open for edit.toFile
- the target file.opts
- MoveFileOptions object describing optional parameters; if null, no options are set.- Returns:
- list of IFileSpec objects representing the results of this move.
- Throws:
P4JavaException
- if any error occurs in the processing of this method.
-
-