added blame support to client api

This commit is contained in:
Sebastian Sdorra
2011-09-22 20:00:31 +02:00
parent 1126a1be1a
commit 979167a497
4 changed files with 124 additions and 15 deletions

View File

@@ -79,6 +79,9 @@ public class ScmUrlProvider
/** Field description */
public static final String URLPART_USERS = "users";
/** Field description */
public static final String URLPATTERN_BLAME = "repositories/{0}/blame";
/** Field description */
public static final String URLPATTERN_BROWSE = "repositories/{0}/browse";
@@ -153,6 +156,24 @@ public class ScmUrlProvider
return baseUrl;
}
/**
* Method description
*
*
* @param repositoryId
* @param path
* @param revision
*
* @return
*/
public String getBlameUrl(String repositoryId, String path, String revision)
{
String url = MessageFormat.format(getResourceUrl(URLPATTERN_BLAME),
repositoryId);
return appendParameter(url, path, revision);
}
/**
* Method description
*
@@ -215,20 +236,8 @@ public class ScmUrlProvider
{
String url = MessageFormat.format(getResourceUrl(URLPATTERN_BROWSE),
repositoryId);
String s = "?";
if (Util.isNotEmpty(path))
{
url = url.concat(s).concat("path=").concat(path);
s = "&";
}
if (Util.isNotEmpty(revision))
{
url = url.concat(s).concat("revision=").concat(revision);
}
return url;
return appendParameter(url, path, revision);
}
/**
@@ -391,6 +400,36 @@ public class ScmUrlProvider
this.extension = extension;
}
//~--- methods --------------------------------------------------------------
/**
* Method description
*
*
* @param url
* @param path
* @param revision
*
* @return
*/
private String appendParameter(String url, String path, String revision)
{
String s = "?";
if (Util.isNotEmpty(path))
{
url = url.concat(s).concat("path=").concat(path);
s = "&";
}
if (Util.isNotEmpty(revision))
{
url = url.concat(s).concat("revision=").concat(revision);
}
return url;
}
//~--- fields ---------------------------------------------------------------
/** Field description */