TSK-281 Remove NotAuthorizedException from BaseQuery. Replace it by NotAuthorizedToQueryWorkbasketException (RuntimeException)
This commit is contained in:
parent
0a904ac220
commit
c64ecd77ba
|
|
@ -2,8 +2,6 @@ package pro.taskana;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main query interface.
|
* Main query interface.
|
||||||
*
|
*
|
||||||
|
|
@ -14,62 +12,57 @@ import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
public interface BaseQuery<T> {
|
public interface BaseQuery<T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will return a list of defined {@link T} objects.
|
* This method will return a list of defined {@link T} objects. In case of a TaskQuery, this method can throw a
|
||||||
|
* NotAuthorizedToQueryWorkbasketException.
|
||||||
*
|
*
|
||||||
* @return List containing elements of type T
|
* @return List containing elements of type T
|
||||||
* @throws NotAuthorizedException
|
|
||||||
* if the user is not authorized to perform this query
|
|
||||||
*/
|
*/
|
||||||
List<T> list() throws NotAuthorizedException;
|
List<T> list();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will return a list of defined {@link T} objects with specified offset and an limit.
|
* This method will return a list of defined {@link T} objects with specified offset and an limit. In case of a
|
||||||
|
* TaskQuery, this method can throw a NotAuthorizedToQueryWorkbasketException.
|
||||||
*
|
*
|
||||||
* @param offset
|
* @param offset
|
||||||
* index of the first element which should be returned.
|
* index of the first element which should be returned.
|
||||||
* @param limit
|
* @param limit
|
||||||
* number of elements which should be returned beginning with offset.
|
* number of elements which should be returned beginning with offset.
|
||||||
* @return List containing elements of type T
|
* @return List containing elements of type T
|
||||||
* @throws NotAuthorizedException
|
|
||||||
* if the user is not authorized to perform this query
|
|
||||||
*/
|
*/
|
||||||
List<T> list(int offset, int limit) throws NotAuthorizedException;
|
List<T> list(int offset, int limit);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will return all results for page X with a size of Y of the current query.<br>
|
* This method will return all results for page X with a size of Y of the current query.<br>
|
||||||
* Negative pageNumber/size will be changed to 0 and the last page got maybe less elements.
|
* Negative pageNumber/size will be changed to 0 and the last page got maybe less elements. In case of a TaskQuery,
|
||||||
|
* this method can throw a NotAuthorizedToQueryWorkbasketException.
|
||||||
*
|
*
|
||||||
* @param pageNumber
|
* @param pageNumber
|
||||||
* current pagination page starting at 0.
|
* current pagination page starting at 0.
|
||||||
* @param pageSize
|
* @param pageSize
|
||||||
* amount of elements for this page.
|
* amount of elements for this page.
|
||||||
* @return resulList for the current query starting at X and returning max Y elements.
|
* @return resulList for the current query starting at X and returning max Y elements.
|
||||||
* @throws NotAuthorizedException
|
|
||||||
* if the user is not authorized to perform this query
|
|
||||||
*/
|
*/
|
||||||
default List<T> listPage(int pageNumber, int pageSize) throws NotAuthorizedException {
|
default List<T> listPage(int pageNumber, int pageSize) {
|
||||||
int offset = (pageNumber < 0) ? 0 : (pageNumber * pageSize);
|
int offset = (pageNumber < 0) ? 0 : (pageNumber * pageSize);
|
||||||
int limit = (pageSize < 0) ? 0 : pageSize;
|
int limit = (pageSize < 0) ? 0 : pageSize;
|
||||||
return list(offset, limit);
|
return list(offset, limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will return a single object of {@link T}.
|
* This method will return a single object of {@link T}. In case of a TaskQuery, this method can throw a
|
||||||
|
* NotAuthorizedToQueryWorkbasketException.
|
||||||
*
|
*
|
||||||
* @return T a single object of given Type.
|
* @return T a single object of given Type.
|
||||||
* @throws NotAuthorizedException
|
|
||||||
* if the user is not authorized to perform this query
|
|
||||||
*/
|
*/
|
||||||
T single() throws NotAuthorizedException;
|
T single();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Counting the amount of rows/results for the current query. This can be used for a pagination afterwards.
|
* Counting the amount of rows/results for the current query. This can be used for a pagination afterwards. In case
|
||||||
|
* of a TaskQuery, this method can throw a NotAuthorizedToQueryWorkbasketException.
|
||||||
*
|
*
|
||||||
* @throws NotAuthorizedException
|
|
||||||
* when permissions not granted.
|
|
||||||
* @return resultRowCount
|
* @return resultRowCount
|
||||||
*/
|
*/
|
||||||
long count() throws NotAuthorizedException;
|
long count();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the sort direction.
|
* Determines the sort direction.
|
||||||
|
|
|
||||||
|
|
@ -903,9 +903,11 @@ public interface TaskQuery extends BaseQuery<TaskSummary> {
|
||||||
*/
|
*/
|
||||||
TaskQuery orderByCustom10(SortDirection sortDirection);
|
TaskQuery orderByCustom10(SortDirection sortDirection);
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Filter for summaries which are containing one of the given taskIds.
|
* Filter for summaries which are containing one of the given taskIds.
|
||||||
|
*
|
||||||
* @param taskIds
|
* @param taskIds
|
||||||
|
* The ids of the searched-for tasks.
|
||||||
* @return the taskQuery
|
* @return the taskQuery
|
||||||
*/
|
*/
|
||||||
TaskQuery idIn(String... taskIds);
|
TaskQuery idIn(String... taskIds);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package pro.taskana.exceptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This exception is used to communicate that a user is not authorized to query a Workbasket.
|
||||||
|
*/
|
||||||
|
public class NotAuthorizedToQueryWorkbasketException extends TaskanaRuntimeException {
|
||||||
|
|
||||||
|
public NotAuthorizedToQueryWorkbasketException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -12,7 +12,6 @@ import org.slf4j.LoggerFactory;
|
||||||
import pro.taskana.ClassificationQuery;
|
import pro.taskana.ClassificationQuery;
|
||||||
import pro.taskana.ClassificationSummary;
|
import pro.taskana.ClassificationSummary;
|
||||||
import pro.taskana.TaskanaEngine;
|
import pro.taskana.TaskanaEngine;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
|
||||||
import pro.taskana.exceptions.TaskanaRuntimeException;
|
import pro.taskana.exceptions.TaskanaRuntimeException;
|
||||||
import pro.taskana.impl.util.LoggerUtils;
|
import pro.taskana.impl.util.LoggerUtils;
|
||||||
|
|
||||||
|
|
@ -559,7 +558,7 @@ public class ClassificationQueryImpl implements ClassificationQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long count() throws NotAuthorizedException {
|
public long count() {
|
||||||
LOGGER.debug("entry to count(), this = {}", this);
|
LOGGER.debug("entry to count(), this = {}", this);
|
||||||
Long rowCount = null;
|
Long rowCount = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import pro.taskana.exceptions.ClassificationAlreadyExistException;
|
||||||
import pro.taskana.exceptions.ClassificationInUseException;
|
import pro.taskana.exceptions.ClassificationInUseException;
|
||||||
import pro.taskana.exceptions.ClassificationNotFoundException;
|
import pro.taskana.exceptions.ClassificationNotFoundException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
|
import pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException;
|
||||||
import pro.taskana.exceptions.SystemException;
|
import pro.taskana.exceptions.SystemException;
|
||||||
import pro.taskana.impl.util.IdGenerator;
|
import pro.taskana.impl.util.IdGenerator;
|
||||||
import pro.taskana.impl.util.LoggerUtils;
|
import pro.taskana.impl.util.LoggerUtils;
|
||||||
|
|
@ -323,7 +324,7 @@ public class ClassificationServiceImpl implements ClassificationService {
|
||||||
throw new ClassificationInUseException("There are " + classificationTasks.size()
|
throw new ClassificationInUseException("There are " + classificationTasks.size()
|
||||||
+ " Tasks which belong to this classification or a child classification. Please complete them and try again.");
|
+ " Tasks which belong to this classification or a child classification. Please complete them and try again.");
|
||||||
}
|
}
|
||||||
} catch (NotAuthorizedException e) {
|
} catch (NotAuthorizedToQueryWorkbasketException e) {
|
||||||
LOGGER.error(
|
LOGGER.error(
|
||||||
"ClassificationQuery unexpectedly returned NotauthorizedException. Throwing SystemException ");
|
"ClassificationQuery unexpectedly returned NotauthorizedException. Throwing SystemException ");
|
||||||
throw new SystemException("ClassificationQuery unexpectedly returned NotauthorizedException.");
|
throw new SystemException("ClassificationQuery unexpectedly returned NotauthorizedException.");
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import pro.taskana.ObjectReferenceQuery;
|
import pro.taskana.ObjectReferenceQuery;
|
||||||
import pro.taskana.TaskanaEngine;
|
import pro.taskana.TaskanaEngine;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
|
||||||
import pro.taskana.exceptions.TaskanaRuntimeException;
|
import pro.taskana.exceptions.TaskanaRuntimeException;
|
||||||
import pro.taskana.impl.util.LoggerUtils;
|
import pro.taskana.impl.util.LoggerUtils;
|
||||||
import pro.taskana.model.ObjectReference;
|
import pro.taskana.model.ObjectReference;
|
||||||
|
|
@ -169,7 +168,7 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long count() throws NotAuthorizedException {
|
public long count() {
|
||||||
LOGGER.debug("entry to count(), this = {}", this);
|
LOGGER.debug("entry to count(), this = {}", this);
|
||||||
Long rowCount = null;
|
Long rowCount = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import pro.taskana.TaskSummary;
|
||||||
import pro.taskana.TaskanaEngine;
|
import pro.taskana.TaskanaEngine;
|
||||||
import pro.taskana.TimeInterval;
|
import pro.taskana.TimeInterval;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
|
import pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException;
|
||||||
import pro.taskana.exceptions.TaskanaRuntimeException;
|
import pro.taskana.exceptions.TaskanaRuntimeException;
|
||||||
import pro.taskana.impl.util.LoggerUtils;
|
import pro.taskana.impl.util.LoggerUtils;
|
||||||
import pro.taskana.model.TaskState;
|
import pro.taskana.model.TaskState;
|
||||||
|
|
@ -635,7 +636,7 @@ public class TaskQueryImpl implements TaskQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TaskSummary> list() throws NotAuthorizedException {
|
public List<TaskSummary> list() {
|
||||||
List<TaskSummary> result = new ArrayList<>();
|
List<TaskSummary> result = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
LOGGER.debug("entry to list(), this = {}", this);
|
LOGGER.debug("entry to list(), this = {}", this);
|
||||||
|
|
@ -645,6 +646,8 @@ public class TaskQueryImpl implements TaskQuery {
|
||||||
tasks = taskanaEngineImpl.getSqlSession().selectList(LINK_TO_MAPPER, this);
|
tasks = taskanaEngineImpl.getSqlSession().selectList(LINK_TO_MAPPER, this);
|
||||||
result = taskService.augmentTaskSummariesByContainedSummaries(tasks);
|
result = taskService.augmentTaskSummariesByContainedSummaries(tasks);
|
||||||
return result;
|
return result;
|
||||||
|
} catch (NotAuthorizedException e) {
|
||||||
|
throw new NotAuthorizedToQueryWorkbasketException(e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
taskanaEngineImpl.returnConnection();
|
taskanaEngineImpl.returnConnection();
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
|
@ -656,7 +659,7 @@ public class TaskQueryImpl implements TaskQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TaskSummary> list(int offset, int limit) throws NotAuthorizedException {
|
public List<TaskSummary> list(int offset, int limit) {
|
||||||
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
|
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
|
||||||
List<TaskSummary> result = new ArrayList<>();
|
List<TaskSummary> result = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
|
|
@ -666,16 +669,16 @@ public class TaskQueryImpl implements TaskQuery {
|
||||||
List<TaskSummaryImpl> tasks = taskanaEngineImpl.getSqlSession().selectList(LINK_TO_MAPPER, this, rowBounds);
|
List<TaskSummaryImpl> tasks = taskanaEngineImpl.getSqlSession().selectList(LINK_TO_MAPPER, this, rowBounds);
|
||||||
result = taskService.augmentTaskSummariesByContainedSummaries(tasks);
|
result = taskService.augmentTaskSummariesByContainedSummaries(tasks);
|
||||||
return result;
|
return result;
|
||||||
} catch (Exception e) {
|
} catch (PersistenceException e) {
|
||||||
if (e instanceof PersistenceException) {
|
if (e.getMessage().contains("ERRORCODE=-4470")) {
|
||||||
if (e.getMessage().contains("ERRORCODE=-4470")) {
|
TaskanaRuntimeException ex = new TaskanaRuntimeException(
|
||||||
TaskanaRuntimeException ex = new TaskanaRuntimeException(
|
"The offset beginning was set over the amount of result-rows.", e.getCause());
|
||||||
"The offset beginning was set over the amount of result-rows.", e.getCause());
|
ex.setStackTrace(e.getStackTrace());
|
||||||
ex.setStackTrace(e.getStackTrace());
|
throw ex;
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
|
} catch (NotAuthorizedException e) {
|
||||||
|
throw new NotAuthorizedToQueryWorkbasketException(e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
taskanaEngineImpl.returnConnection();
|
taskanaEngineImpl.returnConnection();
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
|
@ -687,7 +690,7 @@ public class TaskQueryImpl implements TaskQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TaskSummary single() throws NotAuthorizedException {
|
public TaskSummary single() {
|
||||||
LOGGER.debug("entry to single(), this = {}", this);
|
LOGGER.debug("entry to single(), this = {}", this);
|
||||||
TaskSummary result = null;
|
TaskSummary result = null;
|
||||||
try {
|
try {
|
||||||
|
|
@ -703,6 +706,8 @@ public class TaskQueryImpl implements TaskQuery {
|
||||||
result = augmentedList.get(0);
|
result = augmentedList.get(0);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
} catch (NotAuthorizedException e) {
|
||||||
|
throw new NotAuthorizedToQueryWorkbasketException(e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
taskanaEngineImpl.returnConnection();
|
taskanaEngineImpl.returnConnection();
|
||||||
LOGGER.debug("exit from single(). Returning result {} ", result);
|
LOGGER.debug("exit from single(). Returning result {} ", result);
|
||||||
|
|
@ -710,7 +715,7 @@ public class TaskQueryImpl implements TaskQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long count() throws NotAuthorizedException {
|
public long count() {
|
||||||
LOGGER.debug("entry to count(), this = {}", this);
|
LOGGER.debug("entry to count(), this = {}", this);
|
||||||
Long rowCount = null;
|
Long rowCount = null;
|
||||||
try {
|
try {
|
||||||
|
|
@ -724,11 +729,15 @@ public class TaskQueryImpl implements TaskQuery {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkOpenPermissionForWorkbasketKey() throws NotAuthorizedException {
|
private void checkOpenPermissionForWorkbasketKey() {
|
||||||
if (this.workbasketKeyIn != null && this.workbasketKeyIn.length > 0) {
|
try {
|
||||||
for (String wbKey : this.workbasketKeyIn) {
|
if (this.workbasketKeyIn != null && this.workbasketKeyIn.length > 0) {
|
||||||
taskanaEngineImpl.getWorkbasketService().checkAuthorization(wbKey, WorkbasketAuthorization.OPEN);
|
for (String wbKey : this.workbasketKeyIn) {
|
||||||
|
taskanaEngineImpl.getWorkbasketService().checkAuthorization(wbKey, WorkbasketAuthorization.OPEN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (NotAuthorizedException e) {
|
||||||
|
throw new NotAuthorizedToQueryWorkbasketException(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import org.slf4j.LoggerFactory;
|
||||||
import pro.taskana.TaskanaEngine;
|
import pro.taskana.TaskanaEngine;
|
||||||
import pro.taskana.WorkbasketAccessItem;
|
import pro.taskana.WorkbasketAccessItem;
|
||||||
import pro.taskana.WorkbasketAccessItemQuery;
|
import pro.taskana.WorkbasketAccessItemQuery;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
|
||||||
import pro.taskana.exceptions.TaskanaRuntimeException;
|
import pro.taskana.exceptions.TaskanaRuntimeException;
|
||||||
import pro.taskana.impl.util.LoggerUtils;
|
import pro.taskana.impl.util.LoggerUtils;
|
||||||
|
|
||||||
|
|
@ -61,7 +60,7 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<WorkbasketAccessItem> list() throws NotAuthorizedException {
|
public List<WorkbasketAccessItem> list() {
|
||||||
LOGGER.debug("entry to list(), this = {}", this);
|
LOGGER.debug("entry to list(), this = {}", this);
|
||||||
List<WorkbasketAccessItem> result = new ArrayList<>();
|
List<WorkbasketAccessItem> result = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
|
|
@ -81,7 +80,7 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<WorkbasketAccessItem> list(int offset, int limit) throws NotAuthorizedException {
|
public List<WorkbasketAccessItem> list(int offset, int limit) {
|
||||||
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
|
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
|
||||||
List<WorkbasketAccessItem> result = new ArrayList<>();
|
List<WorkbasketAccessItem> result = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
|
|
@ -91,14 +90,12 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery
|
||||||
.selectList(LINK_TO_MAPPER, this, rowBounds);
|
.selectList(LINK_TO_MAPPER, this, rowBounds);
|
||||||
result.addAll(foundAccessItms);
|
result.addAll(foundAccessItms);
|
||||||
return result;
|
return result;
|
||||||
} catch (Exception e) {
|
} catch (PersistenceException e) {
|
||||||
if (e instanceof PersistenceException) {
|
if (e.getMessage().contains("ERRORCODE=-4470")) {
|
||||||
if (e.getMessage().contains("ERRORCODE=-4470")) {
|
TaskanaRuntimeException ex = new TaskanaRuntimeException(
|
||||||
TaskanaRuntimeException ex = new TaskanaRuntimeException(
|
"The offset beginning was set over the amount of result-rows.", e.getCause());
|
||||||
"The offset beginning was set over the amount of result-rows.", e.getCause());
|
ex.setStackTrace(e.getStackTrace());
|
||||||
ex.setStackTrace(e.getStackTrace());
|
throw ex;
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -112,7 +109,7 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WorkbasketAccessItem single() throws NotAuthorizedException {
|
public WorkbasketAccessItem single() {
|
||||||
LOGGER.debug("entry to single(), this = {}", this);
|
LOGGER.debug("entry to single(), this = {}", this);
|
||||||
WorkbasketAccessItem accessItm = null;
|
WorkbasketAccessItem accessItm = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ import pro.taskana.WorkbasketQuery;
|
||||||
import pro.taskana.WorkbasketSummary;
|
import pro.taskana.WorkbasketSummary;
|
||||||
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
|
||||||
import pro.taskana.exceptions.TaskanaRuntimeException;
|
import pro.taskana.exceptions.TaskanaRuntimeException;
|
||||||
import pro.taskana.impl.util.LoggerUtils;
|
import pro.taskana.impl.util.LoggerUtils;
|
||||||
import pro.taskana.model.WorkbasketAuthorization;
|
import pro.taskana.model.WorkbasketAuthorization;
|
||||||
|
|
@ -337,7 +336,7 @@ public class WorkbasketQueryImpl implements WorkbasketQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long count() throws NotAuthorizedException {
|
public long count() {
|
||||||
LOGGER.debug("entry to count(), this = {}", this);
|
LOGGER.debug("entry to count(), this = {}", this);
|
||||||
Long rowCount = null;
|
Long rowCount = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import pro.taskana.TaskService;
|
||||||
import pro.taskana.TaskSummary;
|
import pro.taskana.TaskSummary;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
|
import pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASRunner;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
|
|
@ -32,7 +33,7 @@ public class QueryTasksByWorkbasketAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test(expected = NotAuthorizedToQueryWorkbasketException.class)
|
||||||
public void testThrowsExceptionIfNoOpenerPermissionOnQueriedWorkbasket()
|
public void testThrowsExceptionIfNoOpenerPermissionOnQueriedWorkbasket()
|
||||||
throws SQLException, NotAuthorizedException, InvalidArgumentException {
|
throws SQLException, NotAuthorizedException, InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
@ -44,7 +45,7 @@ public class QueryTasksByWorkbasketAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test(expected = NotAuthorizedToQueryWorkbasketException.class)
|
||||||
public void testThrowsExceptionIfNoOpenerPermissionOnAtLeastOneQueriedWorkbasket()
|
public void testThrowsExceptionIfNoOpenerPermissionOnAtLeastOneQueriedWorkbasket()
|
||||||
throws SQLException, NotAuthorizedException, InvalidArgumentException {
|
throws SQLException, NotAuthorizedException, InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import pro.taskana.exceptions.ClassificationNotFoundException;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.InvalidWorkbasketException;
|
import pro.taskana.exceptions.InvalidWorkbasketException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
|
import pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException;
|
||||||
import pro.taskana.exceptions.TaskAlreadyExistException;
|
import pro.taskana.exceptions.TaskAlreadyExistException;
|
||||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
import pro.taskana.impl.WorkbasketAccessItemImpl;
|
import pro.taskana.impl.WorkbasketAccessItemImpl;
|
||||||
|
|
@ -137,8 +138,8 @@ public class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
|
||||||
taskService.createTaskQuery()
|
taskService.createTaskQuery()
|
||||||
.workbasketKeyIn(wbKey)
|
.workbasketKeyIn(wbKey)
|
||||||
.list();
|
.list();
|
||||||
fail("NotAuthorizedException was expected ");
|
fail("NotAuthorizedToQueryWorkbasketException was expected ");
|
||||||
} catch (NotAuthorizedException ignored) {
|
} catch (NotAuthorizedToQueryWorkbasketException ignored) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import java.util.List;
|
||||||
|
|
||||||
import pro.taskana.ClassificationQuery;
|
import pro.taskana.ClassificationQuery;
|
||||||
import pro.taskana.ClassificationSummary;
|
import pro.taskana.ClassificationSummary;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by BV on 26.10.2017.
|
* Created by BV on 26.10.2017.
|
||||||
|
|
@ -178,24 +177,24 @@ public class TestClassificationQuery implements ClassificationQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ClassificationSummary> list() throws NotAuthorizedException {
|
public List<ClassificationSummary> list() {
|
||||||
List<ClassificationSummary> returnedClassifications = new ArrayList<>();
|
List<ClassificationSummary> returnedClassifications = new ArrayList<>();
|
||||||
returnedClassifications.addAll(classifications);
|
returnedClassifications.addAll(classifications);
|
||||||
return returnedClassifications;
|
return returnedClassifications;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ClassificationSummary> list(int offset, int limit) throws NotAuthorizedException {
|
public List<ClassificationSummary> list(int offset, int limit) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ClassificationSummary single() throws NotAuthorizedException {
|
public ClassificationSummary single() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long count() throws NotAuthorizedException {
|
public long count() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue