public void persistEmployeeShift( ShiftAssignment shiftAssignment, Long shiftId, Long workshiftId) { Shift myShift = shiftService.findShift(shiftId); for (Employee ployee : shiftAssignment.getEmployeeList()) { Employee myEmp = employeeService.findEmployee(ployee.getId()); Long a = ployee.getWorkshift().getId(); Long b = workshiftId; int a1 = Integer.valueOf(a.intValue()); int b1 = Integer.valueOf(b.intValue()); if (a1 == b1) { myShift.getEmployees().add(myEmp); } } shiftService.updateShift(myShift); }
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(); }