List<WorkingArrangementPerOrderDTO> result = new ArrayList<WorkingArrangementPerOrderDTO>();
// Add current task
final Set<Dependency> dependencies = task
.getDependenciesWithThisDestination();
WorkingArrangementPerOrderDTO workingArrangementPerOrderDTO = new WorkingArrangementPerOrderDTO(
deadLineOrder, task, taskStatus, showDependencies
&& !dependencies.isEmpty());
workingArrangementPerOrderDTO.setStatus(_(workingArrangementPerOrderDTO
.getStatus()));
result.add(workingArrangementPerOrderDTO);
// Add dependencies
if (showDependencies) {
taskDAO.reattach(task);
for (Dependency each : dependencies) {
final OrderElement orderElement = each.getOrigin()
.getOrderElement();
DependencyWorkingArrangementDTO dependencyDTO = new DependencyWorkingArrangementDTO(
orderElement.getName(), orderElement.getCode(), each
.getType().toString(), orderElement
.getAdvancePercentage());
WorkingArrangementPerOrderDTO dto = new WorkingArrangementPerOrderDTO(
task, taskStatus, dependencyDTO);
dto.setStatus(_(dto.getStatus()));
result.add(dto);
}
}
return result;
}