Class BranchSpec

All Implemented Interfaces:
IBranchSpec, IBranchSpecSummary, IServerResource

public class BranchSpec extends BranchSpecSummary implements IBranchSpec
Simple default implementation class for the IBranchSpec interface.
  • Field Details

    • branchView

      protected ViewMap<IBranchMapping> branchView
    • DEFAULT_DESCRIPTION

      public static final String DEFAULT_DESCRIPTION
      Default description for use in newBranchSpec method when no explicit description is given.
      See Also:
  • Constructor Details

    • BranchSpec

      public BranchSpec()
      Default constructor. All fields set to null or false.
    • BranchSpec

      public BranchSpec(String name, String ownerName, String description, boolean locked, Date accessed, Date updated, ViewMap<IBranchMapping> branchView)
      Construct a new BranchSpec from explicit field values.
      Parameters:
      name - name
      ownerName - owner
      description - description
      locked - if locked
      accessed - date
      updated - date
      branchView - view mapping
    • BranchSpec

      public BranchSpec(Map<String,Object> map, IServer server)
      Construct a BranchSpec from a map passed back from the Perforce server in response to a getBranchSpec command.
      Parameters:
      map - spec map
      server - server
    • BranchSpec

      Construct a new BranchSpec from the passed-in summary branch spec. If the summary is null, this is equivalent to calling the default BranchSpec constructor; otherwise after name initialization a refresh() is done on the new (empty) BranchSpec.
      Parameters:
      summary - summary object
      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
  • Method Details

    • newBranchSpec

      public static BranchSpec newBranchSpec(IOptionsServer server, String name, String description, String[] branches)
      Simple factory / convenience method for creating a new local BranchSpec object with defult values.
      Parameters:
      server - non-null server to be associated with the new branch spec.
      name - non-null branch spec name.
      description - if not null, used as the new branc spec's description field; if null, uses the BranchSpec.DEFAULT_DESCRIPTION field.
      branches - if not null, use this as the list of branch spec paths, in the order given, and according to the format in MapEntry.parseViewMappingString; unlike many other core object factory methods, this one does not default if null.
      Returns:
      new local BranchSpec object.
    • refresh

      public void refresh() throws ConnectionException, RequestException, AccessException
      This method will refresh by getting the complete branch model. If this refresh is successful then this branch will be marked as complete.
      Specified by:
      refresh in interface IServerResource
      Overrides:
      refresh in class ServerResource
      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
      See Also:
    • update

      public void update() throws ConnectionException, RequestException, AccessException
      Description copied from interface: IServerResource
      Update the Perforce server object associated with the underlying P4Java object, if possible. The semantics of server updates are generally object-specific and will be spelled out for each participating object.

      The results of calling this method on objects whose canUpdate method returns false are undefined (but will generally result in a UnimplementedError being thrown).

      Specified by:
      update in interface IServerResource
      Overrides:
      update in class ServerResource
      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
      See Also:
    • getBranchView

      public ViewMap<IBranchMapping> getBranchView()
      Description copied from interface: IBranchSpec
      Return the view map associated with this branch spec.

      Specified by:
      getBranchView in interface IBranchSpec
      Returns:
      branch mapping
      See Also:
    • setBranchView

      public void setBranchView(ViewMap<IBranchMapping> branchView)
      Description copied from interface: IBranchSpec
      Set the the view map associated with this branch spec. This will not change the associated branch spec on the Perforce server unless you arrange for the update to server.
      Specified by:
      setBranchView in interface IBranchSpec
      Parameters:
      branchView - new view mappings for the branch.
      See Also: