com.perforce.p4java.impl.generic.core
Class BranchSpec

java.lang.Object
  extended by com.perforce.p4java.impl.generic.core.ServerResource
      extended by com.perforce.p4java.impl.generic.core.BranchSpecSummary
          extended by com.perforce.p4java.impl.generic.core.BranchSpec
All Implemented Interfaces:
IBranchSpec, IBranchSpecSummary, IServerResource

public class BranchSpec
extends BranchSpecSummary
implements IBranchSpec

Simple default implementation class for the IBranchSpec interface.


Nested Class Summary
static class BranchSpec.BranchViewMapping
          Simple default implementation of the IViewMapping interface.
 
Field Summary
protected  ViewMap<IBranchMapping> branchView
           
static String DEFAULT_DESCRIPTION
          Default description for use in newBranchSpec method when no explicit description is given.
 
Fields inherited from class com.perforce.p4java.impl.generic.core.BranchSpecSummary
accessed, description, locked, name, ownerName, updated
 
Fields inherited from class com.perforce.p4java.impl.generic.core.ServerResource
refreshable, server, updateable
 
Constructor Summary
BranchSpec()
          Default constructor.
BranchSpec(IBranchSpecSummary summary)
          Construct a new BranchSpec from the passed-in summary branch spec.
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.
BranchSpec(String name, String ownerName, String description, boolean locked, Date accessed, Date updated, ViewMap<IBranchMapping> branchView)
          Construct a new BranchSpec from explicit field values.
 
Method Summary
 ViewMap<IBranchMapping> getBranchView()
          Return the view map associated with this branch spec.
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.
 void refresh()
          This method will refresh by getting the complete branch model.
 void setBranchView(ViewMap<IBranchMapping> branchView)
          Set the the view map associated with this branch spec.
 void update()
          Update the Perforce server object associated with the underlying P4Java object, if possible.
 
Methods inherited from class com.perforce.p4java.impl.generic.core.BranchSpecSummary
getAccessed, getDescription, getName, getOwnerName, getUpdated, isLocked, setAccessed, setDescription, setLocked, setName, setOwnerName, setUpdated
 
Methods inherited from class com.perforce.p4java.impl.generic.core.ServerResource
canRefresh, canUpdate, complete, setRefreshable, setServer, update, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.perforce.p4java.core.IBranchSpecSummary
getAccessed, getDescription, getName, getOwnerName, getUpdated, isLocked, setAccessed, setDescription, setLocked, setName, setOwnerName, setUpdated
 
Methods inherited from interface com.perforce.p4java.core.IServerResource
canRefresh, canUpdate, setServer, update, update
 

Field Detail

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:
Constant Field Values
Constructor Detail

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.


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.


BranchSpec

public BranchSpec(IBranchSpecSummary summary)
           throws ConnectionException,
                  RequestException,
                  AccessException
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.

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 Detail

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:
ServerResource.refresh()

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:
ServerResource.update()

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
See Also:
IBranchSpec.getBranchView()

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:
IBranchSpec.setBranchView(com.perforce.p4java.core.ViewMap)


Copyright © 2015 Perforce Software. All Rights Reserved.