allow to fetch repositories by type and name

This commit is contained in:
Sebastian Sdorra
2012-01-08 11:57:16 +01:00
parent 05fc269e7e
commit 15e7b38c7c
5 changed files with 84 additions and 0 deletions

View File

@@ -50,6 +50,18 @@ import java.util.Collection;
public interface RepositoryClientHandler extends ClientHandler<Repository>
{
/**
* Method description
*
*
* @param type
* @param name
*
* @return
* @since 1.11
*/
public Repository get(String type, String name);
/**
* Method description
*

View File

@@ -69,6 +69,24 @@ public class JerseyRepositoryClientHandler
//~--- get methods ----------------------------------------------------------
/**
* Method description
*
*
* @param type
* @param name
*
* @return
*/
@Override
public Repository get(String type, String name)
{
String url = urlProvider.getRepositoryUrlProvider().getDetailUrl(type,
name);
return getItemByUrl(url);
}
/**
* Method description
*

View File

@@ -104,6 +104,18 @@ public interface RepositoryUrlProvider extends ModelUrlProvider
public String getContentUrl(String repositoryId, String path,
String revision);
/**
* Method description
*
*
* @param type
* @param name
*
* @return
* @since 1.11
*/
public String getDetailUrl(String type, String name);
/**
* Method description
*

View File

@@ -197,6 +197,23 @@ public class RestRepositoryUrlProvider extends RestModelUrlProvider
PARAMETER_REVISION, revision).toString();
}
/**
* Method description
*
*
* @param type
* @param name
*
* @return
* @since 1.11
*/
@Override
public String getDetailUrl(String type, String name)
{
return new UrlBuilder(base).appendUrlPart(type).appendUrlPart(
name).toString();
}
/**
* Method description
*

View File

@@ -33,6 +33,10 @@
package sonia.scm.url;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.util.HttpUtil;
/**
*
* @author Sebastian Sdorra
@@ -51,6 +55,9 @@ public class WUIRepositoryUrlProvider extends WUIModelUrlProvider
/** Field description */
public static final String COMPONENT_CONTENT = "contentPanel";
/** Field description */
public static final String COMPONENT_DETAIL = "repositoryPanel";
/** Field description */
public static final String COMPONENT_DIFF = "diffPanel";
@@ -180,6 +187,24 @@ public class WUIRepositoryUrlProvider extends WUIModelUrlProvider
VIEW_HISTORY).toString();
}
/**
* Method description
*
*
* @param type
* @param name
*
* @return
* @since 1.11
*/
@Override
public String getDetailUrl(String type, String name)
{
name = name.concat(HttpUtil.SEPARATOR_PATH).concat(name);
return new WUIUrlBuilder(baseUrl, COMPONENT_DETAIL).append(name).toString();
}
/**
* Method description
*