TSK-66 implemented comments from Marcel: use J8 stream for loops
This commit is contained in:
parent
37bb8535a3
commit
bc338b1dc7
|
|
@ -186,10 +186,10 @@ public class TaskQueryImpl implements TaskQuery {
|
||||||
taskanaEngineImpl.openConnection();
|
taskanaEngineImpl.openConnection();
|
||||||
checkAuthorization();
|
checkAuthorization();
|
||||||
List<TaskImpl> tasks = taskanaEngineImpl.getSqlSession().selectList(LINK_TO_MAPPER, this);
|
List<TaskImpl> tasks = taskanaEngineImpl.getSqlSession().selectList(LINK_TO_MAPPER, this);
|
||||||
for (TaskImpl taskImpl : tasks) {
|
tasks.stream().forEach(t -> {
|
||||||
TaskServiceImpl.setPrimaryObjRef(taskImpl);
|
TaskServiceImpl.setPrimaryObjRef(t);
|
||||||
result.add(taskImpl);
|
result.add(t);
|
||||||
}
|
});
|
||||||
return result;
|
return result;
|
||||||
} finally {
|
} finally {
|
||||||
taskanaEngineImpl.returnConnection();
|
taskanaEngineImpl.returnConnection();
|
||||||
|
|
@ -210,10 +210,10 @@ public class TaskQueryImpl implements TaskQuery {
|
||||||
checkAuthorization();
|
checkAuthorization();
|
||||||
RowBounds rowBounds = new RowBounds(offset, limit);
|
RowBounds rowBounds = new RowBounds(offset, limit);
|
||||||
List<TaskImpl> tasks = taskanaEngineImpl.getSqlSession().selectList(LINK_TO_MAPPER, this, rowBounds);
|
List<TaskImpl> tasks = taskanaEngineImpl.getSqlSession().selectList(LINK_TO_MAPPER, this, rowBounds);
|
||||||
for (TaskImpl taskImpl : tasks) {
|
tasks.stream().forEach(t -> {
|
||||||
TaskServiceImpl.setPrimaryObjRef(taskImpl);
|
TaskServiceImpl.setPrimaryObjRef(t);
|
||||||
result.add(taskImpl);
|
result.add(t);
|
||||||
}
|
});
|
||||||
return result;
|
return result;
|
||||||
} finally {
|
} finally {
|
||||||
taskanaEngineImpl.returnConnection();
|
taskanaEngineImpl.returnConnection();
|
||||||
|
|
|
||||||
|
|
@ -276,10 +276,10 @@ public class TaskServiceImpl implements TaskService {
|
||||||
taskanaEngineImpl.openConnection();
|
taskanaEngineImpl.openConnection();
|
||||||
workbasketService.checkAuthorization(workbasketKey, WorkbasketAuthorization.READ);
|
workbasketService.checkAuthorization(workbasketKey, WorkbasketAuthorization.READ);
|
||||||
List<TaskImpl> tasks = taskMapper.findTasksByWorkbasketIdAndState(workbasketKey, taskState);
|
List<TaskImpl> tasks = taskMapper.findTasksByWorkbasketIdAndState(workbasketKey, taskState);
|
||||||
for (TaskImpl taskImpl : tasks) {
|
tasks.stream().forEach(t -> {
|
||||||
setPrimaryObjRef(taskImpl);
|
TaskServiceImpl.setPrimaryObjRef(t);
|
||||||
results.add(taskImpl);
|
results.add(t);
|
||||||
}
|
});
|
||||||
} finally {
|
} finally {
|
||||||
taskanaEngineImpl.returnConnection();
|
taskanaEngineImpl.returnConnection();
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
|
@ -304,8 +304,6 @@ public class TaskServiceImpl implements TaskService {
|
||||||
oldTaskImpl = (TaskImpl) getTaskById(newTaskImpl.getId());
|
oldTaskImpl = (TaskImpl) getTaskById(newTaskImpl.getId());
|
||||||
standardUpdateActions(oldTaskImpl, newTaskImpl);
|
standardUpdateActions(oldTaskImpl, newTaskImpl);
|
||||||
|
|
||||||
Timestamp now = new Timestamp(System.currentTimeMillis());
|
|
||||||
newTaskImpl.setModified(now);
|
|
||||||
taskMapper.update(newTaskImpl);
|
taskMapper.update(newTaskImpl);
|
||||||
LOGGER.debug("Method updateTask() updated task '{}' for user '{}'.", task.getId(), userId);
|
LOGGER.debug("Method updateTask() updated task '{}' for user '{}'.", task.getId(), userId);
|
||||||
|
|
||||||
|
|
@ -440,7 +438,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
newTaskImpl.setPlanned(oldTaskImpl.getPlanned());
|
newTaskImpl.setPlanned(oldTaskImpl.getPlanned());
|
||||||
}
|
}
|
||||||
|
|
||||||
// if no business process id is provided, a unique id is created.
|
// if no business process id is provided, use the id of the old task.
|
||||||
if (newTaskImpl.getBusinessProcessId() == null) {
|
if (newTaskImpl.getBusinessProcessId() == null) {
|
||||||
newTaskImpl.setBusinessProcessId(oldTaskImpl.getBusinessProcessId());
|
newTaskImpl.setBusinessProcessId(oldTaskImpl.getBusinessProcessId());
|
||||||
}
|
}
|
||||||
|
|
@ -466,7 +464,8 @@ public class TaskServiceImpl implements TaskService {
|
||||||
newTaskImpl.setPriority(classification.getPriority());
|
newTaskImpl.setPriority(classification.getPriority());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Timestamp now = new Timestamp(System.currentTimeMillis());
|
||||||
|
newTaskImpl.setModified(now);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue