mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 17:05:43 +01:00
Store original repository name in migration plan
This commit is contained in:
@@ -100,13 +100,14 @@ class MigrationWizardServlet extends HttpServlet {
|
||||
}
|
||||
|
||||
repositoryLineEntries.stream()
|
||||
.map(RepositoryLineEntry::getId)
|
||||
.forEach(
|
||||
id -> {
|
||||
entry-> {
|
||||
String id = entry.getId();
|
||||
String originalName = entry.getOriginalName();
|
||||
String strategy = req.getParameter("strategy-" + id);
|
||||
String namespace = req.getParameter("namespace-" + id);
|
||||
String name = req.getParameter("name-" + id);
|
||||
migrationStrategyDao.set(id, MigrationStrategy.valueOf(strategy), namespace, name);
|
||||
migrationStrategyDao.set(id, originalName, MigrationStrategy.valueOf(strategy), namespace, name);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -150,6 +151,7 @@ class MigrationWizardServlet extends HttpServlet {
|
||||
|
||||
private static class RepositoryLineEntry {
|
||||
private final String id;
|
||||
private final String originalName;
|
||||
private final String type;
|
||||
private final String path;
|
||||
private MigrationStrategy selectedStrategy;
|
||||
@@ -160,6 +162,7 @@ class MigrationWizardServlet extends HttpServlet {
|
||||
|
||||
public RepositoryLineEntry(V1Repository repository) {
|
||||
this.id = repository.getId();
|
||||
this.originalName = repository.getName();
|
||||
this.type = repository.getType();
|
||||
this.path = repository.getType() + "/" + repository.getName();
|
||||
this.selectedStrategy = MigrationStrategy.COPY;
|
||||
@@ -189,6 +192,10 @@ class MigrationWizardServlet extends HttpServlet {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getOriginalName() {
|
||||
return originalName;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ public class MigrationStrategyDao {
|
||||
return plan.get(id);
|
||||
}
|
||||
|
||||
public void set(String repositoryId, MigrationStrategy strategy, String newNamespace, String newName) {
|
||||
plan.set(repositoryId, strategy, newNamespace, newName);
|
||||
public void set(String repositoryId, String originalName, MigrationStrategy strategy, String newNamespace, String newName) {
|
||||
plan.set(repositoryId, originalName, strategy, newNamespace, newName);
|
||||
store.set(plan);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,14 +29,14 @@ class RepositoryMigrationPlan {
|
||||
.findFirst();
|
||||
}
|
||||
|
||||
public void set(String repositoryId, MigrationStrategy strategy, String newNamespace, String newName) {
|
||||
public void set(String repositoryId, String originalName, MigrationStrategy strategy, String newNamespace, String newName) {
|
||||
Optional<RepositoryMigrationEntry> entry = get(repositoryId);
|
||||
if (entry.isPresent()) {
|
||||
entry.get().setStrategy(strategy);
|
||||
entry.get().setNewNamespace(newNamespace);
|
||||
entry.get().setNewName(newName);
|
||||
} else {
|
||||
entries.add(new RepositoryMigrationEntry(repositoryId, strategy, newNamespace, newName));
|
||||
entries.add(new RepositoryMigrationEntry(repositoryId, originalName, strategy, newNamespace, newName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ class RepositoryMigrationPlan {
|
||||
static class RepositoryMigrationEntry {
|
||||
|
||||
private String repositoryId;
|
||||
private String originalName;
|
||||
private MigrationStrategy dataMigrationStrategy;
|
||||
private String newNamespace;
|
||||
private String newName;
|
||||
@@ -52,13 +53,18 @@ class RepositoryMigrationPlan {
|
||||
RepositoryMigrationEntry() {
|
||||
}
|
||||
|
||||
RepositoryMigrationEntry(String repositoryId, MigrationStrategy dataMigrationStrategy, String newNamespace, String newName) {
|
||||
RepositoryMigrationEntry(String repositoryId, String originalName, MigrationStrategy dataMigrationStrategy, String newNamespace, String newName) {
|
||||
this.repositoryId = repositoryId;
|
||||
this.originalName = originalName;
|
||||
this.dataMigrationStrategy = dataMigrationStrategy;
|
||||
this.newNamespace = newNamespace;
|
||||
this.newName = newName;
|
||||
}
|
||||
|
||||
public String getOriginalName() {
|
||||
return originalName;
|
||||
}
|
||||
|
||||
public MigrationStrategy getDataMigrationStrategy() {
|
||||
return dataMigrationStrategy;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user