Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ndoschek committed Jul 24, 2023
1 parent aa368c0 commit 5a1d4d1
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,7 @@ public List<Action> executeAction(final RequestModelAction action) {

ProgressMonitor monitor = notifyStartLoading();
if (isReconnecting) {
GModelRoot oldModel = modelState.getRoot();
if (oldModel != null) {
// use current modelRoot of modelState and submit
modelState.updateRoot(oldModel);
// decrease revision by one, as each submit will increase it by one;
// the next save would produce warning that source model was changed otherwise
modelState.getRoot().setRevision(oldModel.getRevision() - 1);
} else {
sourceModelStorage.loadSourceModel(action);
}
handleReconnect(action);
} else {
sourceModelStorage.loadSourceModel(action);
}
Expand All @@ -92,6 +83,17 @@ public List<Action> executeAction(final RequestModelAction action) {
return modelSubmissionHandler.submitModel();
}

protected void handleReconnect(final RequestModelAction action) {
GModelRoot oldModel = modelState.getRoot();
if (oldModel != null) {
// decrease revision by one, as each submit will increase it by one;
// the next save would produce warning that source model was changed otherwise
modelState.getRoot().setRevision(oldModel.getRevision() - 1);
} else {
sourceModelStorage.loadSourceModel(action);
}
}

protected ProgressMonitor notifyStartLoading() {
String message = "Model loading in progress";
actionDispatcher.dispatch(ServerStatusUtil.info(message));
Expand Down

0 comments on commit 5a1d4d1

Please sign in to comment.