Class ServerResource
- All Implemented Interfaces:
IServerResource
- Direct Known Subclasses:
BranchSpecSummary,ChangelistSummary,ClientSummary,Depot,ExtensionSummary,FileSpec,Fix,Job,JobSpec,LabelSummary,License,LicenseLimits,Repo,ServerIPMACAddress,ServerProcess,Streamlog,StreamSummary,UserGroup,UserSummary
Implementations of interfaces that extend IServerResource should use this as a superclass unless there are good reasons not to.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanRefreshable flagprotected IServerServer instanceprotected booleanUpdateable flag -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault constructor -- sets complete to true, completable, refreshable, and updateable to false, and server to null.protectedServerResource(boolean refreshable, boolean updateable) Explicit some-value constructor; sets server to null.protectedServerResource(boolean refreshable, boolean updateable, IServer server) Explicit all-value constructor.protectedServerResource(IServer server) Sets complete to true, completable, refreshable, and updateable to false, and server to the passed-in value. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if the underlying object is refreshable from the Perforce server.booleanReturns true if the underlying object can be updated back to (or on) the associated Perforce server.voidCreate new map and clear all fields.voidcomplete()Old method called used to call refresh when completing a spec.getRawField(String field) Fetch a value from the raw spec map.Fetch the whole raw spec map.booleanhasRawField(String field) Look for field in map.protected Datevoidrefresh()Refresh the underlying object from the Perforce server.voidsetRawField(String field, Object value) Enter Key/Pair for a spec field.voidsetRawFields(Map<String, Object> map) Add all elements in a map to the specvoidsetRefreshable(boolean refreshable) Set the resource as refreshablevoidSet the server associated with this resource.protected StringtoDateString(Date date) voidupdate()Update the Perforce server object associated with the underlying P4Java object, if possible.voidupdate(boolean force) Force (if true) update the Perforce server object associated with the underlying P4Java object, if possible.voidUpdate the Perforce server object associated with the underlying P4Java object and its options, if possible.
-
Field Details
-
refreshable
protected boolean refreshableRefreshable flag -
updateable
protected boolean updateableUpdateable flag -
server
Server instance
-
-
Constructor Details
-
ServerResource
protected ServerResource()Default constructor -- sets complete to true, completable, refreshable, and updateable to false, and server to null. -
ServerResource
Sets complete to true, completable, refreshable, and updateable to false, and server to the passed-in value.- Parameters:
server- server
-
ServerResource
protected ServerResource(boolean refreshable, boolean updateable) Explicit some-value constructor; sets server to null.- Parameters:
refreshable- refreshableupdateable- updateable
-
ServerResource
Explicit all-value constructor.- Parameters:
refreshable- refreshableupdateable- updateableserver- server
-
-
Method Details
-
canRefresh
public boolean canRefresh()Description copied from interface:IServerResourceReturns true if the underlying object is refreshable from the Perforce server.The details of what "refreshable" means in this context are always object-dependent, but typically mean that "live" data and metadata will be updated from the server. This is especially useful on objects like changelists, where the underlying server-side data may change often outside P4Java's control.
- Specified by:
canRefreshin interfaceIServerResource- Returns:
- true if the underlying the object is refreshable.
- See Also:
-
canUpdate
public boolean canUpdate()Description copied from interface:IServerResourceReturns true if the underlying object can be updated back to (or on) the associated Perforce server. The semantics of server updates are generally object-specific.- Specified by:
canUpdatein interfaceIServerResource- Returns:
- true if the underlying object can be updated back to (or on) the associated Perforce server
- See Also:
-
complete
Description copied from interface:IServerResourceOld method called used to call refresh when completing a spec.- Specified by:
completein interfaceIServerResource- Throws:
ConnectionException- when there is an error talking to the Helix serverRequestException- when there is a problem with the data provided in the requestAccessException- when access to the branch command is not authorised- See Also:
-
refresh
Description copied from interface:IServerResourceRefresh the underlying object from the Perforce server.The details of what "refreshable" means in this context are always object-dependent, but typically mean that "live" data and metadata will be updated from the server.
The results of calling this method on objects whose canRefresh method returns false are undefined (but will generally result in a UnimplementedError being thrown).
- Specified by:
refreshin interfaceIServerResource- 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- 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:IServerResourceForce (if true) 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.Note, in order to force the change it may require super user / admin privileges to work properly.
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- Parameters:
force- if true, force the update of the object on the server.- 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 and its options, 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- Parameters:
opts- Options object describing optional parameters; if null, no options are set.- 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:
-
setRefreshable
public void setRefreshable(boolean refreshable) Set the resource as refreshable- Parameters:
refreshable- true if refreshable
-
setServer
Description copied from interface:IServerResourceSet the server associated with this resource. Setting this null can have bad effects down the line...- Specified by:
setServerin interfaceIServerResource- Parameters:
server- IServer to be used for refresh, update, etc.- See Also:
-
getRawField
Description copied from interface:IServerResourceFetch a value from the raw spec map.- Specified by:
getRawFieldin interfaceIServerResource- Parameters:
field- spec field- Returns:
- valuse as an Object
-
setRawField
Description copied from interface:IServerResourceEnter Key/Pair for a spec field.- Specified by:
setRawFieldin interfaceIServerResource- Parameters:
field- field kayvalue- value
-
hasRawField
Description copied from interface:IServerResourceLook for field in map.- Specified by:
hasRawFieldin interfaceIServerResource- Parameters:
field- field name- Returns:
- true if field exists.
-
getRawFields
Description copied from interface:IServerResourceFetch the whole raw spec map.- Specified by:
getRawFieldsin interfaceIServerResource- Returns:
- Spec Map
-
setRawFields
Description copied from interface:IServerResourceAdd all elements in a map to the spec- Specified by:
setRawFieldsin interfaceIServerResource- Parameters:
map- field map
-
clearRawFields
public void clearRawFields()Description copied from interface:IServerResourceCreate new map and clear all fields.- Specified by:
clearRawFieldsin interfaceIServerResource
-
parseDate
-
toDateString
-