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

Chapter 4. Modifying the employee rostering starter application


To modify the employee rostering starter application to suit your needs, you must change the rules that govern the optimization process. You must also ensure that the data structures include the required data and provide the required calculations for the rules. If the required data is not present in the user interface, you must also modify the user interface.

The following procedure outlines the general approach to modifying the employee rostering starter application.

Prerequisites

  • You must have a build environment that successfully builds the application.
  • You must be able to read and modify Java code.

Procedure

  1. Plan the required changes. Answer the following questions:

    • What are the additional scenarios that must be avoided? These scenarios are hard constraints.
    • What are the additional scenarios that the optimizer must try to avoid when possible? These scenarios are soft constraints.
    • What data is required to calculate if each scenario is happening in a potential solution?
    • Which of the data can be derived from the information that the user enters in the existing version?
    • Which of the data can be hardcoded?
    • Which of the data must be entered by the user and is not entered in the current version?
  2. If any required data can be calculated from the current data or can be hardcoded, add the calculations or hardcoding to existing view or utility classes. If the data must be calculated on the server side, add REST API endpoints to read it.
  3. If any required data must be entered by the user, add the data to the classes representing the data entities (for example, the Employee class), add REST API endpoints to read and write the data, and modify the user interface to enter the data.
  4. When all the data is available, modify the rules. For most modifications, you must add a new rule. The rules are located in the src/main/resources/org/optaweb/employeerostering/server/solver/employeeRosteringScoreRules.drl file of the employee-rostering-server module.

    Use the Drools language for the rules. For reference information about the Drools rule language, see Rule Language Reference. Classes defined in the optashift-employee-rostering-shared and optashift-employee-rostering-server modules are available to the decision engine.

  5. After modifying the application, build and run it.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat