mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 14:35:45 +01:00
allow to fetch repositories by type and name
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user