use of org.bimserver.shared.exceptions.UserException 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();
}
}
use of org.bimserver.shared.exceptions.UserException 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();
}
}
use of org.bimserver.shared.exceptions.UserException in project BIMserver by opensourceBIM.
the class LowLevelServiceImpl method getReferences.
@SuppressWarnings("unchecked")
@Override
public List<Long> getReferences(Long tid, Long oid, String referenceName) throws ServerException, UserException {
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
LongTransaction transaction = getBimServer().getLongTransactionManager().get(tid);
EClass eClass = session.getEClassForOid(oid);
IdEObject object = session.get(eClass, oid, new OldQuery(transaction.getPackageMetaData(), transaction.getPid(), transaction.getRid(), transaction.getRoid(), null, Deep.NO));
if (object == null) {
throw new UserException("No object of type " + eClass.getName() + " with oid " + oid + " found");
}
List<IdEObject> list = (List<IdEObject>) object.eGet(object.eClass().getEStructuralFeature(referenceName));
List<Long> oidList = new ArrayList<Long>();
for (IdEObject idEObject : list) {
oidList.add(idEObject.getOid());
}
return oidList;
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.shared.exceptions.UserException in project BIMserver by opensourceBIM.
the class ServiceImpl method getAllNonAuthorizedProjectsOfUser.
@Override
public List<SProject> getAllNonAuthorizedProjectsOfUser(Long uoid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
BimDatabaseAction<Set<Project>> action = new GetAllNonAuthorizedProjectsOfUserDatabaseAction(session, getInternalAccessMethod(), uoid);
return getBimServer().getSConverter().convertToSListProject(session.executeAndCommitAction(action));
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.shared.exceptions.UserException in project BIMserver by opensourceBIM.
the class ServiceImpl method getAllModelCheckers.
@Override
public List<SModelCheckerInstance> getAllModelCheckers() throws UserException, ServerException {
requireAuthenticationAndRunningServer();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
return getBimServer().getSConverter().convertToSListModelCheckerInstance(session.executeAndCommitAction(new GetAllModelCheckersDatabaseAction(session, getInternalAccessMethod())));
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
Aggregations