Search in sources :

Example 11 with UserSettings

use of org.bimserver.models.store.UserSettings in project BIMserver by opensourceBIM.

the class DeleteRenderEngineDatabaseAction method execute.

@Override
public Void execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
    RenderEnginePluginConfiguration object = getDatabaseSession().get(geteClass(), getOid(), OldQuery.getDefault());
    UserSettings settings = object.getUserSettings();
    settings.getRenderEngines().remove(object);
    getDatabaseSession().store(settings);
    return super.execute();
}
Also used : RenderEnginePluginConfiguration(org.bimserver.models.store.RenderEnginePluginConfiguration) UserSettings(org.bimserver.models.store.UserSettings)

Example 12 with UserSettings

use of org.bimserver.models.store.UserSettings in project BIMserver by opensourceBIM.

the class DeleteSerializerDatabaseAction method execute.

@Override
public Void execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
    SerializerPluginConfiguration object = getDatabaseSession().get(geteClass(), getOid(), OldQuery.getDefault());
    UserSettings settings = object.getUserSettings();
    settings.getSerializers().remove(object);
    getDatabaseSession().store(settings);
    return super.execute();
}
Also used : UserSettings(org.bimserver.models.store.UserSettings) SerializerPluginConfiguration(org.bimserver.models.store.SerializerPluginConfiguration)

Example 13 with UserSettings

use of org.bimserver.models.store.UserSettings 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 14 with UserSettings

use of org.bimserver.models.store.UserSettings 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 15 with UserSettings

use of org.bimserver.models.store.UserSettings 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)

Aggregations

UserSettings (org.bimserver.models.store.UserSettings)43 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)29 DatabaseSession (org.bimserver.database.DatabaseSession)29 UserException (org.bimserver.shared.exceptions.UserException)22 IOException (java.io.IOException)18 ServerException (org.bimserver.shared.exceptions.ServerException)18 SPluginConfigurationComparator (org.bimserver.webservices.SPluginConfigurationComparator)10 User (org.bimserver.models.store.User)9 SerializerPluginConfiguration (org.bimserver.models.store.SerializerPluginConfiguration)7 ArrayList (java.util.ArrayList)6 SetUserSettingDatabaseAction (org.bimserver.database.actions.SetUserSettingDatabaseAction)6 UserSettingsSetter (org.bimserver.database.actions.UserSettingsSetter)6 InternalServicePluginConfiguration (org.bimserver.models.store.InternalServicePluginConfiguration)5 PluginConfiguration (org.bimserver.plugins.PluginConfiguration)5 IfcModelInterface (org.bimserver.emf.IfcModelInterface)4 SDeserializerPluginConfiguration (org.bimserver.interfaces.objects.SDeserializerPluginConfiguration)4 DeserializerPluginConfiguration (org.bimserver.models.store.DeserializerPluginConfiguration)4 RenderEnginePluginConfiguration (org.bimserver.models.store.RenderEnginePluginConfiguration)4 List (java.util.List)3 OldQuery (org.bimserver.database.OldQuery)3