Search in sources :

Example 1 with SModelMergerPluginConfiguration

use of org.bimserver.interfaces.objects.SModelMergerPluginConfiguration in project BIMserver by opensourceBIM.

the class PluginServiceImpl method getAllModelMergers.

@Override
public List<SModelMergerPluginConfiguration> getAllModelMergers(Boolean onlyEnabled) throws ServerException, UserException {
    requireRealUserAuthentication();
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        UserSettings userSettings = getUserSettings(session);
        List<SModelMergerPluginConfiguration> modelMergers = getBimServer().getSConverter().convertToSListModelMergerPluginConfiguration(userSettings.getModelMergers());
        Collections.sort(modelMergers, new SPluginConfigurationComparator());
        return modelMergers;
    } catch (Exception e) {
        return handleException(e);
    } finally {
        session.close();
    }
}
Also used : SPluginConfigurationComparator(org.bimserver.webservices.SPluginConfigurationComparator) DatabaseSession(org.bimserver.database.DatabaseSession) UserSettings(org.bimserver.models.store.UserSettings) SModelMergerPluginConfiguration(org.bimserver.interfaces.objects.SModelMergerPluginConfiguration) IOException(java.io.IOException) ServerException(org.bimserver.shared.exceptions.ServerException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException) UserException(org.bimserver.shared.exceptions.UserException)

Example 2 with SModelMergerPluginConfiguration

use of org.bimserver.interfaces.objects.SModelMergerPluginConfiguration in project BIMserver by opensourceBIM.

the class PluginServiceImpl method addModelMerger.

@Override
public Long addModelMerger(SModelMergerPluginConfiguration modelMerger) throws ServerException, UserException {
    requireRealUserAuthentication();
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        ModelMergerPluginConfiguration convert = getBimServer().getSConverter().convertFromSObject(modelMerger, session);
        return session.executeAndCommitAction(new AddModelMergerDatabaseAction(session, getInternalAccessMethod(), getAuthorization(), convert));
    } catch (Exception e) {
        return handleException(e);
    } finally {
        session.close();
    }
}
Also used : ModelMergerPluginConfiguration(org.bimserver.models.store.ModelMergerPluginConfiguration) SModelMergerPluginConfiguration(org.bimserver.interfaces.objects.SModelMergerPluginConfiguration) DatabaseSession(org.bimserver.database.DatabaseSession) AddModelMergerDatabaseAction(org.bimserver.database.actions.AddModelMergerDatabaseAction) IOException(java.io.IOException) ServerException(org.bimserver.shared.exceptions.ServerException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException) UserException(org.bimserver.shared.exceptions.UserException)

Example 3 with SModelMergerPluginConfiguration

use of org.bimserver.interfaces.objects.SModelMergerPluginConfiguration in project BIMserver by opensourceBIM.

the class PluginServiceImpl method updateModelMerger.

@Override
public void updateModelMerger(SModelMergerPluginConfiguration modelMerger) throws ServerException, UserException {
    requireRealUserAuthentication();
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        ModelMergerPluginConfiguration convert = session.get(modelMerger.getOid(), OldQuery.getDefault());
        getBimServer().getSConverter().convertFromSObject(modelMerger, convert, session);
        session.executeAndCommitAction(new UpdateModelMergerDatabaseAction(session, getInternalAccessMethod(), convert));
    } catch (Exception e) {
        handleException(e);
    } finally {
        session.close();
    }
}
Also used : ModelMergerPluginConfiguration(org.bimserver.models.store.ModelMergerPluginConfiguration) SModelMergerPluginConfiguration(org.bimserver.interfaces.objects.SModelMergerPluginConfiguration) UpdateModelMergerDatabaseAction(org.bimserver.database.actions.UpdateModelMergerDatabaseAction) DatabaseSession(org.bimserver.database.DatabaseSession) IOException(java.io.IOException) ServerException(org.bimserver.shared.exceptions.ServerException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException) UserException(org.bimserver.shared.exceptions.UserException)

Aggregations

IOException (java.io.IOException)3 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)3 DatabaseSession (org.bimserver.database.DatabaseSession)3 SModelMergerPluginConfiguration (org.bimserver.interfaces.objects.SModelMergerPluginConfiguration)3 ServerException (org.bimserver.shared.exceptions.ServerException)3 UserException (org.bimserver.shared.exceptions.UserException)3 ModelMergerPluginConfiguration (org.bimserver.models.store.ModelMergerPluginConfiguration)2 AddModelMergerDatabaseAction (org.bimserver.database.actions.AddModelMergerDatabaseAction)1 UpdateModelMergerDatabaseAction (org.bimserver.database.actions.UpdateModelMergerDatabaseAction)1 UserSettings (org.bimserver.models.store.UserSettings)1 SPluginConfigurationComparator (org.bimserver.webservices.SPluginConfigurationComparator)1