Search in sources :

Example 16 with ServerSettingsSetter

use of org.bimserver.database.actions.ServerSettingsSetter in project BIMserver by opensourceBIM.

the class SettingsServiceImpl method setSendConfirmationEmailAfterRegistration.

@Override
public void setSendConfirmationEmailAfterRegistration(final Boolean sendConfirmationEmailAfterRegistration) 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.setSendConfirmationEmailAfterRegistration(sendConfirmationEmailAfterRegistration);
            }
        });
        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 17 with ServerSettingsSetter

use of org.bimserver.database.actions.ServerSettingsSetter in project BIMserver by opensourceBIM.

the class SettingsServiceImpl method setGenerateGeometryOnCheckin.

@Override
public void setGenerateGeometryOnCheckin(final Boolean generateGeometryOnCheckin) 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.setGenerateGeometryOnCheckin(generateGeometryOnCheckin);
            }
        });
        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 ServerSettingsSetter

use of org.bimserver.database.actions.ServerSettingsSetter in project BIMserver by opensourceBIM.

the class SettingsServiceImpl method setCacheOutputFiles.

@Override
public void setCacheOutputFiles(final Boolean cacheOutputFiles) 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.setCacheOutputFiles(cacheOutputFiles);
            }
        });
        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

DatabaseSession (org.bimserver.database.DatabaseSession)18 ServerSettingsSetter (org.bimserver.database.actions.ServerSettingsSetter)18 SetServerSettingDatabaseAction (org.bimserver.database.actions.SetServerSettingDatabaseAction)18 ServerSettings (org.bimserver.models.store.ServerSettings)18 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)17 SServerSettings (org.bimserver.interfaces.objects.SServerSettings)17 UserException (org.bimserver.shared.exceptions.UserException)4 WebModulePluginConfiguration (org.bimserver.models.store.WebModulePluginConfiguration)1 ServerException (org.bimserver.shared.exceptions.ServerException)1