public void persistWorkShift(ShiftAssignment shiftAssignment) { Date today = new Date(); for (WorkShift workShift : shiftAssignment.getWorkShiftList()) { Shift shift = new Shift(); shift.setShiftDate(today); shiftService.saveShift(shift); workShift = workShiftService.findWorkShift(workShift.getId()); shift.setWorkShift(workShift); shiftService.updateShift(shift); Long workshiftId = workShift.getId(); Long shiftId = shift.getId(); persistEmployeeShift(shiftAssignment, shiftId, workshiftId); } }
public String toDisplayString(ShiftAssignment shiftAssignment) { StringBuilder displayString = new StringBuilder(); for (Employee employee : shiftAssignment.getEmployeeList()) { WorkShift workShift = employee.getWorkshift(); displayString .append(employee.getLabel()) .append("\t") .append(" -> ") .append(employee.getPreference()) .append("\t") .append(" got -> ") .append(workShift.getShiftType()) .append("\t") // .append(workShift.getDepartment().getDept()).append("\t") // .append(workShift.getDepartment().getRequiredGrade()) .append(" wanted-> ") .append(employee.getGrade()) .append("\t") .append(" -> ") .append(workShift == null ? null : workShift.getId()) .append("\n"); } return displayString.toString(); }