Este conteúdo não está disponível no idioma selecionado.
Chapter 3. Overview of the source code of the employee rostering starter application
The employee rostering starter application consists of the following principal components:
- The server that implements the rostering logic using Red Hat Business Optimizer and provides a REST API.
-
The client that implements a user interface using the
gwtlibrary and calls the server using the REST API.
While some code is shared between the client and the server, you can build and use these components independently. In particular, you can implement a different user interface and use the REST API to call the server.
In addition to the two main components, the employee rostering template contains a generator of random source data (useful for demonstration and testing purposes) and a benchmarking application.
Modules and key classes
The Java source code of the employee rostering template contains several Maven modules. Each of these modules includes a separate aven project file (pom.xml), but they are intended for building in a common project.
The modules contain a number of files, including Java classes. This document lists all the modules, as well as the classes and other files that contain the key information for the employee rostering calculations.
-
employee-rostering-benchmarkmodule: Contains an additional application that generates random data and benchmarks the solution. -
employee-rostering-distributionmodule: Contains readme files. -
employee-rostering-docsmodule: Contains documentation files. -
employee-rostering-gwtuimodule: Contains the client application with the user interface, developed using thegwttoolkit. employee-rostering-servermodule: Contains the server application that uses Red Hat Business Optimizer to perform the rostering calculation.-
src/main/resources/org/optaweb/employeerostering/server/solver/employeeRosteringScoreRules.drlfile: Contains the rules for the Red Hat Business Optimizer calculation. These rules are written in the Drools rules language. You can modify the rules to change the logic for employee rostering. -
src/main/java/org.optaweb.employeerostering.server.roster/rosterGenerator.javaclass: generates random input data for demonstration and testing purposes. If you change the requires input data, change the generator accordingly.
-
employee-rostering-sharedmodule: Contains the data structures shared between the server and client applications. In particular, undersrc/main/java/org/optaweb/employeerostering/shared/*, this module includes the Java classes that define the input data for the rostering calculations, including the following classes:-
employee/EmployeeAvailability.javadefines availability information for an employee. For every time slot, an employee can be unavailable, available, or it can be a preferred timeslot for the employee. -
employee/Employee.javadefines an employee. An employee has a name and a list of skills. Skills are represented byEmployeeSkillProficiencyobjects. -
roster/Roster.javadefines the calculated rostering information. -
shift/Shift.javadefines a shift to which an employee can be assigned. A shift is defined by a time slot and a spot. For example, in a diner there could be a shift in theKitchenspot for theFebruary 20 8AM-4PMtime slot. Multiple shifts can be defined for a given spot and time slot; in this case, multiple employees are required for this spot and time slot. -
skill/Skill.javadefines a skill that an employee can have. -
spot/Spot.javadefines a spot where employees can be placed. For example, in a dinerKitchencan be a spot. tenant/Tenant.javadefines a tenant. Each tenant represents an independent set of data; any change in the data for one tenant does not affect any other tenants.The
employee-rostering-sharedmodule also includes other shared artifacts:-
*View.javaclasses define value sets that are calculated from other information; the client application can read these values through the REST API, but not write them. -
*RestService.javainterfaces define the REST API. Both the server and the client application separately define implementations of these interfaces.
-
-
employee-rostering-shared-gwtmodule: Contains some of the classes required for the GWT client application. -
employee-rostering-webappmodule: Contains the HTML and other files necessary for building the entire application (client and server).