use of org.bimserver.database.query.conditions.Condition in project BIMserver by opensourceBIM.
the class GetAllRevisionsByUserDatabaseAction method execute.
@Override
public Set<Revision> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
User user = getUserByUoid(uoid);
Condition condition = new HasReferenceToCondition(StorePackage.eINSTANCE.getRevision_User(), user);
return CollectionUtils.mapToSet(getDatabaseSession().query(condition, Revision.class, OldQuery.getDefault()));
}
use of org.bimserver.database.query.conditions.Condition in project BIMserver by opensourceBIM.
the class RemoteServiceImpl method getPrivateProfiles.
@Override
public List<SProfileDescriptor> getPrivateProfiles(String serviceIdentifier, String token) throws UserException, ServerException {
DatabaseSession session = getServiceMap().getBimServer().getDatabase().createSession();
List<SProfileDescriptor> descriptors = new ArrayList<SProfileDescriptor>();
try {
Condition condition = new AttributeCondition(StorePackage.eINSTANCE.getUser_Token(), new StringLiteral(token));
User user = session.querySingle(condition, User.class, OldQuery.getDefault());
if (user != null) {
for (InternalServicePluginConfiguration internalServicePluginConfiguration : user.getUserSettings().getServices()) {
if (internalServicePluginConfiguration.getPluginDescriptor().getPluginClassName().equals(serviceIdentifier)) {
SProfileDescriptor sProfileDescriptor = new SProfileDescriptor();
descriptors.add(sProfileDescriptor);
sProfileDescriptor.setIdentifier("" + internalServicePluginConfiguration.getOid());
sProfileDescriptor.setName(internalServicePluginConfiguration.getName());
sProfileDescriptor.setDescription(internalServicePluginConfiguration.getDescription());
sProfileDescriptor.setPublicProfile(false);
}
}
}
} catch (BimserverDatabaseException e) {
handleException(e);
} finally {
session.close();
}
return descriptors;
}
use of org.bimserver.database.query.conditions.Condition in project BIMserver by opensourceBIM.
the class GetAllCheckoutsOfRevisionDatabaseAction method execute.
@Override
public List<Checkout> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
Revision revision = getRevisionByRoid(roid);
Condition condition = new HasReferenceToCondition(StorePackage.eINSTANCE.getCheckout_Revision(), revision);
return CollectionUtils.mapToList(getDatabaseSession().query(condition, Checkout.class, OldQuery.getDefault()));
}
use of org.bimserver.database.query.conditions.Condition 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.Condition in project BIMserver by opensourceBIM.
the class GetAllModelMergersDatabaseAction method execute.
@Override
public List<ModelMergerPluginConfiguration> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
Condition condition = new IsOfTypeCondition(StorePackage.eINSTANCE.getModelMergerPluginConfiguration());
Map<Long, ModelMergerPluginConfiguration> result = getDatabaseSession().query(condition, ModelMergerPluginConfiguration.class, OldQuery.getDefault());
List<ModelMergerPluginConfiguration> mapToList = CollectionUtils.mapToList(result);
if (onlyEnabled) {
Iterator<ModelMergerPluginConfiguration> iterator = mapToList.iterator();
while (iterator.hasNext()) {
ModelMergerPluginConfiguration modelMerger = iterator.next();
if (!bimServer.getPluginManager().isEnabled(modelMerger.getPluginDescriptor().getPluginClassName()) || !modelMerger.getEnabled()) {
iterator.remove();
}
}
}
return mapToList;
}
Aggregations