Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4762 - Re-merging via the curation sidebar always uses the project settings instead of the dialog settings #4763

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,16 @@ private void actionMerge(AjaxRequestTarget aTarget, Form<State> aForm)
{
var state = getModelObject();
var dataOwner = state.getUser();
var curationWorkflow = curationWorkflowModel.getObject();

if (aForm.getModelObject().isSaveSettingsAsDefault()) {
curationService.createOrUpdateCurationWorkflow(curationWorkflowModel.getObject());
curationService.createOrUpdateCurationWorkflow(curationWorkflow);
success("Updated project merge strategy settings");
}

try {
var mergeStrategyFactory = curationSidebarService.merge(state, dataOwner.getUsername(),
selectedUsers.getModelObject());
var mergeStrategyFactory = curationSidebarService.merge(state, curationWorkflow,
dataOwner.getUsername(), selectedUsers.getModelObject());
success("Re-merge using [" + mergeStrategyFactory.getLabel() + "] finished!");
aTarget.addChildren(getPage(), IFeedback.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument;
import de.tudarmstadt.ukp.clarin.webanno.security.model.User;
import de.tudarmstadt.ukp.inception.curation.merge.MergeStrategyFactory;
import de.tudarmstadt.ukp.inception.curation.merge.strategy.MergeStrategy;
import de.tudarmstadt.ukp.inception.curation.model.CurationWorkflow;
import de.tudarmstadt.ukp.inception.rendering.editorstate.AnnotatorState;

public interface CurationSidebarService
Expand Down Expand Up @@ -133,4 +135,12 @@ List<User> listUsersReadyForCuration(String aUsername, Project aProject,

MergeStrategyFactory<?> merge(AnnotatorState aState, String aCurator, Collection<User> aUsers)
throws IOException, UIMAException;

void merge(AnnotatorState aState, MergeStrategy aStrategy, String aCurator,
Collection<User> aUsers)
throws IOException, UIMAException;

MergeStrategyFactory<?> merge(AnnotatorState aState, CurationWorkflow aWorkflow,
String aCurator, Collection<User> aUsers)
throws IOException, UIMAException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@
import de.tudarmstadt.ukp.inception.annotation.events.DocumentOpenedEvent;
import de.tudarmstadt.ukp.inception.curation.config.CurationServiceAutoConfiguration;
import de.tudarmstadt.ukp.inception.curation.merge.MergeStrategyFactory;
import de.tudarmstadt.ukp.inception.curation.merge.strategy.MergeStrategy;
import de.tudarmstadt.ukp.inception.curation.model.CurationSettings;
import de.tudarmstadt.ukp.inception.curation.model.CurationSettingsId;
import de.tudarmstadt.ukp.inception.curation.model.CurationWorkflow;
import de.tudarmstadt.ukp.inception.curation.service.CurationMergeService;
import de.tudarmstadt.ukp.inception.curation.service.CurationService;
import de.tudarmstadt.ukp.inception.curation.sidebar.CurationSidebarProperties;
Expand Down Expand Up @@ -541,10 +543,33 @@ public boolean isCurationFinished(AnnotatorState aState, String aSessionOwner)
&& sourceDoc.getState().equals(CURATION_FINISHED));
}

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public MergeStrategyFactory<?> merge(AnnotatorState aState, String aCurator,
Collection<User> aUsers)
throws IOException, UIMAException
{
var workflow = curationService.readOrCreateCurationWorkflow(aState.getProject());
return merge(aState, workflow, aCurator, aUsers);
}

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public MergeStrategyFactory<?> merge(AnnotatorState aState, CurationWorkflow aWorkflow,
String aCurator, Collection<User> aUsers)
throws IOException, UIMAException
{
MergeStrategyFactory factory = curationService.getMergeStrategyFactory(aWorkflow);
var traits = factory.readTraits(aWorkflow);
var mergeStrategy = factory.makeStrategy(traits);
merge(aState, mergeStrategy, aCurator, aUsers);
return factory;
}

@Override
public void merge(AnnotatorState aState, MergeStrategy aStrategy, String aCurator,
Collection<User> aUsers)
throws IOException, UIMAException
{
var doc = aState.getDocument();
var aTargetCas = retrieveCurationCAS(aCurator, doc.getProject().getId(), doc).orElseThrow(
Expand All @@ -555,18 +580,13 @@ public MergeStrategyFactory<?> merge(AnnotatorState aState, String aCurator,
// FIXME: should merging not overwrite the current users annos? (can result in
// deleting the users annotations!!!), currently fixed by warn message to user
// prepare merged CAS
var workflow = curationService.readOrCreateCurationWorkflow(aState.getProject());
MergeStrategyFactory factory = curationService.getMergeStrategyFactory(workflow);
var mergeStrategy = factory.makeStrategy(factory.readTraits(workflow));
curationMergeService.mergeCasses(doc, aState.getUser().getUsername(), aTargetCas, userCases,
mergeStrategy, aState.getAnnotationLayers());
aStrategy, aState.getAnnotationLayers());

// write back and update timestamp
writeCurationCas(aTargetCas, aState, doc.getProject().getId());

LOG.debug("Merge done");

return factory;
}

private class CurationSession
Expand Down