Search in sources :

Example 46 with ProjectId

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

the class ProjectHistoryPortletPresenter method reload.

private void reload() {
    refreshAction.setEnabled(false);
    permissionChecker.hasPermission(VIEW_CHANGES, canViewChanges -> {
        if (canViewChanges) {
            ProjectId projectId = getProjectId();
            presenter.setRevertChangesVisible(true);
            presenter.setChangesForProject(projectId);
            setForbiddenVisible(false);
        } else {
            setForbiddenVisible(true);
        }
    });
}
Also used : ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId)

Example 47 with ProjectId

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

the class DispatchServiceManager method execute.

@SuppressWarnings("unchecked")
public <A extends Action<R>, R extends Result> void execute(A action, final DispatchServiceCallback<R> callback) {
    callback.handleSubmittedForExecution();
    if (action instanceof HasProjectId) {
        ProjectId projectId = ((HasProjectId) action).getProjectId();
        ResultCache resultCache = getResultCache(projectId, eventBus);
        Optional<R> result = resultCache.getCachedResult(action);
        if (result.isPresent()) {
            callback.onSuccess(result.get());
            return;
        }
    }
    requestCount++;
    GWT.log("[Dispatch] Executing action " + requestCount + "    " + action.getClass().getSimpleName());
    async.executeAction(action, new AsyncCallbackProxy(action, callback));
}
Also used : HasProjectId(edu.stanford.bmir.protege.web.shared.project.HasProjectId) ResultCache(edu.stanford.bmir.protege.web.client.dispatch.cache.ResultCache) HasProjectId(edu.stanford.bmir.protege.web.shared.project.HasProjectId) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId)

Example 48 with ProjectId

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

the class EditProjectPrefixDeclarationsHandlerImpl method handleEditProjectPrefixes.

@Override
public void handleEditProjectPrefixes() {
    Place currentPlace = placeController.getWhere();
    if (currentPlace instanceof HasProjectId) {
        ProjectId projectId = ((HasProjectId) currentPlace).getProjectId();
        ProjectPrefixDeclarationsPlace prefixesPlace = new ProjectPrefixDeclarationsPlace(projectId, Optional.ofNullable(currentPlace));
        placeController.goTo(prefixesPlace);
    }
}
Also used : HasProjectId(edu.stanford.bmir.protege.web.shared.project.HasProjectId) ProjectPrefixDeclarationsPlace(edu.stanford.bmir.protege.web.shared.place.ProjectPrefixDeclarationsPlace) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) HasProjectId(edu.stanford.bmir.protege.web.shared.project.HasProjectId) Place(com.google.gwt.place.shared.Place) ProjectPrefixDeclarationsPlace(edu.stanford.bmir.protege.web.shared.place.ProjectPrefixDeclarationsPlace)

Example 49 with ProjectId

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

the class SetDiscussionThreadStatusHandler method execute.

@Nonnull
@Override
public SetDiscussionThreadStatusResult execute(@Nonnull SetDiscussionThreadStatusAction action, @Nonnull ExecutionContext executionContext) {
    EventTag fromTag = eventManager.getCurrentTag();
    ThreadId threadId = action.getThreadId();
    Status status = action.getStatus();
    Optional<EntityDiscussionThread> thread = repository.setThreadStatus(threadId, status);
    int openComments = thread.map(t -> repository.getOpenCommentsCount(projectId, t.getEntity())).orElse(-1);
    eventManager.postEvent(new DiscussionThreadStatusChangedEvent(projectId, threadId, thread.map(EntityDiscussionThread::getEntity), openComments, status));
    EventList<ProjectEvent<?>> eventList = eventManager.getEventsFromTag(fromTag);
    return new SetDiscussionThreadStatusResult(threadId, status, eventList);
}
Also used : edu.stanford.bmir.protege.web.shared.issues(edu.stanford.bmir.protege.web.shared.issues) ProjectEvent(edu.stanford.bmir.protege.web.shared.event.ProjectEvent) BuiltInAction(edu.stanford.bmir.protege.web.shared.access.BuiltInAction) EventList(edu.stanford.bmir.protege.web.shared.event.EventList) EventManager(edu.stanford.bmir.protege.web.server.events.EventManager) Inject(javax.inject.Inject) AbstractProjectActionHandler(edu.stanford.bmir.protege.web.server.dispatch.AbstractProjectActionHandler) AccessManager(edu.stanford.bmir.protege.web.server.access.AccessManager) SET_OBJECT_COMMENT_STATUS(edu.stanford.bmir.protege.web.shared.access.BuiltInAction.SET_OBJECT_COMMENT_STATUS) ExecutionContext(edu.stanford.bmir.protege.web.server.dispatch.ExecutionContext) EventTag(edu.stanford.bmir.protege.web.shared.event.EventTag) Optional(java.util.Optional) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) EventTag(edu.stanford.bmir.protege.web.shared.event.EventTag) ProjectEvent(edu.stanford.bmir.protege.web.shared.event.ProjectEvent) Nonnull(javax.annotation.Nonnull)

Example 50 with ProjectId

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

the class GetIndividualsActionHandler method execute.

@Nonnull
@Override
public GetIndividualsResult execute(@Nonnull GetIndividualsAction action, @Nonnull ExecutionContext executionContext) {
    Stream<OWLNamedIndividual> stream;
    if (action.getType().isOWLThing()) {
        stream = rootOntology.getIndividualsInSignature(Imports.INCLUDED).stream();
    } else {
        stream = rootOntology.getImportsClosure().stream().flatMap(o -> o.getClassAssertionAxioms(action.getType()).stream()).map(OWLClassAssertionAxiom::getIndividual).filter(OWLIndividual::isNamed).map(OWLIndividual::asOWLNamedIndividual);
    }
    Counter counter = new Counter();
    List<OWLNamedIndividualData> individualsData = stream.peek(i -> counter.increment()).map(renderingManager::getRendering).filter(i -> {
        String searchString = action.getFilterString();
        return searchString.isEmpty() || StringUtils.containsIgnoreCase(i.getBrowserText(), searchString);
    }).distinct().sorted().collect(toList());
    PageRequest pageRequest = action.getPageRequest();
    Pager<OWLNamedIndividualData> pager = Pager.getPagerForPageSize(individualsData, pageRequest.getPageSize());
    Page<OWLNamedIndividualData> page = pager.getPage(pageRequest.getPageNumber());
    OWLClassData type = renderingManager.getRendering(action.getType());
    logger.info(BROWSING, "{} {} retrieved instances of {} ({})", projectId, executionContext.getUserId(), action.getType(), renderingManager.getRendering(action.getType()).getBrowserText());
    return new GetIndividualsResult(type, page, counter.getCount(), individualsData.size());
}
Also used : StringUtils(org.apache.commons.lang.StringUtils) RootOntology(edu.stanford.bmir.protege.web.server.inject.project.RootOntology) LoggerFactory(org.slf4j.LoggerFactory) OWLNamedIndividualData(edu.stanford.bmir.protege.web.shared.entity.OWLNamedIndividualData) Inject(javax.inject.Inject) PageRequest(edu.stanford.bmir.protege.web.shared.pagination.PageRequest) RenderingManager(edu.stanford.bmir.protege.web.server.renderer.RenderingManager) OWLIndividual(org.semanticweb.owlapi.model.OWLIndividual) OWLOntology(org.semanticweb.owlapi.model.OWLOntology) AccessManager(edu.stanford.bmir.protege.web.server.access.AccessManager) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) Page(edu.stanford.bmir.protege.web.shared.pagination.Page) Imports(org.semanticweb.owlapi.model.parameters.Imports) Logger(org.slf4j.Logger) OWLNamedIndividual(org.semanticweb.owlapi.model.OWLNamedIndividual) OWLClassAssertionAxiom(org.semanticweb.owlapi.model.OWLClassAssertionAxiom) VIEW_PROJECT(edu.stanford.bmir.protege.web.shared.access.BuiltInAction.VIEW_PROJECT) BuiltInAction(edu.stanford.bmir.protege.web.shared.access.BuiltInAction) Pager(edu.stanford.bmir.protege.web.server.pagination.Pager) GetIndividualsResult(edu.stanford.bmir.protege.web.shared.individualslist.GetIndividualsResult) AbstractProjectActionHandler(edu.stanford.bmir.protege.web.server.dispatch.AbstractProjectActionHandler) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) Stream(java.util.stream.Stream) ExecutionContext(edu.stanford.bmir.protege.web.server.dispatch.ExecutionContext) OWLClassData(edu.stanford.bmir.protege.web.shared.entity.OWLClassData) GetIndividualsAction(edu.stanford.bmir.protege.web.shared.individualslist.GetIndividualsAction) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) BROWSING(edu.stanford.bmir.protege.web.server.logging.Markers.BROWSING) OWLClassData(edu.stanford.bmir.protege.web.shared.entity.OWLClassData) PageRequest(edu.stanford.bmir.protege.web.shared.pagination.PageRequest) GetIndividualsResult(edu.stanford.bmir.protege.web.shared.individualslist.GetIndividualsResult) OWLNamedIndividual(org.semanticweb.owlapi.model.OWLNamedIndividual) OWLNamedIndividualData(edu.stanford.bmir.protege.web.shared.entity.OWLNamedIndividualData) OWLIndividual(org.semanticweb.owlapi.model.OWLIndividual) Nonnull(javax.annotation.Nonnull)

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