Search in sources :

Example 6 with SetUserSettingDatabaseAction

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

the class PluginServiceImpl method setDefaultModelCompare.

public void setDefaultModelCompare(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.setDefaultModelCompare(find(userSettings.getModelCompares(), oid));
            }
        });
        session.executeAndCommitAction(action);
    } catch (BimserverDatabaseException e) {
        handleException(e);
    } finally {
        session.close();
    }
}
Also used : BimserverDatabaseException(org.bimserver.BimserverDatabaseException) UserSettingsSetter(org.bimserver.database.actions.UserSettingsSetter) DatabaseSession(org.bimserver.database.DatabaseSession) UserSettings(org.bimserver.models.store.UserSettings) SetUserSettingDatabaseAction(org.bimserver.database.actions.SetUserSettingDatabaseAction)

Aggregations

BimserverDatabaseException (org.bimserver.BimserverDatabaseException)6 DatabaseSession (org.bimserver.database.DatabaseSession)6 SetUserSettingDatabaseAction (org.bimserver.database.actions.SetUserSettingDatabaseAction)6 UserSettingsSetter (org.bimserver.database.actions.UserSettingsSetter)6 UserSettings (org.bimserver.models.store.UserSettings)6