Learning Path Crash Course: the Java code example does not work

0
Hi guys, I am learning about Mendix and taking the Crash Course, one of the Learning Paths available. I am experiencing a problem related to Java and I do not know how to fix it because I am not a Java developer. The chapter is: “Extending Your Business Logic > 12.9 Writing Your First Java Action > 12.9.4 Writing Your Java Action” We have a snippet to copy and paste into our application: // BEGIN USER CODE String SOLVER_CONFIG_XML = "solver.xml"; SolverConfig solverConfig = SolverConfig.createFromXmlResource(SOLVER_CONFIG_XML); SolverFactory<ShiftSolution> solverFactory = SolverFactory.create(solverConfig); Solver<ShiftSolution> solver = solverFactory.buildSolver(); ShiftSolution shiftSolution = new ShiftSolution(); List<OptaEmployee> employees = new ArrayList<>(); this.EmployeeList.forEach( (employee) -> employees.add(new OptaEmployee(employee)) ); shiftSolution.setEmployeeList(employees); List<OptaShift> shifts = new ArrayList<>(); this.ShiftList.forEach( (shift) -> shifts.add(new OptaShift(shift)) ); shiftSolution.setShiftList(shifts); solver.solve(shiftSolution); ShiftSolution bestShiftSolution = (ShiftSolution)solver.getBestSolution(); List<IMendixObject> plannedShifts = new ArrayList<>(); for (OptaShift optaShift : bestShiftSolution.getShiftList()) { Shift shift = optaShift.getMendixShift(); shift.setShift_Employee(optaShift.getEmployee().getMendixEmployee()); shift.setAssigned(true); plannedShifts.add(shift.getMendixObject()); } return plannedShifts; // END USER CODE But, when I paste this code into Eclipse, I get the errors below: ShiftSolution bestShiftSolution = solver.getBestSolution(); “The method getBestSolution() is undefined for the type Solver<ShiftSolution>” And the second one: shift.setAssigned(true); “The method setAssigned(boolean) is undefined for the type Shift” Is the tutorial out of date? Does anyone know what can be done?   Kind regards, Paulo de Tarso
asked
1 answers
2

What version of Optaplanner did you download? Did you download version 7.30.0 as requested, or a newer version? I suspect you have a different version that doesn’t implement the required methods.

https://academy.mendix.com/link/module/329/lecture/2941/12.9.1-Setting-Up-Your-Development-Environment

answered