public AnnotationFS handle(CreateSpanAnnotationRequest aRequest) throws AnnotationException { CreateSpanAnnotationRequest request = aRequest; for (SpanLayerBehavior behavior : behaviors) { request = behavior.onCreate(this, request); } AnnotationFS newAnnotation = createSpanAnnotation(request.getJcas().getCas(), request.getBegin(), request.getEnd()); publishEvent(new SpanCreatedEvent(this, request.getDocument(), request.getUsername(), newAnnotation)); return newAnnotation; }
public AnnotationFS handle(CreateSpanAnnotationRequest aRequest) throws AnnotationException { CreateSpanAnnotationRequest request = aRequest; for (SpanLayerBehavior behavior : behaviors) { request = behavior.onCreate(this, request); } AnnotationFS newAnnotation = createSpanAnnotation(request.getJcas().getCas(), request.getBegin(), request.getEnd()); publishEvent(new SpanCreatedEvent(this, request.getDocument(), request.getUsername(), newAnnotation)); return newAnnotation; }
@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 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)); }