use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.event.SpanDeletedEvent in project webanno by webanno.
the class SpanAdapter method delete.
@Override
public void delete(AnnotatorState aState, 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, aState.getDocument(), aState.getUser().getUsername(), fs));
}
Aggregations