搜索

此内容没有您所选择的语言版本。

Chapter 3. Overview of the source code of the employee rostering starter application

download PDF

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 gwt library 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-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-gwtui module: Contains the client application with the user interface, developed using the gwt toolkit.
  • employee-rostering-server module: Contains the server application that uses Red Hat Business Optimizer to perform the rostering calculation.

    • src/main/resources/org/optaweb/employeerostering/server/solver/employeeRosteringScoreRules.drl file: 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.java class: generates random input data for demonstration and testing purposes. If you change the requires input data, change the generator accordingly.
  • employee-rostering-shared module: Contains the data structures shared between the server and client applications. In particular, under src/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.java defines 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.java defines an employee. An employee has a name and a list of skills. Skills are represented by EmployeeSkillProficiency objects.
    • roster/Roster.java defines the calculated rostering information.
    • 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.
    • skill/Skill.java defines a skill that an employee can have.
    • spot/Spot.java defines a spot where employees can be placed. For example, in a diner Kitchen can be a spot.
    • tenant/Tenant.java defines 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-shared module also includes other shared artifacts:

    • *View.java classes 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.java interfaces define the REST API. Both the server and the client application separately define implementations of these interfaces.
  • employee-rostering-shared-gwt module: Contains some of the classes required for the GWT client application.
  • employee-rostering-webapp module: Contains the HTML and other files necessary for building the entire application (client and server).
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.