Search in sources :

Example 16 with ServerSettings

use of org.bimserver.models.store.ServerSettings in project BIMserver by opensourceBIM.

the class NotificationsManager method init.

public void init() {
    ServerSettings serverSettings = bimServer.getServerSettingsCache().getServerSettings();
    this.url = serverSettings.getSiteAddress() + "/json";
}
Also used : ServerSettings(org.bimserver.models.store.ServerSettings)

Example 17 with ServerSettings

use of org.bimserver.models.store.ServerSettings in project BIMserver by opensourceBIM.

the class SettingsServiceImpl method setPluginStrictVersionChecking.

@Override
public void setPluginStrictVersionChecking(Boolean strict) throws UserException, ServerException {
    requireAdminAuthenticationAndRunningServer();
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        SetServerSettingDatabaseAction action = new SetServerSettingDatabaseAction(getBimServer(), session, getInternalAccessMethod(), new ServerSettingsSetter() {

            @Override
            public void set(ServerSettings serverSettings) {
                serverSettings.setPluginStrictVersionChecking(strict);
            }
        });
        session.executeAndCommitAction(action);
    } catch (BimserverDatabaseException e) {
        handleException(e);
    } finally {
        session.close();
    }
}
Also used : ServerSettingsSetter(org.bimserver.database.actions.ServerSettingsSetter) BimserverDatabaseException(org.bimserver.BimserverDatabaseException) DatabaseSession(org.bimserver.database.DatabaseSession) SetServerSettingDatabaseAction(org.bimserver.database.actions.SetServerSettingDatabaseAction) SServerSettings(org.bimserver.interfaces.objects.SServerSettings) ServerSettings(org.bimserver.models.store.ServerSettings)

Example 18 with ServerSettings

use of org.bimserver.models.store.ServerSettings in project BIMserver by opensourceBIM.

the class SettingsServiceImpl method setSiteAddress.

@Override
public void setSiteAddress(final String siteAddress) throws ServerException, UserException {
    if (getBimServer().getServerInfo().getServerState() != ServerState.NOT_SETUP) {
        requireAdminAuthentication();
    }
    if (siteAddress.trim().isEmpty()) {
        throw new UserException("Site Address cannot be empty");
    } else if (!siteAddress.startsWith("http://") && !(siteAddress.startsWith("https://"))) {
        throw new UserException("Site Address must start with either \"http://\" or \"https://\"");
    }
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        SetServerSettingDatabaseAction action = new SetServerSettingDatabaseAction(getBimServer(), session, getInternalAccessMethod(), new ServerSettingsSetter() {

            @Override
            public void set(ServerSettings serverSettings) {
                serverSettings.setSiteAddress(siteAddress);
            }
        });
        session.executeAndCommitAction(action);
    } catch (BimserverDatabaseException e) {
        handleException(e);
    } finally {
        session.close();
    }
}
Also used : ServerSettingsSetter(org.bimserver.database.actions.ServerSettingsSetter) BimserverDatabaseException(org.bimserver.BimserverDatabaseException) DatabaseSession(org.bimserver.database.DatabaseSession) SetServerSettingDatabaseAction(org.bimserver.database.actions.SetServerSettingDatabaseAction) SServerSettings(org.bimserver.interfaces.objects.SServerSettings) ServerSettings(org.bimserver.models.store.ServerSettings) UserException(org.bimserver.shared.exceptions.UserException)

Example 19 with ServerSettings

use of org.bimserver.models.store.ServerSettings in project BIMserver by opensourceBIM.

the class SettingsServiceImpl method setServiceRepositoryUrl.

@Override
public void setServiceRepositoryUrl(final String url) throws ServerException, UserException {
    requireAdminAuthenticationAndRunningServer();
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        SetServerSettingDatabaseAction action = new SetServerSettingDatabaseAction(getBimServer(), session, getInternalAccessMethod(), new ServerSettingsSetter() {

            @Override
            public void set(ServerSettings serverSettings) {
                serverSettings.setServiceRepositoryUrl(url);
            }
        });
        session.executeAndCommitAction(action);
    } catch (BimserverDatabaseException e) {
        handleException(e);
    } finally {
        session.close();
    }
}
Also used : ServerSettingsSetter(org.bimserver.database.actions.ServerSettingsSetter) BimserverDatabaseException(org.bimserver.BimserverDatabaseException) DatabaseSession(org.bimserver.database.DatabaseSession) SetServerSettingDatabaseAction(org.bimserver.database.actions.SetServerSettingDatabaseAction) SServerSettings(org.bimserver.interfaces.objects.SServerSettings) ServerSettings(org.bimserver.models.store.ServerSettings)

Example 20 with ServerSettings

use of org.bimserver.models.store.ServerSettings in project BIMserver by opensourceBIM.

the class SettingsServiceImpl method setHideUserListForNonAdmin.

@Override
public void setHideUserListForNonAdmin(final Boolean hideUserListForNonAdmin) throws ServerException, UserException {
    requireAdminAuthenticationAndRunningServer();
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        SetServerSettingDatabaseAction action = new SetServerSettingDatabaseAction(getBimServer(), session, getInternalAccessMethod(), new ServerSettingsSetter() {

            @Override
            public void set(ServerSettings serverSettings) {
                serverSettings.setHideUserListForNonAdmin(hideUserListForNonAdmin);
            }
        });
        session.executeAndCommitAction(action);
    } catch (BimserverDatabaseException e) {
        handleException(e);
    } finally {
        session.close();
    }
}
Also used : ServerSettingsSetter(org.bimserver.database.actions.ServerSettingsSetter) BimserverDatabaseException(org.bimserver.BimserverDatabaseException) DatabaseSession(org.bimserver.database.DatabaseSession) SetServerSettingDatabaseAction(org.bimserver.database.actions.SetServerSettingDatabaseAction) SServerSettings(org.bimserver.interfaces.objects.SServerSettings) ServerSettings(org.bimserver.models.store.ServerSettings)

Aggregations

ServerSettings (org.bimserver.models.store.ServerSettings)29 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)21 DatabaseSession (org.bimserver.database.DatabaseSession)21 ServerSettingsSetter (org.bimserver.database.actions.ServerSettingsSetter)18 SetServerSettingDatabaseAction (org.bimserver.database.actions.SetServerSettingDatabaseAction)18 SServerSettings (org.bimserver.interfaces.objects.SServerSettings)18 UserException (org.bimserver.shared.exceptions.UserException)10 User (org.bimserver.models.store.User)5 ServerException (org.bimserver.shared.exceptions.ServerException)5 Date (java.util.Date)4 HashMap (java.util.HashMap)3 BimserverLockConflictException (org.bimserver.database.BimserverLockConflictException)3 IOException (java.io.IOException)2 URL (java.net.URL)2 ArrayList (java.util.ArrayList)2 GregorianCalendar (java.util.GregorianCalendar)2 Map (java.util.Map)2 InternetAddress (javax.mail.internet.InternetAddress)2 PostCommitAction (org.bimserver.database.PostCommitAction)2 DatabaseInitException (org.bimserver.database.berkeley.DatabaseInitException)2