Skip to content

Commit

Permalink
#4618 - Resizing a span does not update annotations on disk
Browse files Browse the repository at this point in the history
- Save editor CAS after a resize action
  • Loading branch information
reckart committed Mar 11, 2024
1 parent 7f36c44 commit 9120271
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -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());
Expand Down

0 comments on commit 9120271

Please sign in to comment.