@Override public long getDocument(SpanDeletedEvent aEvent) { return aEvent.getDocument().getId(); }
@Override public String getAnnotator(SpanDeletedEvent aEvent) { return aEvent.getUser(); }
/** * Listens to the user deleting an annotation in the main annotation editor. */ @OnEvent public void onAnnotationDeleted(SpanDeletedEvent aEvent) { AnnotatorState state = getModelObject(); ActiveLearningUserState alState = alStateModel.getObject(); // If the user creates a new annotation at the site of the suggestion that is currently // offered to the user, then the AL should move on to the next available suggestion if ( alState.isSessionActive() && (!alState.getSuggestion().isPresent() || ( aEvent.getUser().equals(state.getUser().getUsername()) && aEvent.getDocument().equals(state.getDocument()) && aEvent.getLayer().equals(alState.getLayer()))) ) { reactToAnnotationsBeingCreatedOrDeleted(aEvent.getRequestTarget(), aEvent.getLayer()); } }
@Override public String getDetails(SpanDeletedEvent aEvent) { try { AnnotationDetails details = new AnnotationDetails(aEvent.getAnnotation()); return JSONUtil.toJsonString(details); } catch (IOException e) { log.error("Unable to log event [{}]", aEvent, e); return "<ERROR>"; } } }
@Override public void delete(SourceDocument aDocument, String aUsername, JCas aJCas, VID aVid) { AnnotationFS fs = selectByAddr(aJCas, AnnotationFS.class, aVid.getId()); aJCas.removeFsFromIndexes(fs); // delete associated attachFeature if (getAttachTypeName() != null) { Type theType = CasUtil.getType(aJCas.getCas(), getAttachTypeName()); Feature attachFeature = theType.getFeatureByBaseName(getAttachFeatureName()); if (attachFeature != null) { CasUtil.selectCovered(aJCas.getCas(), theType, fs.getBegin(), fs.getEnd()).get(0) .setFeatureValue(attachFeature, null); } } publishEvent(new SpanDeletedEvent(this, aDocument, aUsername, getLayer(), fs)); }
/** * Listens to the user deleting an annotation in the main annotation editor. */ @OnEvent public void onAnnotationDeleted(SpanDeletedEvent aEvent) { AnnotatorState state = getModelObject(); ActiveLearningUserState alState = alStateModel.getObject(); // If the user creates a new annotation at the site of the suggestion that is currently // offered to the user, then the AL should move on to the next available suggestion if ( alState.isSessionActive() && (!alState.getSuggestion().isPresent() || ( aEvent.getUser().equals(state.getUser().getUsername()) && aEvent.getDocument().equals(state.getDocument()) && aEvent.getLayer().equals(alState.getLayer()))) ) { reactToAnnotationsBeingCreatedOrDeleted(aEvent.getRequestTarget(), aEvent.getLayer()); } }
@Override public String getDetails(SpanDeletedEvent aEvent) { try { AnnotationDetails details = new AnnotationDetails(aEvent.getAnnotation()); return JSONUtil.toJsonString(details); } catch (IOException e) { log.error("Unable to log event [{}]", aEvent, e); return "<ERROR>"; } } }
@Override public void delete(SourceDocument aDocument, String aUsername, JCas aJCas, VID aVid) { AnnotationFS fs = selectByAddr(aJCas, AnnotationFS.class, aVid.getId()); aJCas.removeFsFromIndexes(fs); // delete associated attachFeature if (getAttachTypeName() != null) { Type theType = CasUtil.getType(aJCas.getCas(), getAttachTypeName()); Feature attachFeature = theType.getFeatureByBaseName(getAttachFeatureName()); if (attachFeature != null) { CasUtil.selectCovered(aJCas.getCas(), theType, fs.getBegin(), fs.getEnd()).get(0) .setFeatureValue(attachFeature, null); } } publishEvent(new SpanDeletedEvent(this, aDocument, aUsername, getLayer(), fs)); }
@Override public long getDocument(SpanDeletedEvent aEvent) { return aEvent.getDocument().getId(); }
@Override public String getAnnotator(SpanDeletedEvent aEvent) { return aEvent.getUser(); }
@Override public long getProject(SpanDeletedEvent aEvent) { return aEvent.getDocument().getProject().getId(); }
@Override public long getProject(SpanDeletedEvent aEvent) { return aEvent.getDocument().getProject().getId(); }