/** * Copy this same annotation from the user annotation to the mergeview */ private static void copySpanAnnotation(AnnotatorState aState, AnnotationSchemaService aAnnotationService, AnnotationLayer aAnnotationLayer, AnnotationFS aOldFs, JCas aJCas) throws AnnotationException { SpanAdapter adapter = (SpanAdapter) aAnnotationService.getAdapter(aAnnotationLayer); // Create the annotation - this also takes care of attaching to an annotation if necessary int id = getAddr(adapter.add(aState.getDocument(), aState.getUser().getUsername(), aJCas, aOldFs.getBegin(), aOldFs.getEnd())); List<AnnotationFeature> features = aAnnotationService .listAnnotationFeature(adapter.getLayer()); // Copy the features for (AnnotationFeature feature : features) { Type oldType = adapter.getAnnotationType(aOldFs.getCAS()); Feature oldFeature = oldType.getFeatureByBaseName(feature.getName()); if (isLinkOrBasicFeatures(aOldFs, oldFeature)) { continue; } Object value = adapter.getFeatureValue(feature, aOldFs); adapter.setFeatureValue(aState.getDocument(), aState.getUser().getUsername(), aJCas, id, feature, value); } }
/** * Copy this same annotation from the user annotation to the mergeview */ private static void copySpanAnnotation(AnnotatorState aState, AnnotationSchemaService aAnnotationService, AnnotationLayer aAnnotationLayer, AnnotationFS aOldFs, JCas aJCas) throws AnnotationException { SpanAdapter adapter = (SpanAdapter) aAnnotationService.getAdapter(aAnnotationLayer); // Create the annotation - this also takes care of attaching to an annotation if necessary int id = getAddr(adapter.add(aState.getDocument(), aState.getUser().getUsername(), aJCas, aOldFs.getBegin(), aOldFs.getEnd())); List<AnnotationFeature> features = aAnnotationService .listAnnotationFeature(adapter.getLayer()); // Copy the features for (AnnotationFeature feature : features) { Type oldType = adapter.getAnnotationType(aOldFs.getCAS()); Feature oldFeature = oldType.getFeatureByBaseName(feature.getName()); if (isLinkOrBasicFeatures(aOldFs, oldFeature)) { continue; } Object value = adapter.getFeatureValue(feature, aOldFs); adapter.setFeatureValue(aState.getDocument(), aState.getUser().getUsername(), aJCas, id, feature, value); } }