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
Simple default implementation class for the IBranchSpec interface.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSimple default implementation of the IViewMapping interface. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ViewMap<IBranchMapping>static final StringDefault 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, updatedFields inherited from class com.perforce.p4java.impl.generic.core.ServerResource
refreshable, server, updateable -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.BranchSpec(IBranchSpecSummary summary) Construct a new BranchSpec from the passed-in summary branch spec.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(Map<String, Object> map, IServer server) Construct a BranchSpec from a map passed back from the Perforce server in response to a getBranchSpec command. -
Method Summary
Modifier and TypeMethodDescriptionReturn the view map associated with this branch spec.static BranchSpecnewBranchSpec(IOptionsServer server, String name, String description, 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, setUpdatedMethods inherited from class com.perforce.p4java.impl.generic.core.ServerResource
canRefresh, canUpdate, clearRawFields, complete, getRawField, getRawFields, hasRawField, parseDate, setRawField, setRawFields, setRefreshable, setServer, toDateString, update, updateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.perforce.p4java.core.IBranchSpecSummary
getAccessed, getDescription, getName, getOwnerName, getUpdated, isLocked, setAccessed, setDescription, setLocked, setName, setOwnerName, setUpdatedMethods inherited from interface com.perforce.p4java.core.IServerResource
canRefresh, canUpdate, clearRawFields, complete, getRawField, getRawFields, hasRawField, setRawField, setRawFields, setServer, update, update
-
Field Details
-
branchView
-
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- nameownerName- ownerdescription- descriptionlocked- if lockedaccessed- dateupdated- datebranchView- view mapping
-
BranchSpec
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 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
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:
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:
-
update
Description 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:
-
getBranchView
Description copied from interface:IBranchSpecReturn the view map associated with this branch spec.- Specified by:
getBranchViewin interfaceIBranchSpec- Returns:
- branch mapping
- See Also:
-
setBranchView
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:
-