Search in sources :

Example 1 with GetLogsDatabaseAction

use of org.bimserver.database.actions.GetLogsDatabaseAction in project BIMserver by opensourceBIM.

the class AdminServiceImpl method getLogs.

@Override
public List<SLogAction> getLogs() throws ServerException, UserException {
    requireRealUserAuthentication();
    DatabaseSession session = getBimServer().getDatabase().createSession(OperationType.READ_ONLY);
    try {
        BimDatabaseAction<List<LogAction>> action = new GetLogsDatabaseAction(session, getInternalAccessMethod(), getAuthorization());
        List<LogAction> logs = session.executeAndCommitAction(action);
        List<SLogAction> convertToSListLogAction = getBimServer().getSConverter().convertToSListLogAction(logs);
        Collections.sort(convertToSListLogAction, new SLogComparator(true));
        return convertToSListLogAction;
    } catch (Exception e) {
        return handleException(e);
    } finally {
        session.close();
    }
}
Also used : SLogAction(org.bimserver.interfaces.objects.SLogAction) LogAction(org.bimserver.models.log.LogAction) DatabaseSession(org.bimserver.database.DatabaseSession) GetLogsDatabaseAction(org.bimserver.database.actions.GetLogsDatabaseAction) SLogComparator(org.bimserver.webservices.SLogComparator) List(java.util.List) ArrayList(java.util.ArrayList) SLogAction(org.bimserver.interfaces.objects.SLogAction) UserException(org.bimserver.shared.exceptions.UserException) BimBotsException(org.bimserver.bimbots.BimBotsException) IOException(java.io.IOException) ServerException(org.bimserver.shared.exceptions.ServerException) BimserverDatabaseException(org.bimserver.BimserverDatabaseException)

Aggregations

IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)1 BimBotsException (org.bimserver.bimbots.BimBotsException)1 DatabaseSession (org.bimserver.database.DatabaseSession)1 GetLogsDatabaseAction (org.bimserver.database.actions.GetLogsDatabaseAction)1 SLogAction (org.bimserver.interfaces.objects.SLogAction)1 LogAction (org.bimserver.models.log.LogAction)1 ServerException (org.bimserver.shared.exceptions.ServerException)1 UserException (org.bimserver.shared.exceptions.UserException)1 SLogComparator (org.bimserver.webservices.SLogComparator)1