Search in sources :

Example 1 with DownloadByNewJsonQueryDatabaseAction

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

the class LongDownloadAction method init.

public void init(Thread thread) {
    super.init(thread);
    if (getBimServer().getServerSettingsCache().getServerSettings().getCacheOutputFiles() && getBimServer().getDiskCacheManager().contains(downloadParameters)) {
        return;
    }
    ObjectIDM objectIDM = null;
    if (downloadParameters.getUseObjectIDM()) {
        session = getBimServer().getDatabase().createSession();
        try {
            SerializerPluginConfiguration serializerPluginConfiguration = session.get(StorePackage.eINSTANCE.getSerializerPluginConfiguration(), downloadParameters.getSerializerOid(), OldQuery.getDefault());
            if (serializerPluginConfiguration != null) {
                ObjectIDMPluginConfiguration objectIdm = serializerPluginConfiguration.getObjectIDM();
                if (objectIdm != null) {
                    ObjectIDMPlugin objectIDMPlugin = getBimServer().getPluginManager().getObjectIDMByName(objectIdm.getPluginDescriptor().getPluginClassName(), true);
                    if (objectIDMPlugin != null) {
                        objectIDM = objectIDMPlugin.getObjectIDM(new PluginConfiguration());
                    }
                }
            }
        } catch (BimserverDatabaseException e) {
            LOGGER.error("", e);
        } finally {
            session.close();
        }
    }
    session = getBimServer().getDatabase().createSession();
    switch(downloadParameters.getDownloadType()) {
        case DOWNLOAD_BY_NEW_JSON_QUERY:
            action = new DownloadByNewJsonQueryDatabaseAction(getBimServer(), session, accessMethod, downloadParameters.getRoids(), downloadParameters.getJsonQuery(), downloadParameters.getSerializerOid(), getAuthorization());
            break;
        case DOWNLOAD_PROJECTS:
            action = new DownloadProjectsDatabaseAction(getBimServer(), session, accessMethod, downloadParameters.getRoids(), downloadParameters.getSerializerOid(), getAuthorization(), objectIDM);
            break;
        case DOWNLOAD_COMPARE:
            action = new DownloadCompareDatabaseAction(getBimServer(), session, accessMethod, downloadParameters.getRoids(), downloadParameters.getModelCompareIdentifier(), downloadParameters.getCompareType(), getAuthorization(), objectIDM);
            break;
    }
    action.addProgressListener(this);
}
Also used : DownloadProjectsDatabaseAction(org.bimserver.database.actions.DownloadProjectsDatabaseAction) BimserverDatabaseException(org.bimserver.BimserverDatabaseException) ObjectIDMPluginConfiguration(org.bimserver.models.store.ObjectIDMPluginConfiguration) DownloadCompareDatabaseAction(org.bimserver.database.actions.DownloadCompareDatabaseAction) DownloadByNewJsonQueryDatabaseAction(org.bimserver.database.actions.DownloadByNewJsonQueryDatabaseAction) SerializerPluginConfiguration(org.bimserver.models.store.SerializerPluginConfiguration) SerializerPluginConfiguration(org.bimserver.models.store.SerializerPluginConfiguration) ObjectIDMPluginConfiguration(org.bimserver.models.store.ObjectIDMPluginConfiguration) PluginConfiguration(org.bimserver.plugins.PluginConfiguration) ObjectIDMPlugin(org.bimserver.plugins.objectidms.ObjectIDMPlugin) ObjectIDM(org.bimserver.plugins.objectidms.ObjectIDM)

Aggregations

BimserverDatabaseException (org.bimserver.BimserverDatabaseException)1 DownloadByNewJsonQueryDatabaseAction (org.bimserver.database.actions.DownloadByNewJsonQueryDatabaseAction)1 DownloadCompareDatabaseAction (org.bimserver.database.actions.DownloadCompareDatabaseAction)1 DownloadProjectsDatabaseAction (org.bimserver.database.actions.DownloadProjectsDatabaseAction)1 ObjectIDMPluginConfiguration (org.bimserver.models.store.ObjectIDMPluginConfiguration)1 SerializerPluginConfiguration (org.bimserver.models.store.SerializerPluginConfiguration)1 PluginConfiguration (org.bimserver.plugins.PluginConfiguration)1 ObjectIDM (org.bimserver.plugins.objectidms.ObjectIDM)1 ObjectIDMPlugin (org.bimserver.plugins.objectidms.ObjectIDMPlugin)1