Search in sources :

Example 1 with ProjectId

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

the class EntityChangesPortletPresenter method updateDisplayForSelectedEntity.

private void updateDisplayForSelectedEntity() {
    permissionChecker.hasPermission(VIEW_CHANGES, canViewChanges -> {
        if (canViewChanges) {
            setForbiddenVisible(false);
            ProjectId projectId = getProjectId();
            getSelectedEntity().ifPresent(entity -> presenter.setChangesForEntity(projectId, entity));
        } else {
            setForbiddenVisible(true);
            presenter.clear();
        }
    });
}
Also used : ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId)

Example 2 with ProjectId

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

the class EditProjectTagsUIActionHandler method handleEditProjectTags.

public void handleEditProjectTags() {
    Place currentPlace = placeController.getWhere();
    if (!(currentPlace instanceof HasProjectId)) {
        return;
    }
    ProjectId projectId = ((HasProjectId) currentPlace).getProjectId();
    ProjectTagsPlace projectTagsPlace = new ProjectTagsPlace(projectId, Optional.of(currentPlace));
    placeController.goTo(projectTagsPlace);
}
Also used : HasProjectId(edu.stanford.bmir.protege.web.shared.project.HasProjectId) ProjectTagsPlace(edu.stanford.bmir.protege.web.shared.place.ProjectTagsPlace) 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) ProjectTagsPlace(edu.stanford.bmir.protege.web.shared.place.ProjectTagsPlace)

Example 3 with ProjectId

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

the class ProjectEntityCrudKitSettingsConverter method fromDocument.

@Override
public ProjectEntityCrudKitSettings fromDocument(@Nonnull Document document) {
    ProjectId projectId = ProjectId.get(document.getString(PROJECT_ID));
    Document settingsDocument = (Document) document.get(SETTINGS);
    EntityCrudKitSettings<? extends EntityCrudKitSuffixSettings> settings = converter.fromDocument(settingsDocument);
    return new ProjectEntityCrudKitSettings(projectId, settings);
}
Also used : ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) Document(org.bson.Document)

Example 4 with ProjectId

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

the class LoadProjectActionHandler method execute.

@Nonnull
@Override
public LoadProjectResult execute(@Nonnull final LoadProjectAction action, @Nonnull ExecutionContext executionContext) {
    Stopwatch stopwatch = Stopwatch.createStarted();
    logger.info("{} is being loaded due to request by {}", action.getProjectId(), executionContext.getUserId());
    projectManager.getProject(action.getProjectId(), executionContext.getUserId());
    stopwatch.stop();
    logger.info("{} was loaded in {} ms due to request by {}", action.getProjectId(), stopwatch.elapsed(TimeUnit.MILLISECONDS), executionContext.getUserId());
    MemoryMonitor memoryMonitor = new MemoryMonitor(logger);
    memoryMonitor.monitorMemoryUsage();
    memoryMonitor.logMemoryUsage();
    final ProjectId projectId = action.getProjectId();
    ProjectDetails projectDetails = projectDetailsManager.getProjectDetails(projectId);
    if (!executionContext.getUserId().isGuest()) {
        userActivityManager.addRecentProject(executionContext.getUserId(), action.getProjectId(), System.currentTimeMillis());
    }
    return new LoadProjectResult(action.getProjectId(), executionContext.getUserId(), projectDetails);
}
Also used : MemoryMonitor(edu.stanford.bmir.protege.web.server.util.MemoryMonitor) ProjectDetails(edu.stanford.bmir.protege.web.shared.project.ProjectDetails) Stopwatch(com.google.common.base.Stopwatch) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) LoadProjectResult(edu.stanford.bmir.protege.web.shared.project.LoadProjectResult) Nonnull(javax.annotation.Nonnull)

Example 5 with ProjectId

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

the class ProjectEntityCrudKitSettingsTestCase method hashCodeShouldBeEqualForSameProjectIdAndSettings.

@Test
public void hashCodeShouldBeEqualForSameProjectIdAndSettings() {
    ProjectId projectId = mock(ProjectId.class);
    EntityCrudKitSettings<?> settings = mock(EntityCrudKitSettings.class);
    ProjectEntityCrudKitSettings settingsA = new ProjectEntityCrudKitSettings(projectId, settings);
    ProjectEntityCrudKitSettings settingsB = new ProjectEntityCrudKitSettings(projectId, settings);
    assertEquals(settingsA.hashCode(), settingsB.hashCode());
}
Also used : ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) Test(org.junit.Test)

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