com.perforce.p4java.core
Interface ILabel

All Superinterfaces:
ILabelSummary, IServerResource
All Known Implementing Classes:
Label

public interface ILabel
extends ILabelSummary

Defines and describes a Perforce label. See the main Perforce documentation for label usage and semantics.

ILabel objects are complete and updateable only if they come from the IServer.getLabel() method (or are hand-crafted); label objects from other sources are not complete or completable, and nor are they refreshable. Setter methods defined below affect only local values unless a suitable update is done.


Method Summary
 IServer getServer()
          Get the Perforce server object associated with this label.
 ViewMap<ILabelMapping> getViewMapping()
          Get the view mapping for this label.
 void setServer(IServer server)
          Set the Perforce server object associated with this label.
 void setViewMapping(ViewMap<ILabelMapping> viewMapping)
          Set the view mapping for this label.
 void update()
          Update (or even create) this label on the associated Perforce server, if that server has been set for this label.
 String updateOnServer()
          Deprecated. use update() instead.
 
Methods inherited from interface com.perforce.p4java.core.ILabelSummary
getDescription, getLastAccess, getLastUpdate, getName, getOwnerName, getRevisionSpec, isAutoReload, isLocked, isUnloaded, setAutoReload, setDescription, setLastAccess, setLastUpdate, setLocked, setName, setOwnerName, setRevisionSpec
 
Methods inherited from interface com.perforce.p4java.core.IServerResource
canRefresh, canUpdate, refresh, update, update
 

Method Detail

getViewMapping

ViewMap<ILabelMapping> getViewMapping()
Get the view mapping for this label. Note that only the left hand side (the depot path) of a mapping is used for labels and will be valid here.

Note also that this method will only return the actual view mapping a label if the label object was returned from the IServer's getLabel() method (this is due to limitations in the underlying implementation).

Returns:
non-null but possibly empty list of IClientViewMapping mappings for this label.

setViewMapping

void setViewMapping(ViewMap<ILabelMapping> viewMapping)
Set the view mapping for this label. Note that only the left hand side (the depot path) of a mapping is used for labels and will be valid here.

Parameters:
viewMapping - list of IClientViewMapping mappings for this label.

updateOnServer

String updateOnServer()
                      throws ConnectionException,
                             RequestException,
                             AccessException
Deprecated. use update() instead.

Update (or even create) this label on the associated Perforce server, if that server has been set for this label. Will throw a suitable RequestException if the label is not associated with a server, either as the result of being returned from a server earlier, or as the result of an explicit call on the underlying implementation object.

Note that you should only call this method on "full" labels, i.e. those returned from an explicit single call to IServer.getLabel() or those created by hand; calling this on a label returned from the getLabelList() method may cause the associated in-server label to lose its view mapping.

Returns:
the string message resulting from the update
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

update

void update()
            throws ConnectionException,
                   RequestException,
                   AccessException
Update (or even create) this label on the associated Perforce server, if that server has been set for this label. Will throw a suitable RequestException if the label is not associated with a server, either as the result of being returned from a server earlier, or as the result of an explicit call on the underlying implementation object.

Note that you should only call this method on complete labels, i.e. those returned from an explicit single call to IServer.getLabel() or those created by hand; calling this on a label returned from the getLabelList() method will result in a UnimplementedError being thrown.

Specified by:
update in interface IServerResource
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

getServer

IServer getServer()
Get the Perforce server object associated with this label.

Returns:
possibly-null IServer object associated with this label.

setServer

void setServer(IServer server)
Set the Perforce server object associated with this label.

Specified by:
setServer in interface IServerResource
Parameters:
server - possibly-null IServer object to be associated with this label.


Copyright © 2015 Perforce Software. All Rights Reserved.