use createUrl instead of deprecated getUrl

This commit is contained in:
Sebastian Sdorra
2012-06-15 18:37:45 +02:00
parent 2e8481e63f
commit b95a275cb8
7 changed files with 33 additions and 9 deletions

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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);
}
}

View File

@@ -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

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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;