Search in sources :

Example 1 with FeatureValueUpdatedEvent

use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.event.FeatureValueUpdatedEvent in project webanno by webanno.

the class TypeAdapter_ImplBase method setFeatureValue.

@Override
public void setFeatureValue(AnnotatorState aState, JCas aJcas, int aAddress, AnnotationFeature aFeature, Object aValue) {
    FeatureStructure fs = selectByAddr(aJcas, aAddress);
    Object oldValue = getValue(fs, aFeature);
    featureSupportRegistry.getFeatureSupport(aFeature).setFeatureValue(aJcas, aFeature, aAddress, aValue);
    Object newValue = getValue(fs, aFeature);
    if (!Objects.equals(oldValue, newValue)) {
        publishEvent(new FeatureValueUpdatedEvent(this, aState.getDocument(), aState.getUser().getUsername(), fs, aFeature, newValue, oldValue));
    }
}
Also used : FeatureStructure(org.apache.uima.cas.FeatureStructure) FeatureValueUpdatedEvent(de.tudarmstadt.ukp.clarin.webanno.api.annotation.event.FeatureValueUpdatedEvent)

Aggregations

FeatureValueUpdatedEvent (de.tudarmstadt.ukp.clarin.webanno.api.annotation.event.FeatureValueUpdatedEvent)1 FeatureStructure (org.apache.uima.cas.FeatureStructure)1