diff --git a/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/api/annotation/page/AnnotationPageBase.java b/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/api/annotation/page/AnnotationPageBase.java index 49e1751c15c..428447e6402 100644 --- a/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/api/annotation/page/AnnotationPageBase.java +++ b/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/api/annotation/page/AnnotationPageBase.java @@ -85,7 +85,7 @@ public abstract class AnnotationPageBase private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); public static final String PAGE_PARAM_DOCUMENT = "d"; - public static final String PAGE_PARAM_USER = "u"; + public static final String PAGE_PARAM_DATA_OWNER = "u"; public static final String PAGE_PARAM_FOCUS = "f"; private @SpringBean AnnotationSchemaService annotationService; @@ -103,7 +103,7 @@ protected AnnotationPageBase(PageParameters aParameters) var params = getPageParameters(); StringValue documentParameter = params.get(PAGE_PARAM_DOCUMENT); - StringValue userParameter = params.get(PAGE_PARAM_USER); + StringValue userParameter = params.get(PAGE_PARAM_DATA_OWNER); // If the page was accessed using an URL form ending in a document ID, let's move // the document ID into the fragment and redirect to the form without the document ID. @@ -118,8 +118,8 @@ protected AnnotationPageBase(PageParameters aParameters) fragmentParams.add(format("%s=%s", PAGE_PARAM_DOCUMENT, documentParameter.toString())); params.remove(PAGE_PARAM_DOCUMENT); if (!userParameter.isEmpty()) { - fragmentParams.add(format("%s=%s", PAGE_PARAM_USER, userParameter.toString())); - params.remove(PAGE_PARAM_USER); + fragmentParams.add(format("%s=%s", PAGE_PARAM_DATA_OWNER, userParameter.toString())); + params.remove(PAGE_PARAM_DATA_OWNER); } for (var namedParam : params.getAllNamed()) { clientUrl.setQueryParameter(namedParam.getKey(), namedParam.getValue()); @@ -200,7 +200,7 @@ protected void onParameterArrival(IRequestParameters aRequestParameters, { StringValue document = aRequestParameters.getParameterValue(PAGE_PARAM_DOCUMENT); StringValue focus = aRequestParameters.getParameterValue(PAGE_PARAM_FOCUS); - StringValue user = aRequestParameters.getParameterValue(PAGE_PARAM_USER); + StringValue user = aRequestParameters.getParameterValue(PAGE_PARAM_DATA_OWNER); // nothing changed, do not check for project, because inception always opens // on a project @@ -549,10 +549,10 @@ public void onTargetRespond(AjaxRequestTarget aTarget) // the CURATION_USER here. if (Set.of(userRepository.getCurrentUsername(), CURATION_USER) .contains(state.getUser().getUsername())) { - fragment.removeParameter(PAGE_PARAM_USER); + fragment.removeParameter(PAGE_PARAM_DATA_OWNER); } else { - fragment.putParameter(PAGE_PARAM_USER, state.getUser().getUsername()); + fragment.putParameter(PAGE_PARAM_DATA_OWNER, state.getUser().getUsername()); } // If we do not manually set editedFragment to false, then changing the URL diff --git a/inception/inception-ui-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/annotation/AnnotationPage.java b/inception/inception-ui-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/annotation/AnnotationPage.java index ed8594e5721..7646790ec12 100755 --- a/inception/inception-ui-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/annotation/AnnotationPage.java +++ b/inception/inception-ui-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/annotation/AnnotationPage.java @@ -143,7 +143,7 @@ public AnnotationPage(final PageParameters aPageParameters) StringValue document = aPageParameters.get(PAGE_PARAM_DOCUMENT); StringValue focus = aPageParameters.get(PAGE_PARAM_FOCUS); - StringValue user = aPageParameters.get(PAGE_PARAM_USER); + StringValue user = aPageParameters.get(PAGE_PARAM_DATA_OWNER); handleParameters(document, focus, user); diff --git a/inception/inception-ui-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/annotation/AnnotationPageMenuItem.java b/inception/inception-ui-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/annotation/AnnotationPageMenuItem.java index f0df7a282c8..9dda0c01e2b 100644 --- a/inception/inception-ui-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/annotation/AnnotationPageMenuItem.java +++ b/inception/inception-ui-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/annotation/AnnotationPageMenuItem.java @@ -17,6 +17,7 @@ */ package de.tudarmstadt.ukp.clarin.webanno.ui.annotation; +import static de.tudarmstadt.ukp.clarin.webanno.api.annotation.page.AnnotationPageBase.PAGE_PARAM_DATA_OWNER; import static de.tudarmstadt.ukp.clarin.webanno.model.PermissionLevel.ANNOTATOR; import static de.tudarmstadt.ukp.clarin.webanno.model.PermissionLevel.CURATOR; import static java.lang.String.format; @@ -66,12 +67,19 @@ public String getPath() public String getUrl(Project aProject, long aDocumentId) { - String p = aProject.getSlug() != null ? aProject.getSlug() - : String.valueOf(aProject.getId()); + var p = aProject.getSlug() != null ? aProject.getSlug() : String.valueOf(aProject.getId()); return format("%s/p/%s%s/%d", servletContext.getContextPath(), p, getPath(), aDocumentId); } + public String getUrl(Project aProject, long aDocumentId, String aDataOwner) + { + var p = aProject.getSlug() != null ? aProject.getSlug() : String.valueOf(aProject.getId()); + + return format("%s/p/%s%s/%d?%s=%s", servletContext.getContextPath(), p, getPath(), + aDocumentId, PAGE_PARAM_DATA_OWNER, aDataOwner); + } + @Override public IconType getIcon() { diff --git a/inception/inception-ui-dashboard-activity/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/activity/ActivitiesDashletControllerImpl.java b/inception/inception-ui-dashboard-activity/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/activity/ActivitiesDashletControllerImpl.java index aea26e6384e..ef8af4eebfd 100644 --- a/inception/inception-ui-dashboard-activity/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/activity/ActivitiesDashletControllerImpl.java +++ b/inception/inception-ui-dashboard-activity/src/main/java/de/tudarmstadt/ukp/inception/ui/core/dashboard/activity/ActivitiesDashletControllerImpl.java @@ -26,7 +26,6 @@ import static org.apache.commons.collections4.SetUtils.unmodifiableSet; import java.util.List; -import java.util.Map; import java.util.Objects; import java.util.Set; @@ -41,10 +40,8 @@ import de.tudarmstadt.ukp.clarin.webanno.api.DocumentService; import de.tudarmstadt.ukp.clarin.webanno.api.ProjectService; -import de.tudarmstadt.ukp.clarin.webanno.model.Project; import de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument; import de.tudarmstadt.ukp.clarin.webanno.security.UserDao; -import de.tudarmstadt.ukp.clarin.webanno.security.model.User; import de.tudarmstadt.ukp.clarin.webanno.ui.annotation.AnnotationPageMenuItem; import de.tudarmstadt.ukp.clarin.webanno.ui.curation.page.CurationPageMenuItem; import de.tudarmstadt.ukp.inception.annotation.events.FeatureValueUpdatedEvent; @@ -58,7 +55,6 @@ import de.tudarmstadt.ukp.inception.annotation.layer.span.SpanDeletedEvent; import de.tudarmstadt.ukp.inception.curation.service.CurationDocumentService; import de.tudarmstadt.ukp.inception.log.EventRepository; -import de.tudarmstadt.ukp.inception.log.model.LoggedEvent; @ConditionalOnWebApplication @RestController @@ -117,27 +113,27 @@ public String listActivitiesUrl(long aProjectId) @GetMapping(LIST_PATH) public List listActivities(@PathVariable("projectId") long aProjectId) { - User user = userRepository.getCurrentUser(); - Project project = projectRepository.getProject(aProjectId); + var user = userRepository.getCurrentUser(); + var project = projectRepository.getProject(aProjectId); if (!projectRepository.hasAnyRole(user, project)) { return emptyList(); } - Map annotatableSourceDocuments = documentService - .listAnnotatableDocuments(project, user).keySet().stream() + var annotatableSourceDocuments = documentService.listAnnotatableDocuments(project, user) + .keySet().stream() // .collect(toMap(SourceDocument::getId, identity())); - Map curatableSourceDocuments = curationService - .listCuratableSourceDocuments(project).stream() + var curatableSourceDocuments = curationService.listCuratableSourceDocuments(project) + .stream() // .collect(toMap(SourceDocument::getId, identity())); - boolean isCurator = projectRepository.hasRole(user, project, CURATOR); + var isCurator = projectRepository.hasRole(user, project, CURATOR); // get last annotation events // return filtered by user rights and document state - List recentEvents = eventRepository.listRecentActivity(project, - user.getUsername(), annotationEvents, 10); + var recentEvents = eventRepository.listRecentActivity(project, user.getUsername(), + annotationEvents, 10); return recentEvents.stream() // .filter(Objects::nonNull) // .filter(event -> event.getDocument() != -1l) // @@ -164,7 +160,8 @@ public List listActivities(@PathVariable("projectId") long aProjectId) else { return new Activity(event, annotatableSourceDocuments.get(event.getDocument()), - annotationPageMenuItem.getUrl(project, event.getDocument())); + annotationPageMenuItem.getUrl(project, event.getDocument(), + event.getAnnotator())); } })// .collect(toList());