From 91202717b0119977b0f16574de35f3c6c2a4a854 Mon Sep 17 00:00:00 2001 From: Richard Eckart de Castilho Date: Mon, 11 Mar 2024 17:29:50 +0100 Subject: [PATCH] #4618 - Resizing a span does not update annotations on disk - Save editor CAS after a resize action --- .github/workflows/maven.yml | 14 +++++++++----- .../actions/MoveSpanAnnotationHandler.java | 17 +++++++---------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index ef361fe5f47..8086cfe414b 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -16,15 +16,19 @@ on: jobs: build: + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + jdk: [17] - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - name: Set up JDK ${{ matrix.jdk }} + uses: actions/setup-java@v4 with: - java-version: '17' + java-version: ${{ matrix.jdk }} distribution: 'temurin' cache: maven - name: Build with Maven diff --git a/inception/inception-diam/src/main/java/de/tudarmstadt/ukp/inception/diam/editor/actions/MoveSpanAnnotationHandler.java b/inception/inception-diam/src/main/java/de/tudarmstadt/ukp/inception/diam/editor/actions/MoveSpanAnnotationHandler.java index bfa004ef3b7..4f6099c1f8f 100644 --- a/inception/inception-diam/src/main/java/de/tudarmstadt/ukp/inception/diam/editor/actions/MoveSpanAnnotationHandler.java +++ b/inception/inception-diam/src/main/java/de/tudarmstadt/ukp/inception/diam/editor/actions/MoveSpanAnnotationHandler.java @@ -22,16 +22,13 @@ import java.io.IOException; import org.apache.uima.cas.CAS; -import org.apache.uima.cas.text.AnnotationFS; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.request.Request; import org.springframework.core.annotation.Order; -import de.tudarmstadt.ukp.clarin.webanno.api.annotation.page.AnnotationPageBase; import de.tudarmstadt.ukp.inception.annotation.layer.span.SpanAdapter; import de.tudarmstadt.ukp.inception.diam.editor.config.DiamAutoConfig; import de.tudarmstadt.ukp.inception.diam.model.ajax.DefaultAjaxResponse; -import de.tudarmstadt.ukp.inception.rendering.editorstate.AnnotatorState; import de.tudarmstadt.ukp.inception.rendering.model.Range; import de.tudarmstadt.ukp.inception.rendering.vmodel.VID; import de.tudarmstadt.ukp.inception.schema.api.AnnotationSchemaService; @@ -66,12 +63,13 @@ public String getCommand() public DefaultAjaxResponse handle(AjaxRequestTarget aTarget, Request aRequest) { try { - AnnotationPageBase page = getPage(); - CAS cas = page.getEditorCas(); + var page = getPage(); + var cas = page.getEditorCas(); var vid = getVid(aRequest); - AnnotatorState state = getAnnotatorState(); + var state = getAnnotatorState(); var range = getRangeFromRequest(state, aRequest.getRequestParameters(), cas); moveSpan(aTarget, cas, vid, range); + page.writeEditorCas(cas); return new DefaultAjaxResponse(getAction(aRequest)); } catch (Exception e) { @@ -82,12 +80,11 @@ public DefaultAjaxResponse handle(AjaxRequestTarget aTarget, Request aRequest) private void moveSpan(AjaxRequestTarget aTarget, CAS aCas, VID aVid, Range aRange) throws IOException, AnnotationException { - AnnotatorState state = getAnnotatorState(); + var state = getAnnotatorState(); - AnnotationFS annoFs = ICasUtil.selectAnnotationByAddr(aCas, aVid.getId()); + var annoFs = ICasUtil.selectAnnotationByAddr(aCas, aVid.getId()); - SpanAdapter adapter = (SpanAdapter) annotationService.findAdapter(state.getProject(), - annoFs); + var adapter = (SpanAdapter) annotationService.findAdapter(state.getProject(), annoFs); adapter.move(state.getDocument(), state.getUser().getUsername(), aCas, annoFs, aRange.getBegin(), aRange.getEnd());