Search in sources :

Example 21 with ProjectId

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

the class GetPerspectiveLayoutActionHandler method execute.

@Nonnull
@Override
public GetPerspectiveLayoutResult execute(@Nonnull GetPerspectiveLayoutAction action, @Nonnull ExecutionContext executionContext) {
    PerspectiveId perspectiveId = action.getPerspectiveId();
    ProjectId projectId = action.getProjectId();
    UserId userId = action.getUserId();
    PerspectiveLayout perspectiveLayout = perspectiveLayoutStore.getPerspectiveLayout(projectId, userId, perspectiveId);
    return new GetPerspectiveLayoutResult(perspectiveLayout);
}
Also used : 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) PerspectiveLayout(edu.stanford.bmir.protege.web.shared.perspective.PerspectiveLayout) GetPerspectiveLayoutResult(edu.stanford.bmir.protege.web.shared.perspective.GetPerspectiveLayoutResult) Nonnull(javax.annotation.Nonnull)

Example 22 with ProjectId

use of edu.stanford.bmir.protege.web.shared.project.ProjectId 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 23 with ProjectId

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

the class ActiveProjectManagerImpl method getActiveProjectDetails.

@Override
public void getActiveProjectDetails(Consumer<Optional<ProjectDetails>> projectDetailsConsumer) {
    if (cachedProjectDetails.isPresent()) {
        projectDetailsConsumer.accept(cachedProjectDetails);
    } else {
        Optional<ProjectId> activeProjectId = getActiveProjectId();
        if (activeProjectId.isPresent()) {
            dispatchServiceManager.execute(new GetProjectDetailsAction(activeProjectId.get()), result -> {
                GWT.log("[ActiveProjectManagerImpl] Got details: " + result.getProjectDetails());
                cachedProjectDetails = Optional.of(result.getProjectDetails());
                projectDetailsConsumer.accept(cachedProjectDetails);
            });
        } else {
            projectDetailsConsumer.accept(Optional.empty());
        }
    }
}
Also used : HasProjectId(edu.stanford.bmir.protege.web.shared.project.HasProjectId) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) GetProjectDetailsAction(edu.stanford.bmir.protege.web.shared.project.GetProjectDetailsAction)

Example 24 with ProjectId

use of edu.stanford.bmir.protege.web.shared.project.ProjectId 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 25 with ProjectId

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

the class EntitySearcher method invoke.

/**
 * Invokes the entity searcher to perform a search.
 */
public void invoke() {
    Stopwatch stopwatch = Stopwatch.createStarted();
    matchCounter.reset();
    searchCounter.reset();
    results.clear();
    tagsByLabel.clear();
    tagsManager.getProjectTags().forEach(tag -> tagsByLabel.put(tag.getLabel(), tag));
    tagsByEntity.clear();
    tagsByEntity.putAll(tagsManager.getTags(projectId));
    Pattern searchPattern = compileSearchPattern(searchWords);
    entityStreamSupplier.get().filter(this::isRequiredEntityType).peek(this::incrementSearchCounter).map(this::performMatch).filter(Objects::nonNull).peek(this::incrementMatchCounter).sorted().skip(skip).limit(limit).map(m -> toSearchResult(searchPattern, m)).forEach(results::add);
    logger.info(BROWSING, "{} {} Performed entity search for \"{}\".  Found {} matches in {} entities in {} ms.", projectId, userId, searchString, matchCounter.getCounter(), searchCounter.getCounter(), stopwatch.elapsed(TimeUnit.MILLISECONDS));
}
Also used : HasGetRendering(edu.stanford.bmir.protege.web.server.mansyntax.render.HasGetRendering) StringUtils(org.apache.commons.lang.StringUtils) java.util(java.util) Stopwatch(com.google.common.base.Stopwatch) LoggerFactory(org.slf4j.LoggerFactory) Multimap(com.google.common.collect.Multimap) Supplier(java.util.function.Supplier) CASE_INSENSITIVE(java.util.regex.Pattern.CASE_INSENSITIVE) UserId(edu.stanford.bmir.protege.web.shared.user.UserId) Obo2OWLConstants(org.obolibrary.obo2owl.Obo2OWLConstants) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) HashMultimap(com.google.common.collect.HashMultimap) Matcher(java.util.regex.Matcher) IRI(org.semanticweb.owlapi.model.IRI) SearchType(edu.stanford.bmir.protege.web.shared.search.SearchType) Optional(com.google.common.base.Optional) EntityType(org.semanticweb.owlapi.model.EntityType) Nonnull(javax.annotation.Nonnull) SearchMatch(org.eclipse.jdt.core.search.SearchMatch) Nullable(javax.annotation.Nullable) SearchField.displayName(edu.stanford.bmir.protege.web.shared.search.SearchField.displayName) Logger(org.slf4j.Logger) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) Tag(edu.stanford.bmir.protege.web.shared.tag.Tag) OWLEntityData(edu.stanford.bmir.protege.web.shared.entity.OWLEntityData) TimeUnit(java.util.concurrent.TimeUnit) Stream(java.util.stream.Stream) EntitySearchResult(edu.stanford.bmir.protege.web.shared.search.EntitySearchResult) TagsManager(edu.stanford.bmir.protege.web.server.tag.TagsManager) OWLEntity(org.semanticweb.owlapi.model.OWLEntity) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) Pattern(java.util.regex.Pattern) BROWSING(edu.stanford.bmir.protege.web.server.logging.Markers.BROWSING) Pattern(java.util.regex.Pattern) Stopwatch(com.google.common.base.Stopwatch)

Aggregations

ProjectId (edu.stanford.bmir.protege.web.shared.project.ProjectId)51 Nonnull (javax.annotation.Nonnull)19 UserId (edu.stanford.bmir.protege.web.shared.user.UserId)16 Inject (javax.inject.Inject)14 AccessManager (edu.stanford.bmir.protege.web.server.access.AccessManager)8 java.util (java.util)7 HasProjectId (edu.stanford.bmir.protege.web.shared.project.HasProjectId)6 Collectors.toList (java.util.stream.Collectors.toList)6 Nullable (javax.annotation.Nullable)6 Test (org.junit.Test)6 Logger (org.slf4j.Logger)6 LoggerFactory (org.slf4j.LoggerFactory)6 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)5 ExecutionContext (edu.stanford.bmir.protege.web.server.dispatch.ExecutionContext)5 Optional (java.util.Optional)5 OWLEntity (org.semanticweb.owlapi.model.OWLEntity)5 Subject.forUser (edu.stanford.bmir.protege.web.server.access.Subject.forUser)4 ProjectDetails (edu.stanford.bmir.protege.web.shared.project.ProjectDetails)4 List (java.util.List)4 ImmutableSet (com.google.common.collect.ImmutableSet)3