Chapter 3. Overview of the source code of the employee rostering starter application
The employee rostering starter application consists of the following principal components:
-
A
backend
that implements the rostering logic using Red Hat Business Optimizer and provides a REST API -
A
frontend
module that implements a user interface using React and interacts with thebackend
module through the REST API
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 Maven 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-benchmark
module: Contains an additional application that generates random data and benchmarks the solution. -
employee-rostering-distribution
module: Contains README files. -
employee-rostering-docs
module: Contains documentation files. -
employee-rostering-frontend
module: Contains the client application with the user interface, developed in React. employee-rostering-backend
module: Contains the server application that uses Red Hat Business Optimizer to perform the rostering calculation.-
src/main/java/org.optaweb.employeerostering.service.roster/rosterGenerator.java
: Generates random input data for demonstration and testing purposes. If you change the required input data, change the generator accordingly. -
src/main/java/org.optaweb.employeerostering.domain.employee/EmployeeAvailability.java
: Defines availability information for an employee. For every time slot an employee can be unavailable, available, or it can be designated a preferred time slot for the employee. -
src/main/java/org.optaweb.employeerostering.domain.employee/Employee.java
: Defines an employee. An employee has a name, a list of skills, and works under a contract. Skills are represented by skill objects. -
src/main/java/org.optaweb.employeerostering.domain.roster/Roster.java
: Defines the calculated rostering information. -
src/main/java/org.optaweb.employeerostering.domain.shift/Shift.java
: Defines 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 the Kitchen spot for the February 20 8AM-4PM time 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. -
src/main/java/org.optaweb.employeerostering.domain.skill/Skill.java
: Defines a skill that an employee can have. -
src/main/java/org.optaweb.employeerostering.domain.spot/Spot.java
: Defines a spot where employees can be placed. For example, aKitchen
can be a spot. -
src/main/java/org.optaweb.employeerostering.domain.contract/Contract.java
: Defines a contract that sets limits on work time for an employee in various time periods. -
src/main/java/org.optaweb.employeerostering.domain.tenant/Tenant.java
: Defines a tenant. Each tenant represents an independent set of data. Changes in the data for one tenant do not affect any other tenants. -
*View.java
: Classes related to domain objects that define value sets that are calculated from other information; the client application can read these values through the REST API, but not write them. -
*Service.java
: Interfaces located in the service package that define the REST API. Both the server and the client application separately define implementations of these interfaces.
-