use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.
the class PluginServiceImpl method setDefaultRenderEngine.
public void setDefaultRenderEngine(final Long oid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
SetUserSettingDatabaseAction action = new SetUserSettingDatabaseAction(session, getInternalAccessMethod(), getAuthorization(), new UserSettingsSetter() {
@Override
public void set(UserSettings userSettings) {
userSettings.setDefaultRenderEngine(find(userSettings.getRenderEngines(), oid));
}
});
session.executeAndCommitAction(action);
} catch (BimserverDatabaseException e) {
handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.
the class PluginServiceImpl method addQueryEngine.
@Override
public Long addQueryEngine(SQueryEnginePluginConfiguration queryEngine) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
QueryEnginePluginConfiguration convert = getBimServer().getSConverter().convertFromSObject(queryEngine, session);
return session.executeAndCommitAction(new AddQueryEngineDatabaseAction(session, getInternalAccessMethod(), getAuthorization(), convert));
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.
the class PluginServiceImpl method setDefaultQueryEngine.
public void setDefaultQueryEngine(final Long oid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
SetUserSettingDatabaseAction action = new SetUserSettingDatabaseAction(session, getInternalAccessMethod(), getAuthorization(), new UserSettingsSetter() {
@Override
public void set(UserSettings userSettings) {
userSettings.setDefaultQueryEngine(find(userSettings.getQueryEngines(), oid));
}
});
session.executeAndCommitAction(action);
} catch (BimserverDatabaseException e) {
handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.
the class PluginServiceImpl method getInstalledPluginBundles.
@Override
public List<SPluginBundle> getInstalledPluginBundles() throws UserException, ServerException {
// TODO make sure the database oid's are also coming in with this
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
return session.executeAndCommitAction(new GetInstalledPluginBundles(session, getInternalAccessMethod(), getBimServer(), getBimServer().getServerSettingsCache().getServerSettings().isPluginStrictVersionChecking()));
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.
the class PluginServiceImpl method setDefaultSerializer.
public void setDefaultSerializer(final Long oid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
SetUserSettingDatabaseAction action = new SetUserSettingDatabaseAction(session, getInternalAccessMethod(), getAuthorization(), new UserSettingsSetter() {
@Override
public void set(UserSettings userSettings) {
userSettings.setDefaultSerializer(find(userSettings.getSerializers(), oid));
}
});
session.executeAndCommitAction(action);
} catch (BimserverDatabaseException e) {
handleException(e);
} finally {
session.close();
}
}
Aggregations