Search in sources :

Example 1 with ObjectIDMPluginConfiguration

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

the class DeleteObjectIDMDatabaseAction method execute.

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

Example 2 with ObjectIDMPluginConfiguration

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

the class GetAllObjectIDMsDatabaseAction method execute.

public List<ObjectIDMPluginConfiguration> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
    Condition condition = new IsOfTypeCondition(StorePackage.eINSTANCE.getObjectIDMPluginConfiguration());
    Map<Long, ObjectIDMPluginConfiguration> result = getDatabaseSession().query(condition, ObjectIDMPluginConfiguration.class, OldQuery.getDefault());
    List<ObjectIDMPluginConfiguration> mapToList = CollectionUtils.mapToList(result);
    if (onlyEnabled) {
        Iterator<ObjectIDMPluginConfiguration> iterator = mapToList.iterator();
        while (iterator.hasNext()) {
            ObjectIDMPluginConfiguration objectIdm = iterator.next();
            if (!bimServer.getPluginManager().isEnabled(objectIdm.getPluginDescriptor().getPluginClassName()) || !objectIdm.getEnabled()) {
                iterator.remove();
            }
        }
    }
    return mapToList;
}
Also used : IsOfTypeCondition(org.bimserver.database.query.conditions.IsOfTypeCondition) Condition(org.bimserver.database.query.conditions.Condition) IsOfTypeCondition(org.bimserver.database.query.conditions.IsOfTypeCondition) ObjectIDMPluginConfiguration(org.bimserver.models.store.ObjectIDMPluginConfiguration)

Example 3 with ObjectIDMPluginConfiguration

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

ObjectIDMPluginConfiguration (org.bimserver.models.store.ObjectIDMPluginConfiguration)3 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 Condition (org.bimserver.database.query.conditions.Condition)1 IsOfTypeCondition (org.bimserver.database.query.conditions.IsOfTypeCondition)1 SerializerPluginConfiguration (org.bimserver.models.store.SerializerPluginConfiguration)1 UserSettings (org.bimserver.models.store.UserSettings)1 PluginConfiguration (org.bimserver.plugins.PluginConfiguration)1 ObjectIDM (org.bimserver.plugins.objectidms.ObjectIDM)1 ObjectIDMPlugin (org.bimserver.plugins.objectidms.ObjectIDMPlugin)1