List<Shift> refShiftList = planningWindowStart.getShiftList();
List<Shift> newShiftList = new ArrayList<Shift>(refShiftList.size());
newShiftDate.setShiftList(newShiftList);
nurseRoster.getShiftDateList().add(newShiftDate);
scoreDirector.afterProblemFactAdded(newShiftDate);
Shift oldLastShift = nurseRoster.getShiftList().get(nurseRoster.getShiftList().size() - 1);
long shiftId = oldLastShift.getId() + 1L;
int shiftIndex = oldLastShift.getIndex() + 1;
long shiftAssignmentId = nurseRoster.getShiftAssignmentList().get(
nurseRoster.getShiftAssignmentList().size() - 1).getId() + 1L;
for (Shift refShift : refShiftList) {
Shift newShift = new Shift();
newShift.setId(shiftId);
shiftId++;
newShift.setShiftDate(newShiftDate);
newShift.setShiftType(refShift.getShiftType());
newShift.setIndex(shiftIndex);
shiftIndex++;
newShift.setRequiredEmployeeSize(refShift.getRequiredEmployeeSize());
newShiftList.add(newShift);
nurseRoster.getShiftList().add(newShift);
scoreDirector.afterProblemFactAdded(newShift);
for (int indexInShift = 0; indexInShift < newShift.getRequiredEmployeeSize(); indexInShift++) {
ShiftAssignment newShiftAssignment = new ShiftAssignment();
newShiftAssignment.setId(shiftAssignmentId);
shiftAssignmentId++;
newShiftAssignment.setShift(newShift);
newShiftAssignment.setIndexInShift(indexInShift);