use of org.bimserver.shared.exceptions.ServerException in project BIMserver by opensourceBIM.
the class ServiceImpl method getOidByGuid.
public Long getOidByGuid(Long roid, String guid) throws ServerException, UserException {
requireAuthenticationAndRunningServer();
DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.READ_ONLY);
try {
BimDatabaseAction<Long> action = new GetOidByGuidDatabaseAction(session, getInternalAccessMethod(), roid, guid);
return session.executeAndCommitAction(action);
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.shared.exceptions.ServerException in project BIMserver by opensourceBIM.
the class ServiceImpl method getGeometryInfo.
@Override
public SGeometryInfo getGeometryInfo(Long roid, Long oid) throws UserException, ServerException {
requireAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.READ_ONLY);
try {
BimDatabaseAction<SGeometryInfo> action = new GetGeometryInfoDatabaseAction(getBimServer(), session, getInternalAccessMethod(), roid, oid, getAuthorization());
return session.executeAndCommitAction(action);
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.shared.exceptions.ServerException in project BIMserver by opensourceBIM.
the class ServiceImpl method getQueryEngineById.
@Override
public SQueryEnginePluginConfiguration getQueryEngineById(Long oid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.READ_ONLY);
try {
return getBimServer().getSConverter().convertToSObject(session.executeAndCommitAction(new GetQueryEngineByIdDatabaseAction(session, getInternalAccessMethod(), oid)));
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.shared.exceptions.ServerException in project BIMserver by opensourceBIM.
the class ServiceImpl method addExtendedDataSchema.
@Override
public Long addExtendedDataSchema(SExtendedDataSchema extendedDataSchema) throws ServerException, UserException {
// requireAdminAuthenticationAndRunningServer();
DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.POSSIBLY_WRITE);
try {
ExtendedDataSchema create = session.create(ExtendedDataSchema.class);
ExtendedDataSchema convert = getBimServer().getSConverter().convertFromSObject(extendedDataSchema, create, session);
return session.executeAndCommitAction(new AddExtendedDataSchemaDatabaseAction(session, getInternalAccessMethod(), convert));
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.shared.exceptions.ServerException in project BIMserver by opensourceBIM.
the class ServiceImpl method listBoundingBoxes.
public List<SBounds> listBoundingBoxes(Set<Long> roids) throws ServerException, UserException {
try (DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.READ_ONLY)) {
List<SBounds> results = new ArrayList<>();
Set<Region> regions = new HashSet<>();
for (long roid : roids) {
Revision revision = session.get(roid, OldQuery.getDefault());
for (ConcreteRevision concreteRevision : revision.getConcreteRevisions()) {
Bounds bounds = concreteRevision.getBounds();
if (bounds.getMin().getX() == Double.MAX_VALUE || bounds.getMin().getY() == Double.MAX_VALUE || bounds.getMin().getZ() == Double.MAX_VALUE || bounds.getMax().getX() == -Double.MAX_VALUE || bounds.getMax().getY() == -Double.MAX_VALUE || bounds.getMax().getZ() == -Double.MAX_VALUE) {
// Probably no objects or weird error, let's skip this one
continue;
}
scaleBounds(bounds, concreteRevision.getMultiplierToMm());
boolean integrated = false;
for (Region region : regions) {
if (region.canAccept(bounds)) {
region.integrate(bounds);
integrated = true;
break;
}
}
if (!integrated) {
Region region = new Region(bounds);
regions.add(region);
}
}
}
for (Region region : regions) {
results.add(region.toSBounds());
}
return results;
} catch (Exception e) {
return handleException(e);
}
}
Aggregations