Search in sources :

Example 1 with SetUserSettingDatabaseAction

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

the class PluginServiceImpl method setDefaultModelMerger.

public void setDefaultModelMerger(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.setDefaultModelMerger(find(userSettings.getModelMergers(), 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)

Example 2 with SetUserSettingDatabaseAction

use of org.bimserver.database.actions.SetUserSettingDatabaseAction 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();
    }
}
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)

Example 3 with SetUserSettingDatabaseAction

use of org.bimserver.database.actions.SetUserSettingDatabaseAction 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();
    }
}
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)

Example 4 with SetUserSettingDatabaseAction

use of org.bimserver.database.actions.SetUserSettingDatabaseAction 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();
    }
}
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)

Example 5 with SetUserSettingDatabaseAction

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

the class PluginServiceImpl method setDefaultObjectIDM.

public void setDefaultObjectIDM(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.setDefaultObjectIDM(find(userSettings.getObjectIDMs(), 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