com.microsoft.tfs.core.artifact
Class ArtifactID

java.lang.Object
  extended by com.microsoft.tfs.core.artifact.ArtifactID

public class ArtifactID
extends java.lang.Object

An artifact ID represents the unique, multi-part identifier of an object stored in one of the data repositories of a component of Team Foundation Server. Work items and version control changesets are examples of artifacts.

An artifact ID is composed of 3 parts:

  1. a tool
  2. an artifact type
  3. a tool-specific identifier

An artifact ID can be represented by a URI. This URI is also known as a TFS URI or an artifact URI. The URI contains all 3 parts of an artifact ID in the following form:

vstfs:///tool/artifact-type/tool-specific-identifier

Since:
TEE-SDK-10.1
Thread-safety:
immutable

Field Summary
static java.lang.String URI_SEPARATOR
          The separator used to separate the various parts of the artifact id within a TFS URI.
static java.lang.String VSTFS_PREFIX
          The prefix that all well-formed TFS URIs begin with.
 
Constructor Summary
ArtifactID(java.lang.String uri)
          Create a new artifact id from a TFS URI.
ArtifactID(java.lang.String tool, java.lang.String artifactType, java.lang.String toolSpecificId)
          Create a new artifact id by specifying each of the parts individually.
 
Method Summary
static void checkURIIsWellFormed(java.lang.String uri)
           
 java.lang.String encodeURI()
          Encodes this artifact id as a TFS URI.
 boolean equals(java.lang.Object obj)
          
 java.lang.String getArtifactType()
           
 java.lang.String getTool()
           
 java.lang.String getToolSpecificID()
           
 int hashCode()
          
 boolean isWellFormed()
          Checks whether this artifact id is well formed.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VSTFS_PREFIX

public static final java.lang.String VSTFS_PREFIX
The prefix that all well-formed TFS URIs begin with.

Constant Field Value:
"vstfs:///"
See Also:
Constant Field Values

URI_SEPARATOR

public static final java.lang.String URI_SEPARATOR
The separator used to separate the various parts of the artifact id within a TFS URI.

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

ArtifactID

public ArtifactID(java.lang.String tool,
                  java.lang.String artifactType,
                  java.lang.String toolSpecificId)
Create a new artifact id by specifying each of the parts individually. The resulting artifact id may or may not be well-formed. You can check for well-formedness by calling isWellFormed().

Parameters:
tool - the tool part of the artifact id
artifactType - the artifact type part of the artifact id
toolSpecificId - the tool specific id part of the artifact id

ArtifactID

public ArtifactID(java.lang.String uri)
Create a new artifact id from a TFS URI. The uri must be well-formed.

Parameters:
uri - the uri to decode and create an artifact id from
Throws:
MalformedURIException - if the uri is not well-formed
Method Detail

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

checkURIIsWellFormed

public static void checkURIIsWellFormed(java.lang.String uri)

getTool

public java.lang.String getTool()
Returns:
the tool part of this artifact id

getArtifactType

public java.lang.String getArtifactType()
Returns:
the artifact type part of this artifact id

getToolSpecificID

public java.lang.String getToolSpecificID()
Returns:
the tool specific id part of this artifact id

encodeURI

public java.lang.String encodeURI()
Encodes this artifact id as a TFS URI.

Returns:
a well-formed TFS URI
Throws:
MalformedArtifactIDException - if this artifact id is not well-formed

isWellFormed

public boolean isWellFormed()
Checks whether this artifact id is well formed.

Returns:
true if this artifact id is well formed


© 2015 Microsoft. All rights reserved.