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 { public class TaskanaHistoryEngineImpl implements TaskanaHistoryEngine {
protected static final ThreadLocal<Deque<SqlSessionManager>> SESSION_STACK = new ThreadLocal<>(); protected static final ThreadLocal<Deque<SqlSessionManager>> SESSION_STACK = new ThreadLocal<>();
private static final String DEFAULT = "default"; private static final String DEFAULT = "default";
TaskanaEngineConfiguration taskanaEngineConfiguration;
protected SqlSessionManager sessionManager; protected SqlSessionManager sessionManager;
protected TransactionFactory transactionFactory; protected TransactionFactory transactionFactory;
protected TaskanaHistory taskanaHistoryService; protected TaskanaHistory taskanaHistoryService;
TaskanaEngineConfiguration taskanaEngineConfiguration;
protected TaskanaHistoryEngineImpl(TaskanaEngineConfiguration taskanaEngineConfiguration) protected TaskanaHistoryEngineImpl(TaskanaEngineConfiguration taskanaEngineConfiguration)
throws SQLException { throws SQLException {
this.taskanaEngineConfiguration = taskanaEngineConfiguration; this.taskanaEngineConfiguration = taskanaEngineConfiguration;
@ -81,6 +83,7 @@ public class TaskanaHistoryEngineImpl implements TaskanaHistoryEngine {
try { try {
this.sessionManager.commit(); this.sessionManager.commit();
} catch (Exception e) { } catch (Exception e) {
//ignore
} }
this.sessionManager.close(); this.sessionManager.close();
} }

View File

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

View File

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

View File

@ -113,7 +113,7 @@ public class SimpleHistoryServiceImplTest {
AbstractAccTest.createHistoryEvent("wbKey1", "taskId1", "type1", "Some comment", "wbKey2")); AbstractAccTest.createHistoryEvent("wbKey1", "taskId1", "type1", "Some comment", "wbKey2"));
doReturn(returnList).when(historyQueryMapperMock).queryHistoryEvent(any()); 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(taskanaHistoryEngineMock, times(1)).openConnection();
verify(historyQueryMapperMock, times(1)).queryHistoryEvent(any()); verify(historyQueryMapperMock, times(1)).queryHistoryEvent(any());

View File

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

View File

@ -40,11 +40,11 @@ public class SampleDataGenerator {
} }
public void generateSampleData(String schemaName) { public void generateSampleData(String schemaName) {
StringWriter outWriter = new StringWriter(); final StringWriter outWriter = new StringWriter();
PrintWriter logWriter = new PrintWriter(outWriter); final PrintWriter logWriter = new PrintWriter(outWriter);
StringWriter errorWriter = new StringWriter(); final StringWriter errorWriter = new StringWriter();
PrintWriter errorLogWriter = new PrintWriter(errorWriter); final PrintWriter errorLogWriter = new PrintWriter(errorWriter);
try { try {
runner.runScript(selectSchemaScript(dbProductName, schemaName)); runner.runScript(selectSchemaScript(dbProductName, schemaName));
runner.setStopOnError(false); 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.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import java.sql.SQLException; import java.sql.SQLException;
import java.text.MessageFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Collections; import java.util.Collections;
import javax.sql.DataSource; import javax.sql.DataSource;
@ -105,9 +106,11 @@ public class TaskHistoryEventControllerIntTest {
public void testGetSpecificTaskHistoryEvent() { public void testGetSpecificTaskHistoryEvent() {
ResponseEntity<TaskHistoryEventListResource> response = ResponseEntity<TaskHistoryEventListResource> response =
template.exchange( template.exchange(
server MessageFormat.format(
+ port "{0}{1}/api/v1/task-history-event?"
+ "/api/v1/task-history-event?business-process-id=BPI:01&sort-by=business-process-id&order=asc&page-size=6&page=1", + "business-process-id=BPI:01&sort-by=business-process-id&"
+ "order=asc&page-size=6&page=1",
server, port),
HttpMethod.GET, HttpMethod.GET,
request, request,
new ParameterizedTypeReference<TaskHistoryEventListResource>() {}); new ParameterizedTypeReference<TaskHistoryEventListResource>() {});

View File

@ -27,13 +27,13 @@ public class ExampleBootstrap {
ClassificationNotFoundException, InvalidStateException, InvalidOwnerException, ClassificationNotFoundException, InvalidStateException, InvalidOwnerException,
TaskAlreadyExistException, InvalidArgumentException { TaskAlreadyExistException, InvalidArgumentException {
System.out.println("---------------------------> Start App"); System.out.println("---------------------------> Start App");
Task task = taskanaEjb.getTaskService().newTask(null);
ObjectReference objRef = new ObjectReference(); ObjectReference objRef = new ObjectReference();
objRef.setCompany("aCompany"); objRef.setCompany("aCompany");
objRef.setSystem("aSystem"); objRef.setSystem("aSystem");
objRef.setSystemInstance("anInstance"); objRef.setSystemInstance("anInstance");
objRef.setType("aType"); objRef.setType("aType");
objRef.setValue("aValue"); objRef.setValue("aValue");
Task task = taskanaEjb.getTaskService().newTask(null);
task.setPrimaryObjRef(objRef); task.setPrimaryObjRef(objRef);
task = taskanaEjb.getTaskService().createTask(task); task = taskanaEjb.getTaskService().createTask(task);
System.out.println("---------------------------> Task started: " + task.getId()); 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.ApplicationPath;
import javax.ws.rs.core.Application; import javax.ws.rs.core.Application;
/** TODO Why does this test exist? */ /**
* TODO Why does this test exist?.
*/
@ApplicationPath("/rest") @ApplicationPath("/rest")
public class RestApplication extends Application {} public class RestApplication extends Application {}

View File

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

View File

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

View File

@ -47,7 +47,8 @@ public class BulkOperationResults<K, V> {
} }
} catch (Exception e) { } catch (Exception e) {
LOGGER.warn( 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, objectId,
error, error,
e); e);

View File

@ -1,8 +1,8 @@
package pro.taskana; package pro.taskana;
/** /**
* Enum containing the column names for @see * Enum containing the column names for {@see
* pro.taskana.mappings.QueryMapper#queryClassificationColumnValues(pro.taskana.impl.ClassificationQueryImpl). * pro.taskana.mappings.QueryMapper#queryClassificationColumnValues}.
* *
* @author jsa * @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 * Add condition to query if the caller (one of the accessIds of the caller) has the given
* permission on the workbasket. * permission on the workbasket.
* *
* @return the updated query.
* @param permission the permission for the query condition. * @param permission the permission for the query condition.
* @return the updated query.
*/ */
WorkbasketQuery callerHasPermission(WorkbasketPermission permission); WorkbasketQuery callerHasPermission(WorkbasketPermission permission);

View File

@ -87,7 +87,8 @@ public class DbSchemaCreator {
Map<String, Object> queryResult = runner.selectOne(query, expectedVersion); Map<String, Object> queryResult = runner.selectOne(query, expectedVersion);
if (queryResult == null || queryResult.isEmpty()) { if (queryResult == null || queryResult.isEmpty()) {
LOGGER.error( 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); expectedVersion);
return false; return false;
} else { } else {
@ -97,7 +98,8 @@ public class DbSchemaCreator {
} catch (Exception e) { } catch (Exception e) {
LOGGER.error( 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); expectedVersion);
return false; return false;
} finally { } finally {

View File

@ -399,7 +399,8 @@ public class TaskanaEngineConfiguration {
Boolean.parseBoolean(taskCleanupJobAllCompletedSameParentBusinessProperty); Boolean.parseBoolean(taskCleanupJobAllCompletedSameParentBusinessProperty);
} catch (Exception e) { } catch (Exception e) {
LOGGER.warn( LOGGER.warn(
"Could not parse taskCleanupJobAllCompletedSameParentBusinessProperty ({}). Using default. Exception: {} ", "Could not parse taskCleanupJobAllCompletedSameParentBusinessProperty "
+ "({}). Using default. Exception: {} ",
taskCleanupJobAllCompletedSameParentBusinessProperty, taskCleanupJobAllCompletedSameParentBusinessProperty,
e.getMessage()); e.getMessage());
} }
@ -414,7 +415,8 @@ public class TaskanaEngineConfiguration {
"CleanupJob configuration: minimum age of tasks to be cleanup up is {}", "CleanupJob configuration: minimum age of tasks to be cleanup up is {}",
cleanupJobMinimumAge); cleanupJobMinimumAge);
LOGGER.debug( 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); taskCleanupJobAllCompletedSameParentBusiness);
} }

View File

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

View File

@ -1,6 +1,7 @@
package pro.taskana.history.events.task; package pro.taskana.history.events.task;
import pro.taskana.Task; import pro.taskana.Task;
/** Event fired if a task is created. */ /** Event fired if a task is created. */
public class CreatedEvent extends TaskEvent { 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 @Override
public List<T> list(int offset, int limit) { public List<T> list(int offset, int limit) {
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, _this()); LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, _this());
@ -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 @Override
public T single() { public T single() {
LOGGER.debug("entry to single(), this = {}", _this()); LOGGER.debug("entry to single(), this = {}", _this());
@ -206,6 +206,7 @@ abstract class AbstractWorkbasketAccessItemQueryImpl<
return columnName; return columnName;
} }
@SuppressWarnings("checkstyle:MethodName")
abstract Q _this(); abstract Q _this();
abstract String getLinkToMapper(); abstract String getLinkToMapper();

View File

@ -2,6 +2,7 @@ package pro.taskana.impl;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.SQLIntegrityConstraintViolationException; import java.sql.SQLIntegrityConstraintViolationException;
import java.text.MessageFormat;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
@ -251,13 +252,11 @@ public class ClassificationServiceImpl implements ClassificationService {
} catch (PersistenceException e) { } catch (PersistenceException e) {
if (isReferentialIntegrityConstraintViolation(e)) { if (isReferentialIntegrityConstraintViolation(e)) {
throw new ClassificationInUseException( throw new ClassificationInUseException(
"The classification id = \"" MessageFormat.format(
+ classificationId "The classification id = \"{0}\" and key = \"{1}\" in domain = \"{2}\" "
+ "\" and key = \"" + "is in use and cannot be deleted. There are either tasks or "
+ classification.getKey() + "attachments associated with the classification.",
+ "\" in domain = \"" classificationId, classification.getKey(), classification.getDomain()),
+ classification.getDomain()
+ "\" is in use and cannot be deleted. There are either tasks or attachments associated with the classification.",
e.getCause()); e.getCause());
} }
} }
@ -273,10 +272,12 @@ public class ClassificationServiceImpl implements ClassificationService {
} catch (Exception e) { } catch (Exception e) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
"Invalid service level " MessageFormat.format(
+ serviceLevel "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. " + "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.\" ", + "For example: \"P2D\" represents a period of \"two days.\" ",
serviceLevel),
e.getCause()); e.getCause());
} }
// check that the duration is based on format PnD, i.e. it must start with a P, end with a D // 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))) { || !('d' == serviceLevelLower.charAt(serviceLevel.length() - 1))) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
"Invalid service level " MessageFormat.format(
+ serviceLevel "Invalid service level {0}. Taskana only supports service "
+ ". Taskana only supports service levels that" + "levels that contain a number of whole days "
+ " contain a number of whole days specified according to the format 'PnD' where n is the number of 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) { } catch (ClassificationNotFoundException e) {
doesExist = false; doesExist = false;
LOGGER.debug( LOGGER.debug(
"Method createClassification: Classification does not exist in master domain. Classification {}.", "Method createClassification: Classification does not "
+ "exist in master domain. Classification {}.",
masterClassification); masterClassification);
} catch (ClassificationAlreadyExistException ex) { } catch (ClassificationAlreadyExistException ex) {
LOGGER.warn( LOGGER.warn(
"Method createClassification: Classification does already exist in master domain. Classification {}.", "Method createClassification: Classification does already exist "
+ "in master domain. Classification {}.",
masterClassification); masterClassification);
} finally { } finally {
if (!doesExist) { if (!doesExist) {
classificationMapper.insert(masterClassification); classificationMapper.insert(masterClassification);
LOGGER.debug( LOGGER.debug(
"Method createClassification: Classification created in master-domain, too. Classification {}.", "Method createClassification: Classification created in "
+ "master-domain, too. Classification {}.",
masterClassification); masterClassification);
} }
} }
@ -445,7 +450,8 @@ public class ClassificationServiceImpl implements ClassificationService {
} }
} catch (Exception ex) { } catch (Exception ex) {
LOGGER.warn( 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,
ex); ex);
} }
@ -481,7 +487,8 @@ public class ClassificationServiceImpl implements ClassificationService {
this.getClassification(classificationImpl.getKey(), classificationImpl.getDomain()); this.getClassification(classificationImpl.getKey(), classificationImpl.getDomain());
if (!oldClassification.getModified().equals(classificationImpl.getModified())) { if (!oldClassification.getModified().equals(classificationImpl.getModified())) {
throw new ConcurrencyException( 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()); + classificationImpl.toString());
} }
return oldClassification; 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 @Override
public List<ObjectReference> list(int offset, int limit) { public List<ObjectReference> list(int offset, int limit) {
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this); LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
@ -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 @Override
public ObjectReference single() { public ObjectReference single() {
LOGGER.debug("entry to single(), this = {}", this); 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() { public String getLinkToMapperScript() {
return DB.DB2.dbProductId.equals(getDatabaseId()) ? LINK_TO_MAPPER_DB2 : LINK_TO_MAPPER; 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 @Override
public TaskSummary single() { public TaskSummary single() {
LOGGER.debug("entry to single(), this = {}", this); LOGGER.debug("entry to single(), this = {}", this);

View File

@ -1,5 +1,6 @@
package pro.taskana.impl; package pro.taskana.impl;
import java.text.MessageFormat;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
@ -115,6 +116,42 @@ public class TaskServiceImpl implements TaskService {
return claim(taskId, false); 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 @Override
public Task forceClaim(String taskId) public Task forceClaim(String taskId)
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
@ -129,6 +166,45 @@ public class TaskServiceImpl implements TaskService {
return this.cancelClaim(taskId, false); 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 @Override
public Task forceCancelClaim(String taskId) public Task forceCancelClaim(String taskId)
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
@ -143,6 +219,57 @@ public class TaskServiceImpl implements TaskService {
return completeTask(taskId, false); 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 @Override
public Task forceCompleteTask(String taskId) public Task forceCompleteTask(String taskId)
throws TaskNotFoundException, InvalidOwnerException, InvalidStateException, throws TaskNotFoundException, InvalidOwnerException, InvalidStateException,
@ -430,6 +557,32 @@ public class TaskServiceImpl implements TaskService {
deleteTask(taskId, false); 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 @Override
public void forceDeleteTask(String taskId) public void forceDeleteTask(String taskId)
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException { throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
@ -859,7 +1012,7 @@ public class TaskServiceImpl implements TaskService {
TaskImpl task, Classification classification, PrioDurationHolder prioDurationFromAttachments) TaskImpl task, Classification classification, PrioDurationHolder prioDurationFromAttachments)
throws InvalidArgumentException { throws InvalidArgumentException {
LOGGER.debug("entry to standardSettings()"); LOGGER.debug("entry to standardSettings()");
Instant now = Instant.now(); final Instant now = Instant.now();
task.setId(IdGenerator.generateWithPrefix(ID_PREFIX_TASK)); task.setId(IdGenerator.generateWithPrefix(ID_PREFIX_TASK));
if (task.getExternalId() == null) { if (task.getExternalId() == null) {
task.setExternalId(IdGenerator.generateWithPrefix(ID_PREFIX_EXT_TASK_ID)); 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)); Instant planned = task.getDue().plus(Duration.ofDays(days));
if (task.getPlanned() != null && !task.getPlanned().equals(planned)) { if (task.getPlanned() != null && !task.getPlanned().equals(planned)) {
throw new InvalidArgumentException( 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); task.setPlanned(planned);
} else { } else {
@ -964,7 +1118,8 @@ public class TaskServiceImpl implements TaskService {
BulkOperationResults<String, TaskanaException> bulkLog) { BulkOperationResults<String, TaskanaException> bulkLog) {
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug( LOGGER.debug(
"entry to checkIfTasksMatchCompleteCriteria(taskIds = {}, taskSummaries = {}, bulkLog = {})", "entry to checkIfTasksMatchCompleteCriteria(taskIds = {}, "
+ "taskSummaries = {}, bulkLog = {})",
LoggerUtils.listToString(taskIds), LoggerUtils.listToString(taskIds),
LoggerUtils.listToString(taskSummaries), LoggerUtils.listToString(taskSummaries),
bulkLog); bulkLog);
@ -1024,45 +1179,6 @@ public class TaskServiceImpl implements TaskService {
LOGGER.debug("exit from updateTasksToBeCompleted()"); 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( private void addClassificationSummariesToTaskSummaries(
List<TaskSummaryImpl> tasks, List<ClassificationSummary> classifications) { List<TaskSummaryImpl> tasks, List<ClassificationSummary> classifications) {
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
@ -1079,12 +1195,12 @@ public class TaskServiceImpl implements TaskService {
// assign query results to appropriate tasks. // assign query results to appropriate tasks.
for (TaskSummaryImpl task : tasks) { for (TaskSummaryImpl task : tasks) {
String classificationId = task.getClassificationSummary().getId(); String classificationId = task.getClassificationSummary().getId();
ClassificationSummary aClassification = ClassificationSummary classificationSummary =
classifications.stream() classifications.stream()
.filter(c -> c.getId().equals(classificationId)) .filter(c -> c.getId().equals(classificationId))
.findFirst() .findFirst()
.orElse(null); .orElse(null);
if (aClassification == null) { if (classificationSummary == null) {
throw new SystemException( throw new SystemException(
"Did not find a Classification for task (Id=" "Did not find a Classification for task (Id="
+ task.getTaskId() + task.getTaskId()
@ -1093,7 +1209,7 @@ public class TaskServiceImpl implements TaskService {
+ ")"); + ")");
} }
// set the classification on the task object // set the classification on the task object
task.setClassificationSummary(aClassification); task.setClassificationSummary(classificationSummary);
} }
LOGGER.debug("exit from addClassificationSummariesToTaskSummaries()"); LOGGER.debug("exit from addClassificationSummariesToTaskSummaries()");
} }
@ -1168,18 +1284,18 @@ public class TaskServiceImpl implements TaskService {
TaskSummaryImpl task = taskIterator.next(); TaskSummaryImpl task = taskIterator.next();
String workbasketId = task.getWorkbasketSummaryImpl().getId(); String workbasketId = task.getWorkbasketSummaryImpl().getId();
WorkbasketSummary aWorkbasket = WorkbasketSummary workbasketSummary =
workbaskets.stream() workbaskets.stream()
.filter(x -> workbasketId != null && workbasketId.equals(x.getId())) .filter(x -> workbasketId != null && workbasketId.equals(x.getId()))
.findFirst() .findFirst()
.orElse(null); .orElse(null);
if (aWorkbasket == null) { if (workbasketSummary == null) {
LOGGER.warn("Could not find a Workbasket for task {}.", task.getTaskId()); LOGGER.warn("Could not find a Workbasket for task {}.", task.getTaskId());
taskIterator.remove(); taskIterator.remove();
continue; continue;
} }
task.setWorkbasketSummary(aWorkbasket); task.setWorkbasketSummary(workbasketSummary);
} }
LOGGER.debug("exit from addWorkbasketSummariesToTaskSummaries()"); LOGGER.debug("exit from addWorkbasketSummariesToTaskSummaries()");
} }
@ -1190,7 +1306,8 @@ public class TaskServiceImpl implements TaskService {
List<ClassificationSummary> classifications) { List<ClassificationSummary> classifications) {
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug( LOGGER.debug(
"entry to addAttachmentSummariesToTaskSummaries(taskSummaries = {}, attachmentSummaries = {}, classifications = {})", "entry to addAttachmentSummariesToTaskSummaries(taskSummaries = {}, "
+ "attachmentSummaries = {}, classifications = {})",
LoggerUtils.listToString(taskSummaries), LoggerUtils.listToString(taskSummaries),
LoggerUtils.listToString(attachmentSummaries), LoggerUtils.listToString(attachmentSummaries),
LoggerUtils.listToString(classifications)); 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 // iterate over all attachment summaries an add the appropriate classification summary to each
for (AttachmentSummaryImpl att : attachmentSummaries) { for (AttachmentSummaryImpl att : attachmentSummaries) {
String classificationId = att.getClassificationSummary().getId(); String classificationId = att.getClassificationSummary().getId();
ClassificationSummary aClassification = ClassificationSummary classificationSummary =
classifications.stream() classifications.stream()
.filter(x -> classificationId != null && classificationId.equals(x.getId())) .filter(x -> classificationId != null && classificationId.equals(x.getId()))
.findFirst() .findFirst()
.orElse(null); .orElse(null);
if (aClassification == null) { if (classificationSummary == null) {
throw new SystemException("Could not find a Classification for attachment " + att); throw new SystemException("Could not find a Classification for attachment " + att);
} }
att.setClassificationSummary(aClassification); att.setClassificationSummary(classificationSummary);
} }
LOGGER.debug("exit from addClassificationSummariesToAttachmentSummaries()"); LOGGER.debug("exit from addClassificationSummariesToAttachmentSummaries()");
} }
@ -1264,16 +1381,16 @@ public class TaskServiceImpl implements TaskService {
List<Attachment> result = new ArrayList<>(); List<Attachment> result = new ArrayList<>();
for (AttachmentImpl att : attachmentImpls) { for (AttachmentImpl att : attachmentImpls) {
// find the associated task to use the correct domain // find the associated task to use the correct domain
ClassificationSummary aClassification = ClassificationSummary classificationSummary =
classifications.stream() classifications.stream()
.filter(c -> c != null && c.getId().equals(att.getClassificationSummary().getId())) .filter(c -> c != null && c.getId().equals(att.getClassificationSummary().getId()))
.findFirst() .findFirst()
.orElse(null); .orElse(null);
if (aClassification == null) { if (classificationSummary == null) {
throw new SystemException("Could not find a Classification for attachment " + att); throw new SystemException("Could not find a Classification for attachment " + att);
} }
att.setClassificationSummary(aClassification); att.setClassificationSummary(classificationSummary);
result.add(att); result.add(att);
} }
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
@ -1707,7 +1824,8 @@ public class TaskServiceImpl implements TaskService {
int prioFromClassification, int prioFromClassification,
String serviceLevelFromClassification) { String serviceLevelFromClassification) {
LOGGER.debug( LOGGER.debug(
"entry to getNewPrioDuration(prioDurationHolder = {}, prioFromClassification = {}, serviceLevelFromClassification = {})", "entry to getNewPrioDuration(prioDurationHolder = {}, prioFromClassification = {}, "
+ "serviceLevelFromClassification = {})",
prioDurationHolder, prioDurationHolder,
prioFromClassification, prioFromClassification,
serviceLevelFromClassification); serviceLevelFromClassification);
@ -1787,93 +1905,6 @@ public class TaskServiceImpl implements TaskService {
LOGGER.debug("exit from updateTaskPrioDurationFromClassificationAndAttachments()"); 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( private void updateTaskPrioDurationFromAttachments(
TaskImpl task, PrioDurationHolder prioDurationFromAttachments) { TaskImpl task, PrioDurationHolder prioDurationFromAttachments) {
LOGGER.debug("entry to updateTaskPrioDurationFromAttachments()"); LOGGER.debug("entry to updateTaskPrioDurationFromAttachments()");
@ -1918,9 +1949,10 @@ public class TaskServiceImpl implements TaskService {
att.getClassificationSummary().getId(), att.getClassificationSummary().getId(),
new ClassificationNotFoundException( new ClassificationNotFoundException(
id, id,
"When processing task updates due to change of classification, the classification with id " MessageFormat.format(
+ id "When processing task updates due to change "
+ WAS_NOT_FOUND2)); + "of classification, the classification with id {0}{1}",
id, WAS_NOT_FOUND2)));
} else { } else {
att.setClassificationSummary(classificationSummary); att.setClassificationSummary(classificationSummary);
result.add(att); result.add(att);
@ -1931,32 +1963,6 @@ public class TaskServiceImpl implements TaskService {
return result; 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) { private void createTasksCompletedEvents(List<TaskSummary> taskSummaries) {
taskSummaries.stream() taskSummaries.stream()
.forEach(task -> historyEventProducer.createEvent(new CompletedEvent(task))); .forEach(task -> historyEventProducer.createEvent(new CompletedEvent(task)));

View File

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

View File

@ -227,7 +227,8 @@ public class TaskanaEngineImpl implements TaskanaEngine {
} catch (SQLException e) { } catch (SQLException e) {
throw new SystemException( 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()); e.getCause());
} }
@ -276,7 +277,11 @@ public class TaskanaEngineImpl implements TaskanaEngine {
private ThreadLocal<Deque<SqlSessionManager>> sessionStack = new ThreadLocal<>(); 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() { private Deque<SqlSessionManager> getSessionStack() {
Deque<SqlSessionManager> stack = sessionStack.get(); Deque<SqlSessionManager> stack = sessionStack.get();
if (stack == null) { if (stack == null) {
@ -316,7 +321,8 @@ public class TaskanaEngineImpl implements TaskanaEngine {
sessionManager.getConnection().setSchema(taskanaEngineConfiguration.getSchemaName()); sessionManager.getConnection().setSchema(taskanaEngineConfiguration.getSchemaName());
} catch (SQLException e) { } catch (SQLException e) {
throw new SystemException( 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()); e.getCause());
} }
if (mode != ConnectionManagementMode.EXPLICIT) { if (mode != ConnectionManagementMode.EXPLICIT) {

View File

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

View File

@ -114,30 +114,6 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery
return result; 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 @Override
public List<WorkbasketAccessItem> list(int offset, int limit) { public List<WorkbasketAccessItem> list(int offset, int limit) {
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this); LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
@ -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 @Override
public WorkbasketAccessItem single() { public WorkbasketAccessItem single() {
LOGGER.debug("entry to single(), this = {}", this); 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 @Override
public List<WorkbasketSummary> list(int offset, int limit) { public List<WorkbasketSummary> list(int offset, int limit) {
LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this); LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this);
@ -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 @Override
public WorkbasketSummary single() { public WorkbasketSummary single() {
LOGGER.debug("entry to single(), this = {}", this); LOGGER.debug("entry to single(), this = {}", this);

View File

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

View File

@ -55,7 +55,8 @@ public class ClassificationChangedJob extends AbstractTaskanaJob {
int batchSize = taskanaEngineImpl.getConfiguration().getMaxNumberOfUpdatesPerTransaction(); int batchSize = taskanaEngineImpl.getConfiguration().getMaxNumberOfUpdatesPerTransaction();
List<List<String>> affectedTaskBatches = partition(affectedTaskIds, batchSize); List<List<String>> affectedTaskBatches = partition(affectedTaskIds, batchSize);
LOGGER.debug( 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(), affectedTaskBatches.size(),
affectedTaskIds.size(), affectedTaskIds.size(),
batchSize); batchSize);

View File

@ -70,6 +70,7 @@ public class JobRunner {
try { try {
hostAddress = InetAddress.getLocalHost().getHostAddress(); hostAddress = InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
//ignore
} }
job.setLockedBy(hostAddress + " - " + Thread.currentThread().getName()); job.setLockedBy(hostAddress + " - " + Thread.currentThread().getName());
String owner = 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; import pro.taskana.impl.ClassificationImpl;
/** This class is the mybatis mapping of classifications. */ /** This class is the mybatis mapping of classifications. */
@SuppressWarnings("checkstyle:LineLength") @SuppressWarnings({"checkstyle:LineLength", "checkstyle:indentation"})
public interface ClassificationMapper { public interface ClassificationMapper {
@Select( @Select(

View File

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

View File

@ -17,7 +17,7 @@ import pro.taskana.impl.WorkbasketQueryImpl;
import pro.taskana.impl.WorkbasketSummaryImpl; import pro.taskana.impl.WorkbasketSummaryImpl;
/** This class provides a mapper for all queries. */ /** This class provides a mapper for all queries. */
@SuppressWarnings("checkstyle:LineLength") @SuppressWarnings({"checkstyle:LineLength", "checkstyle:indentation"})
public interface QueryMapper { public interface QueryMapper {
String OBJECTREFERENCEMAPPER_FINDBYID = "pro.taskana.mappings.ObjectReferenceMapper.findById"; 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; import pro.taskana.report.Timestamp;
/** This class is the mybatis mapping of task monitoring. */ /** This class is the mybatis mapping of task monitoring. */
@SuppressWarnings("checkstyle:LineLength") @SuppressWarnings({"checkstyle:LineLength", "checkstyle:indentation"})
public interface TaskMonitorMapper { public interface TaskMonitorMapper {
@Select( @Select(

View File

@ -22,7 +22,9 @@ public class CategoryReport extends Report<MonitorQueryItem, TimeIntervalColumnH
super(timeIntervalColumnHeaders, new String[] {"CLASSIFICATION CATEGORIES"}); super(timeIntervalColumnHeaders, new String[] {"CLASSIFICATION CATEGORIES"});
} }
/** Builder for {@link CategoryReport}. */ /**
* Builder for {@link CategoryReport}.
*/
public interface Builder public interface Builder
extends TimeIntervalReportBuilder<Builder, MonitorQueryItem, TimeIntervalColumnHeader> { 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 * pro.taskana.impl.report.structure.Row}s for the classifications of the attachments of the
* tasks. * tasks.
* *
* @return the DetailedClassificationReport
* @throws InvalidArgumentException if the column headers are not initialized * @throws InvalidArgumentException if the column headers are not initialized
* @throws NotAuthorizedException if the user has no rights to access the monitor * @throws NotAuthorizedException if the user has no rights to access the monitor
* @return the DetailedClassificationReport
*/ */
DetailedClassificationReport buildDetailedReport() DetailedClassificationReport buildDetailedReport()
throws InvalidArgumentException, NotAuthorizedException; throws InvalidArgumentException, NotAuthorizedException;

View File

@ -109,8 +109,8 @@ public interface TimeIntervalReportBuilder<
* *
* @param selectedItems a list of selectedItems * @param selectedItems a list of selectedItems
* @throws InvalidArgumentException if the column headers are not initialized * @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 * @return the list of all taskIds
* @throws NotAuthorizedException if the user has no rights to access the monitor
*/ */
List<String> listTaskIdsForSelectedItems(List<SelectedItem> selectedItems) List<String> listTaskIdsForSelectedItems(List<SelectedItem> selectedItems)
throws NotAuthorizedException, InvalidArgumentException; 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. * 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 * @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 * @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) List<String> listCustomAttributeValuesForCustomAttributeName(CustomField customField)
throws NotAuthorizedException; throws NotAuthorizedException;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,9 +23,9 @@ class GetTaskIdsOfClassificationReportAccTest extends AbstractReportAccTest {
@Test @Test
void testRoleCheck() { 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(); SelectedItem s1 = new SelectedItem();
s1.setKey("L10000"); s1.setKey("L10000");
@ -57,11 +57,11 @@ class GetTaskIdsOfClassificationReportAccTest extends AbstractReportAccTest {
@Test @Test
void testGetTaskIdsOfClassificationReport() void testGetTaskIdsOfClassificationReport()
throws InvalidArgumentException, NotAuthorizedException { 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(); SelectedItem s1 = new SelectedItem();
s1.setKey("L10000"); s1.setKey("L10000");
@ -101,11 +101,11 @@ class GetTaskIdsOfClassificationReportAccTest extends AbstractReportAccTest {
@Test @Test
void testGetTaskIdsOfClassificationReportWithAttachments() void testGetTaskIdsOfClassificationReportWithAttachments()
throws InvalidArgumentException, NotAuthorizedException { 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(); SelectedItem s1 = new SelectedItem();
s1.setKey("L10000"); s1.setKey("L10000");
@ -143,11 +143,11 @@ class GetTaskIdsOfClassificationReportAccTest extends AbstractReportAccTest {
@Test @Test
void testGetTaskIdsOfClassificationReportWithDomainFilter() void testGetTaskIdsOfClassificationReportWithDomainFilter()
throws InvalidArgumentException, NotAuthorizedException { 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(); SelectedItem s1 = new SelectedItem();
s1.setKey("L10000"); s1.setKey("L10000");

View File

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

View File

@ -41,11 +41,11 @@ class GetTaskIdsOfWorkbasketReportAccTest extends AbstractReportAccTest {
@WithAccessId(userName = "monitor") @WithAccessId(userName = "monitor")
@Test @Test
void testGetTaskIdsOfWorkbasketReport() throws InvalidArgumentException, NotAuthorizedException { 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(); SelectedItem s1 = new SelectedItem();
s1.setKey("USER_1_1"); s1.setKey("USER_1_1");
@ -86,11 +86,11 @@ class GetTaskIdsOfWorkbasketReportAccTest extends AbstractReportAccTest {
@Test @Test
void testGetTaskIdsOfWorkbasketReportWithExcludedClassifications() void testGetTaskIdsOfWorkbasketReportWithExcludedClassifications()
throws InvalidArgumentException, NotAuthorizedException { 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(); SelectedItem s1 = new SelectedItem();
s1.setKey("USER_1_1"); s1.setKey("USER_1_1");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -746,7 +746,7 @@ class CreateTaskAccTest extends AbstractAccTest {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); 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"); Task newTask = taskService.newTask("WBI:100000000000000000000000000000000006");
newTask.setClassificationKey("T2100"); newTask.setClassificationKey("T2100");

View File

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

View File

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

View File

@ -62,7 +62,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException, throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException { InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException {
setUpMethod(); setUpMethod();
int attachmentCount = task.getAttachments().size(); final int attachmentCount = task.getAttachments().size();
assertEquals(1, task.getPriority()); assertEquals(1, task.getPriority());
assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(1))); assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(1)));
task.addAttachment(attachment); task.addAttachment(attachment);
@ -118,7 +118,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException,
ConcurrencyException, NotAuthorizedException, AttachmentPersistenceException { ConcurrencyException, NotAuthorizedException, AttachmentPersistenceException {
setUpMethod(); setUpMethod();
int attachmentCount = 0; final int attachmentCount = 0;
task.getAttachments().clear(); task.getAttachments().clear();
task = taskService.updateTask(task); task = taskService.updateTask(task);
task = taskService.getTask(task.getId()); task = taskService.getTask(task.getId());
@ -143,7 +143,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
setUpMethod(); setUpMethod();
// Add attachment before // Add attachment before
task = taskService.getTask(task.getId()); task = taskService.getTask(task.getId());
int attachmentCount = task.getAttachments().size(); final int attachmentCount = task.getAttachments().size();
task.addAttachment(attachment); task.addAttachment(attachment);
task = taskService.updateTask(task); task = taskService.updateTask(task);
task = taskService.getTask(task.getId()); task = taskService.getTask(task.getId());
@ -151,7 +151,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
// Change sth. and add same (id) again - override/update // Change sth. and add same (id) again - override/update
String newChannel = "UPDATED EXTERNAL SINCE LAST ADD"; String newChannel = "UPDATED EXTERNAL SINCE LAST ADD";
attachmentCount = task.getAttachments().size(); final int attachmentCount2 = task.getAttachments().size();
Attachment updatedAttachment = task.getAttachments().get(0); Attachment updatedAttachment = task.getAttachments().get(0);
updatedAttachment.setChannel(newChannel); updatedAttachment.setChannel(newChannel);
Classification newClassification = Classification newClassification =
@ -162,7 +162,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
task.addAttachment(updatedAttachment); task.addAttachment(updatedAttachment);
task = taskService.updateTask(task); task = taskService.updateTask(task);
task = taskService.getTask(task.getId()); 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)); assertThat(task.getAttachments().get(0).getChannel(), equalTo(newChannel));
assertEquals(999, task.getPriority()); assertEquals(999, task.getPriority());
@ -182,7 +182,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException { InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException {
setUpMethod(); setUpMethod();
// Add Attachment before // Add Attachment before
int attachmentCount = task.getAttachments().size(); final int attachmentCount = task.getAttachments().size();
((AttachmentImpl) attachment).setId("TAI:0001"); ((AttachmentImpl) attachment).setId("TAI:0001");
task.addAttachment(attachment); task.addAttachment(attachment);
task.addAttachment(attachment); // overwrite, same id task.addAttachment(attachment); // overwrite, same id
@ -192,11 +192,11 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
assertThat(task.getAttachments().size(), equalTo(attachmentCount + 1)); assertThat(task.getAttachments().size(), equalTo(attachmentCount + 1));
// Add same again - ignored // Add same again - ignored
attachmentCount = task.getAttachments().size(); final int attachmentCount2 = task.getAttachments().size();
Attachment redundantAttachment = task.getAttachments().get(0); Attachment redundantAttachment = task.getAttachments().get(0);
task.addAttachment(redundantAttachment); task.addAttachment(redundantAttachment);
task = taskService.updateTask(task); task = taskService.updateTask(task);
assertThat(task.getAttachments().size(), equalTo(attachmentCount)); assertThat(task.getAttachments().size(), equalTo(attachmentCount2));
} }
@WithAccessId( @WithAccessId(
@ -208,7 +208,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
ConcurrencyException, NotAuthorizedException, AttachmentPersistenceException { ConcurrencyException, NotAuthorizedException, AttachmentPersistenceException {
setUpMethod(); setUpMethod();
// Try to add a single NULL-Element // Try to add a single NULL-Element
int attachmentCount = task.getAttachments().size(); final int attachmentCount = task.getAttachments().size();
task.addAttachment(null); task.addAttachment(null);
task = taskService.updateTask(task); task = taskService.updateTask(task);
task = taskService.getTask(task.getId()); 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. // 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. // 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.getAttachments().add(null);
task.getAttachments().add(null); task.getAttachments().add(null);
task = taskService.updateTask(task); 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()); task = taskService.getTask(task.getId());
assertThat( assertThat(
task.getAttachments().size(), equalTo(attachmentCount)); // persisted values not changed task.getAttachments().size(), equalTo(attachmentCount2)); // persisted values not changed
assertEquals(1, task.getPriority()); assertEquals(1, task.getPriority());
assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(1))); assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(1)));
} }
@ -307,7 +307,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
assertEquals(99, task.getPriority()); assertEquals(99, task.getPriority());
assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(1))); 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"; String newChannel = attachment.getChannel() + "-X";
task.getAttachments().get(0).setChannel(newChannel); task.getAttachments().get(0).setChannel(newChannel);

View File

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

View File

@ -39,7 +39,7 @@ class CreateWorkbasketAccTest extends AbstractAccTest {
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException { InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); 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 workbasket = workbasketService.newWorkbasket("NT1234", "DOMAIN_A");
workbasket.setName("Megabasket"); workbasket.setName("Megabasket");

View File

@ -115,14 +115,15 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
Assertions.assertThrows( Assertions.assertThrows(
InvalidArgumentException.class, InvalidArgumentException.class,
() -> workbasketService.deleteWorkbasket(null), () -> 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 // Test EMPTY-Value
Assertions.assertThrows( Assertions.assertThrows(
InvalidArgumentException.class, InvalidArgumentException.class,
() -> workbasketService.deleteWorkbasket(""), () -> 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( @WithAccessId(
@ -206,8 +207,8 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
throws WorkbasketInUseException, NotAuthorizedException, WorkbasketNotFoundException, throws WorkbasketInUseException, NotAuthorizedException, WorkbasketNotFoundException,
InvalidArgumentException, InvalidOwnerException, InvalidStateException, InvalidArgumentException, InvalidOwnerException, InvalidStateException,
TaskNotFoundException { TaskNotFoundException {
Workbasket wb = workbasketService.getWorkbasket("WBI:100000000000000000000000000000000006"); final Workbasket wb =
boolean markedForDeletion; workbasketService.getWorkbasket("WBI:100000000000000000000000000000000006");
TaskImpl task = (TaskImpl) taskService.getTask("TKI:000000000000000000000000000000000000"); TaskImpl task = (TaskImpl) taskService.getTask("TKI:000000000000000000000000000000000000");
taskService.forceCompleteTask(task.getId()); taskService.forceCompleteTask(task.getId());
@ -216,10 +217,10 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
task = (TaskImpl) taskService.getTask("TKI:000000000000000000000000000000000002"); task = (TaskImpl) taskService.getTask("TKI:000000000000000000000000000000000002");
taskService.forceCompleteTask(task.getId()); taskService.forceCompleteTask(task.getId());
markedForDeletion = workbasketService.deleteWorkbasket(wb.getId()); boolean markedForDeletion = workbasketService.deleteWorkbasket(wb.getId());
assertFalse(markedForDeletion); assertFalse(markedForDeletion);
wb = workbasketService.getWorkbasket(wb.getId()); Workbasket wb2 = workbasketService.getWorkbasket(wb.getId());
assertTrue(wb.isMarkedForDeletion()); assertTrue(wb2.isMarkedForDeletion());
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -12,6 +12,7 @@ import pro.taskana.impl.TaskImpl;
import pro.taskana.impl.persistence.MapTypeHandler; import pro.taskana.impl.persistence.MapTypeHandler;
/** This class contains specific mybatis mappings for task tests. */ /** This class contains specific mybatis mappings for task tests. */
@SuppressWarnings({"checkstyle:LineLength"})
public interface TaskTestMapper { public interface TaskTestMapper {
@Select("select CUSTOM_ATTRIBUTES from TASK where id = #{taskId}") @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.jobs.WorkbasketCleanupJob;
import pro.taskana.transaction.TaskanaTransactionProvider; import pro.taskana.transaction.TaskanaTransactionProvider;
/** */ /**
* Test for internal transaction management.
*/
@ExtendWith(SpringExtension.class) @ExtendWith(SpringExtension.class)
@SpringBootTest( @SpringBootTest(
classes = TaskanaConfigTestApplication.class, classes = TaskanaConfigTestApplication.class,
@ -145,7 +147,7 @@ class TaskanaTransactionIntTest {
throws SQLException, NotAuthorizedException, WorkbasketNotFoundException, throws SQLException, NotAuthorizedException, WorkbasketNotFoundException,
DomainNotFoundException, InvalidWorkbasketException, WorkbasketAlreadyExistException { DomainNotFoundException, InvalidWorkbasketException, WorkbasketAlreadyExistException {
TaskanaEngineImpl taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine; final TaskanaEngineImpl taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
Connection connection = dataSource.getConnection(); Connection connection = dataSource.getConnection();
assertNotEquals(connection.getSchema(), "PUBLIC"); assertNotEquals(connection.getSchema(), "PUBLIC");

View File

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

View File

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

View File

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

View File

@ -71,7 +71,7 @@ public class PagedResources<T> extends ResourceSupport {
@JsonProperty("content") @JsonProperty("content")
public Collection<T> getContent() { public Collection<T> getContent() {
return Collections.unmodifiableCollection(content); return Collections.unmodifiableCollection(content);
}; }
/** Class for Page Metadata. */ /** Class for Page Metadata. */
public static class PageMetadata { 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.PagedResources.PageMetadata;
import pro.taskana.rest.resource.links.PageLinks; import pro.taskana.rest.resource.links.PageLinks;
/** @author HH */
/**
* Resource assembler for {@link WorkbasketSummaryResource}.
*/
@Component @Component
public class WorkbasketSummaryResourceAssembler public class WorkbasketSummaryResourceAssembler
extends ResourceAssemblerSupport<WorkbasketSummary, WorkbasketSummaryResource> { 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); LOGGER.error("The workbasket with the id ' {} ' is not found in database.", id);
} catch (NotAuthorizedException e) { } catch (NotAuthorizedException e) {
LOGGER.error( 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, id,
e); e);
} }

View File

@ -38,13 +38,16 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
classificationFieldDescriptionsMap.put("classificationId", "Unique Id"); classificationFieldDescriptionsMap.put("classificationId", "Unique Id");
classificationFieldDescriptionsMap.put( classificationFieldDescriptionsMap.put(
"key", "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( classificationFieldDescriptionsMap.put(
"parentId", "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( classificationFieldDescriptionsMap.put(
"parentKey", "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( classificationFieldDescriptionsMap.put(
"category", "The category of the classification (MANUAL, EXTERNAL, AUTOMATIC, PROCESS)"); "category", "The category of the classification (MANUAL, EXTERNAL, AUTOMATIC, PROCESS)");
classificationFieldDescriptionsMap.put("type", "The type of classification (TASK, DOCUMENT)"); 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"); "The service level of the classification. This is stated according to ISO 8601");
classificationFieldDescriptionsMap.put( classificationFieldDescriptionsMap.put(
"applicationEntryPoint", "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("custom1", "A custom property with name \"1\"");
classificationFieldDescriptionsMap.put("custom2", "A custom property with name \"2\""); classificationFieldDescriptionsMap.put("custom2", "A custom property with name \"2\"");
classificationFieldDescriptionsMap.put("custom3", "A custom property with name \"3\""); 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"), .description("The domain for which this classification is specified"),
fieldWithPath("key") fieldWithPath("key")
.description( .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") fieldWithPath("name")
.type("String") .type("String")
.description("The name of the classification") .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[].total").description("Sum of all values of the given row"),
fieldWithPath("rows[].depth") fieldWithPath("rows[].depth")
.description( .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[].desc").description("Array containing description of the row."),
fieldWithPath("rows[].display") fieldWithPath("rows[].display")
.description( .description(

View File

@ -37,7 +37,8 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
taskFieldDescriptionsMap.put("taskId", "Unique ID"); taskFieldDescriptionsMap.put("taskId", "Unique ID");
taskFieldDescriptionsMap.put( taskFieldDescriptionsMap.put(
"externalId", "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("created", "The creation timestamp of the task in the system.");
taskFieldDescriptionsMap.put( taskFieldDescriptionsMap.put(
"claimed", "The timestamp of the last claim-operation on the task"); "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("modified", "Timestamp of the last modification of the task");
taskFieldDescriptionsMap.put( taskFieldDescriptionsMap.put(
"planned", "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( taskFieldDescriptionsMap.put(
"due", "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("name", "The name of the task");
taskFieldDescriptionsMap.put("creator", ""); taskFieldDescriptionsMap.put("creator", "");
taskFieldDescriptionsMap.put("description", "The description of the task"); taskFieldDescriptionsMap.put("description", "The description of the task");
@ -547,8 +550,11 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
.contentType("application/hal+json") .contentType("application/hal+json")
.content( .content(
"{\"classificationSummaryResource\":{\"key\":\"L11010\"}," "{\"classificationSummaryResource\":{\"key\":\"L11010\"},"
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"}," + "\"workbasketSummaryResource\":"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}") + "{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\","
+ "\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\","
+ "\"type\":\"MyType1\",\"value\":\"00000001\"}}")
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")) .header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
.andExpect(MockMvcResultMatchers.status().isCreated()) .andExpect(MockMvcResultMatchers.status().isCreated())
.andDo( .andDo(
@ -579,8 +585,11 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
.contentType("application/hal+json") .contentType("application/hal+json")
.content( .content(
"{\"classificationSummaryResource\":{\"key\":\"L11010\"}," "{\"classificationSummaryResource\":{\"key\":\"L11010\"},"
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"}," + "\"workbasketSummaryResource\":"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}") + "{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\","
+ "\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\","
+ "\"type\":\"MyType1\",\"value\":\"00000001\"}}")
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")) .header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
.andExpect(MockMvcResultMatchers.status().isCreated()) .andExpect(MockMvcResultMatchers.status().isCreated())
.andDo(MockMvcRestDocumentation.document("temp")) .andDo(MockMvcRestDocumentation.document("temp"))
@ -618,8 +627,11 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
.contentType("application/hal+json") .contentType("application/hal+json")
.content( .content(
"{\"classificationSummaryResource\":{\"key\":\"L11010\"}," "{\"classificationSummaryResource\":{\"key\":\"L11010\"},"
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"}," + "\"workbasketSummaryResource\":"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}") + "{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\","
+ "\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\","
+ "\"type\":\"MyType1\",\"value\":\"00000001\"}}")
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")) .header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
.andExpect(MockMvcResultMatchers.status().isCreated()) .andExpect(MockMvcResultMatchers.status().isCreated())
.andDo(MockMvcRestDocumentation.document("temp")) .andDo(MockMvcRestDocumentation.document("temp"))
@ -657,8 +669,11 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
.contentType("application/hal+json") .contentType("application/hal+json")
.content( .content(
"{\"classificationSummaryResource\":{\"key\":\"L11010\"}," "{\"classificationSummaryResource\":{\"key\":\"L11010\"},"
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"}," + "\"workbasketSummaryResource\":"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}") + "{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\","
+ "\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\","
+ "\"type\":\"MyType1\",\"value\":\"00000001\"}}")
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")) .header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
.andExpect(MockMvcResultMatchers.status().isCreated()) .andExpect(MockMvcResultMatchers.status().isCreated())
.andDo( .andDo(

View File

@ -36,7 +36,8 @@ class WorkbasketAccessItemControllerRestDocumentation extends BaseRestDocumentat
"accessItems.permOpen", "The permission to view the content (the tasks) of a workbasket"); "accessItems.permOpen", "The permission to view the content (the tasks) of a workbasket");
accessItemFieldDescriptionsMap.put( accessItemFieldDescriptionsMap.put(
"accessItems.permAppend", "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( accessItemFieldDescriptionsMap.put(
"accessItems.permTransfer", "accessItems.permTransfer",
"The permission to transfer tasks (out of the current workbasket)"); "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("description", "The description of the workbasket");
workbasketFieldDescriptionsMap.put( workbasketFieldDescriptionsMap.put(
"owner", "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( workbasketFieldDescriptionsMap.put(
"orgLevel1", "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("orgLevel2", "The second Org Level");
workbasketFieldDescriptionsMap.put("orgLevel3", "The third Org Level"); workbasketFieldDescriptionsMap.put("orgLevel3", "The third Org Level");
workbasketFieldDescriptionsMap.put("orgLevel4", "The fourth Org Level (the lowest one)."); 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.workbasketKey", "The workbasket key");
accessItemFieldDescriptionsMap.put( accessItemFieldDescriptionsMap.put(
"accessItems.accessId", "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.accessName", "");
accessItemFieldDescriptionsMap.put( accessItemFieldDescriptionsMap.put(
"accessItems.permRead", "The permission to read the information about the workbasket"); "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"); "accessItems.permOpen", "The permission to view the content (the tasks) of a workbasket");
accessItemFieldDescriptionsMap.put( accessItemFieldDescriptionsMap.put(
"accessItems.permAppend", "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( accessItemFieldDescriptionsMap.put(
"accessItems.permTransfer", "accessItems.permTransfer",
"The permission to transfer tasks (out of the current workbasket)"); "The permission to transfer tasks (out of the current workbasket)");
@ -411,7 +417,9 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
.contentType("application/json") .contentType("application/json")
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x") .header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")
.content( .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\"}")) + " \"modified\" : \"2018-02-01T11:00:00Z\"}"))
.andExpect(MockMvcResultMatchers.status().isCreated()) .andExpect(MockMvcResultMatchers.status().isCreated())
.andDo( .andDo(

View File

@ -52,7 +52,9 @@ class WorkbasketDefinitionControllerRestDocumentation extends BaseRestDocumentat
+ "{" + "{"
+ "\"distributionTargets\":[], " + "\"distributionTargets\":[], "
+ "\"authorizations\":[], " + "\"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 * 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; private static Map<AccessIdResource, List<AccessIdResource>> users;
@ -353,10 +353,10 @@ public class LdapCacheTestImpl implements LdapCache {
}); });
int groupNumber = 0; int groupNumber = 0;
List<AccessIdResource> group0 = new ArrayList<>(), List<AccessIdResource> group0 = new ArrayList<>();
group1 = new ArrayList<>(), List<AccessIdResource> group1 = new ArrayList<>();
group2 = new ArrayList<>(), List<AccessIdResource> group2 = new ArrayList<>();
group3 = new ArrayList<>(); List<AccessIdResource> group3 = new ArrayList<>();
for (AccessIdResource group : groups) { for (AccessIdResource group : groups) {
switch (groupNumber) { switch (groupNumber) {

View File

@ -97,7 +97,8 @@ class ClassificationControllerIntTest {
.getLink(Link.REL_SELF) .getLink(Link.REL_SELF)
.getHref() .getHref()
.endsWith( .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_FIRST));
assertNotNull(response.getBody().getLink(Link.REL_LAST)); assertNotNull(response.getBody().getLink(Link.REL_LAST));
assertNotNull(response.getBody().getLink(Link.REL_NEXT)); assertNotNull(response.getBody().getLink(Link.REL_NEXT));
@ -108,7 +109,9 @@ class ClassificationControllerIntTest {
@DirtiesContext @DirtiesContext
void testCreateClassification() { void testCreateClassification() {
String newClassification = 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 = ResponseEntity<ClassificationResource> responseEntity =
template.exchange( template.exchange(
@ -121,7 +124,9 @@ class ClassificationControllerIntTest {
assertEquals(HttpStatus.CREATED, responseEntity.getStatusCode()); assertEquals(HttpStatus.CREATED, responseEntity.getStatusCode());
newClassification = 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 = responseEntity =
template.exchange( template.exchange(
@ -137,7 +142,10 @@ class ClassificationControllerIntTest {
@DirtiesContext @DirtiesContext
void testCreateClassificationWithParentId() { void testCreateClassificationWithParentId() {
String newClassification = 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 = ResponseEntity<ClassificationResource> responseEntity =
template.exchange( template.exchange(
@ -152,9 +160,12 @@ class ClassificationControllerIntTest {
@Test @Test
@DirtiesContext @DirtiesContext
@SuppressWarnings("checkstyle:LineLength")
void testCreateClassificationWithParentKey() { void testCreateClassificationWithParentKey() {
String newClassification = 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 = ResponseEntity<ClassificationResource> responseEntity =
template.exchange( template.exchange(
@ -169,10 +180,12 @@ class ClassificationControllerIntTest {
@Test @Test
@DirtiesContext @DirtiesContext
void testCreateClassificationWithParentKeyInDOMAIN_AShouldCreateAClassificationInRootDomain() void testCreateClassificationWithParentKeyInDomain_aShouldCreateAClassificationInRootDomain()
throws IOException { throws IOException {
String newClassification = 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 = ResponseEntity<ClassificationResource> responseEntity =
template.exchange( template.exchange(
@ -207,7 +220,10 @@ class ClassificationControllerIntTest {
@DirtiesContext @DirtiesContext
void testReturn400IfCreateClassificationWithIncompatibleParentIdAndKey() throws IOException { void testReturn400IfCreateClassificationWithIncompatibleParentIdAndKey() throws IOException {
String newClassification = 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 = HttpClientErrorException e =
Assertions.assertThrows( Assertions.assertThrows(
@ -227,7 +243,9 @@ class ClassificationControllerIntTest {
@DirtiesContext @DirtiesContext
void testCreateClassificationWithClassificationIdReturnsError400() throws IOException { void testCreateClassificationWithClassificationIdReturnsError400() throws IOException {
String newClassification = 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 = HttpClientErrorException e =
Assertions.assertThrows( Assertions.assertThrows(

View File

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

View File

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

View File

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

View File

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

View File

@ -139,6 +139,14 @@ class TaskResourceAssemberTest {
Assert.assertEquals(task.getCustomAttribute("16"), resource.getCustom16()); 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) { void testEqualityAttachements(List<Attachment> attachments, List<AttachmentResource> resources) {
Assert.assertEquals(attachments.size(), resources.size()); Assert.assertEquals(attachments.size(), resources.size());
for (int i = 0; i < resources.size(); i++) { for (int i = 0; i < resources.size(); i++) {
@ -148,12 +156,4 @@ class TaskResourceAssemberTest {
Assert.assertEquals(attachment.getId(), resource.getAttachmentId()); 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 @Bean
public FilterRegistrationBean<CorsFilter> corsFilter() { public FilterRegistrationBean<CorsFilter> corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration(); CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true); config.setAllowCredentials(true);
config.addAllowedOrigin("*"); config.addAllowedOrigin("*");