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

java.lang.Object
  extended by com.microsoft.tfs.core.internal.wrappers.WebServiceObjectWrapper
      extended by com.microsoft.tfs.core.clients.versioncontrol.soapextensions.Mapping
          extended by com.microsoft.tfs.core.clients.versioncontrol.soapextensions.WorkingFolder
All Implemented Interfaces:
java.lang.Cloneable

public final class WorkingFolder
extends Mapping
implements java.lang.Cloneable

Represents a Mapping between a server item (by path) and a local path.

Since:
TEE-SDK-10.1
Thread-safety:
thread-compatible

Field Summary
static java.lang.String DEPTH_ONE_STRING
          A string which is used to represent a depth-one mapping when it is the file part of a server path.
 
Fields inherited from class com.microsoft.tfs.core.internal.wrappers.WebServiceObjectWrapper
webServiceObject
 
Constructor Summary
WorkingFolder(ms.tfs.versioncontrol.clientservices._03._WorkingFolder wf)
           
WorkingFolder(java.lang.String serverItem, java.lang.String localItem)
           
WorkingFolder(java.lang.String serverItem, java.lang.String localItem, WorkingFolderType type)
          Creates a working folder object that maps a local path to a server path with a recursion type of "full" (the traditional mapping style).
WorkingFolder(java.lang.String serverItem, java.lang.String localItem, WorkingFolderType type, RecursionType recursion)
          Creates a working folder object that maps a local path to a server path.
 
Method Summary
static boolean areSetsEqual(WorkingFolder[] set1, WorkingFolder[] set2)
           
 java.lang.Object clone()
           
static WorkingFolder[] clone(WorkingFolder[] folders)
           
 boolean equals(java.lang.Object obj)
          
static java.lang.String[] extractMappedPaths(WorkingFolder[] workingFolders)
           
 java.lang.String getLocalItem()
          Gets the path to the local item in this working folder mapping.
static java.lang.String getLocalItemForServerItem(java.lang.String serverItem, WorkingFolder[] folders)
           
static java.lang.String getLocalItemForServerItem(java.lang.String serverItem, WorkingFolder[] folders, boolean detectImplicitCloak)
           
 java.lang.String getLocalItemRaw()
          Gets the path to the local item in the native TFS path format, which is Windows-style paths (even if this code is running on Unix).
static java.lang.String getServerItemForLocalItem(java.lang.String localItem, WorkingFolder[] folders)
           
 ms.tfs.versioncontrol.clientservices._03._WorkingFolder getWebServiceObject()
          Gets the web service object this class wraps.
static java.lang.Iterable<java.lang.String> getWorkspaceRoots(WorkingFolder[] workingFolders)
           
 int hashCode()
          
 void setLocalItem(java.lang.String item)
          Sets the path to the local item in this working folder mapping.
 java.lang.String toString()
           
 java.lang.String translateLocalItemToServerItem(java.lang.String localItem)
          Uses this WorkingFolder object as the closest mapping to translate the provided local item to a server item.
static PathTranslation translateLocalItemToServerItem(java.lang.String localPath, WorkingFolder[] folders)
           Translates a local path to a server path using the supplied working folder mappings.
 java.lang.String translateServerItemToLocalItem(java.lang.String serverItem)
          Uses this WorkingFolder object as the closest mapping to translate the provided server item to a local item.
static PathTranslation translateServerItemToLocalItem(java.lang.String serverPath, WorkingFolder[] folders, boolean interpretOneLevelMappingsNormally)
           Translates a server path to a local path using the supplied working folder mappings.
 
Methods inherited from class com.microsoft.tfs.core.clients.versioncontrol.soapextensions.Mapping
getDepth, getDepthFromRecursion, getDisplayServerItem, getServerItem, getType, isCloaked, setServerItem
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEPTH_ONE_STRING

public static final java.lang.String DEPTH_ONE_STRING
A string which is used to represent a depth-one mapping when it is the file part of a server path.

Constant Field Value:
"*"
See Also:
Constant Field Values
Constructor Detail

WorkingFolder

public WorkingFolder(ms.tfs.versioncontrol.clientservices._03._WorkingFolder wf)

WorkingFolder

public WorkingFolder(java.lang.String serverItem,
                     java.lang.String localItem)

WorkingFolder

public WorkingFolder(java.lang.String serverItem,
                     java.lang.String localItem,
                     WorkingFolderType type)
Creates a working folder object that maps a local path to a server path with a recursion type of "full" (the traditional mapping style).

Parameters:
serverItem - the server item being mapped (must not be null)
localItem - the local path being mapped (may be null for cloak mappings).
type - the type of mapping to create (must not be null)

WorkingFolder

public WorkingFolder(java.lang.String serverItem,
                     java.lang.String localItem,
                     WorkingFolderType type,
                     RecursionType recursion)
Creates a working folder object that maps a local path to a server path.

Parameters:
localItem - the local path being mapped (may be null for cloak mappings).
serverItem - the server item being mapped (must not be null)
type - the type of mapping to create (must not be null)
recursion - the type of recursion to use for the working folder (must not be null)
Method Detail

getWebServiceObject

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

Returns:
the web service object this class wraps.

getLocalItemRaw

public java.lang.String getLocalItemRaw()
Gets the path to the local item in the native TFS path format, which is Windows-style paths (even if this code is running on Unix).

Returns:
the local path in the native TFS path format (Windows-style)

getLocalItem

public java.lang.String getLocalItem()
Gets the path to the local item in this working folder mapping. Can be null for cloaked mappings.

Returns:
the local path.

setLocalItem

public void setLocalItem(java.lang.String item)
Sets the path to the local item in this working folder mapping. Can be set to null for cloaked mappings.

Parameters:
item - the local path.

toString

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

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class Mapping

hashCode

public int hashCode()

Overrides:
hashCode in class Mapping

areSetsEqual

public static boolean areSetsEqual(WorkingFolder[] set1,
                                   WorkingFolder[] set2)
Returns:
True if the two sets are identical, false otherwise

getWorkspaceRoots

public static java.lang.Iterable<java.lang.String> getWorkspaceRoots(WorkingFolder[] workingFolders)

translateServerItemToLocalItem

public java.lang.String translateServerItemToLocalItem(java.lang.String serverItem)
Uses this WorkingFolder object as the closest mapping to translate the provided server item to a local item.

Parameters:
serverItem - The server item to translate. This must be a subitem of this WorkingFolder's server item.
Returns:
The local item of the provided server item

translateLocalItemToServerItem

public java.lang.String translateLocalItemToServerItem(java.lang.String localItem)
Uses this WorkingFolder object as the closest mapping to translate the provided local item to a server item. Do not call this method on WorkingFolders which are cloaks, as they have no local path. Furthermore, this method does not respect the Depth property of a WorkingFolder.

Parameters:
localItem - The local item to translate. This must be a subitem of this WorkingFolder's local item.
Returns:
The server item of the provided local item

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

clone

public static WorkingFolder[] clone(WorkingFolder[] folders)

extractMappedPaths

public static java.lang.String[] extractMappedPaths(WorkingFolder[] workingFolders)

getLocalItemForServerItem

public static java.lang.String getLocalItemForServerItem(java.lang.String serverItem,
                                                         WorkingFolder[] folders)

getLocalItemForServerItem

public static java.lang.String getLocalItemForServerItem(java.lang.String serverItem,
                                                         WorkingFolder[] folders,
                                                         boolean detectImplicitCloak)

getServerItemForLocalItem

public static java.lang.String getServerItemForLocalItem(java.lang.String localItem,
                                                         WorkingFolder[] folders)

translateLocalItemToServerItem

public static PathTranslation translateLocalItemToServerItem(java.lang.String localPath,
                                                             WorkingFolder[] folders)

Translates a local path to a server path using the supplied working folder mappings.

A PathTranslation is returned for items that are cloaked and the translated item will be non-null.

Parameters:
localPath - the local path to translate into a server path (must not be null or empty)
folders - the WorkingFolder mappings to translate with; can be arranged in any order (must not be null)
Returns:
the working folder mapping that most precisely matches the given path (including cloak mappings), or null if the item is not mapped

translateServerItemToLocalItem

public static PathTranslation translateServerItemToLocalItem(java.lang.String serverPath,
                                                             WorkingFolder[] folders,
                                                             boolean interpretOneLevelMappingsNormally)

Translates a server path to a local path using the supplied working folder mappings.

A PathTranslation is returned for items that are cloaked, but the translated item will be null.

Parameters:
serverPath - the server path to translate into a local path (must not be null or empty)
folders - the WorkingFolder mappings to translate with; can be arranged in any order (must not be null)
interpretOneLevelMappingsNormally - if true working folder mappings with RecursionType.ONE_LEVEL are interpreted normally, if false WorkingFolder objects with RecursionType.ONE_LEVEL recursion types are interpreted as having RecursionType.FULL (useful for some UI methods which want to predict mapping locations even though an item may be too far below a one-level to be property considered "mapped")
Returns:
the PathTranslation with the translation information ( PathTranslation.getTranslatedPath() is null for cloaked items), or null if no appropriate working folder mapping was found


© 2015 Microsoft. All rights reserved.