TSK-244: Reset TaskState after a transfer.

This commit is contained in:
Marcel Lengl 2018-02-06 10:14:59 +01:00
parent 9be8d839d3
commit 63d0c5cbff
3 changed files with 7 additions and 8 deletions

View File

@ -247,10 +247,10 @@ public class TaskServiceImpl implements TaskService {
public Task transfer(String taskId, String destinationWorkbasketKey)
throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidWorkbasketException {
LOGGER.debug("entry to transfer(taskId = {}, destinationWorkbasketKey = {})", taskId, destinationWorkbasketKey);
Task result = null;
TaskImpl task = null;
try {
taskanaEngineImpl.openConnection();
TaskImpl task = (TaskImpl) getTask(taskId);
task = (TaskImpl) getTask(taskId);
// transfer requires TRANSFER in source and APPEND on destination workbasket
workbasketService.checkAuthorization(destinationWorkbasketKey, WorkbasketAuthorization.APPEND);
@ -267,15 +267,14 @@ public class TaskServiceImpl implements TaskService {
task.setWorkbasketSummary(destinationWorkbasket.asSummary());
task.setDomain(destinationWorkbasket.getDomain());
task.setModified(Instant.now());
task.setState(TaskState.READY);
taskMapper.update(task);
result = getTask(taskId);
LOGGER.debug("Method transfer() transferred Task '{}' to destination workbasket {}", taskId,
destinationWorkbasketKey);
return result;
return task;
} finally {
taskanaEngineImpl.returnConnection();
LOGGER.debug("exit from transfer(). Returning result {} ", result);
LOGGER.debug("exit from transfer(). Returning result {} ", task);
}
}

View File

@ -11,7 +11,6 @@ import java.util.ArrayList;
import org.h2.store.fs.FileUtils;
import org.junit.AfterClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -41,7 +40,6 @@ public class TransferTaskAccTest extends AbstractAccTest {
super();
}
@Ignore
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})

View File

@ -715,6 +715,7 @@ public class TaskServiceImplTest {
classificationQueryImplMock);
assertThat(actualTask.isRead(), equalTo(false));
assertThat(actualTask.getState(), equalTo(TaskState.READY));
assertThat(actualTask.isTransferred(), equalTo(true));
assertThat(actualTask.getWorkbasketKey(), equalTo(destinationWorkbasket.getKey()));
}
@ -754,6 +755,7 @@ public class TaskServiceImplTest {
classificationQueryImplMock);
assertThat(actualTask.isRead(), equalTo(false));
assertThat(actualTask.getState(), equalTo(TaskState.READY));
assertThat(actualTask.isTransferred(), equalTo(true));
assertThat(actualTask.getWorkbasketKey(), equalTo(destinationWorkbasket.getKey()));
}