All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.stanford.protege.webprotege.bulkop.SetAnnotationValueActionHandler Maven / Gradle / Ivy

The newest version!
package edu.stanford.protege.webprotege.bulkop;

import edu.stanford.protege.webprotege.access.AccessManager;
import edu.stanford.protege.webprotege.change.ChangeApplicationResult;
import edu.stanford.protege.webprotege.change.ChangeListGenerator;
import edu.stanford.protege.webprotege.change.HasApplyChanges;
import edu.stanford.protege.webprotege.dispatch.AbstractProjectChangeHandler;
import edu.stanford.protege.webprotege.ipc.ExecutionContext;
import org.semanticweb.owlapi.model.OWLEntity;

import javax.annotation.Nonnull;
import javax.inject.Inject;
import java.util.Set;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Matthew Horridge
 * Stanford Center for Biomedical Informatics Research
 * 24 Sep 2018
 */
public class SetAnnotationValueActionHandler extends AbstractProjectChangeHandler, SetAnnotationValueAction, SetAnnotationValueResult> {

    @Nonnull
    private final SetAnnotationValueActionChangeListGeneratorFactory factory;

    @Inject
    public SetAnnotationValueActionHandler(@Nonnull AccessManager accessManager,

                                           @Nonnull HasApplyChanges applyChanges,
                                           @Nonnull SetAnnotationValueActionChangeListGeneratorFactory factory) {
        super(accessManager, applyChanges);
        this.factory = checkNotNull(factory);
    }

    @Nonnull
    @Override
    public Class getActionClass() {
        return SetAnnotationValueAction.class;
    }

    @Override
    protected ChangeListGenerator> getChangeListGenerator(SetAnnotationValueAction action, ExecutionContext executionContext) {
        return factory.create(action.changeRequestId(), action.entities(),
                              action.property(),
                              action.value(),
                              action.commitMessage());
    }

    @Override
    protected SetAnnotationValueResult createActionResult(ChangeApplicationResult> changeApplicationResult,
                                                          SetAnnotationValueAction action,
                                                          ExecutionContext executionContext) {
        return new SetAnnotationValueResult();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy