Search in sources :

Example 6 with IsOfTypeCondition

use of org.bimserver.database.query.conditions.IsOfTypeCondition in project BIMserver by opensourceBIM.

the class GetAllModelComparesDatabaseAction method execute.

@Override
public List<ModelComparePluginConfiguration> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
    Condition condition = new IsOfTypeCondition(StorePackage.eINSTANCE.getModelComparePluginConfiguration());
    Map<Long, ModelComparePluginConfiguration> result = getDatabaseSession().query(condition, ModelComparePluginConfiguration.class, OldQuery.getDefault());
    List<ModelComparePluginConfiguration> mapToList = CollectionUtils.mapToList(result);
    if (onlyEnabled) {
        Iterator<ModelComparePluginConfiguration> iterator = mapToList.iterator();
        while (iterator.hasNext()) {
            ModelComparePluginConfiguration modelCompare = iterator.next();
            if (!bimServer.getPluginManager().isEnabled(modelCompare.getPluginDescriptor().getPluginClassName()) || !modelCompare.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) ModelComparePluginConfiguration(org.bimserver.models.store.ModelComparePluginConfiguration)

Example 7 with IsOfTypeCondition

use of org.bimserver.database.query.conditions.IsOfTypeCondition in project BIMserver by opensourceBIM.

the class GetAllQueryEnginesDatabaseAction method execute.

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

Example 8 with IsOfTypeCondition

use of org.bimserver.database.query.conditions.IsOfTypeCondition in project BIMserver by opensourceBIM.

the class GetAllSerializersDatabaseAction method execute.

@Override
public List<SerializerPluginConfiguration> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
    Condition condition = new IsOfTypeCondition(StorePackage.eINSTANCE.getSerializerPluginConfiguration());
    Map<Long, SerializerPluginConfiguration> result = getDatabaseSession().query(condition, SerializerPluginConfiguration.class, OldQuery.getDefault());
    List<SerializerPluginConfiguration> mapToList = CollectionUtils.mapToList(result);
    if (onlyEnabled) {
        Iterator<SerializerPluginConfiguration> iterator = mapToList.iterator();
        while (iterator.hasNext()) {
            SerializerPluginConfiguration serializer = iterator.next();
            if (!bimServer.getPluginManager().isEnabled(serializer.getPluginDescriptor().getPluginClassName()) || !serializer.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) SerializerPluginConfiguration(org.bimserver.models.store.SerializerPluginConfiguration)

Example 9 with IsOfTypeCondition

use of org.bimserver.database.query.conditions.IsOfTypeCondition in project BIMserver by opensourceBIM.

the class GetAllUsersDatabaseAction method execute.

@Override
public Set<User> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
    User actingUser = getUserByUoid(authorization.getUoid());
    Condition condition = new IsOfTypeCondition(StorePackage.eINSTANCE.getUser());
    condition = condition.and(new Not(new AttributeCondition(StorePackage.eINSTANCE.getUser_UserType(), new EnumLiteral(UserType.SYSTEM))));
    if (actingUser.getUserType() != UserType.ADMIN) {
        condition = condition.and(new AttributeCondition(StorePackage.eINSTANCE.getUser_State(), new EnumLiteral(ObjectState.ACTIVE)));
    }
    return CollectionUtils.mapToSet(getDatabaseSession().query(condition, User.class, OldQuery.getDefault()));
}
Also used : IsOfTypeCondition(org.bimserver.database.query.conditions.IsOfTypeCondition) AttributeCondition(org.bimserver.database.query.conditions.AttributeCondition) Condition(org.bimserver.database.query.conditions.Condition) Not(org.bimserver.database.query.conditions.Not) User(org.bimserver.models.store.User) IsOfTypeCondition(org.bimserver.database.query.conditions.IsOfTypeCondition) AttributeCondition(org.bimserver.database.query.conditions.AttributeCondition) EnumLiteral(org.bimserver.database.query.literals.EnumLiteral)

Example 10 with IsOfTypeCondition

use of org.bimserver.database.query.conditions.IsOfTypeCondition in project BIMserver by opensourceBIM.

the class GetAllRenderEnginesDatabaseAction method execute.

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

Aggregations

IsOfTypeCondition (org.bimserver.database.query.conditions.IsOfTypeCondition)11 Condition (org.bimserver.database.query.conditions.Condition)10 User (org.bimserver.models.store.User)3 AttributeCondition (org.bimserver.database.query.conditions.AttributeCondition)2 Not (org.bimserver.database.query.conditions.Not)2 EnumLiteral (org.bimserver.database.query.literals.EnumLiteral)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 AndCondition (org.bimserver.database.query.conditions.AndCondition)1 HasReferenceToCondition (org.bimserver.database.query.conditions.HasReferenceToCondition)1 StringLiteral (org.bimserver.database.query.literals.StringLiteral)1 LogAction (org.bimserver.models.log.LogAction)1 DeserializerPluginConfiguration (org.bimserver.models.store.DeserializerPluginConfiguration)1 ModelComparePluginConfiguration (org.bimserver.models.store.ModelComparePluginConfiguration)1 ModelMergerPluginConfiguration (org.bimserver.models.store.ModelMergerPluginConfiguration)1 ObjectIDMPluginConfiguration (org.bimserver.models.store.ObjectIDMPluginConfiguration)1 Project (org.bimserver.models.store.Project)1 QueryEnginePluginConfiguration (org.bimserver.models.store.QueryEnginePluginConfiguration)1 RenderEnginePluginConfiguration (org.bimserver.models.store.RenderEnginePluginConfiguration)1 SerializerPluginConfiguration (org.bimserver.models.store.SerializerPluginConfiguration)1