use of org.bimserver.database.actions.ServerSettingsSetter in project BIMserver by opensourceBIM.
the class WebModuleManager method setDefault.
public void setDefault(Long oid) throws BimserverDatabaseException, UserException, ServerException {
DatabaseSession session = bimServer.getDatabase().createSession();
try {
final WebModulePluginConfiguration defaultWebModule = session.get(StorePackage.eINSTANCE.getWebModulePluginConfiguration(), oid, OldQuery.getDefault());
bimServer.setDefaultWebModule((WebModulePlugin) bimServer.getPluginManager().getPlugin(defaultWebModule.getPluginDescriptor().getPluginClassName(), true));
SetServerSettingDatabaseAction action = new SetServerSettingDatabaseAction(bimServer, session, AccessMethod.INTERNAL, new ServerSettingsSetter() {
@Override
public void set(ServerSettings serverSettings) {
serverSettings.setWebModule(defaultWebModule);
}
});
session.executeAndCommitAction(action);
} finally {
session.close();
}
}
use of org.bimserver.database.actions.ServerSettingsSetter in project BIMserver by opensourceBIM.
the class SettingsServiceImpl method setAllowUsersToCreateTopLevelProjects.
@Override
public void setAllowUsersToCreateTopLevelProjects(final Boolean allowUsersToCreateTopLevelProjects) 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.setAllowUsersToCreateTopLevelProjects(allowUsersToCreateTopLevelProjects);
}
});
session.executeAndCommitAction(action);
} catch (BimserverDatabaseException e) {
handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.database.actions.ServerSettingsSetter in project BIMserver by opensourceBIM.
the class SettingsServiceImpl method setEmailSenderAddress.
@Override
public void setEmailSenderAddress(final String emailSenderAddress) throws ServerException, UserException {
if (getBimServer().getServerInfo().getServerState() != ServerState.NOT_SETUP) {
requireAdminAuthentication();
}
if (emailSenderAddress.trim().isEmpty()) {
throw new UserException("Email sender address cannot be empty");
}
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
SetServerSettingDatabaseAction action = new SetServerSettingDatabaseAction(getBimServer(), session, getInternalAccessMethod(), new ServerSettingsSetter() {
@Override
public void set(ServerSettings serverSettings) {
serverSettings.setEmailSenderAddress(emailSenderAddress);
}
});
session.executeAndCommitAction(action);
} catch (BimserverDatabaseException e) {
handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.database.actions.ServerSettingsSetter in project BIMserver by opensourceBIM.
the class SettingsServiceImpl method setAllowSelfRegistration.
@Override
public void setAllowSelfRegistration(final Boolean allowSelfRegistration) 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.setAllowSelfRegistration(allowSelfRegistration);
}
});
session.executeAndCommitAction(action);
} catch (BimserverDatabaseException e) {
handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.database.actions.ServerSettingsSetter in project BIMserver by opensourceBIM.
the class SettingsServiceImpl method setProtocolBuffersPort.
@Override
public void setProtocolBuffersPort(final Integer port) 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.setProtocolBuffersPort(port);
}
});
session.executeAndCommitAction(action);
} catch (BimserverDatabaseException e) {
handleException(e);
} finally {
session.close();
}
}
Aggregations