for (Annotation annotation : annotationIndex) {
// TODO be careful here, because some people inherit from DocumentAnnotation
if (typeSystem.subsumes(docType, annotation.getType())) {
continue;
}
Annotation clone = (Annotation) casCopier.copyFs(annotation);
// change the view/sofa of the new annotation...
// see: http://osdir.com/ml/apache.uima.general/2007-09/msg00107.html
clone.setFeatureValue(modview.getTypeSystem()
.getFeatureByFullName(CAS.FEATURE_FULL_NAME_SOFA), modview.getSofa());
final int mappedBegin = map[clone.getBegin()];
final int mappedEnd = map[clone.getEnd()];
if (mappedBegin < mappedEnd) {
if (mappedEnd > fromJcas.getCas().getDocumentAnnotation().getEnd()) {
getContext().getLogger().log(Level.WARNING, "illegal annotation offset mapping");
} else {
int max = modview.getCas().getDocumentAnnotation().getEnd();
if (mappedBegin < max && mappedEnd <= max && mappedBegin >= 0 && mappedEnd > 0) {
clone.setBegin(mappedBegin);
clone.setEnd(mappedEnd);
// TODO handle nested annotation features
modview.addFsToIndexes(clone);
indexedFs.add(clone);
} else {
getContext().getLogger().log(Level.WARNING, "illegal annotation offset mapping");