Search in sources :

Example 16 with UserId

use of edu.stanford.bmir.protege.web.shared.user.UserId in project webprotege by protegeproject.

the class GetPerspectivesActionHandler method execute.

@Nonnull
@Override
public GetPerspectivesResult execute(@Nonnull GetPerspectivesAction action, @Nonnull ExecutionContext executionContext) {
    ProjectId projectId = action.getProjectId();
    UserId userId = action.getUserId();
    ImmutableList<PerspectiveId> perspectives = perspectivesManager.getPerspectives(projectId, userId);
    return new GetPerspectivesResult(perspectives);
}
Also used : GetPerspectivesResult(edu.stanford.bmir.protege.web.shared.perspective.GetPerspectivesResult) UserId(edu.stanford.bmir.protege.web.shared.user.UserId) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) PerspectiveId(edu.stanford.bmir.protege.web.shared.perspective.PerspectiveId) Nonnull(javax.annotation.Nonnull)

Example 17 with UserId

use of edu.stanford.bmir.protege.web.shared.user.UserId in project webprotege by protegeproject.

the class EventPollingManager method pollForProjectEvents.

public void pollForProjectEvents() {
    GWT.log("[Event Polling Manager] Polling for project events for " + projectId + " from " + nextTag);
    UserId userId = loggedInUserProvider.getCurrentUserId();
    dispatchServiceManager.execute(new GetProjectEventsAction(nextTag, projectId), new DispatchServiceCallback<GetProjectEventsResult>() {

        @Override
        public void handleSuccess(GetProjectEventsResult result) {
            dispatchEvents(result.getEvents());
        }
    });
}
Also used : GetProjectEventsAction(edu.stanford.bmir.protege.web.shared.event.GetProjectEventsAction) UserId(edu.stanford.bmir.protege.web.shared.user.UserId) GetProjectEventsResult(edu.stanford.bmir.protege.web.shared.event.GetProjectEventsResult)

Example 18 with UserId

use of edu.stanford.bmir.protege.web.shared.user.UserId in project webprotege by protegeproject.

the class WatchPresenter method start.

public void start(final OWLEntity forEntity) {
    final UserId userId = loggedInUserProvider.getCurrentUserId();
    dispatchServiceManager.execute(new GetWatchesAction(projectId, userId, forEntity), new DispatchServiceCallback<GetWatchesResult>() {

        @Override
        public void handleSuccess(GetWatchesResult result) {
            Set<Watch> watches = result.getWatches();
            updateDialog(watches);
            WebProtegeDialog<WatchTypeSelection> dlg = new WebProtegeDialog<>(controller);
            dlg.show();
            controller.setDialogButtonHandler(DialogButton.OK, (data, closer) -> {
                closer.hide();
                handleWatchTypeForEntity(data, forEntity);
            });
        }
    });
}
Also used : ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) GWT(com.google.gwt.core.client.GWT) DispatchServiceCallback(edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceCallback) DialogButton(edu.stanford.bmir.protege.web.client.library.dlg.DialogButton) Inject(javax.inject.Inject) UserId(edu.stanford.bmir.protege.web.shared.user.UserId) edu.stanford.bmir.protege.web.shared.watches(edu.stanford.bmir.protege.web.shared.watches) LoggedInUserProvider(edu.stanford.bmir.protege.web.client.user.LoggedInUserProvider) DispatchServiceManager(edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager) OWLEntity(org.semanticweb.owlapi.model.OWLEntity) Optional(java.util.Optional) WebProtegeDialog(edu.stanford.bmir.protege.web.client.library.dlg.WebProtegeDialog) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) Collections(java.util.Collections) ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) UserId(edu.stanford.bmir.protege.web.shared.user.UserId) WebProtegeDialog(edu.stanford.bmir.protege.web.client.library.dlg.WebProtegeDialog)

Example 19 with UserId

use of edu.stanford.bmir.protege.web.shared.user.UserId in project webprotege by protegeproject.

the class ChangePasswordActionHandler method executeAuthenticatedAction.

@Override
protected ChangePasswordResult executeAuthenticatedAction(ChangePasswordAction action, ExecutionContext executionContext) {
    SaltedPasswordDigest newPassword = action.getNewPassword();
    Salt newSalt = action.getNewSalt();
    UserId userId = action.getUserId();
    authenticationManager.setDigestedPassword(userId, newPassword, newSalt);
    return new ChangePasswordResult(AuthenticationResponse.SUCCESS);
}
Also used : UserId(edu.stanford.bmir.protege.web.shared.user.UserId)

Example 20 with UserId

use of edu.stanford.bmir.protege.web.shared.user.UserId in project webprotege by protegeproject.

the class AbstractUpdateFrameHandler method execute.

/**
 * Executes the specified action, against the specified project in the specified context.
 * @param action The action to be handled/executed
 * @param executionContext The {@link edu.stanford.bmir.protege.web.server.dispatch.ExecutionContext} that should be
 * used to provide details such as the
 * {@link edu.stanford.bmir.protege.web.shared.user.UserId} of the user who requested the action be executed.
 * @return The result of the execution to be returned to the client.
 */
@Nonnull
@Override
public Result execute(@Nonnull A action, @Nonnull ExecutionContext executionContext) {
    LabelledFrame<F> from = action.getFrom();
    LabelledFrame<F> to = action.getTo();
    final EventTag startTag = eventManager.getCurrentTag();
    if (from.equals(to)) {
        return createResponse(action.getTo(), eventManager.getEventsFromTag(startTag));
    }
    UserId userId = executionContext.getUserId();
    FrameTranslator<F, S> translator = createTranslator();
    final FrameChangeGenerator<F, S> changeGenerator = new FrameChangeGenerator<>(from.getFrame(), to.getFrame(), translator, rootOntology, changeDescriptionGeneratorFactory);
    ChangeDescriptionGenerator<S> generator = changeDescriptionGeneratorFactory.get("Edited " + from.getDisplayName());
    applyChanges.applyChanges(userId, changeGenerator);
    EventList<ProjectEvent<?>> events = eventManager.getEventsFromTag(startTag);
    return createResponse(action.getTo(), events);
}
Also used : UserId(edu.stanford.bmir.protege.web.shared.user.UserId) EventTag(edu.stanford.bmir.protege.web.shared.event.EventTag) ProjectEvent(edu.stanford.bmir.protege.web.shared.event.ProjectEvent) Nonnull(javax.annotation.Nonnull)

Aggregations

UserId (edu.stanford.bmir.protege.web.shared.user.UserId)64 Nonnull (javax.annotation.Nonnull)20 Test (org.junit.Test)14 ProjectId (edu.stanford.bmir.protege.web.shared.project.ProjectId)13 Inject (javax.inject.Inject)6 OWLEntity (org.semanticweb.owlapi.model.OWLEntity)6 List (java.util.List)5 ImmutableList (com.google.common.collect.ImmutableList)4 AccessManager (edu.stanford.bmir.protege.web.server.access.AccessManager)4 WebProtegeSession (edu.stanford.bmir.protege.web.server.session.WebProtegeSession)4 WebProtegeSessionImpl (edu.stanford.bmir.protege.web.server.session.WebProtegeSessionImpl)4 OWLEntityData (edu.stanford.bmir.protege.web.shared.entity.OWLEntityData)4 EventTag (edu.stanford.bmir.protege.web.shared.event.EventTag)4 ArrayList (java.util.ArrayList)4 DispatchServiceCallback (edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceCallback)3 Subject.forUser (edu.stanford.bmir.protege.web.server.access.Subject.forUser)3 Optional (java.util.Optional)3 Stopwatch (com.google.common.base.Stopwatch)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 ProjectResource (edu.stanford.bmir.protege.web.server.access.ProjectResource)2