Search in sources :

Example 1 with SQueryEnginePluginConfiguration

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

the class ServiceImpl method getQueryEngineExampleKeys.

@Override
public List<String> getQueryEngineExampleKeys(Long qeid) throws ServerException, UserException {
    requireRealUserAuthentication();
    SQueryEnginePluginConfiguration queryEngineById = getQueryEngineById(qeid);
    SPluginDescriptor pluginDescriptor = getServiceMap().getPluginInterface().getPluginDescriptor(queryEngineById.getPluginDescriptorId());
    QueryEnginePlugin queryEngine = getBimServer().getPluginManager().getQueryEngine(pluginDescriptor.getPluginClassName(), true);
    return new ArrayList<String>(queryEngine.getExampleKeys());
}
Also used : SPluginDescriptor(org.bimserver.interfaces.objects.SPluginDescriptor) SQueryEnginePluginConfiguration(org.bimserver.interfaces.objects.SQueryEnginePluginConfiguration) ArrayList(java.util.ArrayList) QueryEnginePlugin(org.bimserver.plugins.queryengine.QueryEnginePlugin)

Example 2 with SQueryEnginePluginConfiguration

use of org.bimserver.interfaces.objects.SQueryEnginePluginConfiguration 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();
    }
}
Also used : SQueryEnginePluginConfiguration(org.bimserver.interfaces.objects.SQueryEnginePluginConfiguration) QueryEnginePluginConfiguration(org.bimserver.models.store.QueryEnginePluginConfiguration) AddQueryEngineDatabaseAction(org.bimserver.database.actions.AddQueryEngineDatabaseAction) 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)

Example 3 with SQueryEnginePluginConfiguration

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

the class PluginServiceImpl method getAllQueryEngines.

@Override
public List<SQueryEnginePluginConfiguration> getAllQueryEngines(Boolean onlyEnabled) throws ServerException, UserException {
    requireRealUserAuthentication();
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        UserSettings userSettings = getUserSettings(session);
        List<SQueryEnginePluginConfiguration> queryEngines = getBimServer().getSConverter().convertToSListQueryEnginePluginConfiguration(userSettings.getQueryEngines());
        Collections.sort(queryEngines, new SPluginConfigurationComparator());
        return queryEngines;
    } 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) SQueryEnginePluginConfiguration(org.bimserver.interfaces.objects.SQueryEnginePluginConfiguration) IOException(java.io.IOException) ServerException(org.bimserver.shared.exceptions.ServerException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException) UserException(org.bimserver.shared.exceptions.UserException)

Example 4 with SQueryEnginePluginConfiguration

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

the class PluginServiceImpl method updateQueryEngine.

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

Example 5 with SQueryEnginePluginConfiguration

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

the class ServiceImpl method getQueryEngineExample.

@Override
public String getQueryEngineExample(Long qeid, String key) throws ServerException, UserException {
    requireRealUserAuthentication();
    SQueryEnginePluginConfiguration queryEngineById = getQueryEngineById(qeid);
    SPluginDescriptor pluginDescriptor = getServiceMap().getPluginInterface().getPluginDescriptor(queryEngineById.getPluginDescriptorId());
    QueryEnginePlugin queryEngine = getBimServer().getPluginManager().getQueryEngine(pluginDescriptor.getPluginClassName(), true);
    return queryEngine.getExample(key);
}
Also used : SPluginDescriptor(org.bimserver.interfaces.objects.SPluginDescriptor) SQueryEnginePluginConfiguration(org.bimserver.interfaces.objects.SQueryEnginePluginConfiguration) QueryEnginePlugin(org.bimserver.plugins.queryengine.QueryEnginePlugin)

Aggregations

SQueryEnginePluginConfiguration (org.bimserver.interfaces.objects.SQueryEnginePluginConfiguration)5 IOException (java.io.IOException)3 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)3 DatabaseSession (org.bimserver.database.DatabaseSession)3 ServerException (org.bimserver.shared.exceptions.ServerException)3 UserException (org.bimserver.shared.exceptions.UserException)3 SPluginDescriptor (org.bimserver.interfaces.objects.SPluginDescriptor)2 QueryEnginePluginConfiguration (org.bimserver.models.store.QueryEnginePluginConfiguration)2 QueryEnginePlugin (org.bimserver.plugins.queryengine.QueryEnginePlugin)2 ArrayList (java.util.ArrayList)1 AddQueryEngineDatabaseAction (org.bimserver.database.actions.AddQueryEngineDatabaseAction)1 UpdateQueryEngineDatabaseAction (org.bimserver.database.actions.UpdateQueryEngineDatabaseAction)1 UserSettings (org.bimserver.models.store.UserSettings)1 SPluginConfigurationComparator (org.bimserver.webservices.SPluginConfigurationComparator)1