Search in sources :

Example 1 with ApplicationSettings

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

the class ApplicationSettingsPresenter method applySettings.

private void applySettings() {
    ApplicationSettings applicationSettings = new ApplicationSettings(view.getApplicationName(), new EmailAddress(view.getSystemNotificationEmailAddress()), new ApplicationLocation(view.getScheme().name().toLowerCase(), getHostNameFromView(), getPathFromView(), getPortFromView()), view.isAccountCreationAllowed() ? ACCOUNT_CREATION_ALLOWED : ACCOUNT_CREATION_NOT_ALLOWED, Collections.emptyList(), view.isProjectCreationAllowed() ? EMPTY_PROJECT_CREATION_ALLOWED : EMPTY_PROJECT_CREATION_NOT_ALLOWED, Collections.emptyList(), view.isProjectUploadAllowed() ? PROJECT_UPLOAD_ALLOWED : PROJECT_UPLOAD_NOT_ALLOWED, Collections.emptyList(), view.isNotificationEmailsEnabled() ? SEND_NOTIFICATION_EMAILS : DO_NOT_SEND_NOTIFICATION_EMAILS, parseMaxUploadSize());
    dispatchServiceManager.execute(new SetApplicationSettingsAction(applicationSettings), result -> MessageBox.showMessage("Settings applied", "The application settings have successfully been applied"));
}
Also used : ApplicationSettings(edu.stanford.bmir.protege.web.shared.app.ApplicationSettings) SetApplicationSettingsAction(edu.stanford.bmir.protege.web.shared.app.SetApplicationSettingsAction) ApplicationLocation(edu.stanford.bmir.protege.web.shared.app.ApplicationLocation) EmailAddress(edu.stanford.bmir.protege.web.shared.user.EmailAddress)

Example 2 with ApplicationSettings

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

the class ApplicationPreferencesManager_TestCase method shouldGetProjectCreationAllowed.

@Test
public void shouldGetProjectCreationAllowed() {
    when(accessManager.hasPermission(forAnySignedInUser(), ApplicationResource.get(), BuiltInAction.CREATE_EMPTY_PROJECT)).thenReturn(true);
    ApplicationSettings applicationSettings = manager.getApplicationSettings();
    assertThat(applicationSettings.getProjectCreationSetting(), is(EMPTY_PROJECT_CREATION_ALLOWED));
}
Also used : ApplicationSettings(edu.stanford.bmir.protege.web.shared.app.ApplicationSettings) Test(org.junit.Test)

Example 3 with ApplicationSettings

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

the class ApplicationPreferencesManager_TestCase method shouldGetApplicationSettings.

@Test
public void shouldGetApplicationSettings() {
    ApplicationSettings applicationSettings = manager.getApplicationSettings();
    assertThat(applicationSettings.getApplicationName(), is(THE_APP_NAME));
    assertThat(applicationSettings.getSystemNotificationEmailAddress().getEmailAddress(), is(THE_SYSTEM_NOTIFICATION_EMAIL_ADDRESS));
    assertThat(applicationSettings.getApplicationLocation(), is(applicationLocation));
}
Also used : ApplicationSettings(edu.stanford.bmir.protege.web.shared.app.ApplicationSettings) Test(org.junit.Test)

Example 4 with ApplicationSettings

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

the class ApplicationPreferencesManager_TestCase method shouldGetProjectUploadNotAllowed.

@Test
public void shouldGetProjectUploadNotAllowed() {
    ApplicationSettings applicationSettings = manager.getApplicationSettings();
    assertThat(applicationSettings.getProjectUploadSetting(), is(PROJECT_UPLOAD_NOT_ALLOWED));
}
Also used : ApplicationSettings(edu.stanford.bmir.protege.web.shared.app.ApplicationSettings) Test(org.junit.Test)

Example 5 with ApplicationSettings

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

the class ApplicationPreferencesManager_TestCase method shouldGetAccountCreationAllowed.

@Test
public void shouldGetAccountCreationAllowed() {
    when(accessManager.hasPermission(forGuestUser(), ApplicationResource.get(), BuiltInAction.CREATE_ACCOUNT)).thenReturn(true);
    ApplicationSettings applicationSettings = manager.getApplicationSettings();
    assertThat(applicationSettings.getAccountCreationSetting(), is(ACCOUNT_CREATION_ALLOWED));
}
Also used : ApplicationSettings(edu.stanford.bmir.protege.web.shared.app.ApplicationSettings) Test(org.junit.Test)

Aggregations

ApplicationSettings (edu.stanford.bmir.protege.web.shared.app.ApplicationSettings)9 Test (org.junit.Test)7 EmailAddress (edu.stanford.bmir.protege.web.shared.user.EmailAddress)2 AccountCreationSetting (edu.stanford.bmir.protege.web.shared.app.AccountCreationSetting)1 ApplicationLocation (edu.stanford.bmir.protege.web.shared.app.ApplicationLocation)1 ProjectCreationSetting (edu.stanford.bmir.protege.web.shared.app.ProjectCreationSetting)1 ProjectUploadSetting (edu.stanford.bmir.protege.web.shared.app.ProjectUploadSetting)1 SetApplicationSettingsAction (edu.stanford.bmir.protege.web.shared.app.SetApplicationSettingsAction)1 Nonnull (javax.annotation.Nonnull)1