TSK-1009: Fix simple checkstyle warnings

This commit is contained in:
Benjamin Eckstein 2020-01-07 13:40:41 +01:00 committed by Mustapha Zorgati
parent 3022aafe3b
commit 7509bb0f1c
98 changed files with 934 additions and 813 deletions

View File

@ -24,12 +24,14 @@ import pro.taskana.simplehistory.impl.mappings.HistoryQueryMapper;
public class TaskanaHistoryEngineImpl implements TaskanaHistoryEngine {
protected static final ThreadLocal<Deque<SqlSessionManager>> SESSION_STACK = new ThreadLocal<>();
private static final String DEFAULT = "default";
TaskanaEngineConfiguration taskanaEngineConfiguration;
protected SqlSessionManager sessionManager;
protected TransactionFactory transactionFactory;
protected TaskanaHistory taskanaHistoryService;
TaskanaEngineConfiguration taskanaEngineConfiguration;
protected TaskanaHistoryEngineImpl(TaskanaEngineConfiguration taskanaEngineConfiguration)
throws SQLException {
this.taskanaEngineConfiguration = taskanaEngineConfiguration;
@ -81,6 +83,7 @@ public class TaskanaHistoryEngineImpl implements TaskanaHistoryEngine {
try {
this.sessionManager.commit();
} catch (Exception e) {
//ignore
}
this.sessionManager.close();
}

View File

@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param;
import pro.taskana.history.api.TaskanaHistoryEvent;
/** This class is the mybatis mapping of workbaskets. */
@SuppressWarnings("checkstyle:LineLength")
public interface HistoryEventMapper {
@Insert(

View File

@ -21,12 +21,12 @@ import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
/** Set up database for tests. */
public class AbstractAccTest {
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractAccTest.class);
private static final int POOL_TIME_TO_WAIT = 50;
public static SimpleHistoryServiceImpl historyService;
protected static TaskanaEngineConfiguration taskanaEngineConfiguration;
private static DataSource dataSource = null;
private static String schemaName = null;
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractAccTest.class);
private static final int POOL_TIME_TO_WAIT = 50;
protected AbstractAccTest() {
// not called
@ -39,7 +39,6 @@ public class AbstractAccTest {
public static void resetDb(String schemaName) throws SQLException {
DataSource dataSource = getDataSource();
DBWriter writer = new DBWriter();
taskanaEngineConfiguration =
new TaskanaEngineConfiguration(
dataSource,
@ -48,6 +47,7 @@ public class AbstractAccTest {
historyService = new SimpleHistoryServiceImpl();
historyService.initialize(taskanaEngineConfiguration);
DBWriter writer = new DBWriter();
writer.clearDB(dataSource);
writer.generateTestData(dataSource);
}

View File

@ -113,7 +113,7 @@ public class SimpleHistoryServiceImplTest {
AbstractAccTest.createHistoryEvent("wbKey1", "taskId1", "type1", "Some comment", "wbKey2"));
doReturn(returnList).when(historyQueryMapperMock).queryHistoryEvent(any());
List<HistoryEventImpl> result = cutSpy.createHistoryQuery().taskIdIn("taskId1").list();
final List<HistoryEventImpl> result = cutSpy.createHistoryQuery().taskIdIn("taskId1").list();
verify(taskanaHistoryEngineMock, times(1)).openConnection();
verify(historyQueryMapperMock, times(1)).queryHistoryEvent(any());

View File

@ -151,8 +151,8 @@ public class TaskHistoryEventController extends AbstractPagingController {
PageMetadata pageMetadata = null;
List<HistoryEventImpl> historyEvents = null;
String page = params.getFirst(PAGING_PAGE);
String pageSize = params.getFirst(PAGING_PAGE_SIZE);
final String page = params.getFirst(PAGING_PAGE);
final String pageSize = params.getFirst(PAGING_PAGE_SIZE);
params.remove(PAGING_PAGE);
params.remove(PAGING_PAGE_SIZE);
validateNoInvalidParameterIsLeft(params);

View File

@ -40,11 +40,11 @@ public class SampleDataGenerator {
}
public void generateSampleData(String schemaName) {
StringWriter outWriter = new StringWriter();
PrintWriter logWriter = new PrintWriter(outWriter);
final StringWriter outWriter = new StringWriter();
final PrintWriter logWriter = new PrintWriter(outWriter);
StringWriter errorWriter = new StringWriter();
PrintWriter errorLogWriter = new PrintWriter(errorWriter);
final StringWriter errorWriter = new StringWriter();
final PrintWriter errorLogWriter = new PrintWriter(errorWriter);
try {
runner.runScript(selectSchemaScript(dbProductName, schemaName));
runner.setStopOnError(false);

View File

@ -8,6 +8,7 @@ import static org.junit.Assert.fail;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.sql.SQLException;
import java.text.MessageFormat;
import java.time.LocalDateTime;
import java.util.Collections;
import javax.sql.DataSource;
@ -105,9 +106,11 @@ public class TaskHistoryEventControllerIntTest {
public void testGetSpecificTaskHistoryEvent() {
ResponseEntity<TaskHistoryEventListResource> response =
template.exchange(
server
+ port
+ "/api/v1/task-history-event?business-process-id=BPI:01&sort-by=business-process-id&order=asc&page-size=6&page=1",
MessageFormat.format(
"{0}{1}/api/v1/task-history-event?"
+ "business-process-id=BPI:01&sort-by=business-process-id&"
+ "order=asc&page-size=6&page=1",
server, port),
HttpMethod.GET,
request,
new ParameterizedTypeReference<TaskHistoryEventListResource>() {});

View File

@ -27,13 +27,13 @@ public class ExampleBootstrap {
ClassificationNotFoundException, InvalidStateException, InvalidOwnerException,
TaskAlreadyExistException, InvalidArgumentException {
System.out.println("---------------------------> Start App");
Task task = taskanaEjb.getTaskService().newTask(null);
ObjectReference objRef = new ObjectReference();
objRef.setCompany("aCompany");
objRef.setSystem("aSystem");
objRef.setSystemInstance("anInstance");
objRef.setType("aType");
objRef.setValue("aValue");
Task task = taskanaEjb.getTaskService().newTask(null);
task.setPrimaryObjRef(objRef);
task = taskanaEjb.getTaskService().createTask(task);
System.out.println("---------------------------> Task started: " + task.getId());

View File

@ -3,6 +3,8 @@ package pro.taskana;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
/** TODO Why does this test exist? */
/**
* TODO Why does this test exist?.
*/
@ApplicationPath("/rest")
public class RestApplication extends Application {}

View File

@ -34,7 +34,7 @@ public class TaskanaEjb {
public void triggerRollback()
throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException,
TaskAlreadyExistException, InvalidArgumentException {
Task task = taskService.newTask(null);
final Task task = taskService.newTask(null);
ObjectReference objRef = new ObjectReference();
objRef.setCompany("aCompany");
objRef.setSystem("aSystem");

View File

@ -1,8 +1,8 @@
package pro.taskana;
/**
* Enum containing the column names for @see
* pro.taskana.mappings.QueryMapper#queryWorkbasketAccessItemColumnValues(WorkbasketAccessItemQuery).
* Enum containing the column names for {@see
* pro.taskana.mappings.QueryMapper#queryWorkbasketAccessItemColumnValues}.
*
* @author jsa
*/

View File

@ -47,7 +47,8 @@ public class BulkOperationResults<K, V> {
}
} catch (Exception e) {
LOGGER.warn(
"Can´t add bulkoperation-error, because of a map failure. ID={}, error={} and current failure={}",
"Can´t add bulkoperation-error, because of a map failure. "
+ "ID={}, error={} and current failure={}",
objectId,
error,
e);

View File

@ -1,8 +1,8 @@
package pro.taskana;
/**
* Enum containing the column names for @see
* pro.taskana.mappings.QueryMapper#queryClassificationColumnValues(pro.taskana.impl.ClassificationQueryImpl).
* Enum containing the column names for {@see
* pro.taskana.mappings.QueryMapper#queryClassificationColumnValues}.
*
* @author jsa
*/

View File

@ -154,8 +154,8 @@ public interface WorkbasketQuery extends BaseQuery<WorkbasketSummary, Workbasket
* Add condition to query if the caller (one of the accessIds of the caller) has the given
* permission on the workbasket.
*
* @return the updated query.
* @param permission the permission for the query condition.
* @return the updated query.
*/
WorkbasketQuery callerHasPermission(WorkbasketPermission permission);

View File

@ -87,7 +87,8 @@ public class DbSchemaCreator {
Map<String, Object> queryResult = runner.selectOne(query, expectedVersion);
if (queryResult == null || queryResult.isEmpty()) {
LOGGER.error(
"Schema version not valid. The VERSION property in table TASKANA_SCHEMA_VERSION has not the expected value {}",
"Schema version not valid. The VERSION property in table TASKANA_SCHEMA_VERSION "
+ "has not the expected value {}",
expectedVersion);
return false;
} else {
@ -97,7 +98,8 @@ public class DbSchemaCreator {
} catch (Exception e) {
LOGGER.error(
"Schema version not valid. The VERSION property in table TASKANA_SCHEMA_VERSION has not the expected value {}",
"Schema version not valid. The VERSION property in table TASKANA_SCHEMA_VERSION "
+ "has not the expected value {}",
expectedVersion);
return false;
} finally {

View File

@ -399,7 +399,8 @@ public class TaskanaEngineConfiguration {
Boolean.parseBoolean(taskCleanupJobAllCompletedSameParentBusinessProperty);
} catch (Exception e) {
LOGGER.warn(
"Could not parse taskCleanupJobAllCompletedSameParentBusinessProperty ({}). Using default. Exception: {} ",
"Could not parse taskCleanupJobAllCompletedSameParentBusinessProperty "
+ "({}). Using default. Exception: {} ",
taskCleanupJobAllCompletedSameParentBusinessProperty,
e.getMessage());
}
@ -414,7 +415,8 @@ public class TaskanaEngineConfiguration {
"CleanupJob configuration: minimum age of tasks to be cleanup up is {}",
cleanupJobMinimumAge);
LOGGER.debug(
"TaskCleanupJob configuration: all completed task with the same parent business property id {}",
"TaskCleanupJob configuration: all completed task with the "
+ "same parent business property id {}",
taskCleanupJobAllCompletedSameParentBusiness);
}

View File

@ -1,6 +1,7 @@
package pro.taskana.history.events.task;
import pro.taskana.Task;
/** Event fired if a task is claimed. */
public class ClaimedEvent extends TaskEvent {

View File

@ -1,6 +1,7 @@
package pro.taskana.history.events.task;
import pro.taskana.Task;
/** Event fired if a task is created. */
public class CreatedEvent extends TaskEvent {

View File

@ -99,30 +99,6 @@ abstract class AbstractWorkbasketAccessItemQueryImpl<
}
}
@Override
public List<String> listValues(
AccessItemQueryColumnName columnName, SortDirection sortDirection) {
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, _this());
List<String> result = null;
try {
taskanaEngine.openConnection();
this.columnName = columnName;
this.orderBy.clear();
this.addOrderCriteria(columnName.toString(), sortDirection);
result = taskanaEngine.getSqlSession().selectList(getLinkToValueMapper(), _this());
return result;
} finally {
taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size();
LOGGER.debug(
"Exit from listValues. Returning {} resulting Objects: {} ",
numberOfResultObjects,
LoggerUtils.listToString(result));
}
}
}
@Override
public List<T> list(int offset, int limit) {
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, _this());
@ -154,6 +130,30 @@ abstract class AbstractWorkbasketAccessItemQueryImpl<
}
}
@Override
public List<String> listValues(
AccessItemQueryColumnName columnName, SortDirection sortDirection) {
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, _this());
List<String> result = null;
try {
taskanaEngine.openConnection();
this.columnName = columnName;
this.orderBy.clear();
this.addOrderCriteria(columnName.toString(), sortDirection);
result = taskanaEngine.getSqlSession().selectList(getLinkToValueMapper(), _this());
return result;
} finally {
taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size();
LOGGER.debug(
"Exit from listValues. Returning {} resulting Objects: {} ",
numberOfResultObjects,
LoggerUtils.listToString(result));
}
}
}
@Override
public T single() {
LOGGER.debug("entry to single(), this = {}", _this());
@ -206,6 +206,7 @@ abstract class AbstractWorkbasketAccessItemQueryImpl<
return columnName;
}
@SuppressWarnings("checkstyle:MethodName")
abstract Q _this();
abstract String getLinkToMapper();

View File

@ -2,6 +2,7 @@ package pro.taskana.impl;
import java.sql.SQLException;
import java.sql.SQLIntegrityConstraintViolationException;
import java.text.MessageFormat;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
@ -251,13 +252,11 @@ public class ClassificationServiceImpl implements ClassificationService {
} catch (PersistenceException e) {
if (isReferentialIntegrityConstraintViolation(e)) {
throw new ClassificationInUseException(
"The classification id = \""
+ classificationId
+ "\" and key = \""
+ classification.getKey()
+ "\" in domain = \""
+ classification.getDomain()
+ "\" is in use and cannot be deleted. There are either tasks or attachments associated with the classification.",
MessageFormat.format(
"The classification id = \"{0}\" and key = \"{1}\" in domain = \"{2}\" "
+ "is in use and cannot be deleted. There are either tasks or "
+ "attachments associated with the classification.",
classificationId, classification.getKey(), classification.getDomain()),
e.getCause());
}
}
@ -273,10 +272,12 @@ public class ClassificationServiceImpl implements ClassificationService {
} catch (Exception e) {
throw new InvalidArgumentException(
"Invalid service level "
+ serviceLevel
+ ". The formats accepted are based on the ISO-8601 duration format PnDTnHnMn.nS with days considered to be exactly 24 hours. "
+ "For example: \"P2D\" represents a period of \"two days.\" ",
MessageFormat.format(
"Invalid service level {0}. "
+ "The formats accepted are based on the ISO-8601 duration format "
+ "PnDTnHnMn.nS with days considered to be exactly 24 hours. "
+ "For example: \"P2D\" represents a period of \"two days.\" ",
serviceLevel),
e.getCause());
}
// check that the duration is based on format PnD, i.e. it must start with a P, end with a D
@ -285,10 +286,11 @@ public class ClassificationServiceImpl implements ClassificationService {
|| !('d' == serviceLevelLower.charAt(serviceLevel.length() - 1))) {
throw new InvalidArgumentException(
"Invalid service level "
+ serviceLevel
+ ". Taskana only supports service levels that"
+ " contain a number of whole days specified according to the format 'PnD' where n is the number of days");
MessageFormat.format(
"Invalid service level {0}. Taskana only supports service "
+ "levels that contain a number of whole days "
+ "specified according to the format ''PnD'' where n is the number of days",
serviceLevel));
}
}
@ -348,17 +350,20 @@ public class ClassificationServiceImpl implements ClassificationService {
} catch (ClassificationNotFoundException e) {
doesExist = false;
LOGGER.debug(
"Method createClassification: Classification does not exist in master domain. Classification {}.",
"Method createClassification: Classification does not "
+ "exist in master domain. Classification {}.",
masterClassification);
} catch (ClassificationAlreadyExistException ex) {
LOGGER.warn(
"Method createClassification: Classification does already exist in master domain. Classification {}.",
"Method createClassification: Classification does already exist "
+ "in master domain. Classification {}.",
masterClassification);
} finally {
if (!doesExist) {
classificationMapper.insert(masterClassification);
LOGGER.debug(
"Method createClassification: Classification created in master-domain, too. Classification {}.",
"Method createClassification: Classification created in "
+ "master-domain, too. Classification {}.",
masterClassification);
}
}
@ -445,7 +450,8 @@ public class ClassificationServiceImpl implements ClassificationService {
}
} catch (Exception ex) {
LOGGER.warn(
"Classification-Service threw Exception while calling mapper and searching for classification. EX={}",
"Classification-Service threw Exception while calling "
+ "mapper and searching for classification. EX={}",
ex,
ex);
}
@ -481,7 +487,8 @@ public class ClassificationServiceImpl implements ClassificationService {
this.getClassification(classificationImpl.getKey(), classificationImpl.getDomain());
if (!oldClassification.getModified().equals(classificationImpl.getModified())) {
throw new ConcurrencyException(
"The current Classification has been modified while editing. The values can not be updated. Classification "
"The current Classification has been modified while editing. "
+ "The values can not be updated. Classification "
+ classificationImpl.toString());
}
return oldClassification;

View File

@ -91,29 +91,6 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery {
}
}
@Override
public List<String> listValues(
ObjectReferenceQueryColumnName columnName, SortDirection sortDirection) {
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
List<String> result = new ArrayList<>();
try {
taskanaEngine.openConnection();
this.columnName = columnName;
this.orderBy.clear();
this.addOrderCriteria(columnName.toString(), sortDirection);
result = taskanaEngine.getSqlSession().selectList(LINK_TO_VALUEMAPPER, this);
return result;
} finally {
taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"Exit from listValues. Returning {} resulting Objects: {} ",
result.size(),
LoggerUtils.listToString(result));
}
}
}
@Override
public List<ObjectReference> list(int offset, int limit) {
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
@ -145,6 +122,29 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery {
}
}
@Override
public List<String> listValues(
ObjectReferenceQueryColumnName columnName, SortDirection sortDirection) {
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
List<String> result = new ArrayList<>();
try {
taskanaEngine.openConnection();
this.columnName = columnName;
this.orderBy.clear();
this.addOrderCriteria(columnName.toString(), sortDirection);
result = taskanaEngine.getSqlSession().selectList(LINK_TO_VALUEMAPPER, this);
return result;
} finally {
taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"Exit from listValues. Returning {} resulting Objects: {} ",
result.size(),
LoggerUtils.listToString(result));
}
}
}
@Override
public ObjectReference single() {
LOGGER.debug("entry to single(), this = {}", this);

View File

@ -970,6 +970,40 @@ public class TaskQueryImpl implements TaskQuery {
}
}
@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();
checkOpenAndReadPermissionForSpecifiedWorkbaskets();
setupAccessIds();
setupJoinAndOrderParameters();
RowBounds rowBounds = new RowBounds(offset, limit);
List<TaskSummaryImpl> tasks =
taskanaEngine.getSqlSession().selectList(getLinkToMapperScript(), 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;
} finally {
taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"exit from list(offset,limit). Returning {} resulting Objects: {} ",
result.size(),
LoggerUtils.listToString(result));
}
}
}
public String getLinkToMapperScript() {
return DB.DB2.dbProductId.equals(getDatabaseId()) ? LINK_TO_MAPPER_DB2 : LINK_TO_MAPPER;
}
@ -1016,40 +1050,6 @@ public class TaskQueryImpl implements TaskQuery {
}
}
@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();
checkOpenAndReadPermissionForSpecifiedWorkbaskets();
setupAccessIds();
setupJoinAndOrderParameters();
RowBounds rowBounds = new RowBounds(offset, limit);
List<TaskSummaryImpl> tasks =
taskanaEngine.getSqlSession().selectList(getLinkToMapperScript(), 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;
} finally {
taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"exit from list(offset,limit). Returning {} resulting Objects: {} ",
result.size(),
LoggerUtils.listToString(result));
}
}
}
@Override
public TaskSummary single() {
LOGGER.debug("entry to single(), this = {}", this);

View File

@ -1,5 +1,6 @@
package pro.taskana.impl;
import java.text.MessageFormat;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
@ -115,6 +116,42 @@ public class TaskServiceImpl implements TaskService {
return claim(taskId, false);
}
private Task claim(String taskId, boolean forceClaim)
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
NotAuthorizedException {
String userId = CurrentUserContext.getUserid();
LOGGER.debug(
"entry to claim(id = {}, userId = {}, forceClaim = {})", taskId, userId, forceClaim);
TaskImpl task = null;
try {
taskanaEngine.openConnection();
task = (TaskImpl) getTask(taskId);
TaskState state = task.getState();
if (state == TaskState.COMPLETED) {
throw new InvalidStateException(TASK_WITH_ID + taskId + IS_ALREADY_COMPLETED);
}
if (state == TaskState.CLAIMED && !forceClaim && !task.getOwner().equals(userId)) {
throw new InvalidOwnerException(
TASK_WITH_ID + taskId + IS_ALREADY_CLAIMED_BY + task.getOwner() + ".");
}
Instant now = Instant.now();
task.setOwner(userId);
task.setModified(now);
task.setClaimed(now);
task.setRead(true);
task.setState(TaskState.CLAIMED);
taskMapper.update(task);
LOGGER.debug("Task '{}' claimed by user '{}'.", taskId, userId);
if (HistoryEventProducer.isHistoryEnabled()) {
historyEventProducer.createEvent(new ClaimedEvent(task));
}
} finally {
taskanaEngine.returnConnection();
LOGGER.debug("exit from claim()");
}
return task;
}
@Override
public Task forceClaim(String taskId)
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
@ -129,6 +166,45 @@ public class TaskServiceImpl implements TaskService {
return this.cancelClaim(taskId, false);
}
private Task cancelClaim(String taskId, boolean forceUnclaim)
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
NotAuthorizedException {
String userId = CurrentUserContext.getUserid();
LOGGER.debug(
"entry to cancelClaim(taskId = {}), userId = {}, forceUnclaim = {})",
taskId,
userId,
forceUnclaim);
TaskImpl task = null;
try {
taskanaEngine.openConnection();
task = (TaskImpl) getTask(taskId);
TaskState state = task.getState();
if (state == TaskState.COMPLETED) {
throw new InvalidStateException(TASK_WITH_ID + taskId + IS_ALREADY_COMPLETED);
}
if (state == TaskState.CLAIMED && !forceUnclaim && !userId.equals(task.getOwner())) {
throw new InvalidOwnerException(
TASK_WITH_ID + taskId + IS_ALREADY_CLAIMED_BY + task.getOwner() + ".");
}
Instant now = Instant.now();
task.setOwner(null);
task.setModified(now);
task.setClaimed(null);
task.setRead(true);
task.setState(TaskState.READY);
taskMapper.update(task);
LOGGER.debug("Task '{}' unclaimed by user '{}'.", taskId, userId);
if (HistoryEventProducer.isHistoryEnabled()) {
historyEventProducer.createEvent(new ClaimCancelledEvent(task));
}
} finally {
taskanaEngine.returnConnection();
LOGGER.debug("exit from cancelClaim()");
}
return task;
}
@Override
public Task forceCancelClaim(String taskId)
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
@ -143,6 +219,57 @@ public class TaskServiceImpl implements TaskService {
return completeTask(taskId, false);
}
private Task completeTask(String taskId, boolean isForced)
throws TaskNotFoundException, InvalidOwnerException, InvalidStateException,
NotAuthorizedException {
String userId = CurrentUserContext.getUserid();
LOGGER.debug(
"entry to completeTask(id = {}, userId = {}, isForced = {})", taskId, userId, isForced);
TaskImpl task = null;
try {
taskanaEngine.openConnection();
task = (TaskImpl) this.getTask(taskId);
if (task.getState() == TaskState.COMPLETED) {
return task;
}
// check pre-conditions for non-forced invocation
if (!isForced) {
if (task.getClaimed() == null || task.getState() != TaskState.CLAIMED) {
throw new InvalidStateException(TASK_WITH_ID + taskId + " has to be claimed before.");
} else if (!CurrentUserContext.getAccessIds().contains(task.getOwner())) {
throw new InvalidOwnerException(
"Owner of task "
+ taskId
+ " is "
+ task.getOwner()
+ ", but current User is "
+ userId);
}
} else {
// CLAIM-forced, if task was not already claimed before.
if (task.getClaimed() == null || task.getState() != TaskState.CLAIMED) {
task = (TaskImpl) this.forceClaim(taskId);
}
}
Instant now = Instant.now();
task.setCompleted(now);
task.setModified(now);
task.setState(TaskState.COMPLETED);
task.setOwner(userId);
taskMapper.update(task);
LOGGER.debug("Task '{}' completed by user '{}'.", taskId, userId);
if (HistoryEventProducer.isHistoryEnabled()) {
historyEventProducer.createEvent(new CompletedEvent(task));
}
} finally {
taskanaEngine.returnConnection();
LOGGER.debug("exit from completeTask()");
}
return task;
}
@Override
public Task forceCompleteTask(String taskId)
throws TaskNotFoundException, InvalidOwnerException, InvalidStateException,
@ -430,6 +557,32 @@ public class TaskServiceImpl implements TaskService {
deleteTask(taskId, false);
}
private void deleteTask(String taskId, boolean forceDelete)
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
LOGGER.debug("entry to deleteTask(taskId = {} , forceDelete = {})", taskId, forceDelete);
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.ADMIN);
TaskImpl task = null;
try {
taskanaEngine.openConnection();
task = (TaskImpl) getTask(taskId);
if (!TaskState.COMPLETED.equals(task.getState()) && !forceDelete) {
throw new InvalidStateException(
"Cannot delete Task " + taskId + " because it is not completed.");
}
if (CallbackState.CALLBACK_PROCESSING_REQUIRED.equals(task.getCallbackState())) {
throw new InvalidStateException(
"Task " + taskId + " cannot be deleted because its callback is not yet processed");
}
taskMapper.delete(taskId);
LOGGER.debug("Task {} deleted.", taskId);
} finally {
taskanaEngine.returnConnection();
LOGGER.debug("exit from deleteTask().");
}
}
@Override
public void forceDeleteTask(String taskId)
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
@ -859,7 +1012,7 @@ public class TaskServiceImpl implements TaskService {
TaskImpl task, Classification classification, PrioDurationHolder prioDurationFromAttachments)
throws InvalidArgumentException {
LOGGER.debug("entry to standardSettings()");
Instant now = Instant.now();
final Instant now = Instant.now();
task.setId(IdGenerator.generateWithPrefix(ID_PREFIX_TASK));
if (task.getExternalId() == null) {
task.setExternalId(IdGenerator.generateWithPrefix(ID_PREFIX_EXT_TASK_ID));
@ -905,7 +1058,8 @@ public class TaskServiceImpl implements TaskService {
Instant planned = task.getDue().plus(Duration.ofDays(days));
if (task.getPlanned() != null && !task.getPlanned().equals(planned)) {
throw new InvalidArgumentException(
"Cannot create a task with given planned and due date not matching the service level");
"Cannot create a task with given planned "
+ "and due date not matching the service level");
}
task.setPlanned(planned);
} else {
@ -964,7 +1118,8 @@ public class TaskServiceImpl implements TaskService {
BulkOperationResults<String, TaskanaException> bulkLog) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"entry to checkIfTasksMatchCompleteCriteria(taskIds = {}, taskSummaries = {}, bulkLog = {})",
"entry to checkIfTasksMatchCompleteCriteria(taskIds = {}, "
+ "taskSummaries = {}, bulkLog = {})",
LoggerUtils.listToString(taskIds),
LoggerUtils.listToString(taskSummaries),
bulkLog);
@ -1024,45 +1179,6 @@ public class TaskServiceImpl implements TaskService {
LOGGER.debug("exit from updateTasksToBeCompleted()");
}
private Task cancelClaim(String taskId, boolean forceUnclaim)
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
NotAuthorizedException {
String userId = CurrentUserContext.getUserid();
LOGGER.debug(
"entry to cancelClaim(taskId = {}), userId = {}, forceUnclaim = {})",
taskId,
userId,
forceUnclaim);
TaskImpl task = null;
try {
taskanaEngine.openConnection();
task = (TaskImpl) getTask(taskId);
TaskState state = task.getState();
if (state == TaskState.COMPLETED) {
throw new InvalidStateException(TASK_WITH_ID + taskId + IS_ALREADY_COMPLETED);
}
if (state == TaskState.CLAIMED && !forceUnclaim && !userId.equals(task.getOwner())) {
throw new InvalidOwnerException(
TASK_WITH_ID + taskId + IS_ALREADY_CLAIMED_BY + task.getOwner() + ".");
}
Instant now = Instant.now();
task.setOwner(null);
task.setModified(now);
task.setClaimed(null);
task.setRead(true);
task.setState(TaskState.READY);
taskMapper.update(task);
LOGGER.debug("Task '{}' unclaimed by user '{}'.", taskId, userId);
if (HistoryEventProducer.isHistoryEnabled()) {
historyEventProducer.createEvent(new ClaimCancelledEvent(task));
}
} finally {
taskanaEngine.returnConnection();
LOGGER.debug("exit from cancelClaim()");
}
return task;
}
private void addClassificationSummariesToTaskSummaries(
List<TaskSummaryImpl> tasks, List<ClassificationSummary> classifications) {
if (LOGGER.isDebugEnabled()) {
@ -1079,12 +1195,12 @@ public class TaskServiceImpl implements TaskService {
// assign query results to appropriate tasks.
for (TaskSummaryImpl task : tasks) {
String classificationId = task.getClassificationSummary().getId();
ClassificationSummary aClassification =
ClassificationSummary classificationSummary =
classifications.stream()
.filter(c -> c.getId().equals(classificationId))
.findFirst()
.orElse(null);
if (aClassification == null) {
if (classificationSummary == null) {
throw new SystemException(
"Did not find a Classification for task (Id="
+ task.getTaskId()
@ -1093,7 +1209,7 @@ public class TaskServiceImpl implements TaskService {
+ ")");
}
// set the classification on the task object
task.setClassificationSummary(aClassification);
task.setClassificationSummary(classificationSummary);
}
LOGGER.debug("exit from addClassificationSummariesToTaskSummaries()");
}
@ -1168,18 +1284,18 @@ public class TaskServiceImpl implements TaskService {
TaskSummaryImpl task = taskIterator.next();
String workbasketId = task.getWorkbasketSummaryImpl().getId();
WorkbasketSummary aWorkbasket =
WorkbasketSummary workbasketSummary =
workbaskets.stream()
.filter(x -> workbasketId != null && workbasketId.equals(x.getId()))
.findFirst()
.orElse(null);
if (aWorkbasket == null) {
if (workbasketSummary == null) {
LOGGER.warn("Could not find a Workbasket for task {}.", task.getTaskId());
taskIterator.remove();
continue;
}
task.setWorkbasketSummary(aWorkbasket);
task.setWorkbasketSummary(workbasketSummary);
}
LOGGER.debug("exit from addWorkbasketSummariesToTaskSummaries()");
}
@ -1190,7 +1306,8 @@ public class TaskServiceImpl implements TaskService {
List<ClassificationSummary> classifications) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"entry to addAttachmentSummariesToTaskSummaries(taskSummaries = {}, attachmentSummaries = {}, classifications = {})",
"entry to addAttachmentSummariesToTaskSummaries(taskSummaries = {}, "
+ "attachmentSummaries = {}, classifications = {})",
LoggerUtils.listToString(taskSummaries),
LoggerUtils.listToString(attachmentSummaries),
LoggerUtils.listToString(classifications));
@ -1234,15 +1351,15 @@ public class TaskServiceImpl implements TaskService {
// iterate over all attachment summaries an add the appropriate classification summary to each
for (AttachmentSummaryImpl att : attachmentSummaries) {
String classificationId = att.getClassificationSummary().getId();
ClassificationSummary aClassification =
ClassificationSummary classificationSummary =
classifications.stream()
.filter(x -> classificationId != null && classificationId.equals(x.getId()))
.findFirst()
.orElse(null);
if (aClassification == null) {
if (classificationSummary == null) {
throw new SystemException("Could not find a Classification for attachment " + att);
}
att.setClassificationSummary(aClassification);
att.setClassificationSummary(classificationSummary);
}
LOGGER.debug("exit from addClassificationSummariesToAttachmentSummaries()");
}
@ -1264,16 +1381,16 @@ public class TaskServiceImpl implements TaskService {
List<Attachment> result = new ArrayList<>();
for (AttachmentImpl att : attachmentImpls) {
// find the associated task to use the correct domain
ClassificationSummary aClassification =
ClassificationSummary classificationSummary =
classifications.stream()
.filter(c -> c != null && c.getId().equals(att.getClassificationSummary().getId()))
.findFirst()
.orElse(null);
if (aClassification == null) {
if (classificationSummary == null) {
throw new SystemException("Could not find a Classification for attachment " + att);
}
att.setClassificationSummary(aClassification);
att.setClassificationSummary(classificationSummary);
result.add(att);
}
if (LOGGER.isDebugEnabled()) {
@ -1707,7 +1824,8 @@ public class TaskServiceImpl implements TaskService {
int prioFromClassification,
String serviceLevelFromClassification) {
LOGGER.debug(
"entry to getNewPrioDuration(prioDurationHolder = {}, prioFromClassification = {}, serviceLevelFromClassification = {})",
"entry to getNewPrioDuration(prioDurationHolder = {}, prioFromClassification = {}, "
+ "serviceLevelFromClassification = {})",
prioDurationHolder,
prioFromClassification,
serviceLevelFromClassification);
@ -1787,93 +1905,6 @@ public class TaskServiceImpl implements TaskService {
LOGGER.debug("exit from updateTaskPrioDurationFromClassificationAndAttachments()");
}
private Task completeTask(String taskId, boolean isForced)
throws TaskNotFoundException, InvalidOwnerException, InvalidStateException,
NotAuthorizedException {
String userId = CurrentUserContext.getUserid();
LOGGER.debug(
"entry to completeTask(id = {}, userId = {}, isForced = {})", taskId, userId, isForced);
TaskImpl task = null;
try {
taskanaEngine.openConnection();
task = (TaskImpl) this.getTask(taskId);
if (task.getState() == TaskState.COMPLETED) {
return task;
}
// check pre-conditions for non-forced invocation
if (!isForced) {
if (task.getClaimed() == null || task.getState() != TaskState.CLAIMED) {
throw new InvalidStateException(TASK_WITH_ID + taskId + " has to be claimed before.");
} else if (!CurrentUserContext.getAccessIds().contains(task.getOwner())) {
throw new InvalidOwnerException(
"Owner of task "
+ taskId
+ " is "
+ task.getOwner()
+ ", but current User is "
+ userId);
}
} else {
// CLAIM-forced, if task was not already claimed before.
if (task.getClaimed() == null || task.getState() != TaskState.CLAIMED) {
task = (TaskImpl) this.forceClaim(taskId);
}
}
Instant now = Instant.now();
task.setCompleted(now);
task.setModified(now);
task.setState(TaskState.COMPLETED);
task.setOwner(userId);
taskMapper.update(task);
LOGGER.debug("Task '{}' completed by user '{}'.", taskId, userId);
if (HistoryEventProducer.isHistoryEnabled()) {
historyEventProducer.createEvent(new CompletedEvent(task));
}
} finally {
taskanaEngine.returnConnection();
LOGGER.debug("exit from completeTask()");
}
return task;
}
private Task claim(String taskId, boolean forceClaim)
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
NotAuthorizedException {
String userId = CurrentUserContext.getUserid();
LOGGER.debug(
"entry to claim(id = {}, userId = {}, forceClaim = {})", taskId, userId, forceClaim);
TaskImpl task = null;
try {
taskanaEngine.openConnection();
task = (TaskImpl) getTask(taskId);
TaskState state = task.getState();
if (state == TaskState.COMPLETED) {
throw new InvalidStateException(TASK_WITH_ID + taskId + IS_ALREADY_COMPLETED);
}
if (state == TaskState.CLAIMED && !forceClaim && !task.getOwner().equals(userId)) {
throw new InvalidOwnerException(
TASK_WITH_ID + taskId + IS_ALREADY_CLAIMED_BY + task.getOwner() + ".");
}
Instant now = Instant.now();
task.setOwner(userId);
task.setModified(now);
task.setClaimed(now);
task.setRead(true);
task.setState(TaskState.CLAIMED);
taskMapper.update(task);
LOGGER.debug("Task '{}' claimed by user '{}'.", taskId, userId);
if (HistoryEventProducer.isHistoryEnabled()) {
historyEventProducer.createEvent(new ClaimedEvent(task));
}
} finally {
taskanaEngine.returnConnection();
LOGGER.debug("exit from claim()");
}
return task;
}
private void updateTaskPrioDurationFromAttachments(
TaskImpl task, PrioDurationHolder prioDurationFromAttachments) {
LOGGER.debug("entry to updateTaskPrioDurationFromAttachments()");
@ -1918,9 +1949,10 @@ public class TaskServiceImpl implements TaskService {
att.getClassificationSummary().getId(),
new ClassificationNotFoundException(
id,
"When processing task updates due to change of classification, the classification with id "
+ id
+ WAS_NOT_FOUND2));
MessageFormat.format(
"When processing task updates due to change "
+ "of classification, the classification with id {0}{1}",
id, WAS_NOT_FOUND2)));
} else {
att.setClassificationSummary(classificationSummary);
result.add(att);
@ -1931,32 +1963,6 @@ public class TaskServiceImpl implements TaskService {
return result;
}
private void deleteTask(String taskId, boolean forceDelete)
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
LOGGER.debug("entry to deleteTask(taskId = {} , forceDelete = {})", taskId, forceDelete);
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.ADMIN);
TaskImpl task = null;
try {
taskanaEngine.openConnection();
task = (TaskImpl) getTask(taskId);
if (!TaskState.COMPLETED.equals(task.getState()) && !forceDelete) {
throw new InvalidStateException(
"Cannot delete Task " + taskId + " because it is not completed.");
}
if (CallbackState.CALLBACK_PROCESSING_REQUIRED.equals(task.getCallbackState())) {
throw new InvalidStateException(
"Task " + taskId + " cannot be deleted because its callback is not yet processed");
}
taskMapper.delete(taskId);
LOGGER.debug("Task {} deleted.", taskId);
} finally {
taskanaEngine.returnConnection();
LOGGER.debug("exit from deleteTask().");
}
}
private void createTasksCompletedEvents(List<TaskSummary> taskSummaries) {
taskSummaries.stream()
.forEach(task -> historyEventProducer.createEvent(new CompletedEvent(task)));

View File

@ -199,7 +199,8 @@ public class TaskTransferrer {
} finally {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"exit from transferTasks(targetWbKey = {}, targetWbDomain = {}, destination taskIds = {})",
"exit from transferTasks(targetWbKey = {}, targetWbDomain = {}, "
+ "destination taskIds = {})",
destinationWorkbasketKey,
destinationWorkbasketDomain,
LoggerUtils.listToString(taskIds));
@ -285,7 +286,8 @@ public class TaskTransferrer {
BulkOperationResults<String, TaskanaException> bulkLog) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"entry to checkIfTransferConditionsAreFulfilled(taskIds = {}, taskSummaries = {}, bulkLog = {})",
"entry to checkIfTransferConditionsAreFulfilled(taskIds = {}, "
+ "taskSummaries = {}, bulkLog = {})",
LoggerUtils.listToString(taskIds),
LoggerUtils.listToString(taskSummaries),
bulkLog);
@ -316,7 +318,8 @@ public class TaskTransferrer {
BulkOperationResults<String, TaskanaException> bulkLog) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"entry to checkIfTasksMatchTransferCriteria(taskIds = {}, taskSummaries = {}, sourceWorkbaskets = {}, bulkLog = {})",
"entry to checkIfTasksMatchTransferCriteria(taskIds = {}, taskSummaries = {}, "
+ "sourceWorkbaskets = {}, bulkLog = {})",
LoggerUtils.listToString(taskIds),
LoggerUtils.listToString(taskSummaries),
LoggerUtils.listToString(sourceWorkbaskets),

View File

@ -227,7 +227,8 @@ public class TaskanaEngineImpl implements TaskanaEngine {
} catch (SQLException e) {
throw new SystemException(
"Method createSqlSessionManager() could not open a connection to the database. No databaseId has been set.",
"Method createSqlSessionManager() could not open a connection "
+ "to the database. No databaseId has been set.",
e.getCause());
}
@ -276,7 +277,11 @@ public class TaskanaEngineImpl implements TaskanaEngine {
private ThreadLocal<Deque<SqlSessionManager>> sessionStack = new ThreadLocal<>();
/** @return Stack of SqlSessionManager */
/**
* Get latest SqlSession from session stack.
*
* @return Stack of SqlSessionManager
*/
private Deque<SqlSessionManager> getSessionStack() {
Deque<SqlSessionManager> stack = sessionStack.get();
if (stack == null) {
@ -316,7 +321,8 @@ public class TaskanaEngineImpl implements TaskanaEngine {
sessionManager.getConnection().setSchema(taskanaEngineConfiguration.getSchemaName());
} catch (SQLException e) {
throw new SystemException(
"Method openConnection() could not open a connection to the database. No schema has been created.",
"Method openConnection() could not open a connection "
+ "to the database. No schema has been created.",
e.getCause());
}
if (mode != ConnectionManagementMode.EXPLICIT) {

View File

@ -177,6 +177,7 @@ abstract class TimeIntervalReportBuilderImpl<
}
}
@SuppressWarnings("checkstyle:MethodName")
protected abstract B _this();
protected abstract String determineGroupedBy();

View File

@ -114,30 +114,6 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery
return result;
}
@Override
public List<String> listValues(
AccessItemQueryColumnName columnName, SortDirection sortDirection) {
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
List<String> result = null;
try {
taskanaEngine.openConnection();
this.columnName = columnName;
this.orderBy.clear();
this.addOrderCriteria(columnName.toString(), sortDirection);
result = taskanaEngine.getSqlSession().selectList(LINK_TO_VALUEMAPPER, this);
return result;
} finally {
taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size();
LOGGER.debug(
"Exit from listValues. Returning {} resulting Objects: {} ",
numberOfResultObjects,
LoggerUtils.listToString(result));
}
}
}
@Override
public List<WorkbasketAccessItem> list(int offset, int limit) {
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
@ -169,6 +145,30 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery
}
}
@Override
public List<String> listValues(
AccessItemQueryColumnName columnName, SortDirection sortDirection) {
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
List<String> result = null;
try {
taskanaEngine.openConnection();
this.columnName = columnName;
this.orderBy.clear();
this.addOrderCriteria(columnName.toString(), sortDirection);
result = taskanaEngine.getSqlSession().selectList(LINK_TO_VALUEMAPPER, this);
return result;
} finally {
taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) {
int numberOfResultObjects = result == null ? 0 : result.size();
LOGGER.debug(
"Exit from listValues. Returning {} resulting Objects: {} ",
numberOfResultObjects,
LoggerUtils.listToString(result));
}
}
}
@Override
public WorkbasketAccessItem single() {
LOGGER.debug("entry to single(), this = {}", this);

View File

@ -400,28 +400,6 @@ public class WorkbasketQueryImpl implements WorkbasketQuery {
}
}
public List<String> listValues(
WorkbasketQueryColumnName columnName, SortDirection sortDirection) {
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
List<String> result = new ArrayList<>();
try {
taskanaEngine.openConnection();
this.columnName = columnName;
handleCallerRolesAndAccessIds();
this.orderBy.clear();
result = taskanaEngine.getSqlSession().selectList(LINK_TO_VALUEMAPPER, this);
return result;
} finally {
taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"Exit from listValues. Returning {} resulting Objects: {} ",
result.size(),
LoggerUtils.listToString(result));
}
}
}
@Override
public List<WorkbasketSummary> list(int offset, int limit) {
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
@ -452,6 +430,28 @@ public class WorkbasketQueryImpl implements WorkbasketQuery {
}
}
public List<String> listValues(
WorkbasketQueryColumnName columnName, SortDirection sortDirection) {
LOGGER.debug("Entry to listValues(dbColumnName={}) this = {}", columnName, this);
List<String> result = new ArrayList<>();
try {
taskanaEngine.openConnection();
this.columnName = columnName;
handleCallerRolesAndAccessIds();
this.orderBy.clear();
result = taskanaEngine.getSqlSession().selectList(LINK_TO_VALUEMAPPER, this);
return result;
} finally {
taskanaEngine.returnConnection();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"Exit from listValues. Returning {} resulting Objects: {} ",
result.size(),
LoggerUtils.listToString(result));
}
}
}
@Override
public WorkbasketSummary single() {
LOGGER.debug("entry to single(), this = {}", this);

View File

@ -1,5 +1,6 @@
package pro.taskana.impl;
import java.text.MessageFormat;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
@ -178,16 +179,18 @@ public class WorkbasketServiceImpl implements WorkbasketService {
|| workbasketAccessItem.getAccessId() == null
|| workbasketAccessItem.getWorkbasketId() == null) {
throw new InvalidArgumentException(
"Checking the preconditions of the current WorkbasketAccessItem failed. WorkbasketAccessItem="
+ workbasketAccessItem.toString());
MessageFormat.format(
"Checking the preconditions of the current "
+ "WorkbasketAccessItem failed. WorkbasketAccessItem={0}",
workbasketAccessItem.toString()));
}
WorkbasketImpl wb = workbasketMapper.findById(workbasketAccessItem.getWorkbasketId());
if (wb == null) {
throw new WorkbasketNotFoundException(
workbasketAccessItem.getWorkbasketId(),
"WorkbasketAccessItem "
+ workbasketAccessItem
+ " refers to a not existing workbasket");
MessageFormat
.format("WorkbasketAccessItem {0} refers to a not existing workbasket",
workbasketAccessItem));
}
workbasketAccessMapper.insert(accessItem);
LOGGER.debug(
@ -218,14 +221,16 @@ public class WorkbasketServiceImpl implements WorkbasketService {
(WorkbasketAccessItemImpl) workbasketAccessItem;
if (wbAccessItemImpl.getWorkbasketId() == null) {
throw new InvalidArgumentException(
"Checking the preconditions of the current WorkbasketAccessItem failed - WBID is NULL. WorkbasketAccessItem="
+ workbasketAccessItem.toString());
MessageFormat.format(
"Checking the preconditions of the current WorkbasketAccessItem failed "
+ "- WBID is NULL. WorkbasketAccessItem={0}",
workbasketAccessItem.toString()));
} else if (!wbAccessItemImpl.getWorkbasketId().equals(workbasketId)) {
throw new InvalidArgumentException(
"Checking the preconditions of the current WorkbasketAccessItem failed - the WBID does not match. Target-WBID='"
+ workbasketId
+ "' WorkbasketAccessItem="
+ workbasketAccessItem.toString());
MessageFormat.format(
"Checking the preconditions of the current WorkbasketAccessItem failed "
+ "- the WBID does not match. Target-WBID=''{0}'' WorkbasketAccessItem={1}",
workbasketId, workbasketAccessItem.toString()));
}
if (wbAccessItemImpl.getId() == null || wbAccessItemImpl.getId().isEmpty()) {
wbAccessItemImpl.setId(
@ -598,7 +603,8 @@ public class WorkbasketServiceImpl implements WorkbasketService {
getWorkbasket(targetId);
distributionTargetMapper.insert(sourceWorkbasketId, targetId);
LOGGER.debug(
"Method setDistributionTargets() created distributiontarget for source '{}' and target {}",
"Method setDistributionTargets() created distribution target "
+ "for source '{}' and target {}",
sourceWorkbasketId,
targetId);
}
@ -634,7 +640,8 @@ public class WorkbasketServiceImpl implements WorkbasketService {
sourceWorkbasketId, targetWorkbasketId);
if (numOfDistTargets > 0) {
LOGGER.debug(
"addDistributionTarget detected that the specified distribution target exists already. Doing nothing...");
"addDistributionTarget detected that the specified "
+ "distribution target exists already. Doing nothing.");
} else {
distributionTargetMapper.insert(sourceWorkbasketId, targetWorkbasketId);
LOGGER.debug(
@ -680,13 +687,15 @@ public class WorkbasketServiceImpl implements WorkbasketService {
workbasketMapper.update(sourceWorkbasket);
} catch (WorkbasketNotFoundException e) {
LOGGER.debug(
"removeDistributionTarget found that the source workbasket {} doesn't exist. Ignoring the request... ",
"removeDistributionTarget found that the source workbasket {} "
+ "doesn't exist. Ignoring the request... ",
sourceWorkbasketId);
}
} else {
LOGGER.debug(
"removeDistributionTarget detected that the specified distribution target doesn't exist. Doing nothing...");
"removeDistributionTarget detected that the specified distribution "
+ "target doesn't exist. Doing nothing...");
}
} finally {
taskanaEngine.returnConnection();

View File

@ -55,7 +55,8 @@ public class ClassificationChangedJob extends AbstractTaskanaJob {
int batchSize = taskanaEngineImpl.getConfiguration().getMaxNumberOfUpdatesPerTransaction();
List<List<String>> affectedTaskBatches = partition(affectedTaskIds, batchSize);
LOGGER.debug(
"Creating {} TaskRefreshJobs out of {} affected tasks with a maximum number of {} tasks each. ",
"Creating {} TaskRefreshJobs out of {} affected tasks "
+ "with a maximum number of {} tasks each. ",
affectedTaskBatches.size(),
affectedTaskIds.size(),
batchSize);

View File

@ -70,6 +70,7 @@ public class JobRunner {
try {
hostAddress = InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
//ignore
}
job.setLockedBy(hostAddress + " - " + Thread.currentThread().getName());
String owner = hostAddress + " - " + Thread.currentThread().getName();

View File

@ -11,7 +11,7 @@ import org.apache.ibatis.annotations.Update;
import pro.taskana.impl.ClassificationImpl;
/** This class is the mybatis mapping of classifications. */
@SuppressWarnings("checkstyle:LineLength")
@SuppressWarnings({"checkstyle:LineLength", "checkstyle:indentation"})
public interface ClassificationMapper {
@Select(

View File

@ -9,8 +9,9 @@ import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import pro.taskana.ObjectReference;
/** This class is the mybatis mapping of ObjectReference. */
@SuppressWarnings("checkstyle:LineLength")
@SuppressWarnings({"checkstyle:LineLength", "checkstyle:indentation"})
public interface ObjectReferenceMapper {
@Select(

View File

@ -17,7 +17,7 @@ import pro.taskana.impl.WorkbasketQueryImpl;
import pro.taskana.impl.WorkbasketSummaryImpl;
/** This class provides a mapper for all queries. */
@SuppressWarnings("checkstyle:LineLength")
@SuppressWarnings({"checkstyle:LineLength", "checkstyle:indentation"})
public interface QueryMapper {
String OBJECTREFERENCEMAPPER_FINDBYID = "pro.taskana.mappings.ObjectReferenceMapper.findById";

View File

@ -18,7 +18,7 @@ import pro.taskana.impl.report.item.TimestampQueryItem;
import pro.taskana.report.Timestamp;
/** This class is the mybatis mapping of task monitoring. */
@SuppressWarnings("checkstyle:LineLength")
@SuppressWarnings({"checkstyle:LineLength", "checkstyle:indentation"})
public interface TaskMonitorMapper {
@Select(

View File

@ -22,7 +22,9 @@ public class CategoryReport extends Report<MonitorQueryItem, TimeIntervalColumnH
super(timeIntervalColumnHeaders, new String[] {"CLASSIFICATION CATEGORIES"});
}
/** Builder for {@link CategoryReport}. */
/**
* Builder for {@link CategoryReport}.
*/
public interface Builder
extends TimeIntervalReportBuilder<Builder, MonitorQueryItem, TimeIntervalColumnHeader> {

View File

@ -34,9 +34,9 @@ public class ClassificationReport extends Report<MonitorQueryItem, TimeIntervalC
* pro.taskana.impl.report.structure.Row}s for the classifications of the attachments of the
* tasks.
*
* @return the DetailedClassificationReport
* @throws InvalidArgumentException if the column headers are not initialized
* @throws NotAuthorizedException if the user has no rights to access the monitor
* @return the DetailedClassificationReport
*/
DetailedClassificationReport buildDetailedReport()
throws InvalidArgumentException, NotAuthorizedException;

View File

@ -109,8 +109,8 @@ public interface TimeIntervalReportBuilder<
*
* @param selectedItems a list of selectedItems
* @throws InvalidArgumentException if the column headers are not initialized
* @throws NotAuthorizedException if the user has no rights to access the monitor
* @return the list of all taskIds
* @throws NotAuthorizedException if the user has no rights to access the monitor
*/
List<String> listTaskIdsForSelectedItems(List<SelectedItem> selectedItems)
throws NotAuthorizedException, InvalidArgumentException;
@ -119,8 +119,8 @@ public interface TimeIntervalReportBuilder<
* Returns a list of all values of an entered custom field that are in the report.
*
* @param customField the customField whose values should appear in the list
* @throws NotAuthorizedException if the user has no rights to access the monitor
* @return the list of all custom attribute values
* @throws NotAuthorizedException if the user has no rights to access the monitor
*/
List<String> listCustomAttributeValuesForCustomAttributeName(CustomField customField)
throws NotAuthorizedException;

View File

@ -139,9 +139,9 @@ public final class CurrentUserContext {
if (subject != null) {
Set<Principal> principals = subject.getPrincipals();
LOGGER.trace("Public principals of caller: {}", principals);
for (Principal pC : principals) {
if (!(pC instanceof Group)) {
String userIdFound = pC.getName();
for (Principal principal : principals) {
if (!(principal instanceof Group)) {
String userIdFound = principal.getName();
String userIdUsed = userIdFound;
if (TaskanaEngineConfiguration.shouldUseLowerCaseForAccessIds() && userIdFound != null) {
userIdUsed = userIdFound.toLowerCase();

View File

@ -68,7 +68,8 @@ class CreateClassificationAccTest extends AbstractAccTest {
void testCreateClassificationWithMasterCopy()
throws ClassificationAlreadyExistException, ClassificationNotFoundException,
NotAuthorizedException, DomainNotFoundException, InvalidArgumentException {
long amountOfClassificationsBefore = classificationService.createClassificationQuery().count();
final long countClassificationsBefore =
classificationService.createClassificationQuery().count();
Classification classification =
classificationService.newClassification("Key1", "DOMAIN_A", "TASK");
classification.setIsValidInDomain(true);
@ -86,7 +87,7 @@ class CreateClassificationAccTest extends AbstractAccTest {
// Check 2 new created
long amountOfClassificationsAfter = classificationService.createClassificationQuery().count();
assertThat(amountOfClassificationsAfter, equalTo(amountOfClassificationsBefore + 2));
assertThat(amountOfClassificationsAfter, equalTo(countClassificationsBefore + 2));
// Check main
classification = classificationService.getClassification(classification.getId());

View File

@ -57,8 +57,8 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
String newName = "updated Name";
String newEntryPoint = "updated EntryPoint";
Classification classification = classificationService.getClassification("T2100", "DOMAIN_A");
Instant createdBefore = classification.getCreated();
Instant modifiedBefore = classification.getModified();
final Instant createdBefore = classification.getCreated();
final Instant modifiedBefore = classification.getModified();
classification.setApplicationEntryPoint(newEntryPoint);
classification.setCategory("PROCESS");
@ -133,8 +133,8 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
classificationService.getClassification(
beforeTask.getClassificationSummary().getKey(), beforeTask.getDomain());
classification.setCategory("PROCESS");
Instant createdBefore = classification.getCreated();
Instant modifiedBefore = classification.getModified();
final Instant createdBefore = classification.getCreated();
final Instant modifiedBefore = classification.getModified();
classification = taskanaEngine.getClassificationService().updateClassification(classification);
TaskImpl updatedTask =
@ -164,7 +164,8 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException,
InterruptedException, InvalidArgumentException {
Classification base = classificationService.getClassification("T2100", "DOMAIN_A");
Classification classification = classificationService.getClassification("T2100", "DOMAIN_A");
final Classification classification =
classificationService.getClassification("T2100", "DOMAIN_A");
// UPDATE BASE
base.setApplicationEntryPoint("SOME CHANGED POINT");
@ -218,11 +219,11 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException,
InterruptedException, TaskNotFoundException, InvalidArgumentException {
String newEntryPoint = "updated EntryPoint";
Instant before = Instant.now();
final Instant before = Instant.now();
Classification classification =
classificationService.getClassification("CLI:100000000000000000000000000000000003");
Instant createdBefore = classification.getCreated();
Instant modifiedBefore = classification.getModified();
final Instant modifiedBefore = classification.getModified();
classification.setPriority(1000);
classification.setServiceLevel("P15D");

View File

@ -26,11 +26,11 @@ public class AbstractReportAccTest {
private static void resetDb() throws SQLException {
DataSource dataSource = TaskanaEngineTestConfiguration.getDataSource();
String schemaName = TaskanaEngineTestConfiguration.getSchemaName();
SampleDataGenerator sampleDataGenerator = new SampleDataGenerator(dataSource, schemaName);
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, schemaName);
taskanaEngineConfiguration.setGermanPublicHolidaysEnabled(false);
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
taskanaEngine.setConnectionManagementMode(TaskanaEngine.ConnectionManagementMode.AUTOCOMMIT);
SampleDataGenerator sampleDataGenerator = new SampleDataGenerator(dataSource, schemaName);
sampleDataGenerator.clearDb();
sampleDataGenerator.generateMonitorData();
}

View File

@ -46,11 +46,11 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId(userName = "monitor")
@Test
void testGetTaskIdsOfCategoryReport() throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("EXTERN");
@ -95,13 +95,13 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
@Test
void testGetTaskIdsOfCategoryReportWithWorkbasketFilter()
throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("EXTERN");
@ -140,12 +140,12 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
@Test
void testGetTaskIdsOfCategoryReportWithStateFilter()
throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TaskState> states = Collections.singletonList(TaskState.READY);
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<TaskState> states = Collections.singletonList(TaskState.READY);
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("EXTERN");
@ -191,12 +191,12 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
@Test
void testGetTaskIdsOfCategoryReportWithCategoryFilter()
throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("AUTOMATIC");
@ -228,12 +228,12 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
@Test
void testGetTaskIdsOfCategoryReportWithDomainFilter()
throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> domains = Collections.singletonList("DOMAIN_A");
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("EXTERN");
@ -272,13 +272,13 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
@Test
void testGetTaskIdsOfCategoryReportWithCustomFieldValueFilter()
throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("EXTERN");
@ -317,11 +317,11 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId(userName = "monitor")
@Test
void testThrowsExceptionIfSubKeysAreUsed() {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("EXTERN");

View File

@ -23,9 +23,9 @@ class GetTaskIdsOfClassificationReportAccTest extends AbstractReportAccTest {
@Test
void testRoleCheck() {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("L10000");
@ -57,11 +57,11 @@ class GetTaskIdsOfClassificationReportAccTest extends AbstractReportAccTest {
@Test
void testGetTaskIdsOfClassificationReport()
throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("L10000");
@ -101,11 +101,11 @@ class GetTaskIdsOfClassificationReportAccTest extends AbstractReportAccTest {
@Test
void testGetTaskIdsOfClassificationReportWithAttachments()
throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("L10000");
@ -143,11 +143,11 @@ class GetTaskIdsOfClassificationReportAccTest extends AbstractReportAccTest {
@Test
void testGetTaskIdsOfClassificationReportWithDomainFilter()
throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("L10000");

View File

@ -47,11 +47,11 @@ class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAccTest {
@Test
void testGetTaskIdsOfCustomFieldValueReport()
throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("Geschaeftsstelle A");
@ -93,13 +93,13 @@ class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAccTest {
@Test
void testGetTaskIdsOfCustomFieldValueReportWithWorkbasketFilter()
throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("Geschaeftsstelle A");
@ -137,11 +137,11 @@ class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAccTest {
@Test
void testGetTaskIdsOfCustomFieldValueReportWithStateFilter()
throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("Geschaeftsstelle A");
@ -184,12 +184,12 @@ class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAccTest {
@Test
void testGetTaskIdsOfCustomFieldValueReportWithCategoryFilter()
throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<String> categories = Arrays.asList("AUTOMATIC", "MANUAL");
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("Geschaeftsstelle A");
@ -227,11 +227,11 @@ class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAccTest {
@Test
void testGetTaskIdsOfCustomFieldValueReportWithDomainFilter()
throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("Geschaeftsstelle A");
@ -269,13 +269,13 @@ class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAccTest {
@Test
void testGetTaskIdsOfCustomFieldValueReportWithCustomFieldValueFilter()
throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
Map<CustomField, String> customAttributeFilter = new HashMap<>();
final Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("Geschaeftsstelle A");
@ -313,11 +313,11 @@ class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAccTest {
@WithAccessId(userName = "monitor")
@Test
void testThrowsExceptionIfSubKeysAreUsed() {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("Geschaeftsstelle A");

View File

@ -41,11 +41,11 @@ class GetTaskIdsOfWorkbasketReportAccTest extends AbstractReportAccTest {
@WithAccessId(userName = "monitor")
@Test
void testGetTaskIdsOfWorkbasketReport() throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("USER_1_1");
@ -86,11 +86,11 @@ class GetTaskIdsOfWorkbasketReportAccTest extends AbstractReportAccTest {
@Test
void testGetTaskIdsOfWorkbasketReportWithExcludedClassifications()
throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
final TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems = new ArrayList<>();
final List<SelectedItem> selectedItems = new ArrayList<>();
SelectedItem s1 = new SelectedItem();
s1.setKey("USER_1_1");

View File

@ -85,7 +85,7 @@ class ProvideCategoryReportAccTest extends AbstractReportAccTest {
LOGGER.debug(reportToString(report, columnHeaders));
}
int sumLineCount = IntStream.of(report.getSumRow().getCells()).sum();
final int sumLineCount = IntStream.of(report.getSumRow().getCells()).sum();
assertNotNull(report);
assertEquals(3, report.rowSize());
@ -361,10 +361,10 @@ class ProvideCategoryReportAccTest extends AbstractReportAccTest {
private String reportToString(
CategoryReport report, List<TimeIntervalColumnHeader> columnHeaders) {
String formatColumWidth = "| %-7s ";
String formatFirstColumn = "| %-36s %-4s ";
String formatFirstColumnFirstLine = "| %-29s %12s ";
String formatFirstColumnSumLine = "| %-36s %-5s";
final String formatColumWidth = "| %-7s ";
final String formatFirstColumn = "| %-36s %-4s ";
final String formatFirstColumnFirstLine = "| %-29s %12s ";
final String formatFirstColumnSumLine = "| %-36s %-5s";
int reportWidth = columnHeaders == null ? 46 : columnHeaders.size() * 10 + 46;
StringBuilder builder = new StringBuilder();

View File

@ -91,7 +91,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
LOGGER.debug(reportToString(report, columnHeaders));
}
int sumLineCount = IntStream.of(report.getSumRow().getCells()).sum();
final int sumLineCount = IntStream.of(report.getSumRow().getCells()).sum();
assertNotNull(report);
assertEquals(5, report.rowSize());
@ -413,10 +413,10 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
private String reportToString(
ClassificationReport report, List<TimeIntervalColumnHeader> columnHeaders) {
String formatColumWidth = "| %-7s ";
String formatFirstColumn = "| %-36s %-4s ";
String formatFirstColumnFirstLine = "| %-29s %12s ";
String formatFirstColumnSumLine = "| %-36s %-5s";
final String formatColumWidth = "| %-7s ";
final String formatFirstColumn = "| %-36s %-4s ";
final String formatFirstColumnFirstLine = "| %-29s %12s ";
final String formatFirstColumnSumLine = "| %-36s %-5s";
int reportWidth = columnHeaders == null ? 46 : columnHeaders.size() * 10 + 46;
StringBuilder builder = new StringBuilder();

View File

@ -389,8 +389,8 @@ class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest {
CustomFieldValueReport report, List<TimeIntervalColumnHeader> columnHeaders) {
String formatColumWidth = "| %-7s ";
String formatFirstColumn = "| %-36s %-4s ";
String formatFirstColumnFirstLine = "| %-29s %12s ";
String formatFirstColumnSumLine = "| %-36s %-5s";
final String formatFirstColumnFirstLine = "| %-29s %12s ";
final String formatFirstColumnSumLine = "| %-36s %-5s";
int reportWidth = columnHeaders == null ? 46 : columnHeaders.size() * 10 + 46;
StringBuilder builder = new StringBuilder();

View File

@ -593,9 +593,9 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
DetailedClassificationReport report, List<TimeIntervalColumnHeader> columnHeaders) {
String formatColumWidth = "| %-7s ";
String formatFirstColumn = "| %-36s %-4s ";
String formatFirstColumnFirstLine = "| %-29s %12s ";
String formatFirstColumnDetailLines = "| + %-34s %-4s ";
String formatFirstColumnSumLine = "| %-36s %-5s";
final String formatFirstColumnFirstLine = "| %-29s %12s ";
final String formatFirstColumnDetailLines = "| + %-34s %-4s ";
final String formatFirstColumnSumLine = "| %-36s %-5s";
int reportWidth = columnHeaders == null ? 46 : columnHeaders.size() * 10 + 46;
StringBuilder builder = new StringBuilder();

View File

@ -150,8 +150,8 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
List<TaskStatusColumnHeader> columnHeaders = report.getColumnHeaders();
String formatColumnWidth = "| %-7s ";
String formatFirstColumn = "| %-36s %-4s ";
String formatFirstColumnFirstLine = "| %-29s %12s ";
String formatFirstColumnSumLine = "| %-36s %-5s";
final String formatFirstColumnFirstLine = "| %-29s %12s ";
final String formatFirstColumnSumLine = "| %-36s %-5s";
int reportWidth = columnHeaders.size() * 10 + 46;
StringBuilder builder = new StringBuilder();

View File

@ -85,7 +85,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
LOGGER.debug(reportToString(report, columnHeaders));
}
int sumLineCount = IntStream.of(report.getSumRow().getCells()).sum();
final int sumLineCount = IntStream.of(report.getSumRow().getCells()).sum();
assertNotNull(report);
assertEquals(3, report.rowSize());
@ -438,8 +438,8 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
WorkbasketReport report, List<TimeIntervalColumnHeader> reportLineItemDefinitions) {
String formatColumWidth = "| %-7s ";
String formatFirstColumn = "| %-36s %-4s ";
String formatFirstColumnFirstLine = "| %-29s %12s ";
String formatFirstColumnSumLine = "| %-36s %-5s";
final String formatFirstColumnFirstLine = "| %-29s %12s ";
final String formatFirstColumnSumLine = "| %-36s %-5s";
int reportWidth =
reportLineItemDefinitions == null ? 46 : reportLineItemDefinitions.size() * 10 + 46;

View File

@ -111,7 +111,6 @@ class CallbackStateAccTest extends AbstractAccTest {
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
TaskAlreadyExistException, InvalidArgumentException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService();
TaskImpl createdTask1 =
createTask(taskanaEngine.getTaskService(), CallbackState.CALLBACK_PROCESSING_REQUIRED);
@ -125,6 +124,7 @@ class CallbackStateAccTest extends AbstractAccTest {
createTask(taskanaEngine.getTaskService(), CallbackState.CALLBACK_PROCESSING_REQUIRED);
assertEquals(CallbackState.CALLBACK_PROCESSING_REQUIRED, createdTask3.getCallbackState());
TaskService taskService = taskanaEngine.getTaskService();
createdTask1 = (TaskImpl) taskService.forceCompleteTask(createdTask1.getId());
createdTask2 = (TaskImpl) taskService.forceCompleteTask(createdTask2.getId());
createdTask3 = (TaskImpl) taskService.forceCompleteTask(createdTask3.getId());
@ -136,12 +136,6 @@ class CallbackStateAccTest extends AbstractAccTest {
List<String> taskIds =
new ArrayList<>(
Arrays.asList(createdTask1.getId(), createdTask2.getId(), createdTask3.getId()));
List<String> externalIds =
new ArrayList<>(
Arrays.asList(
createdTask1.getExternalId(),
createdTask2.getExternalId(),
createdTask3.getExternalId()));
// delete should fail because callback_state = CALLBACK_PROCESSING_REQUIRED
BulkOperationResults<String, TaskanaException> bulkResult1 = taskService.deleteTasks(taskIds);
@ -153,6 +147,12 @@ class CallbackStateAccTest extends AbstractAccTest {
TaskanaException excpt = bulkResult1.getErrorForId(taskId);
assertEquals("pro.taskana.exceptions.InvalidStateException", excpt.getClass().getName());
}
List<String> externalIds =
new ArrayList<>(
Arrays.asList(
createdTask1.getExternalId(),
createdTask2.getExternalId(),
createdTask3.getExternalId()));
// now enable deletion by setting callback state to CALLBACK_PROCESSING_COMPLETED
BulkOperationResults<String, TaskanaException> bulkResult2 =
@ -341,7 +341,6 @@ class CallbackStateAccTest extends AbstractAccTest {
// let's set it to CALLBACK_PROCESSING_REQUIRED
List<TaskSummary> completedTasks =
taskService.createTaskQuery().stateIn(TaskState.COMPLETED).list();
long numberOfCompletedTasksAtStartOfTest = completedTasks.size();
List<String> externalIds =
completedTasks.stream().map(TaskSummary::getExternalId).collect(Collectors.toList());
BulkOperationResults<String, TaskanaException> bulkResultCompleted =
@ -354,6 +353,7 @@ class CallbackStateAccTest extends AbstractAccTest {
taskService.forceCompleteTask(claimedTasks.get(4).getTaskId());
taskService.forceCompleteTask(claimedTasks.get(5).getTaskId());
long numberOfCompletedTasksAtStartOfTest = completedTasks.size();
// now lets retrieve those completed tasks that have callback_processing_required
List<TaskSummary> tasksToBeActedUpon =
taskService

View File

@ -168,7 +168,7 @@ class CompleteTaskAccTest extends AbstractAccTest {
assertNotNull(createdTask);
assertNull(createdTask.getClaimed());
Instant before = createdTask.getCreated();
final Instant before = createdTask.getCreated();
Task claimedTask = taskService.claim(createdTask.getId());
assertNotNull(claimedTask.getOwner());
@ -297,7 +297,7 @@ class CompleteTaskAccTest extends AbstractAccTest {
assertNotNull(taskBefore);
assertEquals(TaskState.CLAIMED, taskBefore.getState());
Instant before = Instant.now();
final Instant before = Instant.now();
Thread.sleep(1);
Task taskAfter = taskService.forceCancelClaim("TKI:000000000000000000000000000000000043");

View File

@ -746,7 +746,7 @@ class CreateTaskAccTest extends AbstractAccTest {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.getWorkbasket("USER_1_1", "DOMAIN_A");
final Workbasket workbasket = workbasketService.getWorkbasket("USER_1_1", "DOMAIN_A");
Task newTask = taskService.newTask("WBI:100000000000000000000000000000000006");
newTask.setClassificationKey("T2100");

View File

@ -192,7 +192,7 @@ class TransferTaskAccTest extends AbstractAccTest {
void testBulkTransferTaskToWorkbasketById()
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
TaskNotFoundException {
Instant before = Instant.now();
final Instant before = Instant.now();
TaskService taskService = taskanaEngine.getTaskService();
ArrayList<String> taskIdList = new ArrayList<>();
taskIdList.add("TKI:000000000000000000000000000000000004");
@ -202,7 +202,8 @@ class TransferTaskAccTest extends AbstractAccTest {
taskService.transferTasks("WBI:100000000000000000000000000000000006", taskIdList);
assertFalse(results.containsErrors());
Workbasket wb = taskanaEngine.getWorkbasketService().getWorkbasket("USER_1_1", "DOMAIN_A");
final Workbasket wb =
taskanaEngine.getWorkbasketService().getWorkbasket("USER_1_1", "DOMAIN_A");
Task transferredTask = taskService.getTask("TKI:000000000000000000000000000000000004");
assertNotNull(transferredTask);
assertTrue(transferredTask.isTransferred());
@ -231,8 +232,9 @@ class TransferTaskAccTest extends AbstractAccTest {
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService();
Workbasket wb = taskanaEngine.getWorkbasketService().getWorkbasket("USER_1_1", "DOMAIN_A");
Instant before = Instant.now();
final Workbasket wb =
taskanaEngine.getWorkbasketService().getWorkbasket("USER_1_1", "DOMAIN_A");
final Instant before = Instant.now();
ArrayList<String> taskIdList = new ArrayList<>();
taskIdList.add("TKI:000000000000000000000000000000000006"); // working
taskIdList.add("TKI:000000000000000000000000000000000041"); // NotAuthorized READ
@ -359,7 +361,7 @@ class TransferTaskAccTest extends AbstractAccTest {
void testBulkTransferByWorkbasketAndDomainByKey()
throws WorkbasketNotFoundException, NotAuthorizedException, InvalidArgumentException,
TaskNotFoundException {
Instant before = Instant.now();
final Instant before = Instant.now();
TaskService taskService = taskanaEngine.getTaskService();
List<String> taskIdList = new ArrayList<>();
@ -370,7 +372,8 @@ class TransferTaskAccTest extends AbstractAccTest {
taskService.transferTasks("GPK_B_KSC_1", "DOMAIN_B", taskIdList);
assertFalse(results.containsErrors());
Workbasket wb = taskanaEngine.getWorkbasketService().getWorkbasket("GPK_B_KSC_1", "DOMAIN_B");
final Workbasket wb =
taskanaEngine.getWorkbasketService().getWorkbasket("GPK_B_KSC_1", "DOMAIN_B");
Task transferredTask = taskService.getTask("TKI:000000000000000000000000000000000023");
assertNotNull(transferredTask);
assertTrue(transferredTask.isTransferred());

View File

@ -55,7 +55,7 @@ class UpdateTaskAccTest extends AbstractAccTest {
TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
Instant modifiedOriginal = task.getModified();
final Instant modifiedOriginal = task.getModified();
task.setPrimaryObjRef(
createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "7654321"));
task.setBusinessProcessId("MY_PROCESS_ID");
@ -139,7 +139,7 @@ class UpdateTaskAccTest extends AbstractAccTest {
TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
ClassificationSummary classificationSummary = task.getClassificationSummary();
final ClassificationSummary classificationSummary = task.getClassificationSummary();
task.setClassificationKey("T2100");
Task updatedTask = taskService.updateTask(task);
updatedTask = taskService.getTask(updatedTask.getId());

View File

@ -62,7 +62,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException {
setUpMethod();
int attachmentCount = task.getAttachments().size();
final int attachmentCount = task.getAttachments().size();
assertEquals(1, task.getPriority());
assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(1)));
task.addAttachment(attachment);
@ -118,7 +118,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException,
ConcurrencyException, NotAuthorizedException, AttachmentPersistenceException {
setUpMethod();
int attachmentCount = 0;
final int attachmentCount = 0;
task.getAttachments().clear();
task = taskService.updateTask(task);
task = taskService.getTask(task.getId());
@ -143,7 +143,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
setUpMethod();
// Add attachment before
task = taskService.getTask(task.getId());
int attachmentCount = task.getAttachments().size();
final int attachmentCount = task.getAttachments().size();
task.addAttachment(attachment);
task = taskService.updateTask(task);
task = taskService.getTask(task.getId());
@ -151,7 +151,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
// Change sth. and add same (id) again - override/update
String newChannel = "UPDATED EXTERNAL SINCE LAST ADD";
attachmentCount = task.getAttachments().size();
final int attachmentCount2 = task.getAttachments().size();
Attachment updatedAttachment = task.getAttachments().get(0);
updatedAttachment.setChannel(newChannel);
Classification newClassification =
@ -162,7 +162,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
task.addAttachment(updatedAttachment);
task = taskService.updateTask(task);
task = taskService.getTask(task.getId());
assertThat(task.getAttachments().size(), equalTo(attachmentCount));
assertThat(task.getAttachments().size(), equalTo(attachmentCount2));
assertThat(task.getAttachments().get(0).getChannel(), equalTo(newChannel));
assertEquals(999, task.getPriority());
@ -182,7 +182,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException {
setUpMethod();
// Add Attachment before
int attachmentCount = task.getAttachments().size();
final int attachmentCount = task.getAttachments().size();
((AttachmentImpl) attachment).setId("TAI:0001");
task.addAttachment(attachment);
task.addAttachment(attachment); // overwrite, same id
@ -192,11 +192,11 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
assertThat(task.getAttachments().size(), equalTo(attachmentCount + 1));
// Add same again - ignored
attachmentCount = task.getAttachments().size();
final int attachmentCount2 = task.getAttachments().size();
Attachment redundantAttachment = task.getAttachments().get(0);
task.addAttachment(redundantAttachment);
task = taskService.updateTask(task);
assertThat(task.getAttachments().size(), equalTo(attachmentCount));
assertThat(task.getAttachments().size(), equalTo(attachmentCount2));
}
@WithAccessId(
@ -208,7 +208,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
ConcurrencyException, NotAuthorizedException, AttachmentPersistenceException {
setUpMethod();
// Try to add a single NULL-Element
int attachmentCount = task.getAttachments().size();
final int attachmentCount = task.getAttachments().size();
task.addAttachment(null);
task = taskService.updateTask(task);
task = taskService.getTask(task.getId());
@ -224,15 +224,15 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
// Test no NullPointer on NULL-Value and removing it on current data.
// New loading can do this, but returned value should got this "function", too.
attachmentCount = task.getAttachments().size();
final int attachmentCount2 = task.getAttachments().size();
task.getAttachments().add(null);
task.getAttachments().add(null);
task.getAttachments().add(null);
task = taskService.updateTask(task);
assertThat(task.getAttachments().size(), equalTo(attachmentCount)); // locally, not persisted
assertThat(task.getAttachments().size(), equalTo(attachmentCount2)); // locally, not persisted
task = taskService.getTask(task.getId());
assertThat(
task.getAttachments().size(), equalTo(attachmentCount)); // persisted values not changed
task.getAttachments().size(), equalTo(attachmentCount2)); // persisted values not changed
assertEquals(1, task.getPriority());
assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(1)));
}
@ -307,7 +307,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
assertEquals(99, task.getPriority());
assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(1)));
int attachmentCount = task.getAttachments().size();
final int attachmentCount = task.getAttachments().size();
String newChannel = attachment.getChannel() + "-X";
task.getAttachments().get(0).setChannel(newChannel);

View File

@ -158,7 +158,7 @@ class WorkOnTaskAccTest extends AbstractAccTest {
void testCompleteTask()
throws NotAuthorizedException, TaskNotFoundException, InvalidStateException,
InvalidOwnerException {
Instant before = Instant.now().minus(Duration.ofSeconds(3L));
final Instant before = Instant.now().minus(Duration.ofSeconds(3L));
TaskService taskService = taskanaEngine.getTaskService();
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000032");

View File

@ -39,7 +39,7 @@ class CreateWorkbasketAccTest extends AbstractAccTest {
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
int before = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").list().size();
final int before = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").list().size();
Workbasket workbasket = workbasketService.newWorkbasket("NT1234", "DOMAIN_A");
workbasket.setName("Megabasket");

View File

@ -115,14 +115,15 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
Assertions.assertThrows(
InvalidArgumentException.class,
() -> workbasketService.deleteWorkbasket(null),
"delete() should have thrown an InvalidArgumentException, when the param ID is null.");
"delete() should have thrown an InvalidArgumentException, " + "when the param ID is null.");
// Test EMPTY-Value
Assertions.assertThrows(
InvalidArgumentException.class,
() -> workbasketService.deleteWorkbasket(""),
"delete() should have thrown an InvalidArgumentException, when the param ID is EMPTY-String.");
"delete() should have thrown an InvalidArgumentException, "
+ "when the param ID is EMPTY-String.");
}
@WithAccessId(
@ -206,8 +207,8 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
throws WorkbasketInUseException, NotAuthorizedException, WorkbasketNotFoundException,
InvalidArgumentException, InvalidOwnerException, InvalidStateException,
TaskNotFoundException {
Workbasket wb = workbasketService.getWorkbasket("WBI:100000000000000000000000000000000006");
boolean markedForDeletion;
final Workbasket wb =
workbasketService.getWorkbasket("WBI:100000000000000000000000000000000006");
TaskImpl task = (TaskImpl) taskService.getTask("TKI:000000000000000000000000000000000000");
taskService.forceCompleteTask(task.getId());
@ -216,10 +217,10 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
task = (TaskImpl) taskService.getTask("TKI:000000000000000000000000000000000002");
taskService.forceCompleteTask(task.getId());
markedForDeletion = workbasketService.deleteWorkbasket(wb.getId());
boolean markedForDeletion = workbasketService.deleteWorkbasket(wb.getId());
assertFalse(markedForDeletion);
wb = workbasketService.getWorkbasket(wb.getId());
assertTrue(wb.isMarkedForDeletion());
Workbasket wb2 = workbasketService.getWorkbasket(wb.getId());
assertTrue(wb2.isMarkedForDeletion());
}
}

View File

@ -32,7 +32,7 @@ public class UpdateWorkbasketAccTest extends AbstractAccTest {
public void testUpdateWorkbasket() throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.getWorkbasket("GPK_KSC", "DOMAIN_A");
Instant modified = workbasket.getModified();
final Instant modified = workbasket.getModified();
workbasket.setName("new name");
workbasket.setDescription("new description");

View File

@ -56,7 +56,7 @@ class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
accessItem.setPermRead(true);
accessItem = workbasketService.createWorkbasketAccessItem(accessItem);
WorkbasketAccessItem newItem = accessItem;
final WorkbasketAccessItem newItem = accessItem;
accessItem.setPermCustom1(true);
accessItem.setPermAppend(false);
accessItem.setAccessName("Rojas, Miguel");
@ -126,11 +126,11 @@ class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
ClassificationNotFoundException, TaskAlreadyExistException {
TaskService taskService = taskanaEngine.getTaskService();
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
final WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
String wbKey = "USER_2_1";
String wbDomain = "DOMAIN_A";
String groupName = "group_2";
final String groupName = "group_2";
Task newTask = taskService.newTask(wbKey, wbDomain);
newTask.setClassificationKey("T2100");
@ -171,7 +171,7 @@ class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
final String wbId = "WBI:100000000000000000000000000000000004";
List<WorkbasketAccessItem> accessItems = workbasketService.getWorkbasketAccessItems(wbId);
int countBefore = accessItems.size();
final int countBefore = accessItems.size();
// update some values
WorkbasketAccessItem item0 = accessItems.get(0);
@ -231,7 +231,7 @@ class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
final String wbId = "WBI:100000000000000000000000000000000004";
List<WorkbasketAccessItem> accessItems = workbasketService.getWorkbasketAccessItems(wbId);
int countBefore = accessItems.size();
final int countBefore = accessItems.size();
// update some values
WorkbasketAccessItem item0 = accessItems.get(0);

View File

@ -58,13 +58,13 @@ class CategoryReportBuilderImplTest {
@Test
void testGetTotalNumbersOfCatgoryReport()
throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN");
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> classificationIds = Collections.singletonList("L10000");
List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
@ -83,7 +83,7 @@ class CategoryReportBuilderImplTest {
customAttributeFilter))
.thenReturn(expectedResult);
CategoryReport actualResult =
final CategoryReport actualResult =
cut.createCategoryReportBuilder()
.workbasketIdIn(workbasketIds)
.stateIn(states)
@ -117,19 +117,19 @@ class CategoryReportBuilderImplTest {
@Test
void testGetCategoryReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN");
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> classificationIds = Collections.singletonList("L10000");
List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<TimeIntervalColumnHeader> columnHeaders =
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
List<MonitorQueryItem> expectedResult = new ArrayList<>();
final List<MonitorQueryItem> expectedResult = new ArrayList<>();
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
monitorQueryItem.setKey("EXTERN");
monitorQueryItem.setAgeInDays(0);
@ -145,7 +145,7 @@ class CategoryReportBuilderImplTest {
customAttributeFilter))
.thenReturn(expectedResult);
CategoryReport actualResult =
final CategoryReport actualResult =
cut.createCategoryReportBuilder()
.workbasketIdIn(workbasketIds)
.stateIn(states)
@ -181,16 +181,16 @@ class CategoryReportBuilderImplTest {
@Test
void testListTaskIdsOfCategoryReportForSelectedItems()
throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN");
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> classificationIds = Collections.singletonList("L10000");
List<String> excludedClassificationIds = Collections.singletonList("L20000");
Map<CustomField, String> customAttributeFilter = new HashMap<>();
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<TimeIntervalColumnHeader> columnHeaders =
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
SelectedItem selectedItem = new SelectedItem();
@ -214,7 +214,7 @@ class CategoryReportBuilderImplTest {
false))
.thenReturn(expectedResult);
List<String> actualResult =
final List<String> actualResult =
cut.createCategoryReportBuilder()
.workbasketIdIn(workbasketIds)
.stateIn(states)
@ -258,23 +258,23 @@ class CategoryReportBuilderImplTest {
@Test
void testListCustomAttributeValuesForCustomAttributeName() throws NotAuthorizedException {
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN");
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> classificationIds = Collections.singletonList("L10000");
List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<TimeIntervalColumnHeader> columnHeaders =
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
SelectedItem selectedItem = new SelectedItem();
selectedItem.setKey("EXTERN");
selectedItem.setLowerAgeLimit(1);
selectedItem.setUpperAgeLimit(5);
List<SelectedItem> selectedItems = Collections.singletonList(selectedItem);
final List<SelectedItem> selectedItems = Collections.singletonList(selectedItem);
List<String> expectedResult = Collections.singletonList("Geschaeftsstelle A");
when(taskMonitorMapperMock.getCustomAttributeValuesForReport(
@ -288,7 +288,7 @@ class CategoryReportBuilderImplTest {
CustomField.CUSTOM_1))
.thenReturn(expectedResult);
List<String> actualResult =
final List<String> actualResult =
cut.createCategoryReportBuilder()
.workbasketIdIn(workbasketIds)
.stateIn(states)

View File

@ -61,17 +61,17 @@ class ClassificationReportBuilderImplTest {
@Test
void testGetTotalNumbersOfClassificationReport()
throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN");
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> classificationIds = Collections.singletonList("L10000");
List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<MonitorQueryItem> expectedResult = new ArrayList<>();
final List<MonitorQueryItem> expectedResult = new ArrayList<>();
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
monitorQueryItem.setKey("CLI:000000000000000000000000000000000001");
monitorQueryItem.setNumberOfTasks(1);
@ -86,7 +86,7 @@ class ClassificationReportBuilderImplTest {
customAttributeFilter))
.thenReturn(expectedResult);
ClassificationReport actualResult =
final ClassificationReport actualResult =
cut.createClassificationReportBuilder()
.workbasketIdIn(workbasketIds)
.stateIn(states)
@ -121,20 +121,20 @@ class ClassificationReportBuilderImplTest {
@Test
void testGetClassificationReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN");
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> classificationIds = Collections.singletonList("L10000");
List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<TimeIntervalColumnHeader> columnHeaders =
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
List<MonitorQueryItem> expectedResult = new ArrayList<>();
final List<MonitorQueryItem> expectedResult = new ArrayList<>();
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
monitorQueryItem.setKey("CLI:000000000000000000000000000000000001");
monitorQueryItem.setAgeInDays(0);
@ -150,7 +150,7 @@ class ClassificationReportBuilderImplTest {
customAttributeFilter))
.thenReturn(expectedResult);
ClassificationReport actualResult =
final ClassificationReport actualResult =
cut.createClassificationReportBuilder()
.workbasketIdIn(workbasketIds)
.stateIn(states)
@ -188,17 +188,17 @@ class ClassificationReportBuilderImplTest {
@Test
void testGetTotalNumbersOfDetailedClassificationReport()
throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN");
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> classificationIds = Collections.singletonList("L10000");
List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<DetailedMonitorQueryItem> expectedResult = new ArrayList<>();
final List<DetailedMonitorQueryItem> expectedResult = new ArrayList<>();
DetailedMonitorQueryItem detailedMonitorQueryItem = new DetailedMonitorQueryItem();
detailedMonitorQueryItem.setKey("CLI:000000000000000000000000000000000001");
detailedMonitorQueryItem.setAttachmentKey("CLI:000000000000000000000000000000000006");
@ -214,7 +214,7 @@ class ClassificationReportBuilderImplTest {
customAttributeFilter))
.thenReturn(expectedResult);
DetailedClassificationReport actualResult =
final DetailedClassificationReport actualResult =
cut.createClassificationReportBuilder()
.workbasketIdIn(workbasketIds)
.stateIn(states)
@ -252,19 +252,19 @@ class ClassificationReportBuilderImplTest {
@Test
void testGetDetailedClassificationReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN");
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> classificationIds = Collections.singletonList("L10000");
List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<TimeIntervalColumnHeader> columnHeaders =
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
List<DetailedMonitorQueryItem> expectedResult = new ArrayList<>();
final List<DetailedMonitorQueryItem> expectedResult = new ArrayList<>();
DetailedMonitorQueryItem detailedMonitorQueryItem = new DetailedMonitorQueryItem();
detailedMonitorQueryItem.setKey("CLI:000000000000000000000000000000000001");
detailedMonitorQueryItem.setAttachmentKey("CLI:000000000000000000000000000000000006");
@ -281,7 +281,7 @@ class ClassificationReportBuilderImplTest {
customAttributeFilter))
.thenReturn(expectedResult);
DetailedClassificationReport actualResult =
final DetailedClassificationReport actualResult =
cut.createClassificationReportBuilder()
.workbasketIdIn(workbasketIds)
.stateIn(states)
@ -322,25 +322,25 @@ class ClassificationReportBuilderImplTest {
@Test
void testGetTaskIdsForSelectedItems() throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN");
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> classificationIds = Collections.singletonList("L10000");
List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<TimeIntervalColumnHeader> columnHeaders =
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
SelectedItem selectedItem = new SelectedItem();
selectedItem.setKey("EXTERN");
selectedItem.setLowerAgeLimit(1);
selectedItem.setUpperAgeLimit(5);
List<SelectedItem> selectedItems = Collections.singletonList(selectedItem);
final List<SelectedItem> selectedItems = Collections.singletonList(selectedItem);
List<String> expectedResult =
final List<String> expectedResult =
Collections.singletonList("TKI:000000000000000000000000000000000001");
when(taskMonitorMapperMock.getTaskIdsForSelectedItems(
workbasketIds,
@ -355,7 +355,7 @@ class ClassificationReportBuilderImplTest {
false))
.thenReturn(expectedResult);
List<String> actualResult =
final List<String> actualResult =
cut.createClassificationReportBuilder()
.workbasketIdIn(workbasketIds)
.stateIn(states)
@ -402,25 +402,25 @@ class ClassificationReportBuilderImplTest {
@Test
void testListCustomAttributeValuesForCustomAttributeName() throws NotAuthorizedException {
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN");
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> classificationIds = Collections.singletonList("L10000");
List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<TimeIntervalColumnHeader> columnHeaders =
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
SelectedItem selectedItem = new SelectedItem();
selectedItem.setKey("EXTERN");
selectedItem.setLowerAgeLimit(1);
selectedItem.setUpperAgeLimit(5);
List<SelectedItem> selectedItems = Collections.singletonList(selectedItem);
final List<SelectedItem> selectedItems = Collections.singletonList(selectedItem);
List<String> expectedResult = Collections.singletonList("Geschaeftsstelle A");
final List<String> expectedResult = Collections.singletonList("Geschaeftsstelle A");
when(taskMonitorMapperMock.getCustomAttributeValuesForReport(
workbasketIds,
states,
@ -432,7 +432,7 @@ class ClassificationReportBuilderImplTest {
CustomField.CUSTOM_1))
.thenReturn(expectedResult);
List<String> actualResult =
final List<String> actualResult =
cut.createClassificationReportBuilder()
.workbasketIdIn(workbasketIds)
.stateIn(states)

View File

@ -57,17 +57,17 @@ class CustomFieldValueReportBuilderImplTest {
@Test
void testGetTotalNumbersOfCustomFieldValueReport()
throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN");
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> classificationIds = Collections.singletonList("L10000");
List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<MonitorQueryItem> expectedResult = new ArrayList<>();
final List<MonitorQueryItem> expectedResult = new ArrayList<>();
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
monitorQueryItem.setKey("Geschaeftsstelle A");
monitorQueryItem.setNumberOfTasks(1);
@ -83,7 +83,7 @@ class CustomFieldValueReportBuilderImplTest {
customAttributeFilter))
.thenReturn(expectedResult);
CustomFieldValueReport actualResult =
final CustomFieldValueReport actualResult =
cut.createCustomFieldValueReportBuilder(CustomField.CUSTOM_1)
.workbasketIdIn(workbasketIds)
.stateIn(states)
@ -117,19 +117,19 @@ class CustomFieldValueReportBuilderImplTest {
@Test
void testGetCustomFieldValueReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN");
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> classificationIds = Collections.singletonList("L10000");
List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<TimeIntervalColumnHeader> columnHeaders =
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
List<MonitorQueryItem> expectedResult = new ArrayList<>();
final List<MonitorQueryItem> expectedResult = new ArrayList<>();
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
monitorQueryItem.setKey("Geschaeftsstelle A");
monitorQueryItem.setAgeInDays(0);
@ -146,7 +146,7 @@ class CustomFieldValueReportBuilderImplTest {
customAttributeFilter))
.thenReturn(expectedResult);
CustomFieldValueReport actualResult =
final CustomFieldValueReport actualResult =
cut.createCustomFieldValueReportBuilder(CustomField.CUSTOM_1)
.workbasketIdIn(workbasketIds)
.stateIn(states)
@ -181,16 +181,16 @@ class CustomFieldValueReportBuilderImplTest {
@Test
void testListCustomAttributeValuesForCustomAttributeName() throws NotAuthorizedException {
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN");
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> classificationIds = Collections.singletonList("L10000");
List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<TimeIntervalColumnHeader> columnHeaders =
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
SelectedItem selectedItem = new SelectedItem();
@ -211,7 +211,7 @@ class CustomFieldValueReportBuilderImplTest {
CustomField.CUSTOM_1))
.thenReturn(expectedResult);
List<String> actualResult =
final List<String> actualResult =
cut.createCustomFieldValueReportBuilder(CustomField.CUSTOM_1)
.workbasketIdIn(workbasketIds)
.stateIn(states)

View File

@ -61,7 +61,7 @@ class TaskStatusReportBuilderImplTest {
when(taskMonitorMapperMock.getTasksCountByState(null, null)).thenReturn(queryItems);
// when
TaskStatusReport report = cut.createTaskStatusReportBuilder().buildReport();
final TaskStatusReport report = cut.createTaskStatusReportBuilder().buildReport();
// then
InOrder inOrder = inOrder(taskanaEngineMock, internalTaskanaEngineMock, taskMonitorMapperMock);
@ -98,7 +98,7 @@ class TaskStatusReportBuilderImplTest {
.thenReturn(queryItems);
// when
TaskStatusReport report =
final TaskStatusReport report =
cut.createTaskStatusReportBuilder().stateIn(Collections.emptyList()).buildReport();
// then

View File

@ -72,7 +72,7 @@ class TaskTransferrerTest {
when(taskanaEngineMock.getWorkbasketService()).thenReturn(workbasketServiceMock);
cut = new TaskTransferrer(internalTaskanaEngineMock, taskMapperMock, taskServiceImplMock);
TaskTransferrer cutSpy = Mockito.spy(cut);
final TaskTransferrer cutSpy = Mockito.spy(cut);
Workbasket destinationWorkbasket = TaskServiceImplTest.createWorkbasket("2", "k1");
Workbasket sourceWorkbasket = TaskServiceImplTest.createWorkbasket("47", "key47");
Classification dummyClassification = TaskServiceImplTest.createDummyClassification();
@ -85,7 +85,7 @@ class TaskTransferrerTest {
.thenReturn(destinationWorkbasket);
doReturn(task).when(taskServiceImplMock).getTask(task.getId());
Task actualTask = cutSpy.transfer(task.getId(), destinationWorkbasket.getId());
final Task actualTask = cutSpy.transfer(task.getId(), destinationWorkbasket.getId());
verify(internalTaskanaEngineMock, times(1)).openConnection();
verify(workbasketServiceMock, times(1))

View File

@ -61,16 +61,16 @@ class WorkbasketReportBuilderImplTest {
@Test
void testGetTotalNumbersOfWorkbasketReportBasedOnDueDate()
throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN");
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> classificationIds = Collections.singletonList("L10000");
List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<CombinedClassificationFilter> combinedClassificationFilter =
final List<CombinedClassificationFilter> combinedClassificationFilter =
Collections.singletonList(
new CombinedClassificationFilter(
"CLI:000000000000000000000000000000000003",
@ -92,7 +92,7 @@ class WorkbasketReportBuilderImplTest {
combinedClassificationFilter))
.thenReturn(expectedResult);
WorkbasketReport actualResult =
final WorkbasketReport actualResult =
cut.createWorkbasketReportBuilder()
.workbasketIdIn(workbasketIds)
.stateIn(states)
@ -128,24 +128,24 @@ class WorkbasketReportBuilderImplTest {
@Test
void testGetWorkbasketReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN");
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> classificationIds = Collections.singletonList("L10000");
List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<CombinedClassificationFilter> combinedClassificationFilter =
final List<CombinedClassificationFilter> combinedClassificationFilter =
Collections.singletonList(
new CombinedClassificationFilter(
"CLI:000000000000000000000000000000000003",
"CLI:000000000000000000000000000000000008"));
List<TimeIntervalColumnHeader> columnHeaders =
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
List<MonitorQueryItem> expectedResult = new ArrayList<>();
final List<MonitorQueryItem> expectedResult = new ArrayList<>();
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
monitorQueryItem.setKey("WBI:000000000000000000000000000000000001");
monitorQueryItem.setAgeInDays(0);
@ -162,7 +162,7 @@ class WorkbasketReportBuilderImplTest {
combinedClassificationFilter))
.thenReturn(expectedResult);
WorkbasketReport actualResult =
final WorkbasketReport actualResult =
cut.createWorkbasketReportBuilder()
.workbasketIdIn(workbasketIds)
.stateIn(states)
@ -200,16 +200,16 @@ class WorkbasketReportBuilderImplTest {
@Test
void testGetTaskIdsOfCategoryReportForSelectedItems()
throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN");
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> classificationIds = Collections.singletonList("L10000");
List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<TimeIntervalColumnHeader> columnHeaders =
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
SelectedItem selectedItem = new SelectedItem();
@ -233,7 +233,7 @@ class WorkbasketReportBuilderImplTest {
false))
.thenReturn(expectedResult);
List<String> actualResult =
final List<String> actualResult =
cut.createWorkbasketReportBuilder()
.workbasketIdIn(workbasketIds)
.stateIn(states)
@ -281,16 +281,16 @@ class WorkbasketReportBuilderImplTest {
@Test
void testListCustomAttributeValuesForCustomAttributeName() throws NotAuthorizedException {
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN");
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> classificationIds = Collections.singletonList("L10000");
List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<TimeIntervalColumnHeader> columnHeaders =
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
SelectedItem selectedItem = new SelectedItem();
@ -311,7 +311,7 @@ class WorkbasketReportBuilderImplTest {
CustomField.CUSTOM_1))
.thenReturn(expectedResult);
List<String> actualResult =
final List<String> actualResult =
cut.createWorkbasketReportBuilder()
.workbasketIdIn(workbasketIds)
.stateIn(states)
@ -355,16 +355,16 @@ class WorkbasketReportBuilderImplTest {
@Test
void testGetTotalNumbersOfWorkbasketReportBasedOnCreatedDate()
throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds =
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN");
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> classificationIds = Collections.singletonList("L10000");
List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
Map<CustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(CustomField.CUSTOM_1, "Geschaeftsstelle A");
List<CombinedClassificationFilter> combinedClassificationFilter =
final List<CombinedClassificationFilter> combinedClassificationFilter =
Arrays.asList(
new CombinedClassificationFilter(
"CLI:000000000000000000000000000000000003",
@ -386,7 +386,7 @@ class WorkbasketReportBuilderImplTest {
combinedClassificationFilter))
.thenReturn(expectedResult);
WorkbasketReport actualResult =
final WorkbasketReport actualResult =
cut.createWorkbasketReportBuilder()
.workbasketIdIn(workbasketIds)
.stateIn(states)

View File

@ -82,7 +82,7 @@ class WorkbasketServiceImplTest {
doReturn(expectedWb).when(workbasketServiceSpy).getWorkbasket(any());
when(internalTaskanaEngineMock.domainExists(any())).thenReturn(true);
Workbasket actualWb = workbasketServiceSpy.createWorkbasket(expectedWb);
final Workbasket actualWb = workbasketServiceSpy.createWorkbasket(expectedWb);
workbasketServiceSpy.setDistributionTargets(
expectedWb.getId(), createTestDistributionTargets(distTargetAmount));

View File

@ -87,7 +87,7 @@ class ClassificationServiceImplIntAutoCommitTest {
throws ClassificationAlreadyExistException, ClassificationNotFoundException,
NotAuthorizedException, ConcurrencyException, DomainNotFoundException,
InvalidArgumentException {
String description = "TEST SOMETHING";
final String description = "TEST SOMETHING";
Classification classification = this.createDummyClassificationWithUniqueKey("DOMAIN_A", "TASK");
classification.setDescription("");
classification = classificationService.createClassification(classification);

View File

@ -46,8 +46,8 @@ import pro.taskana.sampledata.SampleDataGenerator;
*/
public class ClassificationServiceImplIntExplicitTest {
private static final String ID_PREFIX_CLASSIFICATION = "CLI";
static int counter = 0;
private static final String ID_PREFIX_CLASSIFICATION = "CLI";
private DataSource dataSource;
private ClassificationService classificationService;
private TaskanaEngineConfiguration taskanaEngineConfiguration;
@ -90,7 +90,6 @@ public class ClassificationServiceImplIntExplicitTest {
final String domain = "DOMAIN_A";
final String key = "dummy-key";
ClassificationImpl expectedClassification;
Classification actualClassification;
// new classification but master existing
expectedClassification =
@ -99,7 +98,7 @@ public class ClassificationServiceImplIntExplicitTest {
expectedClassification.setDomain("DOMAIN_B");
classificationService.createClassification(expectedClassification);
connection.commit();
actualClassification = classificationService.getClassification(key, "DOMAIN_B");
Classification actualClassification = classificationService.getClassification(key, "DOMAIN_B");
assertThat(actualClassification, not(IsEqual.equalTo(null)));
assertThat(actualClassification.getCreated(), not(IsEqual.equalTo(null)));
assertThat(actualClassification.getId(), not(IsEqual.equalTo(null)));

View File

@ -204,21 +204,15 @@ class TaskServiceImplIntAutocommitTest {
ClassificationAlreadyExistException, TaskNotFoundException, InterruptedException,
TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException,
WorkbasketAlreadyExistException, DomainNotFoundException, InvalidStateException {
Workbasket sourceWB;
Workbasket destinationWB;
WorkbasketImpl wb;
ClassificationImpl classification;
TaskImpl task;
Task resultTask;
final int sleepTime = 100;
// Source Workbasket
wb = (WorkbasketImpl) workbasketService.newWorkbasket("key1", "DOMAIN_A");
WorkbasketImpl wb = (WorkbasketImpl) workbasketService.newWorkbasket("key1", "DOMAIN_A");
wb.setName("Basic-Workbasket");
wb.setDescription("Just used as base WB for Task here");
wb.setType(WorkbasketType.GROUP);
wb.setOwner("The Tester ID");
sourceWB = workbasketService.createWorkbasket(wb);
final Workbasket sourceWB = workbasketService.createWorkbasket(wb);
// Destination Workbasket
wb = (WorkbasketImpl) workbasketService.newWorkbasket("k1", "DOMAIN_A");
@ -227,17 +221,17 @@ class TaskServiceImplIntAutocommitTest {
wb.setType(WorkbasketType.CLEARANCE);
wb.setDescription("Destination WB where Task should be transfered to");
wb.setOwner("The Tester ID");
destinationWB = workbasketService.createWorkbasket(wb);
final Workbasket destinationWB = workbasketService.createWorkbasket(wb);
// Classification required for Task
classification =
(ClassificationImpl) classificationService.newClassification("KEY", "DOMAIN_A", "TASK");
ClassificationImpl classification = (ClassificationImpl) classificationService
.newClassification("KEY", "DOMAIN_A", "TASK");
classification.setCategory("EXTERNAL");
classification.setName("Transfert-Task Classification");
classificationService.createClassification(classification);
// Task which should be transfered
task = (TaskImpl) taskServiceImpl.newTask(sourceWB.getId());
TaskImpl task = (TaskImpl) taskServiceImpl.newTask(sourceWB.getId());
task.setName("Task Name");
task.setDescription("Task used for transfer Test");
task.setRead(true);
@ -248,7 +242,7 @@ class TaskServiceImplIntAutocommitTest {
task = (TaskImpl) taskServiceImpl.createTask(task);
Thread.sleep(sleepTime); // Sleep for modification-timestamp
resultTask = taskServiceImpl.transfer(task.getId(), destinationWB.getId());
Task resultTask = taskServiceImpl.transfer(task.getId(), destinationWB.getId());
assertThat(resultTask.isRead(), equalTo(false));
assertThat(resultTask.isTransferred(), equalTo(true));
assertThat(resultTask.getWorkbasketSummary().getId(), equalTo(destinationWB.getId()));

View File

@ -130,7 +130,7 @@ class TaskServiceImplIntExplicitTest {
workbasket.setId("1"); // set id manually for authorization tests
workbasket.setType(WorkbasketType.GROUP);
Classification classification =
final Classification classification =
classificationService.newClassification("TEST", "DOMAIN_A", "TASK");
taskanaEngineImpl.getWorkbasketService().createWorkbasket(workbasket);
@ -170,7 +170,7 @@ class TaskServiceImplIntExplicitTest {
Connection connection = dataSource.getConnection();
taskanaEngineImpl.setConnection(connection);
Task task = this.generateDummyTask();
final Task task = this.generateDummyTask();
connection.commit();
WorkbasketAccessItem accessItem = workbasketService.newWorkbasketAccessItem("1", "Elena");
@ -180,12 +180,12 @@ class TaskServiceImplIntExplicitTest {
workbasketService.createWorkbasketAccessItem(accessItem);
task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
task = taskServiceImpl.createTask(task);
final Task task2 = taskServiceImpl.createTask(task);
connection.commit(); // needed so that the change is visible in the other session
TaskanaEngine te2 = taskanaEngineConfiguration.buildTaskanaEngine();
TaskServiceImpl taskServiceImpl2 = (TaskServiceImpl) te2.getTaskService();
Task resultTask = taskServiceImpl2.getTask(task.getId());
Task resultTask = taskServiceImpl2.getTask(task2.getId());
assertNotNull(resultTask);
connection.commit();
}
@ -301,24 +301,18 @@ class TaskServiceImplIntExplicitTest {
TaskAlreadyExistException, SQLException, InvalidWorkbasketException,
InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException,
InvalidStateException {
Workbasket sourceWB;
Workbasket destinationWB;
WorkbasketImpl wb;
ClassificationImpl classification;
TaskImpl task;
Task resultTask;
final int sleepTime = 100;
final String user = CurrentUserContext.getUserid();
Connection connection = dataSource.getConnection();
taskanaEngineImpl.setConnection(connection);
// Source Workbasket
wb = (WorkbasketImpl) workbasketService.newWorkbasket("sourceWbKey", "DOMAIN_A");
WorkbasketImpl wb = (WorkbasketImpl) workbasketService.newWorkbasket("sourceWbKey", "DOMAIN_A");
wb.setName("Basic-Workbasket");
wb.setDescription("Just used as base WB for Task here");
wb.setOwner(user);
wb.setType(WorkbasketType.PERSONAL);
sourceWB = workbasketService.createWorkbasket(wb);
Workbasket sourceWB = workbasketService.createWorkbasket(wb);
createWorkbasketWithSecurity(wb, wb.getOwner(), false, false, false, false);
createWorkbasketWithSecurity(sourceWB, sourceWB.getOwner(), true, true, true, true);
@ -330,18 +324,18 @@ class TaskServiceImplIntExplicitTest {
wb.setOwner(user);
wb.setType(WorkbasketType.TOPIC);
destinationWB = workbasketService.createWorkbasket(wb);
Workbasket destinationWB = workbasketService.createWorkbasket(wb);
createWorkbasketWithSecurity(destinationWB, destinationWB.getOwner(), false, true, true, true);
// Classification required for Task
classification =
(ClassificationImpl) classificationService.newClassification("KEY", "DOMAIN_A", "TASK");
ClassificationImpl classification = (ClassificationImpl) classificationService
.newClassification("KEY", "DOMAIN_A", "TASK");
classification.setCategory("EXTERNAL");
classification.setName("Transfert-Task Classification");
classificationService.createClassification(classification);
// Task which should be transfered
task = (TaskImpl) taskServiceImpl.newTask(sourceWB.getId());
TaskImpl task = (TaskImpl) taskServiceImpl.newTask(sourceWB.getId());
task.setName("Task Name");
task.setDescription("Task used for transfer Test");
task.setRead(true);
@ -354,7 +348,7 @@ class TaskServiceImplIntExplicitTest {
Thread.sleep(sleepTime); // Sleep for modification-timestamp
connection.commit();
resultTask = taskServiceImpl.transfer(task.getId(), destinationWB.getId());
Task resultTask = taskServiceImpl.transfer(task.getId(), destinationWB.getId());
connection.commit();
assertThat(resultTask.isRead(), equalTo(false));
assertThat(resultTask.isTransferred(), equalTo(true));
@ -445,11 +439,13 @@ class TaskServiceImplIntExplicitTest {
Assertions.assertThrows(
NotAuthorizedException.class,
() -> taskServiceImpl.transfer(taskCreated.getId(), wbNoAppendCreated.getId()),
"Transfer Task should be FAILED, because there are no APPEND-Rights on destination WB.");
"Transfer Task should be FAILED, "
+ "because there are no APPEND-Rights on destination WB.");
assertTrue(
e.getMessage().contains("APPEND"),
"Transfer Task should be FAILED, because there are no APPEND-Rights on destination WB.");
"Transfer Task should be FAILED, "
+ "because there are no APPEND-Rights on destination WB.");
assertThat(taskCreated.isTransferred(), equalTo(false));
assertThat(taskCreated.getWorkbasketKey(), not(equalTo(wbNoAppendCreated.getKey())));

View File

@ -221,9 +221,9 @@ class WorkbasketServiceImplIntAutocommitTest {
WorkbasketMapper mapper = session.getMapper(WorkbasketMapper.class);
WorkbasketImpl wb1 = (WorkbasketImpl) basket1;
WorkbasketImpl wb2 = (WorkbasketImpl) basket2;
WorkbasketImpl wb3 = (WorkbasketImpl) basket3;
WorkbasketImpl wb4 = (WorkbasketImpl) basket4;
final WorkbasketImpl wb2 = (WorkbasketImpl) basket2;
final WorkbasketImpl wb3 = (WorkbasketImpl) basket3;
final WorkbasketImpl wb4 = (WorkbasketImpl) basket4;
engineProxy.openConnection();
wb1.setModified(now.minus(Duration.ofDays(10L)));

View File

@ -45,8 +45,9 @@ import pro.taskana.security.WithAccessId;
@ExtendWith(JAASExtension.class)
class WorkbasketServiceImplIntExplicitTest {
private static final int SLEEP_TIME = 100;
static int counter = 0;
private static final int SLEEP_TIME = 100;
private DataSource dataSource;
private TaskanaEngineConfiguration taskanaEngineConfiguration;
private TaskanaEngine taskanaEngine;

View File

@ -12,6 +12,7 @@ import pro.taskana.impl.TaskImpl;
import pro.taskana.impl.persistence.MapTypeHandler;
/** This class contains specific mybatis mappings for task tests. */
@SuppressWarnings({"checkstyle:LineLength"})
public interface TaskTestMapper {
@Select("select CUSTOM_ATTRIBUTES from TASK where id = #{taskId}")

View File

@ -38,7 +38,9 @@ import pro.taskana.jobs.TaskCleanupJob;
import pro.taskana.jobs.WorkbasketCleanupJob;
import pro.taskana.transaction.TaskanaTransactionProvider;
/** */
/**
* Test for internal transaction management.
*/
@ExtendWith(SpringExtension.class)
@SpringBootTest(
classes = TaskanaConfigTestApplication.class,
@ -145,7 +147,7 @@ class TaskanaTransactionIntTest {
throws SQLException, NotAuthorizedException, WorkbasketNotFoundException,
DomainNotFoundException, InvalidWorkbasketException, WorkbasketAlreadyExistException {
TaskanaEngineImpl taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
final TaskanaEngineImpl taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
Connection connection = dataSource.getConnection();
assertNotEquals(connection.getSchema(), "PUBLIC");

View File

@ -265,9 +265,6 @@
value="Method name ''{0}'' must match pattern ''{1}''."/>
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
</module>
<module name="SingleLineJavadoc">
<property name="ignoreInlineTags" value="false"/>
</module>
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="expected"/>
</module>

View File

@ -229,11 +229,10 @@ public class TaskController extends AbstractPagingController {
result = ResponseEntity.ok(taskResourceAssembler.toResource(task));
} else {
throw new InvalidArgumentException(
"TaskId ('"
+ taskId
+ "') is not identical with the taskId of to object in the payload which should be updated. ID=('"
+ taskResource.getTaskId()
+ "')");
String.format(
"TaskId ('%s') is not identical with the taskId of to "
+ "object in the payload which should be updated. ID=('%s')",
taskId, taskResource.getTaskId()));
}
if (LOGGER.isDebugEnabled()) {

View File

@ -1,5 +1,6 @@
package pro.taskana.rest;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -107,8 +108,11 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
}
} else {
throw new InvalidArgumentException(
accessId
+ " corresponding to a group, not a user. You just can remove access items for a user");
MessageFormat
.format(
"{0} corresponding to a group, not a user. "
+ "You just can remove access items for a user",
accessId));
}
ResponseEntity<Void> response = ResponseEntity.noContent().build();

View File

@ -71,7 +71,7 @@ public class PagedResources<T> extends ResourceSupport {
@JsonProperty("content")
public Collection<T> getContent() {
return Collections.unmodifiableCollection(content);
};
}
/** Class for Page Metadata. */
public static class PageMetadata {

View File

@ -14,7 +14,10 @@ import pro.taskana.rest.WorkbasketController;
import pro.taskana.rest.resource.PagedResources.PageMetadata;
import pro.taskana.rest.resource.links.PageLinks;
/** @author HH */
/**
* Resource assembler for {@link WorkbasketSummaryResource}.
*/
@Component
public class WorkbasketSummaryResourceAssembler
extends ResourceAssemblerSupport<WorkbasketSummary, WorkbasketSummaryResource> {

View File

@ -49,7 +49,8 @@ public class DistributionTargetDeserializer extends StdDeserializer<List<Workbas
LOGGER.error("The workbasket with the id ' {} ' is not found in database.", id);
} catch (NotAuthorizedException e) {
LOGGER.error(
"The user misses some required permissions for the workbasket with ID ' {} '. Exception = {}.",
"The user misses some required permissions for "
+ "the workbasket with ID ' {} '. Exception = {}.",
id,
e);
}

View File

@ -38,13 +38,16 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
classificationFieldDescriptionsMap.put("classificationId", "Unique Id");
classificationFieldDescriptionsMap.put(
"key",
"The key of the classification. This is typically an externally known code or abbreviation of the classification");
"The key of the classification. This is typically an externally "
+ "known code or abbreviation of the classification");
classificationFieldDescriptionsMap.put(
"parentId",
"The id of the parent classification. Empty string (\"\") if this is a root classification.");
"The id of the parent classification. Empty string (\"\") "
+ "if this is a root classification.");
classificationFieldDescriptionsMap.put(
"parentKey",
"The key of the parent classification. Empty string (\"\") if this is a root classification.");
"The key of the parent classification. Empty string (\"\") "
+ "if this is a root classification.");
classificationFieldDescriptionsMap.put(
"category", "The category of the classification (MANUAL, EXTERNAL, AUTOMATIC, PROCESS)");
classificationFieldDescriptionsMap.put("type", "The type of classification (TASK, DOCUMENT)");
@ -64,7 +67,8 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
"The service level of the classification. This is stated according to ISO 8601");
classificationFieldDescriptionsMap.put(
"applicationEntryPoint",
"The logical name of the entry point, the task list application should redirect to work on a task of this classification");
"The logical name of the entry point, the task list application "
+ "should redirect to work on a task of this classification");
classificationFieldDescriptionsMap.put("custom1", "A custom property with name \"1\"");
classificationFieldDescriptionsMap.put("custom2", "A custom property with name \"2\"");
classificationFieldDescriptionsMap.put("custom3", "A custom property with name \"3\"");
@ -161,7 +165,8 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
.description("The domain for which this classification is specified"),
fieldWithPath("key")
.description(
"The key of the classification. This is typically an externally known code or abbreviation of the classification"),
"The key of the classification. This is typically an externally "
+ "known code or abbreviation of the classification"),
fieldWithPath("name")
.type("String")
.description("The name of the classification")

View File

@ -35,7 +35,8 @@ class MonitorControllerRestDocumentation extends BaseRestDocumentation {
fieldWithPath("rows[].total").description("Sum of all values of the given row"),
fieldWithPath("rows[].depth")
.description(
"Depth of the row. If the depth is > 0, then this row is a sub-row of a prior row"),
"Depth of the row. If the depth is > 0, "
+ "then this row is a sub-row of a prior row"),
fieldWithPath("rows[].desc").description("Array containing description of the row."),
fieldWithPath("rows[].display")
.description(

View File

@ -37,7 +37,8 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
taskFieldDescriptionsMap.put("taskId", "Unique ID");
taskFieldDescriptionsMap.put(
"externalId",
"External ID. Can be used to enforce idempotency at task creation. Can identify an external task.");
"External ID. Can be used to enforce idempotence at task creation. "
+ "Can identify an external task.");
taskFieldDescriptionsMap.put("created", "The creation timestamp of the task in the system.");
taskFieldDescriptionsMap.put(
"claimed", "The timestamp of the last claim-operation on the task");
@ -45,10 +46,12 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
taskFieldDescriptionsMap.put("modified", "Timestamp of the last modification of the task");
taskFieldDescriptionsMap.put(
"planned",
"Planned start of the task. The actual completion of the task should be between PLANNED and DUE.");
"Planned start of the task. The actual completion of the task "
+ "should be between PLANNED and DUE.");
taskFieldDescriptionsMap.put(
"due",
"Timestamp when the task is due. The actual completion of the task should be between PLANNED and DUE.");
"Timestamp when the task is due. The actual completion of the task "
+ "should be between PLANNED and DUE.");
taskFieldDescriptionsMap.put("name", "The name of the task");
taskFieldDescriptionsMap.put("creator", "");
taskFieldDescriptionsMap.put("description", "The description of the task");
@ -547,8 +550,11 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
.contentType("application/hal+json")
.content(
"{\"classificationSummaryResource\":{\"key\":\"L11010\"},"
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}")
+ "\"workbasketSummaryResource\":"
+ "{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\","
+ "\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\","
+ "\"type\":\"MyType1\",\"value\":\"00000001\"}}")
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
.andExpect(MockMvcResultMatchers.status().isCreated())
.andDo(
@ -579,8 +585,11 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
.contentType("application/hal+json")
.content(
"{\"classificationSummaryResource\":{\"key\":\"L11010\"},"
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}")
+ "\"workbasketSummaryResource\":"
+ "{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\","
+ "\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\","
+ "\"type\":\"MyType1\",\"value\":\"00000001\"}}")
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
.andExpect(MockMvcResultMatchers.status().isCreated())
.andDo(MockMvcRestDocumentation.document("temp"))
@ -618,8 +627,11 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
.contentType("application/hal+json")
.content(
"{\"classificationSummaryResource\":{\"key\":\"L11010\"},"
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}")
+ "\"workbasketSummaryResource\":"
+ "{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\","
+ "\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\","
+ "\"type\":\"MyType1\",\"value\":\"00000001\"}}")
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
.andExpect(MockMvcResultMatchers.status().isCreated())
.andDo(MockMvcRestDocumentation.document("temp"))
@ -657,8 +669,11 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
.contentType("application/hal+json")
.content(
"{\"classificationSummaryResource\":{\"key\":\"L11010\"},"
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}")
+ "\"workbasketSummaryResource\":"
+ "{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\","
+ "\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\","
+ "\"type\":\"MyType1\",\"value\":\"00000001\"}}")
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
.andExpect(MockMvcResultMatchers.status().isCreated())
.andDo(

View File

@ -36,7 +36,8 @@ class WorkbasketAccessItemControllerRestDocumentation extends BaseRestDocumentat
"accessItems.permOpen", "The permission to view the content (the tasks) of a workbasket");
accessItemFieldDescriptionsMap.put(
"accessItems.permAppend",
"The permission to add tasks to the workbasket (required for creation and tranferring of tasks)");
"The permission to add tasks to the workbasket "
+ "(required for creation and tranferring of tasks)");
accessItemFieldDescriptionsMap.put(
"accessItems.permTransfer",
"The permission to transfer tasks (out of the current workbasket)");

View File

@ -46,10 +46,14 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
workbasketFieldDescriptionsMap.put("description", "The description of the workbasket");
workbasketFieldDescriptionsMap.put(
"owner",
"The owner of the workbasket. The owner is responsible for the on-time completion of all tasks in the workbasket.");
"The owner of the workbasket. The owner is responsible for the on-time completion "
+ "of all tasks in the workbasket.");
workbasketFieldDescriptionsMap.put(
"orgLevel1",
"The first Org Level (the top one)\nThe Org Level is an association with an org hierarchie level in the organization. The values are used for monitoring and statistical purposes and should reflect the responsibility of the tasks in the workbasket.");
"The first Org Level (the top one)\nThe Org Level is an association with an org "
+ "hierarchie level in the organization. The values are used for monitoring "
+ "and statistical purposes and should reflect the responsibility of the "
+ "tasks in the workbasket.");
workbasketFieldDescriptionsMap.put("orgLevel2", "The second Org Level");
workbasketFieldDescriptionsMap.put("orgLevel3", "The third Org Level");
workbasketFieldDescriptionsMap.put("orgLevel4", "The fourth Org Level (the lowest one).");
@ -75,7 +79,8 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
accessItemFieldDescriptionsMap.put("accessItems.workbasketKey", "The workbasket key");
accessItemFieldDescriptionsMap.put(
"accessItems.accessId",
"The access id, this ACL entry refers to. This could be either a userid or a full qualified group id (both lower case)");
"The access id, this ACL entry refers to. This could be either a userid or a "
+ "full qualified group id (both lower case)");
accessItemFieldDescriptionsMap.put("accessItems.accessName", "");
accessItemFieldDescriptionsMap.put(
"accessItems.permRead", "The permission to read the information about the workbasket");
@ -83,7 +88,8 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
"accessItems.permOpen", "The permission to view the content (the tasks) of a workbasket");
accessItemFieldDescriptionsMap.put(
"accessItems.permAppend",
"The permission to add tasks to the workbasket (required for creation and transferring of tasks)");
"The permission to add tasks to the workbasket (required for creation "
+ "and transferring of tasks)");
accessItemFieldDescriptionsMap.put(
"accessItems.permTransfer",
"The permission to transfer tasks (out of the current workbasket)");
@ -411,7 +417,9 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
.contentType("application/json")
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")
.content(
"{\"key\" : \"asdasdasd\", \"name\" : \"Gruppenpostkorb KSC\", \"domain\" : \"DOMAIN_A\", \"type\" : \"GROUP\", \"created\" : \"2018-02-01T11:00:00Z\",\r\n"
"{\"key\" : \"asdasdasd\", \"name\" : \"Gruppenpostkorb KSC\", "
+ "\"domain\" : \"DOMAIN_A\", \"type\" : \"GROUP\", "
+ "\"created\" : \"2018-02-01T11:00:00Z\",\r\n"
+ " \"modified\" : \"2018-02-01T11:00:00Z\"}"))
.andExpect(MockMvcResultMatchers.status().isCreated())
.andDo(

View File

@ -52,7 +52,9 @@ class WorkbasketDefinitionControllerRestDocumentation extends BaseRestDocumentat
+ "{"
+ "\"distributionTargets\":[], "
+ "\"authorizations\":[], "
+ "\"workbasket\": {\"name\":\"wbblabla\", \"key\":\"neuerKeyXy\", \"domain\": \"DOMAIN_A\", \"type\":\"GROUP\" , \"workbasketId\":\"gibtsNed\"}"
+ "\"workbasket\": {\"name\":\"wbblabla\", \"key\":\"neuerKeyXy\", "
+ "\"domain\": \"DOMAIN_A\", \"type\":\"GROUP\" , "
+ "\"workbasketId\":\"gibtsNed\"}"
+ "}"
+ "]";

View File

@ -18,7 +18,7 @@ public class LdapCacheTestImpl implements LdapCache {
/**
* Dictionary is a {@link Map} collection that contains {@link AccessIdResource} as key (user) and
* {@link List<AccessIdResource>} as value (groups of which the user is a member) .
* {@link List} as value (groups of which the user is a member) .
*/
private static Map<AccessIdResource, List<AccessIdResource>> users;
@ -353,10 +353,10 @@ public class LdapCacheTestImpl implements LdapCache {
});
int groupNumber = 0;
List<AccessIdResource> group0 = new ArrayList<>(),
group1 = new ArrayList<>(),
group2 = new ArrayList<>(),
group3 = new ArrayList<>();
List<AccessIdResource> group0 = new ArrayList<>();
List<AccessIdResource> group1 = new ArrayList<>();
List<AccessIdResource> group2 = new ArrayList<>();
List<AccessIdResource> group3 = new ArrayList<>();
for (AccessIdResource group : groups) {
switch (groupNumber) {

View File

@ -97,7 +97,8 @@ class ClassificationControllerIntTest {
.getLink(Link.REL_SELF)
.getHref()
.endsWith(
"/api/v1/classifications?domain=DOMAIN_A&sort-by=key&order=asc&page=2&page-size=5"));
"/api/v1/classifications?"
+ "domain=DOMAIN_A&sort-by=key&order=asc&page=2&page-size=5"));
assertNotNull(response.getBody().getLink(Link.REL_FIRST));
assertNotNull(response.getBody().getLink(Link.REL_LAST));
assertNotNull(response.getBody().getLink(Link.REL_NEXT));
@ -108,7 +109,9 @@ class ClassificationControllerIntTest {
@DirtiesContext
void testCreateClassification() {
String newClassification =
"{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS\",\"name\":\"new classification\",\"type\":\"TASK\"}";
"{\"classificationId\":\"\",\"category\":\"MANUAL\","
+ "\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS\","
+ "\"name\":\"new classification\",\"type\":\"TASK\"}";
ResponseEntity<ClassificationResource> responseEntity =
template.exchange(
@ -121,7 +124,9 @@ class ClassificationControllerIntTest {
assertEquals(HttpStatus.CREATED, responseEntity.getStatusCode());
newClassification =
"{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS_2\",\"name\":\"new classification\",\"type\":\"TASK\"}";
"{\"classificationId\":\"\",\"category\":\"MANUAL\","
+ "\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS_2\","
+ "\"name\":\"new classification\",\"type\":\"TASK\"}";
responseEntity =
template.exchange(
@ -137,7 +142,10 @@ class ClassificationControllerIntTest {
@DirtiesContext
void testCreateClassificationWithParentId() {
String newClassification =
"{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_B\",\"key\":\"NEW_CLASS_P1\",\"name\":\"new classification\",\"type\":\"TASK\",\"parentId\":\"CLI:200000000000000000000000000000000015\"}";
"{\"classificationId\":\"\",\"category\":\"MANUAL\","
+ "\"domain\":\"DOMAIN_B\",\"key\":\"NEW_CLASS_P1\","
+ "\"name\":\"new classification\",\"type\":\"TASK\","
+ "\"parentId\":\"CLI:200000000000000000000000000000000015\"}";
ResponseEntity<ClassificationResource> responseEntity =
template.exchange(
@ -152,9 +160,12 @@ class ClassificationControllerIntTest {
@Test
@DirtiesContext
@SuppressWarnings("checkstyle:LineLength")
void testCreateClassificationWithParentKey() {
String newClassification =
"{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_B\",\"key\":\"NEW_CLASS_P2\",\"name\":\"new classification\",\"type\":\"TASK\",\"parentKey\":\"T2100\"}";
"{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_B\","
+ "\"key\":\"NEW_CLASS_P2\",\"name\":\"new classification\","
+ "\"type\":\"TASK\",\"parentKey\":\"T2100\"}";
ResponseEntity<ClassificationResource> responseEntity =
template.exchange(
@ -169,10 +180,12 @@ class ClassificationControllerIntTest {
@Test
@DirtiesContext
void testCreateClassificationWithParentKeyInDOMAIN_AShouldCreateAClassificationInRootDomain()
void testCreateClassificationWithParentKeyInDomain_aShouldCreateAClassificationInRootDomain()
throws IOException {
String newClassification =
"{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS_P2\",\"name\":\"new classification\",\"type\":\"TASK\",\"parentKey\":\"T2100\"}";
"{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_A\","
+ "\"key\":\"NEW_CLASS_P2\",\"name\":\"new classification\","
+ "\"type\":\"TASK\",\"parentKey\":\"T2100\"}";
ResponseEntity<ClassificationResource> responseEntity =
template.exchange(
@ -207,7 +220,10 @@ class ClassificationControllerIntTest {
@DirtiesContext
void testReturn400IfCreateClassificationWithIncompatibleParentIdAndKey() throws IOException {
String newClassification =
"{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_B\",\"key\":\"NEW_CLASS_P3\",\"name\":\"new classification\",\"type\":\"TASK\",\"parentId\":\"CLI:200000000000000000000000000000000015\",\"parentKey\":\"T2000\"}";
"{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_B\","
+ "\"key\":\"NEW_CLASS_P3\",\"name\":\"new classification\","
+ "\"type\":\"TASK\",\"parentId\":\"CLI:200000000000000000000000000000000015\","
+ "\"parentKey\":\"T2000\"}";
HttpClientErrorException e =
Assertions.assertThrows(
@ -227,7 +243,9 @@ class ClassificationControllerIntTest {
@DirtiesContext
void testCreateClassificationWithClassificationIdReturnsError400() throws IOException {
String newClassification =
"{\"classificationId\":\"someId\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS\",\"name\":\"new classification\",\"type\":\"TASK\"}";
"{\"classificationId\":\"someId\",\"category\":\"MANUAL\","
+ "\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS\","
+ "\"name\":\"new classification\",\"type\":\"TASK\"}";
HttpClientErrorException e =
Assertions.assertThrows(

View File

@ -160,7 +160,7 @@ class ClassificationDefinitionControllerIntTest {
void testImportMultipleClassifications() throws IOException {
ClassificationResource classification1 =
this.createClassification("id1", "ImportKey1", "DOMAIN_A", null, null);
String c1 = objMapper.writeValueAsString(classification1);
final String c1 = objMapper.writeValueAsString(classification1);
ClassificationResource classification2 =
this.createClassification(
@ -229,7 +229,7 @@ class ClassificationDefinitionControllerIntTest {
@Test
void testHookExistingChildToNewParent() throws IOException {
ClassificationResource newClassification =
final ClassificationResource newClassification =
createClassification("new Classification", "newClass", "DOMAIN_A", null, "L11010");
ClassificationSummaryResource existingClassification =
getClassificationWithKeyAndDomain("L110102", "DOMAIN_A");
@ -261,22 +261,22 @@ class ClassificationDefinitionControllerIntTest {
void testImportParentAndChildClassification() throws IOException {
ClassificationResource classification1 =
this.createClassification("parentId", "ImportKey6", "DOMAIN_A", null, null);
String c1 = objMapper.writeValueAsString(classification1);
final String c1 = objMapper.writeValueAsString(classification1);
ClassificationResource classification2 =
this.createClassification("childId1", "ImportKey7", "DOMAIN_A", null, "ImportKey6");
String c21 = objMapper.writeValueAsString(classification2);
final String c21 = objMapper.writeValueAsString(classification2);
classification2 =
this.createClassification("childId2", "ImportKey8", "DOMAIN_A", "parentId", null);
String c22 = objMapper.writeValueAsString(classification2);
final String c22 = objMapper.writeValueAsString(classification2);
ClassificationResource classification3 =
this.createClassification(
"grandchildId1", "ImportKey9", "DOMAIN_A", "childId1", "ImportKey7");
String c31 = objMapper.writeValueAsString(classification3);
final String c31 = objMapper.writeValueAsString(classification3);
classification3 =
this.createClassification("grandchild2", "ImportKey10", "DOMAIN_A", null, "ImportKey7");
String c32 = objMapper.writeValueAsString(classification3);
final String c32 = objMapper.writeValueAsString(classification3);
List<String> clList = new ArrayList<>();
clList.add(c31);
@ -345,7 +345,7 @@ class ClassificationDefinitionControllerIntTest {
assertEquals("L11010", child1.getParentKey());
child1.setParentId("CLI:100000000000000000000000000000000002");
child1.setParentKey("L10303");
String withNewParent = objMapper.writeValueAsString(child1);
final String withNewParent = objMapper.writeValueAsString(child1);
ClassificationSummaryResource child2 =
this.getClassificationWithKeyAndDomain("L110107", "DOMAIN_A");

View File

@ -48,8 +48,10 @@ import pro.taskana.sampledata.SampleDataGenerator;
class TaskControllerIntTest {
private static RestTemplate template;
@Value("${taskana.schemaName:TASKANA}")
public String schemaName;
@Autowired RestHelper restHelper;
@Autowired private DataSource dataSource;
@ -191,7 +193,8 @@ class TaskControllerIntTest {
.getLink(Link.REL_SELF)
.getHref()
.endsWith(
"/api/v1/tasks?state=READY,CLAIMED&sort-by=por.value&order=desc&page=15&page-size=5"));
"/api/v1/tasks?"
+ "state=READY,CLAIMED&sort-by=por.value&order=desc&page=15&page-size=5"));
assertNotNull(response.getBody().getLink(Link.REL_FIRST));
assertNotNull(response.getBody().getLink(Link.REL_LAST));
assertNotNull(response.getBody().getLink(Link.REL_PREVIOUS));
@ -199,8 +202,9 @@ class TaskControllerIntTest {
@Test
void testGetLastPageSortedByDueWithHiddenTasksRemovedFromResult() {
resetDb(); // required because
// ClassificationControllerIntTest.testGetQueryByPorSecondPageSortedByType changes
resetDb();
// required because
// ClassificationControllerIntTest.testGetQueryByPorSecondPageSortedByType changes
// tasks and this test depends on the tasks as they are in sampledata
HttpHeaders headers = new HttpHeaders();
@ -241,7 +245,7 @@ class TaskControllerIntTest {
@Test
void testGetQueryByPorSecondPageSortedByType() {
resetDb(); // required because
// ClassificationControllerIntTest.testGetQueryByPorSecondPageSortedByType changes
// ClassificationControllerIntTest.testGetQueryByPorSecondPageSortedByType changes
// tasks and this test depends on the tasks as they are in sampledata
HttpHeaders headers = new HttpHeaders();
@ -250,7 +254,9 @@ class TaskControllerIntTest {
ResponseEntity<TaskSummaryListResource> response =
template.exchange(
restHelper.toUrl(Mapping.URL_TASKS)
+ "?por.company=00&por.system=PASystem&por.instance=00&por.type=VNR&por.value=22334455&sort-by=por.type&order=asc&page=2&page-size=5",
+ "?por.company=00&por.system=PASystem&por.instance=00&"
+ "por.type=VNR&por.value=22334455&sort-by=por.type&"
+ "order=asc&page=2&page-size=5",
HttpMethod.GET,
request,
ParameterizedTypeReference.forType(TaskSummaryListResource.class));
@ -265,7 +271,9 @@ class TaskControllerIntTest {
.getLink(Link.REL_SELF)
.getHref()
.endsWith(
"/api/v1/tasks?por.company=00&por.system=PASystem&por.instance=00&por.type=VNR&por.value=22334455&sort-by=por.type&order=asc&page=2&page-size=5"));
"/api/v1/tasks?por.company=00&por.system=PASystem&por.instance=00&"
+ "por.type=VNR&por.value=22334455&sort-by=por.type&order=asc&"
+ "page=2&page-size=5"));
assertNotNull(response.getBody().getLink(Link.REL_FIRST));
assertNotNull(response.getBody().getLink(Link.REL_LAST));
assertNotNull(response.getBody().getLink(Link.REL_PREVIOUS));
@ -273,12 +281,13 @@ class TaskControllerIntTest {
@Test
void testGetTaskWithAttachments() throws IOException {
URL url = new URL(restHelper.toUrl("/api/v1/tasks/TKI:000000000000000000000000000000000002"));
final URL url = new URL(restHelper.toUrl("/api/v1/tasks/"
+ "TKI:000000000000000000000000000000000002"));
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Authorization", "Basic YWRtaW46YWRtaW4=");
assertEquals(200, con.getResponseCode());
ObjectMapper objectMapper = new ObjectMapper();
final ObjectMapper objectMapper = new ObjectMapper();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
@ -311,7 +320,7 @@ class TaskControllerIntTest {
}
in.close();
con.disconnect();
String originalTask = content.toString();
final String originalTask = content.toString();
con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("PUT");
@ -398,10 +407,12 @@ class TaskControllerIntTest {
@Test
void testCreateTaskWithInvalidParameter() throws IOException {
String taskToCreateJson =
final String taskToCreateJson =
"{\"classificationKey\":\"L11010\","
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}";
+ "\"workbasketSummaryResource\":"
+ "{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\","
+ "\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}";
URL url = new URL(restHelper.toUrl(Mapping.URL_TASKS));
HttpURLConnection con = (HttpURLConnection) url.openConnection();
@ -416,10 +427,12 @@ class TaskControllerIntTest {
assertEquals(400, con.getResponseCode());
con.disconnect();
taskToCreateJson =
"{\"classificationSummaryResource\":{\"classificationId\":\"CLI:100000000000000000000000000000000004\"},"
final String taskToCreateJson2 =
"{\"classificationSummaryResource\":"
+ "{\"classificationId\":\"CLI:100000000000000000000000000000000004\"},"
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"\"},"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}";
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\","
+ "\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}";
url = new URL(restHelper.toUrl(Mapping.URL_TASKS));
con = (HttpURLConnection) url.openConnection();
@ -428,7 +441,7 @@ class TaskControllerIntTest {
con.setRequestProperty("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
con.setRequestProperty("Content-Type", "application/json");
out = new BufferedWriter(new OutputStreamWriter(con.getOutputStream()));
out.write(taskToCreateJson);
out.write(taskToCreateJson2);
out.flush();
out.close();
assertEquals(400, con.getResponseCode());

View File

@ -62,7 +62,8 @@ class WorkbasketDefinitionControllerIntTest {
assertEquals(HttpStatus.OK, response.getStatusCode());
assertThat(response.getBody().get(0), instanceOf(WorkbasketDefinitionResource.class));
boolean allAuthorizationsAreEmpty = true, allDistributionTargetsAreEmpty = true;
boolean allAuthorizationsAreEmpty = true;
boolean allDistributionTargetsAreEmpty = true;
for (WorkbasketDefinitionResource workbasketDefinition : response.getBody()) {
if (allAuthorizationsAreEmpty && !workbasketDefinition.getAuthorizations().isEmpty()) {
allAuthorizationsAreEmpty = false;

View File

@ -77,7 +77,7 @@ class ReportResourceTest {
@Test
void testOneSingleRow() {
// given
ClassificationReport report = new ClassificationReport(headers);
final ClassificationReport report = new ClassificationReport(headers);
MonitorQueryItem item = new MonitorQueryItem();
item.setAgeInDays(daysDiff - 1);
item.setNumberOfTasks(2);
@ -121,7 +121,7 @@ class ReportResourceTest {
@Test
void testMultipleSingleRows() {
// given
ClassificationReport report = new ClassificationReport(headers);
final ClassificationReport report = new ClassificationReport(headers);
MonitorQueryItem item = new MonitorQueryItem();
item.setAgeInDays(daysDiff - 1);
item.setNumberOfTasks(2);
@ -174,7 +174,7 @@ class ReportResourceTest {
@Test
void testOneFoldableRow() {
// given
ClassificationReport.DetailedClassificationReport report =
final ClassificationReport.DetailedClassificationReport report =
new ClassificationReport.DetailedClassificationReport(headers);
DetailedMonitorQueryItem item = new DetailedMonitorQueryItem();
item.setAgeInDays(daysDiff - 1);
@ -252,7 +252,7 @@ class ReportResourceTest {
@Test
void testMultipleFoldableRows() {
// given
ClassificationReport.DetailedClassificationReport report =
final ClassificationReport.DetailedClassificationReport report =
new ClassificationReport.DetailedClassificationReport(headers);
DetailedMonitorQueryItem item = new DetailedMonitorQueryItem();
item.setAgeInDays(daysDiff - 1);

View File

@ -139,6 +139,14 @@ class TaskResourceAssemberTest {
Assert.assertEquals(task.getCustomAttribute("16"), resource.getCustom16());
}
void testEquality(
Map<String, String> customAttributes, List<TaskResource.CustomAttribute> resourceAttributes) {
Assert.assertEquals(customAttributes.size(), resourceAttributes.size());
resourceAttributes.forEach(
attribute ->
Assert.assertEquals(customAttributes.get(attribute.getKey()), attribute.getValue()));
}
void testEqualityAttachements(List<Attachment> attachments, List<AttachmentResource> resources) {
Assert.assertEquals(attachments.size(), resources.size());
for (int i = 0; i < resources.size(); i++) {
@ -148,12 +156,4 @@ class TaskResourceAssemberTest {
Assert.assertEquals(attachment.getId(), resource.getAttachmentId());
}
}
void testEquality(
Map<String, String> customAttributes, List<TaskResource.CustomAttribute> resourceAttributes) {
Assert.assertEquals(customAttributes.size(), resourceAttributes.size());
resourceAttributes.forEach(
attribute ->
Assert.assertEquals(customAttributes.get(attribute.getKey()), attribute.getValue()));
}
}

View File

@ -52,7 +52,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Bean
public FilterRegistrationBean<CorsFilter> corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.addAllowedOrigin("*");