use of org.bimserver.database.DatabaseSession 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.database.DatabaseSession 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();
}
}
use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.
the class ServiceImpl method getAllCheckoutsByUser.
@Override
public List<SCheckout> getAllCheckoutsByUser(Long uoid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
BimDatabaseAction<List<Checkout>> action = new GetAllCheckoutsByUserDatabaseAction(session, getInternalAccessMethod(), uoid);
List<Checkout> list = session.executeAndCommitAction(action);
Collections.sort(list, new CheckoutComparator());
return getBimServer().getSConverter().convertToSListCheckout(list);
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.
the class ServiceImpl method removeUserFromProject.
@Override
public Boolean removeUserFromProject(Long uoid, Long poid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
BimDatabaseAction<Boolean> action = new RemoveUserFromProjectDatabaseAction(getBimServer(), session, getInternalAccessMethod(), uoid, poid, getAuthorization());
return session.executeAndCommitAction(action);
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.
the class ServiceImpl method getDeserializerById.
@Override
public SDeserializerPluginConfiguration getDeserializerById(Long oid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
return getBimServer().getSConverter().convertToSObject(session.executeAndCommitAction(new GetDeserializerByIdDatabaseAction(session, getInternalAccessMethod(), oid)));
} catch (Exception e) {
handleException(e);
} finally {
session.close();
}
return null;
}
Aggregations