com.microsoft.tfs.core.clients.versioncontrol.conflicts
Class ConflictDescription

java.lang.Object
  extended by com.microsoft.tfs.core.clients.versioncontrol.conflicts.ConflictDescription
Direct Known Subclasses:
FilenameConflictDescription, UnknownConflictDescription, VersionConflictDescription, WritableConflictDescription

public abstract class ConflictDescription
extends java.lang.Object

This is the base conflict description class. It presents textual descriptions of conflicts, primarily for UI. This class is abstract, to get a ConflictDescription, you should call ConflictDescription#getConflictDescription(ConflictCategory, Conflict) .

Since:
TEE-SDK-10.1

Constructor Summary
protected ConflictDescription(Workspace workspace, Conflict conflict, ItemSpec[] conflictItemSpecs)
          Internal constructor for creating a conflict description.
 
Method Summary
 boolean analyzeConflict()
          Analyze the conflict for mergeability, enablement, etc.
 void clearAnalysis()
          Clears any data leftover from the analysis of this conflict.
 java.lang.String getChangeDescription()
          Returns the "change description" - number of local/server/conflicting changes.
 Conflict getConflict()
          Get the underlying core conflict for this conflict.
abstract  ConflictCategory getConflictCategory()
          Gets the category of this conflict
 ItemSpec[] getConflictItemSpecs()
          The item specs queried to return this conflict.
abstract  java.lang.String getDescription()
          A long description of this conflict, suitable for display to the user.
 java.lang.String getLocalFileDescription()
          Gets the description of the local file.
 java.lang.String getLocalPath()
          Gets the local filename affected by the conflict.
 java.lang.String getLocalPath(ConflictDescriptionPathType pathType)
          Gets the local filename affected by the conflict.
abstract  java.lang.String getName()
          A short description of the conflict, eg "Version Conflict"
 java.lang.String getRemoteFileDescription()
          Gets the description of the server's file.
abstract  ConflictResolution[] getResolutions(ConflictResolutionContributor resolutionContributor)
          Gets the resolution options for this particular conflict with the available merge toolset.
 java.lang.String getServerPath()
          Gets the server filename affected by this conflict.
 Workspace getWorkspace()
          Get the workspace this conflict is occurring in.
 boolean hasAnalyzed()
          Returns whether this conflict has been analyzed for mergeability.
 boolean isBaseless()
           
 boolean isResolutionEnabled(ConflictResolution resolution)
          Determines if a conflict resolution should be enabled (shown to the user.) We may know ahead of time that certain conflict resolutions (for example, AcceptMerge) are invalid (due to analyzing the conflict.)
protected  java.util.Collection<ConflictResolution> loadContributedResolutions(ConflictResolutionContributor resolutionContributor, ConflictResolutionOptions resolutionOptions)
          Utility method for subclasses: loads contributed conflict resolution options from the resolution contributor.
 boolean showChangeDescription()
          The UI should attempt to show a change description (number of local/server/conflicting changes.)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConflictDescription

protected ConflictDescription(Workspace workspace,
                              Conflict conflict,
                              ItemSpec[] conflictItemSpecs)
Internal constructor for creating a conflict description.

Parameters:
conflict - the Conflict to wrap
Method Detail

getWorkspace

public Workspace getWorkspace()
Get the workspace this conflict is occurring in.

Returns:
The Workspace this conflict occurs in.

getConflict

public Conflict getConflict()
Get the underlying core conflict for this conflict.

Returns:
The original Conflict for this conflict

getConflictItemSpecs

public ItemSpec[] getConflictItemSpecs()
The item specs queried to return this conflict. These may be requeried.

Returns:
An array of ItemSpecs that were queried to return this conflict. May be null or empty.

getConflictCategory

public abstract ConflictCategory getConflictCategory()
Gets the category of this conflict

Returns:
A ConflictCategory for this conflict

getLocalPath

public java.lang.String getLocalPath()
Gets the local filename affected by the conflict. Returns the target local file, if defined, or the source local file.

Returns:
Local filename or null

getLocalPath

public java.lang.String getLocalPath(ConflictDescriptionPathType pathType)
Gets the local filename affected by the conflict. By default this will return the target local file (if not null), then the source local file. This may be overridden with the pathType argument.

Parameters:
pathType - May be ConflictDescriptionPathType.SOURCE to prefer the source local item (if not null)
Returns:
The local filename affected by this conflict or null

getServerPath

public java.lang.String getServerPath()
Gets the server filename affected by this conflict. Defaults to the your server file, unless it does not exist, then tries base server file and finally their server file.

Returns:
The server filename affected by this conflict.

getLocalFileDescription

public java.lang.String getLocalFileDescription()
Gets the description of the local file. For most conflicts, this is generally called the "local" file.

Returns:
A String representing the name of the server file

getRemoteFileDescription

public java.lang.String getRemoteFileDescription()
Gets the description of the server's file. For most conflicts, this is generally called the "server" file.

Returns:
A String representing the name of the server file

isBaseless

public boolean isBaseless()

getName

public abstract java.lang.String getName()
A short description of the conflict, eg "Version Conflict"

Returns:
A String representing the short description of the conflict

getDescription

public abstract java.lang.String getDescription()
A long description of this conflict, suitable for display to the user. eg ("You have a conflicting pending change.")

Returns:
A string representing the description of the conflict

showChangeDescription

public boolean showChangeDescription()
The UI should attempt to show a change description (number of local/server/conflicting changes.)

Returns:
true to show change description, false otherwise

getChangeDescription

public java.lang.String getChangeDescription()
Returns the "change description" - number of local/server/conflicting changes.


analyzeConflict

public boolean analyzeConflict()
Analyze the conflict for mergeability, enablement, etc.

Returns:
true if the conflict was analyzed, false if no changes were made

hasAnalyzed

public boolean hasAnalyzed()
Returns whether this conflict has been analyzed for mergeability.

Returns:

clearAnalysis

public void clearAnalysis()
Clears any data leftover from the analysis of this conflict.


getResolutions

public abstract ConflictResolution[] getResolutions(ConflictResolutionContributor resolutionContributor)
Gets the resolution options for this particular conflict with the available merge toolset. If the toolset is not null and contains a matching tool, external resolution options may be available.

Parameters:
resolutionContributor - an object which contributes resolutions for conflicts. May be null, but external resolution options won't be available.
Returns:
An array of ConflictResolutions for this particular conflict.

isResolutionEnabled

public boolean isResolutionEnabled(ConflictResolution resolution)
Determines if a conflict resolution should be enabled (shown to the user.) We may know ahead of time that certain conflict resolutions (for example, AcceptMerge) are invalid (due to analyzing the conflict.)

Parameters:
resolution - The resolution to examine
Returns:
true if the resolution is enabled, false otherwise

loadContributedResolutions

protected final java.util.Collection<ConflictResolution> loadContributedResolutions(ConflictResolutionContributor resolutionContributor,
                                                                                    ConflictResolutionOptions resolutionOptions)
Utility method for subclasses: loads contributed conflict resolution options from the resolution contributor.

Parameters:
resolutionContributor - The ConflictResolutionContributor for this product (may be null)
resolutionOptions - The ResolutionOptions for this conflict description (not null)
Returns:
A collection of contributed conflict resolutions (never null)


© 2015 Microsoft. All rights reserved.