TSK-244: Reset TaskState after a transfer.
This commit is contained in:
parent
9be8d839d3
commit
63d0c5cbff
|
|
@ -247,10 +247,10 @@ public class TaskServiceImpl implements TaskService {
|
||||||
public Task transfer(String taskId, String destinationWorkbasketKey)
|
public Task transfer(String taskId, String destinationWorkbasketKey)
|
||||||
throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidWorkbasketException {
|
throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidWorkbasketException {
|
||||||
LOGGER.debug("entry to transfer(taskId = {}, destinationWorkbasketKey = {})", taskId, destinationWorkbasketKey);
|
LOGGER.debug("entry to transfer(taskId = {}, destinationWorkbasketKey = {})", taskId, destinationWorkbasketKey);
|
||||||
Task result = null;
|
TaskImpl task = null;
|
||||||
try {
|
try {
|
||||||
taskanaEngineImpl.openConnection();
|
taskanaEngineImpl.openConnection();
|
||||||
TaskImpl task = (TaskImpl) getTask(taskId);
|
task = (TaskImpl) getTask(taskId);
|
||||||
|
|
||||||
// transfer requires TRANSFER in source and APPEND on destination workbasket
|
// transfer requires TRANSFER in source and APPEND on destination workbasket
|
||||||
workbasketService.checkAuthorization(destinationWorkbasketKey, WorkbasketAuthorization.APPEND);
|
workbasketService.checkAuthorization(destinationWorkbasketKey, WorkbasketAuthorization.APPEND);
|
||||||
|
|
@ -267,15 +267,14 @@ public class TaskServiceImpl implements TaskService {
|
||||||
task.setWorkbasketSummary(destinationWorkbasket.asSummary());
|
task.setWorkbasketSummary(destinationWorkbasket.asSummary());
|
||||||
task.setDomain(destinationWorkbasket.getDomain());
|
task.setDomain(destinationWorkbasket.getDomain());
|
||||||
task.setModified(Instant.now());
|
task.setModified(Instant.now());
|
||||||
|
task.setState(TaskState.READY);
|
||||||
taskMapper.update(task);
|
taskMapper.update(task);
|
||||||
|
|
||||||
result = getTask(taskId);
|
|
||||||
LOGGER.debug("Method transfer() transferred Task '{}' to destination workbasket {}", taskId,
|
LOGGER.debug("Method transfer() transferred Task '{}' to destination workbasket {}", taskId,
|
||||||
destinationWorkbasketKey);
|
destinationWorkbasketKey);
|
||||||
return result;
|
return task;
|
||||||
} finally {
|
} finally {
|
||||||
taskanaEngineImpl.returnConnection();
|
taskanaEngineImpl.returnConnection();
|
||||||
LOGGER.debug("exit from transfer(). Returning result {} ", result);
|
LOGGER.debug("exit from transfer(). Returning result {} ", task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
import org.h2.store.fs.FileUtils;
|
import org.h2.store.fs.FileUtils;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
|
@ -41,7 +40,6 @@ public class TransferTaskAccTest extends AbstractAccTest {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
|
|
|
||||||
|
|
@ -715,6 +715,7 @@ public class TaskServiceImplTest {
|
||||||
classificationQueryImplMock);
|
classificationQueryImplMock);
|
||||||
|
|
||||||
assertThat(actualTask.isRead(), equalTo(false));
|
assertThat(actualTask.isRead(), equalTo(false));
|
||||||
|
assertThat(actualTask.getState(), equalTo(TaskState.READY));
|
||||||
assertThat(actualTask.isTransferred(), equalTo(true));
|
assertThat(actualTask.isTransferred(), equalTo(true));
|
||||||
assertThat(actualTask.getWorkbasketKey(), equalTo(destinationWorkbasket.getKey()));
|
assertThat(actualTask.getWorkbasketKey(), equalTo(destinationWorkbasket.getKey()));
|
||||||
}
|
}
|
||||||
|
|
@ -754,6 +755,7 @@ public class TaskServiceImplTest {
|
||||||
classificationQueryImplMock);
|
classificationQueryImplMock);
|
||||||
|
|
||||||
assertThat(actualTask.isRead(), equalTo(false));
|
assertThat(actualTask.isRead(), equalTo(false));
|
||||||
|
assertThat(actualTask.getState(), equalTo(TaskState.READY));
|
||||||
assertThat(actualTask.isTransferred(), equalTo(true));
|
assertThat(actualTask.isTransferred(), equalTo(true));
|
||||||
assertThat(actualTask.getWorkbasketKey(), equalTo(destinationWorkbasket.getKey()));
|
assertThat(actualTask.getWorkbasketKey(), equalTo(destinationWorkbasket.getKey()));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue