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.
  • Constructor Details

    • 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 Details

    • moveFile

      public List<IFileSpec> moveFile(int changelistId, boolean listOnly, boolean noClientMove, 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 interface IMoveDelegator
      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 performed
      noClientMove - 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 request
      AccessException - if the Perforce server denies access to the caller
    • moveFile

      public 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 interface IMoveDelegator
      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.
    • moveFile

      public List<IFileSpec> moveFile(@Nullable MoveFileOptions opts) throws P4JavaException
      Description copied from interface: IMoveDelegator
      Move by default takes an already opened file and moves it from one client location to another, reopening it as a pending depot move. When the file is submitted with 'p4 submit', its depot file is moved accordingly. The 'p4 move' command is intended for moves that occur within the same branch and not for restructuring the depot by moving an entire branch.

      Note that this operation is not supported on servers earlier than 2025.1; any attempt to use this on earlier servers will result in a RequestException with a suitable message.

      Specified by:
      moveFile in interface IMoveDelegator
      Parameters:
      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.