|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.perforce.p4java.impl.generic.core.ServerResource com.perforce.p4java.impl.generic.core.ChangelistSummary com.perforce.p4java.impl.generic.core.Changelist
public class Changelist
Simple default generic implementation class for the IChangelist interface.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.perforce.p4java.core.IChangelist |
---|
IChangelist.Type |
Nested classes/interfaces inherited from interface com.perforce.p4java.core.IChangelistSummary |
---|
IChangelistSummary.Visibility |
Field Summary | |
---|---|
static String |
DEFAULT_DESCRIPTION
The default description string for new changelists created by newChangelist. |
protected List<IFileSpec> |
fileSpecs
|
protected List<String> |
jobIds
|
protected Server |
serverImpl
|
Fields inherited from class com.perforce.p4java.impl.generic.core.ChangelistSummary |
---|
CHANGE_KEY, CLIENT_KEY, clientId, date, DATE_FORMAT, DATE_KEY, description, DESCRIPTION_KEY, id, JOBS_KEY, NEW_KEY, shelved, status, STATUS_KEY, USER_KEY, username, visibility |
Fields inherited from class com.perforce.p4java.impl.generic.core.ServerResource |
---|
refreshable, server, updateable |
Fields inherited from interface com.perforce.p4java.core.IChangelist |
---|
DEFAULT, UNKNOWN |
Constructor Summary | |
---|---|
Changelist()
Default constructor; calls default superclass constructor. |
|
Changelist(IChangelistSummary summary,
IServer server,
boolean refresh)
Construct a new Changelist using the passed-in changelist as a template. |
|
Changelist(int id,
String clientId,
String username,
ChangelistStatus status,
Date date,
String description,
boolean shelved,
Server serverImpl)
Construct a changelist implementation given an explicit set of initial field values. |
|
Changelist(int id,
String clientId,
String username,
ChangelistStatus status,
Date date,
String description,
boolean shelved,
Server serverImpl,
IChangelistSummary.Visibility visibility)
Construct a changelist implementation given an explicit set of initial field values. |
|
Changelist(Map<String,Object> map,
Server serverImpl)
Construct a changelist impl from the passed-in map and serverImpl parameters. |
Method Summary | |
---|---|
List<String> |
getCachedJobIdList()
Return a cached list of job Id's associated with this changelist. |
String |
getClientId()
Get the ID of the Perforce client workspace associated with this changelist. |
Date |
getDate()
Get the date the changelist was created or last updated. |
String |
getDescription()
Return the description associated with this changelist. |
InputStream |
getDiffs(DiffType diffType)
Get an InputStream onto the file diffs associated with this changelist. |
InputStream |
getDiffsStream(GetChangelistDiffsOptions opts)
Get an InputStream onto the file diffs associated with this changelist. |
List<IFileSpec> |
getFiles(boolean refresh)
Get the list of files associated with this changelist, optionally refreshing the list from the server. |
List<IFileSpec> |
getFiles(boolean refresh,
boolean bypassServer)
|
List<IFileSpec> |
getFileSpecs()
|
int |
getId()
Return the Perforce changelist's ID. |
List<String> |
getJobIds()
Return a list of Perforce jobs IDs for jobs marked as associated with this changelist. |
List<IJob> |
getJobs()
Return a list of Perforce jobs marked as associated with this changelist. |
IServer |
getServer()
|
ChangelistStatus |
getStatus()
Get the status of this changelist, if known. |
String |
getUsername()
Get the user name of the user associated with this changelist. |
boolean |
isShelved()
Does this changelist contain at least one shelved file? This only applies to changelists whose IChangelistSummary.getStatus() is
ChangelistStatus.PENDING and that have been returned as
IChangelistSummary objects. |
static Changelist |
newChangelist(IClient client,
String description)
Return a new local Changelist object with default values by calling newChangelist with server and client name values taken from the passed-in client object. |
static Changelist |
newChangelist(IServer server,
String clientName,
String description)
Return a new local Changelist object with default values. |
void |
refresh()
Refresh the underlying object from the Perforce server. |
void |
setClientId(String clientId)
Set the client ID. |
void |
setDate(Date date)
Set the changelist date. |
String |
setDescription(String description)
Set the description string for this changelist. |
void |
setFileSpecs(List<IFileSpec> fileSpecs)
|
void |
setId(int id)
Set the changelist ID. |
void |
setServerImpl(Server serverImpl)
|
void |
setShelved(boolean shelved)
Set the changelist as shelved or not shelved |
void |
setStatus(ChangelistStatus status)
Set the changelist status. |
void |
setUsername(String username)
Set the changelist owner ID. |
List<IFileSpec> |
submit(boolean reOpen)
Submit this changelist. |
List<IFileSpec> |
submit(boolean reOpen,
List<String> jobIds,
String jobStatus)
Submit this changelist and associate it with the passed-in jobs. |
List<IFileSpec> |
submit(SubmitOptions opts)
Submit this changelist and associate it with any jobs in the passed-in options. |
void |
submit(SubmitOptions opts,
IStreamingCallback callback,
int key)
Submit this changelist and associate it with any jobs in the passed-in options. |
void |
update()
Update the Perforce server object associated with the underlying P4Java object, if possible. |
void |
update(boolean force)
Force (if true) update the Perforce server object associated with the underlying P4Java object, if possible. |
void |
update(Options opts)
Update the Perforce server object associated with the underlying P4Java object and its options, if possible. |
void |
updateOnServer(boolean refresh)
Update the Perforce server's version of this changelist. |
Methods inherited from class com.perforce.p4java.impl.generic.core.ChangelistSummary |
---|
getVisibility, setVisibility |
Methods inherited from class com.perforce.p4java.impl.generic.core.ServerResource |
---|
canRefresh, canUpdate, complete, setRefreshable, setServer |
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.IServerResource |
---|
canRefresh, canUpdate, setServer |
Methods inherited from interface com.perforce.p4java.core.IChangelistSummary |
---|
getVisibility, setVisibility |
Field Detail |
---|
protected Server serverImpl
protected List<IFileSpec> fileSpecs
protected List<String> jobIds
public static final String DEFAULT_DESCRIPTION
Constructor Detail |
---|
public Changelist()
Actual users of this constructor need to ensure that the super-super-class ServeResource fields are set appropriately after calling this constructor.
public Changelist(int id, String clientId, String username, ChangelistStatus status, Date date, String description, boolean shelved, Server serverImpl)
This constructor requires a Server object as its serverImpl parameter; note that any server object returned by the ServerFactory will work, as long as it's downcast to Server. If it doesn't cast cleanly, then it is not suitable for use here.
public Changelist(int id, String clientId, String username, ChangelistStatus status, Date date, String description, boolean shelved, Server serverImpl, IChangelistSummary.Visibility visibility)
This constructor requires a Server object as its serverImpl parameter; note that any server object returned by the ServerFactory will work, as long as it's downcast to Server. If it doesn't cast cleanly, then it is not suitable for use here.
public Changelist(IChangelistSummary summary, IServer server, boolean refresh) throws ConnectionException, RequestException, AccessException
If changelist is null, this is equivalent to calling the default constructor.
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 callerpublic Changelist(Map<String,Object> map, Server serverImpl)
This constructor requires a Server object as its serverImpl parameter; note that any server object returned by the ServerFactory will work, as long as it's downcast to Server. If it doesn't cast cleanly, then it is not suitable for use here.
Method Detail |
---|
public static Changelist newChangelist(IServer server, String clientName, String description)
Note that this object is a local object only -- you must subsequently call the client's createChangelist method to also create it on the server (or use the Factory.createChangelist convenience method).
server
- non-null IServer object to be associated with this changelist.clientName
- non-null name of the client to be associated with
this changelistdescription
- if not null, the changelist description string; if null,
defaults to Changelist.DEFAULT_DESCRIPTION.
public static Changelist newChangelist(IClient client, String description)
client
- non-null client to be associated withdescription
- if not null, the changelist description string; if null,
defaults to Changelist.DEFAULT_DESCRIPTION.
public boolean isShelved()
IChangelistSummary
IChangelistSummary.getStatus()
is
ChangelistStatus.PENDING
and that have been returned as
IChangelistSummary objects. The value here is unreliable for
full IChangelist objects returned from getChangelist, etc.
isShelved
in interface IChangelistSummary
isShelved
in class ChangelistSummary
IChangelistSummary.isShelved()
public void setShelved(boolean shelved)
setShelved
in interface IChangelistSummary
setShelved
in class ChangelistSummary
shelved
- IChangelistSummary.setShelved(boolean)
public int getId()
IChangelistSummary
getId
in interface IChangelistSummary
getId
in class ChangelistSummary
IChangelistSummary.getId()
public void setId(int id)
IChangelistSummary
setId
in interface IChangelistSummary
setId
in class ChangelistSummary
id
- new changelist ID.IChangelistSummary.setId(int)
public String getClientId()
IChangelistSummary
getClientId
in interface IChangelistSummary
getClientId
in class ChangelistSummary
IChangelistSummary.getClientId()
public void setClientId(String clientId)
IChangelistSummary
setClientId
in interface IChangelistSummary
setClientId
in class ChangelistSummary
clientId
- new client ID.IChangelistSummary.setClientId(java.lang.String)
public String getUsername()
IChangelistSummary
getUsername
in interface IChangelistSummary
getUsername
in class ChangelistSummary
IChangelistSummary.getUsername()
public void setUsername(String username)
IChangelistSummary
setUsername
in interface IChangelistSummary
setUsername
in class ChangelistSummary
username
- new owner's user name.IChangelistSummary.setUsername(java.lang.String)
public ChangelistStatus getStatus()
IChangelistSummary
getStatus
in interface IChangelistSummary
getStatus
in class ChangelistSummary
IChangelistSummary.getStatus()
public void setStatus(ChangelistStatus status)
IChangelistSummary
setStatus
in interface IChangelistSummary
setStatus
in class ChangelistSummary
public Date getDate()
IChangelistSummary
getDate
in interface IChangelistSummary
getDate
in class ChangelistSummary
IChangelistSummary.getDate()
public void setDate(Date date)
IChangelistSummary
setDate
in interface IChangelistSummary
setDate
in class ChangelistSummary
date
- new changelist dateIChangelistSummary.setDate(java.util.Date)
public String getDescription()
IChangelistSummary
getDescription
in interface IChangelistSummary
getDescription
in class ChangelistSummary
IChangelistSummary.getDescription()
public String setDescription(String description)
IChangelistSummary
setDescription
in interface IChangelistSummary
setDescription
in class ChangelistSummary
description
- non-null new description string.
IChangelistSummary.setDescription(java.lang.String)
public IServer getServer()
public void setServerImpl(Server serverImpl)
public List<IFileSpec> getFiles(boolean refresh) throws ConnectionException, RequestException, AccessException
IChangelist
If this is the first time this method has been called on this changelist, or if refresh is true, the file list is obtained from the server and copied locally to this object; otherwise, the local copy is returned.
Note that the actual file list is returned; this file list is guaranteed mutable and you can change it "live" (by, for example, deleting files from it (deleting files is, in fact, the only thing that makes sense from a Perforce point of view)). Such changes will only be reflected back to the server when a submit is done; adding files to this list results in undefined behavior.
The IFileSpec objects returned are not guaranteed to have any fields except depot path, version, and action valid (and, in fact, if it comes directly from the server, those are usually the only fields that are valid.
Note that the Perforce server side of the submit() processing expects all file lists to be in canonical depot path form; file specs in the associated submit file list that don't have a depot spec will be left untouched (this is a Perforce thing, not a P4Java thing).
This is one of the guaranteed "live" method on this interface, and will return the list as it exists when called (rather than when the underlying implementation object was created) if refresh is true. This can be an expensive method to evaluate, so don't use it willy-nilly.
getFiles
in interface IChangelist
refresh
- if true, get a new list from the server rather than return the
local copy.
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 callerpublic List<IFileSpec> getFiles(boolean refresh, boolean bypassServer) throws ConnectionException, RequestException, AccessException
ConnectionException
RequestException
AccessException
public InputStream getDiffs(DiffType diffType) throws ConnectionException, RequestException, AccessException
IChangelist
This is one of the guaranteed "live" method on this interface, and will return the diff output as it exists when called (rather than when the underlying implementation object was created). This can be an expensive method to evaluate, and can generate reams and reams (and reams) of output, so don't use it willy-nilly.
You should remember to close the returned InputStream when finished with the stream, in order to release the underlying io resources. Failure to do this may leave temporary files lying around or cause inefficient memory usage.
getDiffs
in interface IChangelist
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 callerIChangelist.getDiffs(com.perforce.p4java.core.file.DiffType)
public InputStream getDiffsStream(GetChangelistDiffsOptions opts) throws P4JavaException
IChangelist
This is one of the guaranteed "live" method on this interface, and will return the diff output as it exists when called (rather than when the underlying implementation object was created). This can be an expensive method to evaluate, and can generate reams and reams (and reams) of output, so don't use it willy-nilly.
You should remember to close the returned InputStream when finished with the stream, in order to release the underlying io resources. Failure to do this may leave temporary files lying around or cause inefficient memory usage.
getDiffsStream
in interface IChangelist
opts
- GetChangelistDiffs object describing optional parameters; if null, no
options are set.
P4JavaException
- if any error occurs in the processing of this method.IChangelist.getDiffsStream(com.perforce.p4java.option.server.GetChangelistDiffsOptions)
public List<String> getJobIds() throws ConnectionException, RequestException, AccessException
IChangelist
Note that "associated" here usually means "fixed", but that is not always the case.
getJobIds
in interface IChangelist
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 callerIChangelist.getJobIds()
public List<String> getCachedJobIdList() throws ConnectionException, RequestException, AccessException
IChangelist
getCachedJobIdList
in interface IChangelist
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 callerIChangelist.getCachedJobIdList()
public List<IJob> getJobs() throws ConnectionException, RequestException, AccessException
IChangelist
Note that "associated" here usually means "fixed", but that is not always the case.
getJobs
in interface IChangelist
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 callerIChangelist.getJobs()
public List<IFileSpec> submit(boolean reOpen, List<String> jobIds, String jobStatus) throws ConnectionException, RequestException, AccessException
IChangelist
If the submit is successful, the status of the underlying changelist will be updated to reflect the new status. Other fields will not be automatically updated and need to be refreshed with the refresh() method if you need to access them live.
Note that the list of filespecs returned from the submit will contain only summary filespecs for successful files -- generally only the depot path, action, and revisions fields will be valid; other fields may be null or undefined depending on the server and client implementations. That is, do not rely on the returned filespec list for anything other than depot paths.
Note also that any jobIds and / or job status arguments will override any jobIds already associated with this object on submission (i.e. jobs in the local object's job list).
submit
in interface IChangelist
reOpen
- if true, reopen the submitted files for editing after a successful submit.jobIds
- if non-null, contains a list of job IDs for jobs that will have their status
changed to fixed or "jobStatus", below. This list will override any existing
list attached to the changelist as a result of a refresh operation after
fixing a job, etc.jobStatus
- if jobIds is non-null, contains a string to which
the jobs in the jobIds list will be set on a successful submit; if
null the jobs will be marked fixed.
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 callerIChangelist.submit(boolean, java.util.List, java.lang.String)
public List<IFileSpec> submit(SubmitOptions opts) throws P4JavaException
IChangelist
If the submit is successful, the status of the underlying changelist will be updated to reflect the new status. Other fields will not be automatically updated and need to be refreshed with the refresh() method if you need to access them live.
Note that the list of filespecs returned from the submit will contain only summary filespecs for successful files -- generally only the depot path, action, and revisions fields will be valid; other fields may be null or undefined depending on the server and client implementations. That is, do not rely on the returned filespec list for anything other than depot paths.
Note also that any jobIds and / or job status arguments given to the SubmitOptions argument will override any jobIds already associated with this object on submission (i.e. jobs in the local object's job list).
submit
in interface IChangelist
opts
- SubmitOptions object describing optional parameters; if null, no
options are set.
P4JavaException
- if any error occurs in the processing of this method.IChangelist.submit(com.perforce.p4java.option.changelist.SubmitOptions)
public void submit(SubmitOptions opts, IStreamingCallback callback, int key) throws P4JavaException
IChangelist
Note that this method takes an IStreamingCallback parameter, and the results are sent to the user using the IStreamingCallback handleResult method; see the IStreamingCallback Javadoc for details. The payload passed to handleResult is usually the raw map gathered together deep in the RPC protocol layer, and the user is assumed to have the knowledge and technology to be able to parse it and use it.
submit
in interface IChangelist
opts
- SubmitOptions object describing optional parameters; if null, no
options are set.callback
- a non-null IStreamingCallback to be used to process the incoming
results.key
- an opaque integer key that is passed to the IStreamingCallback callback
methods to identify the action as being associated with this specific
call.
P4JavaException
- if any error occurs in the processing of this method.IChangelist.submit(com.perforce.p4java.option.changelist.SubmitOptions, com.perforce.p4java.server.callback.IStreamingCallback, int)
public List<IFileSpec> submit(boolean reOpen) throws ConnectionException, RequestException, AccessException
IChangelist
If the submit is successful, the status of the underlying changelist will be updated to reflect the new status. Other fields will not be automatically updated and need to be refreshed with the refresh() method if you need to access them live.
Note that the list of filespecs returned from the submit will contain only summary filespecs for successful files -- generally only the depot path, action, and revisions fields will be valid; other fields may be null or undefined depending on the server and client implementations. That is, do not rely on the returned filespec list for anything other than depot paths.
submit
in interface IChangelist
reOpen
- if true, reopen the submitted files for editing after a successful submit.
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 callerIChangelist.submit(boolean)
public void refresh() throws ConnectionException, RequestException, AccessException
IServerResource
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).
refresh
in interface IChangelist
refresh
in interface IServerResource
refresh
in class ServerResource
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 callerIServerResource.refresh()
public void update() throws ConnectionException, RequestException, AccessException
IServerResource
The results of calling this method on objects whose canUpdate method returns false are undefined (but will generally result in a UnimplementedError being thrown).
update
in interface IServerResource
update
in class ServerResource
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 callerServerResource.update()
public void update(boolean force) throws ConnectionException, RequestException, AccessException
IServerResource
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).
update
in interface IServerResource
update
in class ServerResource
force
- if true, force the update of the object on the server.
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 callerServerResource.update(boolean)
public void update(Options opts) throws ConnectionException, RequestException, AccessException
IServerResource
The results of calling this method on objects whose canUpdate method returns false are undefined (but will generally result in a UnimplementedError being thrown).
update
in interface IServerResource
update
in class ServerResource
opts
- Options object describing optional parameters; if null, no
options are set.
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 callerServerResource.update(com.perforce.p4java.option.Options)
public void updateOnServer(boolean refresh) throws ConnectionException, RequestException, AccessException
IChangelist
updateOnServer
in interface IChangelist
refresh
- if true, does a refresh() behind the scenes after a successful return.
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 callerIChangelist.updateOnServer(boolean)
public List<IFileSpec> getFileSpecs()
public void setFileSpecs(List<IFileSpec> fileSpecs)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |