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);
}
});
}
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));
}
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);
}
}
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);
}
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());
}
Aggregations