Search in sources :

Example 1 with TaskanaRuntimeException

use of pro.taskana.exceptions.TaskanaRuntimeException in project taskana by Taskana.

the class ObjectReferenceQueryImpl method list.

@Override
public List<ObjectReference> list(int offset, int limit) {
    LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
    List<ObjectReference> result = null;
    try {
        taskanaEngine.openConnection();
        RowBounds rowBounds = new RowBounds(offset, limit);
        result = taskanaEngine.getSqlSession().selectList(LINK_TO_MAPPER, this, rowBounds);
        return result;
    } catch (Exception e) {
        if (e instanceof PersistenceException) {
            if (e.getMessage().contains("ERRORCODE=-4470")) {
                TaskanaRuntimeException ex = new TaskanaRuntimeException("The offset beginning was set over the amount of result-rows.", e.getCause());
                ex.setStackTrace(e.getStackTrace());
                throw ex;
            }
        }
        throw e;
    } finally {
        taskanaEngine.returnConnection();
        if (LOGGER.isDebugEnabled()) {
            int numberOfResultObjects = result == null ? 0 : result.size();
            LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", numberOfResultObjects, LoggerUtils.listToString(result));
        }
    }
}
Also used : PersistenceException(org.apache.ibatis.exceptions.PersistenceException) RowBounds(org.apache.ibatis.session.RowBounds) TaskanaRuntimeException(pro.taskana.exceptions.TaskanaRuntimeException) PersistenceException(org.apache.ibatis.exceptions.PersistenceException) TaskanaRuntimeException(pro.taskana.exceptions.TaskanaRuntimeException)

Example 2 with TaskanaRuntimeException

use of pro.taskana.exceptions.TaskanaRuntimeException in project taskana by Taskana.

the class TaskQueryImpl method list.

@Override
public List<TaskSummary> list(int offset, int limit) {
    LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
    List<TaskSummary> result = new ArrayList<>();
    try {
        taskanaEngine.openConnection();
        checkOpenPermissionForSpecifiedWorkbaskets();
        RowBounds rowBounds = new RowBounds(offset, limit);
        List<TaskSummaryImpl> tasks = taskanaEngine.getSqlSession().selectList(LINK_TO_MAPPER, this, rowBounds);
        result = taskService.augmentTaskSummariesByContainedSummaries(tasks);
        return result;
    } catch (PersistenceException e) {
        if (e.getMessage().contains("ERRORCODE=-4470")) {
            TaskanaRuntimeException ex = new TaskanaRuntimeException("The offset beginning was set over the amount of result-rows.", e.getCause());
            ex.setStackTrace(e.getStackTrace());
            throw ex;
        }
        throw e;
    } catch (NotAuthorizedException e) {
        throw new NotAuthorizedToQueryWorkbasketException(e.getMessage());
    } finally {
        taskanaEngine.returnConnection();
        if (LOGGER.isDebugEnabled()) {
            int numberOfResultObjects = result == null ? 0 : result.size();
            LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", numberOfResultObjects, LoggerUtils.listToString(result));
        }
    }
}
Also used : TaskSummary(pro.taskana.TaskSummary) ArrayList(java.util.ArrayList) PersistenceException(org.apache.ibatis.exceptions.PersistenceException) RowBounds(org.apache.ibatis.session.RowBounds) NotAuthorizedToQueryWorkbasketException(pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException) TaskanaRuntimeException(pro.taskana.exceptions.TaskanaRuntimeException) NotAuthorizedException(pro.taskana.exceptions.NotAuthorizedException)

Example 3 with TaskanaRuntimeException

use of pro.taskana.exceptions.TaskanaRuntimeException in project taskana by Taskana.

the class ClassificationQueryImpl method list.

@Override
public List<ClassificationSummary> list(int offset, int limit) {
    LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
    List<ClassificationSummary> result = null;
    try {
        taskanaEngine.openConnection();
        RowBounds rowBounds = new RowBounds(offset, limit);
        result = taskanaEngine.getSqlSession().selectList(LINK_TO_SUMMARYMAPPER, this, rowBounds);
        return result;
    } catch (Exception e) {
        if (e instanceof PersistenceException) {
            if (e.getMessage().contains("ERRORCODE=-4470")) {
                TaskanaRuntimeException ex = new TaskanaRuntimeException("The offset beginning was set over the amount of result-rows.", e.getCause());
                ex.setStackTrace(e.getStackTrace());
                throw ex;
            }
        }
        throw e;
    } finally {
        taskanaEngine.returnConnection();
        if (LOGGER.isDebugEnabled()) {
            int numberOfResultObjects = result == null ? 0 : result.size();
            LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", numberOfResultObjects, LoggerUtils.listToString(result));
        }
    }
}
Also used : ClassificationSummary(pro.taskana.ClassificationSummary) PersistenceException(org.apache.ibatis.exceptions.PersistenceException) RowBounds(org.apache.ibatis.session.RowBounds) TaskanaRuntimeException(pro.taskana.exceptions.TaskanaRuntimeException) PersistenceException(org.apache.ibatis.exceptions.PersistenceException) TaskanaRuntimeException(pro.taskana.exceptions.TaskanaRuntimeException)

Example 4 with TaskanaRuntimeException

use of pro.taskana.exceptions.TaskanaRuntimeException in project taskana by Taskana.

the class WorkbasketAccessItemQueryImpl method list.

@Override
public List<WorkbasketAccessItem> list(int offset, int limit) {
    LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
    List<WorkbasketAccessItem> result = new ArrayList<>();
    try {
        taskanaEngine.openConnection();
        RowBounds rowBounds = new RowBounds(offset, limit);
        List<WorkbasketAccessItemImpl> foundAccessItms = taskanaEngine.getSqlSession().selectList(LINK_TO_MAPPER, this, rowBounds);
        result.addAll(foundAccessItms);
        return result;
    } catch (PersistenceException e) {
        if (e.getMessage().contains("ERRORCODE=-4470")) {
            TaskanaRuntimeException ex = new TaskanaRuntimeException("The offset beginning was set over the amount of result-rows.", e.getCause());
            ex.setStackTrace(e.getStackTrace());
            throw ex;
        }
        throw e;
    } finally {
        taskanaEngine.returnConnection();
        if (LOGGER.isDebugEnabled()) {
            int numberOfResultObjects = result == null ? 0 : result.size();
            LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", numberOfResultObjects, LoggerUtils.listToString(result));
        }
    }
}
Also used : WorkbasketAccessItem(pro.taskana.WorkbasketAccessItem) ArrayList(java.util.ArrayList) PersistenceException(org.apache.ibatis.exceptions.PersistenceException) RowBounds(org.apache.ibatis.session.RowBounds) TaskanaRuntimeException(pro.taskana.exceptions.TaskanaRuntimeException)

Example 5 with TaskanaRuntimeException

use of pro.taskana.exceptions.TaskanaRuntimeException in project taskana by Taskana.

the class WorkbasketQueryImpl method list.

@Override
public List<WorkbasketSummary> list(int offset, int limit) {
    LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
    List<WorkbasketSummary> workbaskets = null;
    try {
        taskanaEngine.openConnection();
        RowBounds rowBounds = new RowBounds(offset, limit);
        handleCallerRolesAndAccessIds();
        workbaskets = taskanaEngine.getSqlSession().selectList(LINK_TO_MAPPER, this, rowBounds);
        return workbaskets;
    } catch (PersistenceException e) {
        if (e.getMessage().contains("ERRORCODE=-4470")) {
            TaskanaRuntimeException ex = new TaskanaRuntimeException("The offset beginning was set over the amount of result-rows.", e.getCause());
            ex.setStackTrace(e.getStackTrace());
            throw ex;
        }
        throw e;
    } finally {
        taskanaEngine.returnConnection();
        if (LOGGER.isDebugEnabled()) {
            int numberOfResultObjects = workbaskets == null ? 0 : workbaskets.size();
            LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", numberOfResultObjects, LoggerUtils.listToString(workbaskets));
        }
    }
}
Also used : PersistenceException(org.apache.ibatis.exceptions.PersistenceException) RowBounds(org.apache.ibatis.session.RowBounds) TaskanaRuntimeException(pro.taskana.exceptions.TaskanaRuntimeException) WorkbasketSummary(pro.taskana.WorkbasketSummary)

Aggregations

PersistenceException (org.apache.ibatis.exceptions.PersistenceException)5 RowBounds (org.apache.ibatis.session.RowBounds)5 TaskanaRuntimeException (pro.taskana.exceptions.TaskanaRuntimeException)5 ArrayList (java.util.ArrayList)2 ClassificationSummary (pro.taskana.ClassificationSummary)1 TaskSummary (pro.taskana.TaskSummary)1 WorkbasketAccessItem (pro.taskana.WorkbasketAccessItem)1 WorkbasketSummary (pro.taskana.WorkbasketSummary)1 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)1 NotAuthorizedToQueryWorkbasketException (pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException)1