Gitlab is now using https://gitlab.lcsb.uni.lu as it's primary address. Please update your bookmarks. FAQ.

Commit dfaf8482 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

handle project without top map

parent 9ce0700f
Pipeline #43279 passed with stage
in 18 minutes and 3 seconds
......@@ -113,15 +113,17 @@ public class ModelRestImpl extends BaseRestImpl {
private List<Map<String, Object>> createData(Project project) throws QueryException {
List<Map<String, Object>> result = new ArrayList<>();
Collection<ModelData> originalModels = getModelService().getModelsByProjectId(project.getProjectId());
ModelData topModel = project.getTopModel().getModelData();
List<ModelData> models = new ArrayList<>();
for (ModelData model: originalModels) {
if (!Objects.equals(model.getId(), topModel.getId())) {
models.add(model);
if (project.getTopModel() != null) {
ModelData topModel = project.getTopModel().getModelData();
for (ModelData model : originalModels) {
if (!Objects.equals(model.getId(), topModel.getId())) {
models.add(model);
}
}
result.add(getModel(topModel));
}
models.sort(ModelData.ID_COMPARATOR);
result.add(getModel(topModel));
for (ModelData model2 : models) {
result.add(getModel(model2));
}
......
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