public ProjectRegionMilestone save(ProjectRegionMilestone projectRegionMilestone) { if (projectRegionMilestone.getId() == null) { projectRegionMilestone.setId(UUID.randomUUID()); } mapper.save(projectRegionMilestone); return projectRegionMilestone; }
public List<ProjectRegionMilestone> findAll() { List<ProjectRegionMilestone> projectRegionMilestones = new ArrayList<>(); BoundStatement stmt = findAllStmt.bind(); session .execute(stmt) .all() .stream() .map( row -> { ProjectRegionMilestone projectRegionMilestone = new ProjectRegionMilestone(); projectRegionMilestone.setId(row.getUUID("id")); projectRegionMilestone.setPlanned(row.getDate("planned")); projectRegionMilestone.setActual(row.getDate("actual")); return projectRegionMilestone; }) .forEach(projectRegionMilestones::add); return projectRegionMilestones; }