Search in sources :

Example 1 with ModelComparePluginConfiguration

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

the class DeleteModelCompareDatabaseAction method execute.

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

Example 2 with ModelComparePluginConfiguration

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

the class DownloadCompareDatabaseAction method getModelCompare.

public org.bimserver.plugins.modelcompare.ModelCompare getModelCompare() throws ModelCompareException, BimserverDatabaseException {
    Revision revision1 = getDatabaseSession().get(roid1, OldQuery.getDefault());
    Revision revision2 = getDatabaseSession().get(roid2, OldQuery.getDefault());
    PackageMetaData packageMetaData = getBimServer().getMetaDataManager().getPackageMetaData(revision1.getProject().getSchema());
    if (revision1.getProject().getSchema().equals(revision2.getProject().getSchema())) {
        ModelComparePluginConfiguration modelCompareObject = getDatabaseSession().get(StorePackage.eINSTANCE.getModelComparePluginConfiguration(), mcid, OldQuery.getDefault());
        if (modelCompareObject != null) {
            ModelComparePlugin modelComparePlugin = getBimServer().getPluginManager().getModelComparePlugin(modelCompareObject.getPluginDescriptor().getPluginClassName(), true);
            if (modelComparePlugin != null) {
                org.bimserver.plugins.modelcompare.ModelCompare modelCompare = modelComparePlugin.createModelCompare(new PluginConfiguration(modelCompareObject.getSettings()), packageMetaData);
                return modelCompare;
            } else {
                throw new ModelCompareException("No Model Compare found " + modelCompareObject.getPluginDescriptor().getPluginClassName());
            }
        } else {
            throw new ModelCompareException("No configured Model Compare found");
        }
    } else {
        throw new ModelCompareException("Schemas not the same");
    }
}
Also used : ModelComparePlugin(org.bimserver.plugins.modelcompare.ModelComparePlugin) Revision(org.bimserver.models.store.Revision) PackageMetaData(org.bimserver.emf.PackageMetaData) ModelComparePluginConfiguration(org.bimserver.models.store.ModelComparePluginConfiguration) ModelComparePluginConfiguration(org.bimserver.models.store.ModelComparePluginConfiguration) PluginConfiguration(org.bimserver.plugins.PluginConfiguration) ModelCompareException(org.bimserver.plugins.modelcompare.ModelCompareException)

Example 3 with ModelComparePluginConfiguration

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

the class PluginServiceImpl method updateModelCompare.

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

Example 4 with ModelComparePluginConfiguration

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

the class PluginServiceImpl method addModelCompare.

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

Example 5 with ModelComparePluginConfiguration

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

the class CompareDatabaseAction method getModelCompare.

public org.bimserver.plugins.modelcompare.ModelCompare getModelCompare() throws ModelCompareException, BimserverDatabaseException {
    Revision revision1 = getDatabaseSession().get(roid1, OldQuery.getDefault());
    Revision revision2 = getDatabaseSession().get(roid2, OldQuery.getDefault());
    PackageMetaData packageMetaData = bimServer.getMetaDataManager().getPackageMetaData(revision1.getProject().getSchema());
    if (revision1.getProject().getSchema().equals(revision2.getProject().getSchema())) {
        ModelComparePluginConfiguration modelCompareObject = getDatabaseSession().get(StorePackage.eINSTANCE.getModelComparePluginConfiguration(), mcid, OldQuery.getDefault());
        if (modelCompareObject != null) {
            ModelComparePlugin modelComparePlugin = bimServer.getPluginManager().getModelComparePlugin(modelCompareObject.getPluginDescriptor().getPluginClassName(), true);
            if (modelComparePlugin != null) {
                org.bimserver.plugins.modelcompare.ModelCompare modelCompare = modelComparePlugin.createModelCompare(new PluginConfiguration(modelCompareObject.getSettings()), packageMetaData);
                return modelCompare;
            } else {
                throw new ModelCompareException("No Model Compare found " + modelCompareObject.getPluginDescriptor().getPluginClassName());
            }
        } else {
            throw new ModelCompareException("No configured Model Compare found");
        }
    } else {
        throw new ModelCompareException("Not the same schema");
    }
}
Also used : ModelComparePlugin(org.bimserver.plugins.modelcompare.ModelComparePlugin) Revision(org.bimserver.models.store.Revision) PackageMetaData(org.bimserver.emf.PackageMetaData) ModelComparePluginConfiguration(org.bimserver.models.store.ModelComparePluginConfiguration) ModelComparePluginConfiguration(org.bimserver.models.store.ModelComparePluginConfiguration) PluginConfiguration(org.bimserver.plugins.PluginConfiguration) ModelCompareException(org.bimserver.plugins.modelcompare.ModelCompareException)

Aggregations

ModelComparePluginConfiguration (org.bimserver.models.store.ModelComparePluginConfiguration)6 IOException (java.io.IOException)2 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)2 DatabaseSession (org.bimserver.database.DatabaseSession)2 PackageMetaData (org.bimserver.emf.PackageMetaData)2 SModelComparePluginConfiguration (org.bimserver.interfaces.objects.SModelComparePluginConfiguration)2 Revision (org.bimserver.models.store.Revision)2 PluginConfiguration (org.bimserver.plugins.PluginConfiguration)2 ModelCompareException (org.bimserver.plugins.modelcompare.ModelCompareException)2 ModelComparePlugin (org.bimserver.plugins.modelcompare.ModelComparePlugin)2 ServerException (org.bimserver.shared.exceptions.ServerException)2 UserException (org.bimserver.shared.exceptions.UserException)2 AddModelCompareDatabaseAction (org.bimserver.database.actions.AddModelCompareDatabaseAction)1 UpdateModelCompareDatabaseAction (org.bimserver.database.actions.UpdateModelCompareDatabaseAction)1 Condition (org.bimserver.database.query.conditions.Condition)1 IsOfTypeCondition (org.bimserver.database.query.conditions.IsOfTypeCondition)1 UserSettings (org.bimserver.models.store.UserSettings)1