com.microsoft.tfs.core.clients.versioncontrol.soapextensions
Class PendingChange

java.lang.Object
  extended by com.microsoft.tfs.core.internal.wrappers.WebServiceObjectWrapper
      extended by com.microsoft.tfs.core.clients.versioncontrol.soapextensions.PendingChange
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable<PendingChange>

public final class PendingChange
extends com.microsoft.tfs.core.internal.wrappers.WebServiceObjectWrapper
implements java.lang.Comparable<PendingChange>, java.lang.Cloneable

Contains information about a change the user wants to perform to a versioned item (or possibly a newly added item).

Since:
TEE-SDK-10.1

Field Summary
 
Fields inherited from class com.microsoft.tfs.core.internal.wrappers.WebServiceObjectWrapper
webServiceObject
 
Constructor Summary
PendingChange(ms.tfs.versioncontrol.clientservices._03._PendingChange change)
           
PendingChange(PendingChange change)
          Creates a clone of the given PendingChange.
PendingChange(java.lang.String serverItem, java.lang.String sourceServerItem, int sourceVersionFrom, int sourceDeletionID, int deletionID, LockLevel lockLevel, java.lang.String localItem, ItemType itemType, int itemID, java.util.Calendar creationDate, int version, ChangeType changeType, byte[] hashValue, byte[] uploadHashValue, int encoding, int pendingChangeID, PropertyValue[] properties, boolean isCandidate)
           
PendingChange(Workspace workspace, GetOperation operation, ProcessType processType)
          Construct a PendingChange from a GetOperation.
 
Method Summary
 int compareTo(PendingChange other)
           
 void downloadBaseFile(VersionControlClient client, java.lang.String localFileName)
          Downloads the content of the version of the file against which the change was pended.
 java.io.File downloadBaseFileToTempLocation(VersionControlClient client, java.lang.String fileName)
          Downloads the content of the version of the file against which the change was pended to a temp file in a new temp directory allocated with TempStorageService.
 void downloadShelvedFile(VersionControlClient client, java.lang.String localFileName)
          Downloads the shelved content for this pending change.
 java.io.File downloadShelvedFileToTempLocation(VersionControlClient client, java.lang.String fileName)
          Downloads the shelved content for this pending change to a temp file in a new temp directory allocated with TempStorageService.
 boolean equals(java.lang.Object obj)
           
 boolean equalsIgnoringLockLevelAndVersion(java.lang.Object obj)
          Like equals(Object), but does not test the lock level and version.
 ChangeType getChangeType()
           
 ConflictType getConflictType()
           
 java.util.Calendar getCreationDate()
           
 int getDeletionID()
           
 java.lang.String getDownloadURL()
           
 int getEncoding()
           
 byte[] getHashValue()
           
 int getItemID()
           
 ItemType getItemType()
           
 long getLength()
           
 java.lang.String getLocalItem()
           
 LockLevel getLockLevel()
           
 java.lang.String getLockLevelName()
          The localized string appropriate for normal text lock level display (command-line client "status /format:detailed" command, for example).
 java.lang.String getLockLevelShortName()
          The localized string appropriate for very space-constrained lock level display (command-line client "status /format:brief" command, for example).
 MergeSource[] getMergeSources()
           
 int getPendingChangeID()
          Deprecated. since TFS 2010
 java.lang.String getPendingSetName()
          Name of the PendingSet that this PendingChange is part of.
 java.lang.String getPendingSetOwner()
          Owner of the PendingSet that this PendingChange is part of.
 java.lang.String getPendingSetOwnerDisplay()
          Unique Owner of the PendingSet that this PendingChange is part of.
 PropertyValue[] getPropertyValues()
           
 java.lang.String getServerItem()
           
 java.lang.String getShelvedDownloadURL()
           
 java.lang.String getSourceLocalItem()
           
 java.lang.String getSourceServerItem()
           
 int getSourceVersionFrom()
           
 byte[] getUploadContentHashValue()
           
 int getVersion()
           
 ms.tfs.versioncontrol.clientservices._03._PendingChange getWebServiceObject()
          Gets the web service object this class wraps.
 boolean hasContentChange()
          Tests whether this pending change has local content which differs from the server item.
 int hashCode()
           
 boolean hasLocalItem()
          Tests whether the local item is null.
 boolean isAdd()
           
 boolean isBranch()
           
 boolean isCandidate()
          If false, the change is actually pended otherwise this is a candidate change, which we have detected which the user might choose to accept or discard.
 boolean isDelete()
           
 boolean isEdit()
           
 boolean isEncoding()
           
 boolean isInShelveset()
          Flag indicating if this pending change is part of shelveset or workspace.
 boolean isLocalItemDelete()
           
 boolean isLock()
           
 boolean isMerge()
           
 boolean isRename()
           
 boolean isRollback()
           
static boolean isSourceRename(ChangeType changeType)
           
 boolean isUnchanged(Workspace workspace)
          Determine whether this pending change is unchanged using either local workspace or server workspace.
 boolean isUnchangedInLocalWorkspace(Workspace workspace)
          Tests whether this pending change has local content which differs from local baseline.
 boolean isUnchangedInServerWorkspace()
          Determine whether this pending change is unchanged pending change.
 boolean isUndelete()
           
 boolean isUndone()
           
 void restoreCandidateDelete(Workspace workspace)
          Restores a candidate delete on disk, if it's a folder, walks children recursively and restores them as well.
 void setCandidate(boolean value)
           
 void setChangeType(ChangeType changeType)
           
 void setConflictType(ConflictType conflictType)
           
 void setCreationDate(java.util.Calendar date)
           
 void setDeletionID(int did)
           
 void setDownloadURL(java.lang.String url)
           
 void setEncoding(int enc)
           
 void setHashValue(byte[] hash)
           
 void setInShelveset(boolean value)
           
 void setItemID(int itemid)
           
 void setItemType(ItemType type)
           
 void setLength(long value)
           
 void setLocalItem(java.lang.String item)
           
 void setLockLevel(LockLevel lock)
           
 void setPendingChangeID(int pcid)
          Deprecated. since TFS 2010
 void setPendingSetName(java.lang.String name)
           
 void setPendingSetOwner(java.lang.String owner)
           
 void setPendingSetOwnerDisplay(java.lang.String owner)
           
 void setServerItem(java.lang.String item)
           
 void setShelvedDownloadURL(java.lang.String url)
           
 void setSourceLocalItem(java.lang.String item)
           
 void setSourceServerItem(java.lang.String item)
           
 void setUploadContentHashValue(byte[] hash)
           
 void setVersion(int version)
           
static java.lang.String[] toLocalItems(PendingChange[] changes)
          Extracts all the non-null local items from an array of pending changes and returns a new array containing them.
static java.lang.String[] toServerItems(PendingChange[] changes)
          Extracts all the non-null server items from an array of pending changes and returns a new array containing them.
 java.lang.String toString()
           
 void updateMissingProperties(VersionControlClient client)
          Queries server for full PendingChange object (including download URL) and populates downloadUrl, shelvedDownloadUrl, SourceServerItem and SourceLocalItem of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PendingChange

public PendingChange(ms.tfs.versioncontrol.clientservices._03._PendingChange change)

PendingChange

public PendingChange(PendingChange change)
Creates a clone of the given PendingChange.

Parameters:
change - the change to clone (must not be null)

PendingChange

public PendingChange(Workspace workspace,
                     GetOperation operation,
                     ProcessType processType)
Construct a PendingChange from a GetOperation. This is just a convenience method for GetEngine to use. Do not use this outside of com.microsoft.tfs.core.

Parameters:
workspace - the workspace where the get operation happened (must not be null)
operation - the operation to initialize the pending change from (must not be null)
processType - the process type of the operation (must not be null)

PendingChange

public PendingChange(java.lang.String serverItem,
                     java.lang.String sourceServerItem,
                     int sourceVersionFrom,
                     int sourceDeletionID,
                     int deletionID,
                     LockLevel lockLevel,
                     java.lang.String localItem,
                     ItemType itemType,
                     int itemID,
                     java.util.Calendar creationDate,
                     int version,
                     ChangeType changeType,
                     byte[] hashValue,
                     byte[] uploadHashValue,
                     int encoding,
                     int pendingChangeID,
                     PropertyValue[] properties,
                     boolean isCandidate)
Method Detail

getWebServiceObject

public ms.tfs.versioncontrol.clientservices._03._PendingChange getWebServiceObject()
Gets the web service object this class wraps. The returned object should not be modified.

Returns:
the web service object this class wraps.

downloadShelvedFileToTempLocation

public java.io.File downloadShelvedFileToTempLocation(VersionControlClient client,
                                                      java.lang.String fileName)
Downloads the shelved content for this pending change to a temp file in a new temp directory allocated with TempStorageService. Throws VersionControlException this is not a shelved pending change.

Parameters:
fileName - the file name (not full path) to give the temporary file (must not be null or empty)
Returns:
the temporary file created

downloadShelvedFile

public void downloadShelvedFile(VersionControlClient client,
                                java.lang.String localFileName)
Downloads the shelved content for this pending change. Throws VersionControlException this is not a shelved pending change.

Parameters:
client - the VersionControlClient to use to download the file (must not be null)
localFileName - where to save the downloaded file contents (must not be null)

downloadBaseFileToTempLocation

public java.io.File downloadBaseFileToTempLocation(VersionControlClient client,
                                                   java.lang.String fileName)
Downloads the content of the version of the file against which the change was pended to a temp file in a new temp directory allocated with TempStorageService.

Parameters:
fileName - the file name (not full path) to give the temporary file (must not be null or empty)
Returns:
the temporary file created

downloadBaseFile

public void downloadBaseFile(VersionControlClient client,
                             java.lang.String localFileName)
Downloads the content of the version of the file against which the change was pended.

Parameters:
localFileName - where to save the downloaded file contents (must not be null)

updateMissingProperties

public void updateMissingProperties(VersionControlClient client)
Queries server for full PendingChange object (including download URL) and populates downloadUrl, shelvedDownloadUrl, SourceServerItem and SourceLocalItem of this object. SourceLocalItem is null most of the time for real PendingChange objects. After this method finishes download URLS can be still empty, if the workspace or shelveset were deleted or we didn't serialize properly all required properties (PendingSetName, PendingSetOwner, IsInShelveset).


getChangeType

public ChangeType getChangeType()

setChangeType

public void setChangeType(ChangeType changeType)

getConflictType

public ConflictType getConflictType()

setConflictType

public void setConflictType(ConflictType conflictType)

getCreationDate

public java.util.Calendar getCreationDate()

setCreationDate

public void setCreationDate(java.util.Calendar date)

getDeletionID

public int getDeletionID()

setDeletionID

public void setDeletionID(int did)

getEncoding

public int getEncoding()

setEncoding

public void setEncoding(int enc)

getHashValue

public byte[] getHashValue()
Returns:
the MD5 HashValue for the contents of the version of the file the change is pended against.

setHashValue

public void setHashValue(byte[] hash)
Parameters:
hash - the MD5 HashValue for the contents of the version of the file the change is pended against.

getServerItem

public java.lang.String getServerItem()

setServerItem

public void setServerItem(java.lang.String item)

getItemID

public int getItemID()

setItemID

public void setItemID(int itemid)

hasLocalItem

public boolean hasLocalItem()
Tests whether the local item is null. Skips path conversion, making it faster than calling getLocalItem().

Returns:
true if the local item is not null, false if the local item is null

getLocalItem

public java.lang.String getLocalItem()
Returns:
the local item associated with this change. May be null (e.g. if a rename is pended from a mapped folder to an unmapped server path).

setLocalItem

public void setLocalItem(java.lang.String item)

getLockLevel

public LockLevel getLockLevel()

setLockLevel

public void setLockLevel(LockLevel lock)

getSourceVersionFrom

public int getSourceVersionFrom()

getPendingChangeID

@Deprecated
public int getPendingChangeID()
Deprecated. since TFS 2010


setPendingChangeID

@Deprecated
public void setPendingChangeID(int pcid)
Deprecated. since TFS 2010


getSourceServerItem

public java.lang.String getSourceServerItem()

setSourceServerItem

public void setSourceServerItem(java.lang.String item)

getSourceLocalItem

public java.lang.String getSourceLocalItem()

setSourceLocalItem

public void setSourceLocalItem(java.lang.String item)

getItemType

public ItemType getItemType()

setItemType

public void setItemType(ItemType type)

getUploadContentHashValue

public byte[] getUploadContentHashValue()
Returns:
the MD5 HashValue for the file that is currently associated with this pending change.

setUploadContentHashValue

public void setUploadContentHashValue(byte[] hash)
Parameters:
hash - the MD5 HashValue for the file that is currently associated with this pending change.

getVersion

public int getVersion()

setVersion

public void setVersion(int version)

isCandidate

public boolean isCandidate()
If false, the change is actually pended otherwise this is a candidate change, which we have detected which the user might choose to accept or discard.


setCandidate

public void setCandidate(boolean value)

getPendingSetName

public java.lang.String getPendingSetName()
Name of the PendingSet that this PendingChange is part of. This denormalization is needed to download content of the base or shelved file. The setter should be used only by the code that creates object.


setPendingSetName

public void setPendingSetName(java.lang.String name)

getPendingSetOwner

public java.lang.String getPendingSetOwner()
Owner of the PendingSet that this PendingChange is part of. This denormalization is needed to download content of the base or shelved file. The setter should be used only by the code that creates object.


setPendingSetOwner

public void setPendingSetOwner(java.lang.String owner)

getPendingSetOwnerDisplay

public java.lang.String getPendingSetOwnerDisplay()
Unique Owner of the PendingSet that this PendingChange is part of. This denormalization is needed to download content of the base or shelved file. The setter should be used only by the code that creates object.


setPendingSetOwnerDisplay

public void setPendingSetOwnerDisplay(java.lang.String owner)

isInShelveset

public boolean isInShelveset()
Flag indicating if this pending change is part of shelveset or workspace. This denormalization is needed to download content of the base or shelved file. The setter should be used only by the code that creates object.


setInShelveset

public void setInShelveset(boolean value)

compareTo

public int compareTo(PendingChange other)
Specified by:
compareTo in interface java.lang.Comparable<PendingChange>

toServerItems

public static java.lang.String[] toServerItems(PendingChange[] changes)
Extracts all the non-null server items from an array of pending changes and returns a new array containing them.

Parameters:
changes - the changes to examine for server items.
Returns:
a new array of server item strings.

toLocalItems

public static java.lang.String[] toLocalItems(PendingChange[] changes)
Extracts all the non-null local items from an array of pending changes and returns a new array containing them.

Parameters:
changes - the changes to examine for local items.
Returns:
a new array of local item strings.

equalsIgnoringLockLevelAndVersion

public boolean equalsIgnoringLockLevelAndVersion(java.lang.Object obj)
Like equals(Object), but does not test the lock level and version. This method might be useful for some UI classes that need to compare changes between pending change sets (e.g. during a refresh).

See Also:
Object.equals(java.lang.Object)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class com.microsoft.tfs.core.internal.wrappers.WebServiceObjectWrapper

hashCode

public int hashCode()
Overrides:
hashCode in class com.microsoft.tfs.core.internal.wrappers.WebServiceObjectWrapper

getLockLevelName

public java.lang.String getLockLevelName()
The localized string appropriate for normal text lock level display (command-line client "status /format:detailed" command, for example).

Returns:
the localized short string that describes the lock level. If the lock member is unchanged, "none" is returned.

getLockLevelShortName

public java.lang.String getLockLevelShortName()
The localized string appropriate for very space-constrained lock level display (command-line client "status /format:brief" command, for example). The strings returned are one character long.

Returns:
the localized (very) short string that describes the lock level for this pending change.

toString

public java.lang.String toString()
Overrides:
toString in class com.microsoft.tfs.core.internal.wrappers.WebServiceObjectWrapper

isUndone

public boolean isUndone()

isLocalItemDelete

public boolean isLocalItemDelete()

getLength

public long getLength()

setLength

public void setLength(long value)

getDownloadURL

public java.lang.String getDownloadURL()

setDownloadURL

public void setDownloadURL(java.lang.String url)

getShelvedDownloadURL

public java.lang.String getShelvedDownloadURL()

setShelvedDownloadURL

public void setShelvedDownloadURL(java.lang.String url)

isSourceRename

public static boolean isSourceRename(ChangeType changeType)

getMergeSources

public MergeSource[] getMergeSources()

hasContentChange

public boolean hasContentChange()
                         throws CanceledException
Tests whether this pending change has local content which differs from the server item. Useful for finding users' changes during "return online" and post-build reconcile operations.

Returns:
true if the pending change is a ChangeType.EDIT and the local item's contents are different than the server's contents, false otherwise
Throws:
CanceledException - if the hash operation was cancelled via the default TaskMonitor

isUnchanged

public boolean isUnchanged(Workspace workspace)
Determine whether this pending change is unchanged using either local workspace or server workspace.

Parameters:
workspace -
Returns:

isUnchangedInServerWorkspace

public boolean isUnchangedInServerWorkspace()
                                     throws CanceledException
Determine whether this pending change is unchanged pending change. Return true only if the pending change is only in type EDIT and no content changes.

Returns:
true if the pending change is ChangeType.EDIT, and the local item's has no content changes, false otherwise
Throws:
CanceledException - if the core operation was cancelled via the default TaskMonitor

isUnchangedInLocalWorkspace

public boolean isUnchangedInLocalWorkspace(Workspace workspace)
                                    throws CanceledException
Tests whether this pending change has local content which differs from local baseline. Useful for determine pending change is unchanged pending change when using local workspace.

Returns:
true if the pending change is a ChangeType.EDIT and the local item's contents are same as baseline, false otherwise
Throws:
CanceledException - if the hash operation was cancelled via the default TaskMonitor

isAdd

public boolean isAdd()

isEdit

public boolean isEdit()

isRename

public boolean isRename()

isEncoding

public boolean isEncoding()

isDelete

public boolean isDelete()

isUndelete

public boolean isUndelete()

isBranch

public boolean isBranch()

isMerge

public boolean isMerge()

isRollback

public boolean isRollback()

isLock

public boolean isLock()

getPropertyValues

public PropertyValue[] getPropertyValues()

restoreCandidateDelete

public void restoreCandidateDelete(Workspace workspace)
Restores a candidate delete on disk, if it's a folder, walks children recursively and restores them as well.

Parameters:
workspace - the workspace to restore changes in (must not be null )


© 2015 Microsoft. All rights reserved.