Search in sources :

Example 1 with SGeometryInfo

use of org.bimserver.interfaces.objects.SGeometryInfo 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();
    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();
    }
}
Also used : SGeometryInfo(org.bimserver.interfaces.objects.SGeometryInfo) DatabaseSession(org.bimserver.database.DatabaseSession) GetGeometryInfoDatabaseAction(org.bimserver.database.actions.GetGeometryInfoDatabaseAction) IOException(java.io.IOException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException) SerializerException(org.bimserver.plugins.serializers.SerializerException) BcfException(org.opensourcebim.bcf.BcfException) UserException(org.bimserver.shared.exceptions.UserException) CannotBeScheduledException(org.bimserver.longaction.CannotBeScheduledException) DeserializeException(org.bimserver.plugins.deserializers.DeserializeException) ServerException(org.bimserver.shared.exceptions.ServerException) MessagingException(javax.mail.MessagingException) AddressException(javax.mail.internet.AddressException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) MalformedURLException(java.net.MalformedURLException)

Example 2 with SGeometryInfo

use of org.bimserver.interfaces.objects.SGeometryInfo in project BIMserver by opensourceBIM.

the class GetGeometryInfoDatabaseAction method execute.

@Override
public SGeometryInfo execute() throws UserException, BimserverDatabaseException, BimserverLockConflictException {
    Revision revision = getDatabaseSession().get(roid, OldQuery.getDefault());
    Project project = revision.getProject();
    PackageMetaData packageMetaData = bimServer.getMetaDataManager().getPackageMetaData(project.getSchema());
    IdEObject ifcProduct = getDatabaseSession().get(oid, new OldQuery(packageMetaData, project.getId(), revision.getId(), revision.getOid()));
    if (ifcProduct == null) {
        throw new UserException("Object with oid " + oid + " not found");
    }
    EStructuralFeature geometryFeature = packageMetaData.getEClass("IfcProduct").getEStructuralFeature("geometry");
    GeometryInfo geometry = (GeometryInfo) ifcProduct.eGet(geometryFeature);
    SGeometryInfo convertToSObject = bimServer.getSConverter().convertToSObject(geometry);
    return convertToSObject;
}
Also used : SGeometryInfo(org.bimserver.interfaces.objects.SGeometryInfo) Project(org.bimserver.models.store.Project) Revision(org.bimserver.models.store.Revision) IdEObject(org.bimserver.emf.IdEObject) PackageMetaData(org.bimserver.emf.PackageMetaData) EStructuralFeature(org.eclipse.emf.ecore.EStructuralFeature) GeometryInfo(org.bimserver.models.geometry.GeometryInfo) SGeometryInfo(org.bimserver.interfaces.objects.SGeometryInfo) UserException(org.bimserver.shared.exceptions.UserException) OldQuery(org.bimserver.database.OldQuery)

Aggregations

SGeometryInfo (org.bimserver.interfaces.objects.SGeometryInfo)2 UserException (org.bimserver.shared.exceptions.UserException)2 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 MalformedURLException (java.net.MalformedURLException)1 MessagingException (javax.mail.MessagingException)1 AddressException (javax.mail.internet.AddressException)1 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)1 DatabaseSession (org.bimserver.database.DatabaseSession)1 OldQuery (org.bimserver.database.OldQuery)1 GetGeometryInfoDatabaseAction (org.bimserver.database.actions.GetGeometryInfoDatabaseAction)1 IdEObject (org.bimserver.emf.IdEObject)1 PackageMetaData (org.bimserver.emf.PackageMetaData)1 CannotBeScheduledException (org.bimserver.longaction.CannotBeScheduledException)1 GeometryInfo (org.bimserver.models.geometry.GeometryInfo)1 Project (org.bimserver.models.store.Project)1 Revision (org.bimserver.models.store.Revision)1 DeserializeException (org.bimserver.plugins.deserializers.DeserializeException)1 SerializerException (org.bimserver.plugins.serializers.SerializerException)1 ServerException (org.bimserver.shared.exceptions.ServerException)1