mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-07-04 08:58:22 +02:00
Append import bundle link to repository type if unbundle command is supported
This commit is contained in:
@@ -47,8 +47,13 @@ public abstract class RepositoryTypeToRepositoryTypeDtoMapper extends BaseMapper
|
||||
void appendLinks(RepositoryType repositoryType, @MappingTarget RepositoryTypeDto target) {
|
||||
Links.Builder linksBuilder = linkingTo().self(resourceLinks.repositoryType().self(repositoryType.getName()));
|
||||
|
||||
if (RepositoryPermissions.create().isPermitted() && repositoryType.getSupportedCommands().contains(Command.PULL)) {
|
||||
linksBuilder.array(Link.linkBuilder("import", resourceLinks.repository().importFromUrl(repositoryType.getName())).withName("url").build());
|
||||
if (RepositoryPermissions.create().isPermitted()) {
|
||||
if (repositoryType.getSupportedCommands().contains(Command.PULL)) {
|
||||
linksBuilder.array(Link.linkBuilder("import", resourceLinks.repository().importFromUrl(repositoryType.getName())).withName("url").build());
|
||||
}
|
||||
if (repositoryType.getSupportedCommands().contains(Command.UNBUNDLE)) {
|
||||
linksBuilder.array(Link.linkBuilder("import", resourceLinks.repository().importFromBundle(repositoryType.getName())).withName("bundle").build());
|
||||
}
|
||||
}
|
||||
|
||||
target.add(linksBuilder.build());
|
||||
|
||||
@@ -360,6 +360,10 @@ class ResourceLinks {
|
||||
String importFromUrl(String type) {
|
||||
return repositoryImportLinkBuilder.method("getRepositoryImportResource").parameters().method("importFromUrl").parameters(type).href();
|
||||
}
|
||||
|
||||
String importFromBundle(String type) {
|
||||
return repositoryImportLinkBuilder.method("getRepositoryImportResource").parameters().method("importFromBundle").parameters(type).href();
|
||||
}
|
||||
}
|
||||
|
||||
RepositoryCollectionLinks repositoryCollection() {
|
||||
|
||||
Reference in New Issue
Block a user