use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.
the class ServiceImpl method getAllUsers.
@Override
public List<SUser> getAllUsers() throws ServerException, UserException {
if (getBimServer().getServerSettingsCache().getServerSettings().getHideUserListForNonAdmin()) {
if (getCurrentUser().getUserType() != SUserType.ADMIN) {
throw new UserException("Admin rights required to list users");
}
}
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
BimDatabaseAction<Set<User>> action = new GetAllUsersDatabaseAction(session, getInternalAccessMethod(), getAuthorization());
List<SUser> convertToSListUser = getBimServer().getSConverter().convertToSListUser(session.executeAndCommitAction(action));
Collections.sort(convertToSListUser, new SUserComparator());
return convertToSListUser;
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.
the class ServiceImpl method updateModelChecker.
@Override
public void updateModelChecker(SModelCheckerInstance modelCheckerInstance) throws UserException, ServerException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
BimDatabaseAction<Void> action = new UpdateModelCheckerDatabaseAction(getBimServer(), session, getInternalAccessMethod(), getBimServer().getSConverter().convertFromSObject(modelCheckerInstance, session));
session.executeAndCommitAction(action);
} catch (Exception e) {
handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.
the class ServiceImpl method deleteProject.
@Override
public Boolean deleteProject(Long poid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
BimDatabaseAction<Boolean> action = new DeleteProjectDatabaseAction(getBimServer(), session, getInternalAccessMethod(), 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 getAllModelCheckersOfProject.
@Override
public List<SModelCheckerInstance> getAllModelCheckersOfProject(Long poid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
Project project = session.get(poid, OldQuery.getDefault());
return getBimServer().getSConverter().convertToSListModelCheckerInstance(project.getModelCheckers());
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
use of org.bimserver.database.DatabaseSession in project BIMserver by opensourceBIM.
the class ServiceImpl method removeNewServiceFromProject.
@Override
public void removeNewServiceFromProject(Long poid, Long serviceOid) throws ServerException, UserException {
requireRealUserAuthentication();
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
BimDatabaseAction<Boolean> action = new RemoveNewServiceFromProjectDatabaseAction(getBimServer(), session, getInternalAccessMethod(), serviceOid, poid, getAuthorization());
session.executeAndCommitAction(action);
} catch (Exception e) {
handleException(e);
} finally {
session.close();
}
}
Aggregations