mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 23:45:44 +01:00
Merged 2.0.0-m3 into feature/global_config_v2_endpoint
This commit is contained in:
@@ -522,7 +522,8 @@ public class RepositoryImportResource
|
||||
|
||||
try
|
||||
{
|
||||
repository = new Repository(null, type, name);
|
||||
// TODO #8783
|
||||
// repository = new Repository(null, type, name);
|
||||
manager.create(repository);
|
||||
}
|
||||
catch (RepositoryAlreadyExistsException ex)
|
||||
@@ -717,7 +718,8 @@ public class RepositoryImportResource
|
||||
{
|
||||
for (String repositoryName : repositoryNames)
|
||||
{
|
||||
Repository repository = manager.get(type, repositoryName);
|
||||
// TODO #8783
|
||||
/*Repository repository = null; //manager.get(type, repositoryName);
|
||||
|
||||
if (repository != null)
|
||||
{
|
||||
@@ -727,7 +729,7 @@ public class RepositoryImportResource
|
||||
{
|
||||
logger.warn("could not find imported repository {}",
|
||||
repositoryName);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,42 +521,6 @@ public class RepositoryResource extends AbstractManagerResource<Repository, Repo
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link Repository} with the specified type and name.
|
||||
*
|
||||
* @param type the type of the repository
|
||||
* @param name the name of the repository
|
||||
*
|
||||
* @return the {@link Repository} with the specified type and name
|
||||
*/
|
||||
@GET
|
||||
@Path("{type: [a-z]+}/{name: .*}")
|
||||
@StatusCodes({
|
||||
@ResponseCode(code = 200, condition = "success"),
|
||||
@ResponseCode(code = 404, condition = "not found, no repository with the specified type and name available"),
|
||||
@ResponseCode(code = 500, condition = "internal server error")
|
||||
})
|
||||
@TypeHint(Repository.class)
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
public Response getByTypeAndName(@PathParam("type") String type,
|
||||
@PathParam("name") String name)
|
||||
{
|
||||
Response response;
|
||||
Repository repository = repositoryManager.get(type, name);
|
||||
|
||||
if (repository != null)
|
||||
{
|
||||
prepareForReturn(repository);
|
||||
response = Response.ok(repository).build();
|
||||
}
|
||||
else
|
||||
{
|
||||
response = Response.status(Response.Status.NOT_FOUND).build();
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link Changeset} from the given repository
|
||||
* with the specified revision.
|
||||
|
||||
@@ -44,8 +44,6 @@ import com.google.inject.Inject;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.RepositoryManager;
|
||||
import sonia.scm.repository.RepositoryTypePredicate;
|
||||
import sonia.scm.url.UrlProvider;
|
||||
import sonia.scm.url.UrlProviderFactory;
|
||||
import sonia.scm.util.HttpUtil;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
@@ -106,19 +104,15 @@ public class RepositoryRootResource
|
||||
*/
|
||||
@GET
|
||||
@Produces(MediaType.TEXT_HTML)
|
||||
public Viewable renderRepositoriesRoot(@Context HttpServletRequest request,
|
||||
@PathParam("type") final String type)
|
||||
throws IOException
|
||||
public Viewable renderRepositoriesRoot(@Context HttpServletRequest request, @PathParam("type") final String type)
|
||||
{
|
||||
String baseUrl = HttpUtil.getCompleteUrl(request);
|
||||
UrlProvider uiUrlProvider = UrlProviderFactory.createUrlProvider(baseUrl,
|
||||
UrlProviderFactory.TYPE_WUI);
|
||||
//J-
|
||||
Collection<RepositoryTemplateElement> unsortedRepositories =
|
||||
Collections2.transform(
|
||||
Collections2.filter(
|
||||
repositoryManager.getAll(), new RepositoryTypePredicate(type))
|
||||
, new RepositoryTransformFunction(uiUrlProvider, baseUrl)
|
||||
, new RepositoryTransformFunction(baseUrl)
|
||||
);
|
||||
|
||||
List<RepositoryTemplateElement> repositories = Ordering.from(
|
||||
@@ -149,43 +143,16 @@ public class RepositoryRootResource
|
||||
*
|
||||
*
|
||||
* @param repository
|
||||
* @param uiUrlProvider
|
||||
* @param baseUrl
|
||||
*/
|
||||
public RepositoryTemplateElement(Repository repository,
|
||||
UrlProvider uiUrlProvider, String baseUrl)
|
||||
public RepositoryTemplateElement(Repository repository, String baseUrl)
|
||||
{
|
||||
this.repository = repository;
|
||||
this.urlProvider = uiUrlProvider;
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
//~--- get methods --------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getCommitUrl()
|
||||
{
|
||||
return urlProvider.getRepositoryUrlProvider().getChangesetUrl(
|
||||
repository.getId(), 0, 20);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDetailUrl()
|
||||
{
|
||||
return urlProvider.getRepositoryUrlProvider().getDetailUrl(
|
||||
repository.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -208,18 +175,6 @@ public class RepositoryRootResource
|
||||
return repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getSourceUrl()
|
||||
{
|
||||
return urlProvider.getRepositoryUrlProvider().getBrowseUrl(
|
||||
repository.getId(), null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -239,8 +194,6 @@ public class RepositoryRootResource
|
||||
/** Field description */
|
||||
private Repository repository;
|
||||
|
||||
/** Field description */
|
||||
private UrlProvider urlProvider;
|
||||
}
|
||||
|
||||
|
||||
@@ -284,20 +237,8 @@ public class RepositoryRootResource
|
||||
implements Function<Repository, RepositoryTemplateElement>
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param request
|
||||
* @param repositoryManager
|
||||
* @param urlProvider
|
||||
* @param baseUrl
|
||||
*/
|
||||
public RepositoryTransformFunction(UrlProvider urlProvider, String baseUrl)
|
||||
public RepositoryTransformFunction(String baseUrl)
|
||||
{
|
||||
this.urlProvider = urlProvider;
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
@@ -314,15 +255,12 @@ public class RepositoryRootResource
|
||||
@Override
|
||||
public RepositoryTemplateElement apply(Repository repository)
|
||||
{
|
||||
return new RepositoryTemplateElement(repository, urlProvider, baseUrl);
|
||||
return new RepositoryTemplateElement(repository, baseUrl);
|
||||
}
|
||||
|
||||
//~--- fields -------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private String baseUrl;
|
||||
|
||||
/** Field description */
|
||||
private UrlProvider urlProvider;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user