Search in sources :

Example 1 with SDataObject

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

the class LowLevelServiceImpl method getDataObjectByGuid.

@Override
public SDataObject getDataObjectByGuid(Long roid, String guid) throws ServerException, UserException {
    requireAuthenticationAndRunningServer();
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        BimDatabaseAction<DataObject> action = new GetDataObjectByGuidDatabaseAction(getBimServer(), session, getInternalAccessMethod(), roid, guid, getAuthorization());
        SDataObject dataObject = getBimServer().getSConverter().convertToSObject(session.executeAndCommitAction(action));
        return dataObject;
    } catch (Exception e) {
        return handleException(e);
    } finally {
        session.close();
    }
}
Also used : SDataObject(org.bimserver.interfaces.objects.SDataObject) DataObject(org.bimserver.models.store.DataObject) DatabaseSession(org.bimserver.database.DatabaseSession) GetDataObjectByGuidDatabaseAction(org.bimserver.database.actions.GetDataObjectByGuidDatabaseAction) SDataObject(org.bimserver.interfaces.objects.SDataObject) UserException(org.bimserver.shared.exceptions.UserException) NoTransactionException(org.bimserver.webservices.NoTransactionException) ServerException(org.bimserver.shared.exceptions.ServerException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException)

Example 2 with SDataObject

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

the class LowLevelServiceImpl method getDataObjectByOid.

@Override
public SDataObject getDataObjectByOid(Long roid, Long oid) throws ServerException, UserException {
    requireAuthenticationAndRunningServer();
    DatabaseSession session = getBimServer().getDatabase().createSession();
    try {
        BimDatabaseAction<DataObject> action = new GetDataObjectByOidDatabaseAction(getBimServer(), session, getInternalAccessMethod(), roid, oid, getAuthorization());
        SDataObject dataObject = getBimServer().getSConverter().convertToSObject(session.executeAndCommitAction(action));
        return dataObject;
    } catch (Exception e) {
        return handleException(e);
    } finally {
        session.close();
    }
}
Also used : GetDataObjectByOidDatabaseAction(org.bimserver.database.actions.GetDataObjectByOidDatabaseAction) SDataObject(org.bimserver.interfaces.objects.SDataObject) DataObject(org.bimserver.models.store.DataObject) DatabaseSession(org.bimserver.database.DatabaseSession) SDataObject(org.bimserver.interfaces.objects.SDataObject) UserException(org.bimserver.shared.exceptions.UserException) NoTransactionException(org.bimserver.webservices.NoTransactionException) ServerException(org.bimserver.shared.exceptions.ServerException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException)

Aggregations

BimserverDatabaseException (org.bimserver.BimserverDatabaseException)2 DatabaseSession (org.bimserver.database.DatabaseSession)2 SDataObject (org.bimserver.interfaces.objects.SDataObject)2 DataObject (org.bimserver.models.store.DataObject)2 ServerException (org.bimserver.shared.exceptions.ServerException)2 UserException (org.bimserver.shared.exceptions.UserException)2 NoTransactionException (org.bimserver.webservices.NoTransactionException)2 GetDataObjectByGuidDatabaseAction (org.bimserver.database.actions.GetDataObjectByGuidDatabaseAction)1 GetDataObjectByOidDatabaseAction (org.bimserver.database.actions.GetDataObjectByOidDatabaseAction)1