Commit 1dc4d5ae authored by Adrien's avatar Adrien Committed by Romain Bioteau

fix(importer) do note migrate not imported diagrams (#1527)

* Artifacts with the flag 'keep existing' should not be migrated -> if
the bos archive contains a lot of diagrams, it could be long for nothing

closes [BS-19201](https://bonitasoft.atlassian.net/browse/BS-19201)
parent 28a19257
......@@ -57,4 +57,8 @@ public abstract class AbstractFileModel extends AbstractImportModel implements I
this.status = ConflictStatus.NONE;
}
public boolean shouldBeImported() {
return importAction == ImportAction.OVERWRITE;
}
}
......@@ -15,7 +15,6 @@ public class ImportArchiveModel {
private final List<ImportStoreModel> stores = new ArrayList<>();
private final BosArchive bosArchive;
private IStatus validationStatus = Status.OK_STATUS;
private IStatus validationStatus2;
public ImportArchiveModel(BosArchive bosArchive) {
this.bosArchive = bosArchive;
......@@ -43,7 +42,7 @@ public class ImportArchiveModel {
public void removeStore(ImportStoreModel store) {
stores.remove(store);
}
public List<ImportStoreModel> getStores() {
Collections.sort(stores, (f1, f2) -> f1.getFolderName().compareTo(f2.getFolderName()));
return Collections.unmodifiableList(stores);
......
......@@ -41,7 +41,19 @@ public class ImportStoreModel extends AbstractFolderModel {
}
public Stream<ImportableUnit> importableUnits() {
return Stream.concat(getFiles().stream().filter(ImportableUnit.class::isInstance).map(ImportableUnit.class::cast),
getFolders().stream().filter(ImportableUnit.class::isInstance).map(ImportableUnit.class::cast));
return Stream.concat(importableFiles(), importableFolders());
}
private Stream<ImportableUnit> importableFolders() {
return getFolders().stream()
.filter(ImportableUnit.class::isInstance)
.map(ImportableUnit.class::cast);
}
private Stream<ImportableUnit> importableFiles() {
return getFiles().stream()
.filter(AbstractFileModel::shouldBeImported)
.filter(ImportableUnit.class::isInstance)
.map(ImportableUnit.class::cast);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment