public class MoveDelegator extends BaseDelegator implements IMoveDelegator
MAX_LIMIT_SUPPORTED_MIN_VERSION, QUERY_EXPRESSIONS_SUPPORTED_MIN_VERSION, USER_RESTRICTIONS_SUPPORTED_MIN_VERSION
Constructor and Description |
---|
MoveDelegator(IOptionsServer server)
Instantiate a new MoveDelegator, providing the server object that will be used to
execute Perforce Helix move commands.
|
Modifier and Type | Method and Description |
---|---|
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).
|
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).
|
public MoveDelegator(IOptionsServer server)
server
- a concrete implementation of a Perforce Helix Serverpublic 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
IMoveDelegator
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.
moveFile
in interface IMoveDelegator
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.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 callerpublic java.util.List<IFileSpec> moveFile(@Nonnull IFileSpec fromFile, @Nonnull IFileSpec toFile, @Nullable MoveFileOptions opts) throws P4JavaException
IMoveDelegator
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.
moveFile
in interface IMoveDelegator
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.P4JavaException
- if any error occurs in the processing of this method.