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;
}
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;
}
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;
}
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()));
}
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;
}
Aggregations