Class BranchSpec
- java.lang.Object
-
- com.perforce.p4java.impl.generic.core.ServerResource
-
- com.perforce.p4java.impl.generic.core.BranchSpecSummary
-
- 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
Nested Classes Modifier and Type Class Description static classBranchSpec.BranchViewMappingSimple default implementation of the IViewMapping interface.
-
Field Summary
Fields Modifier and Type Field Description protected ViewMap<IBranchMapping>branchViewstatic java.lang.StringDEFAULT_DESCRIPTIONDefault 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
Constructors Constructor Description BranchSpec()Default constructor.BranchSpec(IBranchSpecSummary summary)Construct a new BranchSpec from the passed-in summary branch spec.BranchSpec(java.lang.String name, java.lang.String ownerName, java.lang.String description, boolean locked, java.util.Date accessed, java.util.Date updated, ViewMap<IBranchMapping> branchView)Construct a new BranchSpec from explicit field values.BranchSpec(java.util.Map<java.lang.String,java.lang.Object> map, IServer server)Construct a BranchSpec from a map passed back from the Perforce server in response to a getBranchSpec command.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ViewMap<IBranchMapping>getBranchView()Return the view map associated with this branch spec.static BranchSpecnewBranchSpec(IOptionsServer server, java.lang.String name, java.lang.String description, java.lang.String[] branches)Simple factory / convenience method for creating a new local BranchSpec object with defult values.voidrefresh()This method will refresh by getting the complete branch model.voidsetBranchView(ViewMap<IBranchMapping> branchView)Set the the view map associated with this branch spec.voidupdate()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, clearRawFields, complete, getRawField, getRawFields, hasRawField, parseDate, setRawField, setRawFields, setRefreshable, setServer, toDateString, 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, clearRawFields, complete, getRawField, getRawFields, hasRawField, setRawField, setRawFields, setServer, update, update
-
-
-
-
Field Detail
-
branchView
protected ViewMap<IBranchMapping> branchView
-
DEFAULT_DESCRIPTION
public static final java.lang.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(java.lang.String name, java.lang.String ownerName, java.lang.String description, boolean locked, java.util.Date accessed, java.util.Date updated, ViewMap<IBranchMapping> branchView)Construct a new BranchSpec from explicit field values.- Parameters:
name- nameownerName- ownerdescription- descriptionlocked- if lockedaccessed- dateupdated- datebranchView- view mapping
-
BranchSpec
public BranchSpec(java.util.Map<java.lang.String,java.lang.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 mapserver- server
-
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.- 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 requestAccessException- if the Perforce server denies access to the caller
-
-
Method Detail
-
newBranchSpec
public static BranchSpec newBranchSpec(IOptionsServer server, java.lang.String name, java.lang.String description, java.lang.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, AccessExceptionThis method will refresh by getting the complete branch model. If this refresh is successful then this branch will be marked as complete.- Specified by:
refreshin interfaceIServerResource- Overrides:
refreshin classServerResource- 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- See Also:
ServerResource.refresh()
-
update
public void update() throws ConnectionException, RequestException, AccessExceptionDescription copied from interface:IServerResourceUpdate 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:
updatein interfaceIServerResource- Overrides:
updatein classServerResource- 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- See Also:
ServerResource.update()
-
getBranchView
public ViewMap<IBranchMapping> getBranchView()
Description copied from interface:IBranchSpecReturn the view map associated with this branch spec.- Specified by:
getBranchViewin interfaceIBranchSpec- Returns:
- branch mapping
- See Also:
IBranchSpec.getBranchView()
-
setBranchView
public void setBranchView(ViewMap<IBranchMapping> branchView)
Description copied from interface:IBranchSpecSet 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:
setBranchViewin interfaceIBranchSpec- Parameters:
branchView- new view mappings for the branch.- See Also:
IBranchSpec.setBranchView(com.perforce.p4java.core.ViewMap)
-
-