use of org.bimserver.database.actions.ServerSettingsSetter in project BIMserver by opensourceBIM.
the class SettingsServiceImpl method setSmtpServer.
@Override
public void setSmtpServer(final String smtpServer) throws ServerException, UserException {
if (getBimServer().getServerInfo().getServerState() != ServerState.NOT_SETUP) {
requireAdminAuthentication();
}
if (smtpServer.trim().isEmpty()) {
throw new UserException("SMTP server 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.setSmtpServer(smtpServer);
}
});
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 setServerIcon.
@Override
public void setServerIcon(final String serverIcon) throws ServerException, UserException {
if (getBimServer().getServerInfo().getServerState() != ServerState.NOT_SETUP) {
requireAdminAuthentication();
}
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
SetServerSettingDatabaseAction action = new SetServerSettingDatabaseAction(getBimServer(), session, getInternalAccessMethod(), new ServerSettingsSetter() {
@Override
public void set(ServerSettings serverSettings) {
serverSettings.setIcon(serverIcon);
}
});
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 setServerDescription.
@Override
public void setServerDescription(final String serverDescription) throws ServerException, UserException {
if (getBimServer().getServerInfo().getServerState() != ServerState.NOT_SETUP) {
requireAdminAuthentication();
}
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
SetServerSettingDatabaseAction action = new SetServerSettingDatabaseAction(getBimServer(), session, getInternalAccessMethod(), new ServerSettingsSetter() {
@Override
public void set(ServerSettings serverSettings) {
serverSettings.setDescription(serverDescription);
}
});
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 setWhiteListedDomains.
@Override
public void setWhiteListedDomains(final List<String> domains) throws ServerException, UserException {
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
SetServerSettingDatabaseAction action = new SetServerSettingDatabaseAction(getBimServer(), session, getInternalAccessMethod(), new ServerSettingsSetter() {
@Override
public void set(ServerSettings serverSettings) {
serverSettings.getWhitelistedDomains().clear();
serverSettings.getWhitelistedDomains().addAll(domains);
}
});
session.executeAndCommitAction(action);
getBimServer().getServerSettingsCache().updateCache();
} catch (Exception e) {
handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.database.actions.ServerSettingsSetter in project BIMserver by opensourceBIM.
the class SettingsServiceImpl method setServerName.
@Override
public void setServerName(final String serverName) throws ServerException, UserException {
if (getBimServer().getServerInfo().getServerState() != ServerState.NOT_SETUP) {
requireAdminAuthentication();
}
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
SetServerSettingDatabaseAction action = new SetServerSettingDatabaseAction(getBimServer(), session, getInternalAccessMethod(), new ServerSettingsSetter() {
@Override
public void set(ServerSettings serverSettings) {
serverSettings.setName(serverName);
}
});
session.executeAndCommitAction(action);
} catch (BimserverDatabaseException e) {
handleException(e);
} finally {
session.close();
}
}
Aggregations