From 59cb6f262be0e94cbe7841dc4509afcf890487a3 Mon Sep 17 00:00:00 2001 From: Richard Eckart de Castilho Date: Wed, 21 Feb 2024 22:13:40 +0100 Subject: [PATCH] #4538 - Lazy details and selecting annotations my break after opening a read-only document and not performing actions for a short time - When a CAS is read-only, do not upgrade it --- .../ukp/clarin/webanno/ui/annotation/AnnotationPage.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inception/inception-ui-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/annotation/AnnotationPage.java b/inception/inception-ui-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/annotation/AnnotationPage.java index 45c3142a739..601ba3d925e 100755 --- a/inception/inception-ui-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/annotation/AnnotationPage.java +++ b/inception/inception-ui-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/annotation/AnnotationPage.java @@ -20,6 +20,7 @@ import static de.tudarmstadt.ukp.clarin.webanno.api.annotation.page.AnnotationEditorState.KEY_EDITOR_STATE; import static de.tudarmstadt.ukp.clarin.webanno.api.annotation.page.AnnotationPageBase.PAGE_PARAM_DOCUMENT; import static de.tudarmstadt.ukp.clarin.webanno.api.casstorage.CasUpgradeMode.FORCE_CAS_UPGRADE; +import static de.tudarmstadt.ukp.clarin.webanno.api.casstorage.CasUpgradeMode.NO_CAS_UPGRADE; import static de.tudarmstadt.ukp.clarin.webanno.model.AnnotationDocumentState.IGNORE; import static de.tudarmstadt.ukp.clarin.webanno.model.AnnotationDocumentStateChangeFlag.EXPLICIT_ANNOTATOR_USER_ACTION; import static de.tudarmstadt.ukp.clarin.webanno.model.PermissionLevel.ANNOTATOR; @@ -457,12 +458,13 @@ protected void actionLoadDocument(AjaxRequestTarget aTarget, int aFocus) .createOrGetAnnotationDocument(state.getDocument(), state.getUser()); var stateBeforeOpening = annotationDocument.getState(); + var editable = isEditable(); + // Read the CAS // Update the annotation document CAS var editorCas = documentService.readAnnotationCas(annotationDocument, - FORCE_CAS_UPGRADE); + editable ? FORCE_CAS_UPGRADE : NO_CAS_UPGRADE); - var editable = isEditable(); applicationEventPublisherHolder.get() .publishEvent(new BeforeDocumentOpenedEvent(this, editorCas, getModelObject().getDocument(),