mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-22 23:42:11 +01:00
use createUrl instead of deprecated getUrl
This commit is contained in:
@@ -170,7 +170,7 @@ public class CreateRepositorySubCommand extends TemplateSubCommand
|
||||
|
||||
Map<String, Object> env = new HashMap<String, Object>();
|
||||
|
||||
env.put("repository", new RepositoryWrapper(repository));
|
||||
env.put("repository", new RepositoryWrapper(config, repository));
|
||||
renderTemplate(env, GetRepositorySubCommand.TEMPLATE);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ public class GetRepositorySubCommand extends TemplateSubCommand
|
||||
{
|
||||
Map<String, Object> env = new HashMap<String, Object>();
|
||||
|
||||
env.put("repository", new RepositoryWrapper(repository));
|
||||
env.put("repository", new RepositoryWrapper(config, repository));
|
||||
renderTemplate(env, TEMPLATE);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -74,7 +74,7 @@ public class ListRepositoriesSubCommand extends TemplateSubCommand
|
||||
List<Repository> repositories = session.getRepositoryHandler().getAll();
|
||||
Map<String, Object> env = new HashMap<String, Object>();
|
||||
|
||||
env.put("repositories", WrapperUtil.wrapRepositories(repositories));
|
||||
env.put("repositories", WrapperUtil.wrapRepositories(config, repositories));
|
||||
renderTemplate(env, TEMPLATE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ public class ModifyRepositorySubCommand extends TemplateSubCommand
|
||||
|
||||
Map<String, Object> env = new HashMap<String, Object>();
|
||||
|
||||
env.put("repository", new RepositoryWrapper(repository));
|
||||
env.put("repository", new RepositoryWrapper(config, repository));
|
||||
renderTemplate(env, GetRepositorySubCommand.TEMPLATE);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -120,7 +120,7 @@ public abstract class PermissionSubCommand extends TemplateSubCommand
|
||||
|
||||
Map<String, Object> env = new HashMap<String, Object>();
|
||||
|
||||
env.put("repository", new RepositoryWrapper(repository));
|
||||
env.put("repository", new RepositoryWrapper(config, repository));
|
||||
renderTemplate(env, GetRepositorySubCommand.TEMPLATE);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -35,6 +35,7 @@ package sonia.scm.cli.wrapper;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.cli.config.ServerConfig;
|
||||
import sonia.scm.repository.Permission;
|
||||
import sonia.scm.repository.Repository;
|
||||
|
||||
@@ -54,10 +55,25 @@ public class RepositoryWrapper extends AbstractWrapper
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param config
|
||||
* @param repository
|
||||
*/
|
||||
public RepositoryWrapper(Repository repository)
|
||||
public RepositoryWrapper(ServerConfig config, Repository repository)
|
||||
{
|
||||
this(config.getServerUrl(), repository);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param baseUrl
|
||||
* @param repository
|
||||
*/
|
||||
public RepositoryWrapper(String baseUrl, Repository repository)
|
||||
{
|
||||
this.baseUrl = baseUrl;
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
@@ -159,7 +175,7 @@ public class RepositoryWrapper extends AbstractWrapper
|
||||
*/
|
||||
public String getUrl()
|
||||
{
|
||||
return repository.getUrl();
|
||||
return repository.createUrl(baseUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,6 +202,9 @@ public class RepositoryWrapper extends AbstractWrapper
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private String baseUrl;
|
||||
|
||||
/** Field description */
|
||||
private Repository repository;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ package sonia.scm.cli.wrapper;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.cli.config.ServerConfig;
|
||||
import sonia.scm.group.Group;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.user.User;
|
||||
@@ -76,18 +77,22 @@ public class WrapperUtil
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param baseUrl
|
||||
*
|
||||
* @param config
|
||||
* @param repositories
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static List<RepositoryWrapper> wrapRepositories(
|
||||
public static List<RepositoryWrapper> wrapRepositories(ServerConfig config,
|
||||
Collection<Repository> repositories)
|
||||
{
|
||||
List<RepositoryWrapper> wrappers = new ArrayList<RepositoryWrapper>();
|
||||
|
||||
for (Repository r : repositories)
|
||||
{
|
||||
wrappers.add(new RepositoryWrapper(r));
|
||||
wrappers.add(new RepositoryWrapper(config.getServerUrl(), r));
|
||||
}
|
||||
|
||||
return wrappers;
|
||||
|
||||
Reference in New Issue
Block a user