mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
Cleanup smells
This commit is contained in:
@@ -44,8 +44,8 @@ import sonia.scm.NotFoundException;
|
||||
public class RepositoryNotFoundException extends NotFoundException
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
private static final long serialVersionUID = -6583078808900520166L;
|
||||
private static final String TYPE_REPOSITORY = "repository";
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
@@ -55,14 +55,14 @@ public class RepositoryNotFoundException extends NotFoundException
|
||||
*
|
||||
*/
|
||||
public RepositoryNotFoundException(Repository repository) {
|
||||
super("repository", repository.getName() + "/" + repository.getNamespace());
|
||||
super(TYPE_REPOSITORY, repository.getName() + "/" + repository.getNamespace());
|
||||
}
|
||||
|
||||
public RepositoryNotFoundException(String repositoryId) {
|
||||
super("repository", repositoryId);
|
||||
super(TYPE_REPOSITORY, repositoryId);
|
||||
}
|
||||
|
||||
public RepositoryNotFoundException(NamespaceAndName namespaceAndName) {
|
||||
super("repository", namespaceAndName.toString());
|
||||
super(TYPE_REPOSITORY, namespaceAndName.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ public final class RepositoryService implements Closeable {
|
||||
|
||||
public Stream<ScmProtocol> getSupportedProtocols() {
|
||||
return protocolProviders.stream()
|
||||
.filter(provider -> provider.getType().equals(getRepository().getType()))
|
||||
.filter(protocolProvider -> protocolProvider.getType().equals(getRepository().getType()))
|
||||
.map(this::createProviderInstanceForRepository);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public abstract class InitializingHttpScmProtocolWrapper implements ScmProtocolP
|
||||
if (!repository.getType().equals(getType())) {
|
||||
throw new IllegalArgumentException("cannot handle repository with type " + repository.getType() + " with protocol for type " + getType());
|
||||
}
|
||||
return new ProtocolWrapper(repository);
|
||||
return new ProtocolWrapper(repository, computeBasePath());
|
||||
}
|
||||
|
||||
private String computeBasePath() {
|
||||
@@ -70,8 +70,8 @@ public abstract class InitializingHttpScmProtocolWrapper implements ScmProtocolP
|
||||
|
||||
private class ProtocolWrapper extends HttpScmProtocol {
|
||||
|
||||
public ProtocolWrapper(Repository repository) {
|
||||
super(repository, computeBasePath());
|
||||
public ProtocolWrapper(Repository repository, String basePath) {
|
||||
super(repository, basePath);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,8 +29,6 @@ public abstract class RepositoryToRepositoryDtoMapper extends BaseMapper<Reposit
|
||||
private ResourceLinks resourceLinks;
|
||||
@Inject
|
||||
private RepositoryServiceFactory serviceFactory;
|
||||
@Inject
|
||||
private ScmPathInfoStore scmPathInfoStore;
|
||||
|
||||
abstract HealthCheckFailureDto toDto(HealthCheckFailure failure);
|
||||
|
||||
@@ -47,7 +45,7 @@ public abstract class RepositoryToRepositoryDtoMapper extends BaseMapper<Reposit
|
||||
try (RepositoryService repositoryService = serviceFactory.create(repository)) {
|
||||
if (RepositoryPermissions.pull(repository).isPermitted()) {
|
||||
List<Link> protocolLinks = repositoryService.getSupportedProtocols()
|
||||
.map(protocol -> createProtocolLink(protocol, repository))
|
||||
.map(this::createProtocolLink)
|
||||
.collect(toList());
|
||||
linksBuilder.array(protocolLinks);
|
||||
}
|
||||
@@ -63,7 +61,7 @@ public abstract class RepositoryToRepositoryDtoMapper extends BaseMapper<Reposit
|
||||
target.add(linksBuilder.build());
|
||||
}
|
||||
|
||||
private Link createProtocolLink(ScmProtocol protocol, Repository repository) {
|
||||
private Link createProtocolLink(ScmProtocol protocol) {
|
||||
return Link.linkBuilder("protocol", protocol.getUrl()).withName(protocol.getType()).build();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user