Unify and manage your data

Create or update the Java logic

Learn how to write or update the Java logic of a workflow in the custom workflow repository, submit it for review, and register the JAR file that Reltio builds on the tenant.

Create or update Java logic when a step of the workflow needs behavior that the Java logic on your tenant does not provide. You write the Java classes and their tests in the custom workflow repository, and submit them in a pull request. Reltio reviews the pull request, builds the Java logic into a JAR file, and sends you an email. You then register the JAR file on the tenant, so that the steps of the workflow call its classes.

Write the Java logic yourself, or describe your requirements to the AI agent in a natural language prompt. For the cases that require Java logic, see When Java development is required.

Prerequisites

Before you begin, confirm the following requirements:

  • The custom workflow repository is connected for the tenant. For the steps, see Connect the custom workflow repository.

  • The BPMN file of the workflow is created or updated. For the steps, see Create or update the BPMN file.

  • Your Reltio user has the ROLE_WORKFLOW_MANAGER role on the tenant. This role is required to register the JAR file.

  • To build and test the Java logic on your computer, JDK 17 and Maven are installed. The integrated development experience does not run the build. You run it in a terminal.

To write and check the Java logic
  1. In the business configuration tree of the Reltio IDE extension view, expand the Workflows folder of the tenant, and then write or update the Java classes and their tests in one of the following ways:
    • Describe your requirements to the AI agent in a natural language prompt: The AI agent adds or updates the Java classes and tests in the module folders of the repository. If the BPMN file does not call the classes yet, the AI agent updates it.

    • Write the code yourself: Open a class under Java Classes or a test under Java Tests, and edit it in the editor. For the interfaces that your classes implement, see the Workflow repository on GitHub.

    Java Classes and Java Tests are grouped by Maven module. Each module builds into one JAR file. Add the classes to an existing module, or add a module for each additional custom workflow.

    When you update Java logic that is already in a JAR file, increase the version number in the pom.xml file of the module, for example from 1.0-SNAPSHOT to 1.1-SNAPSHOT. If the version number stays the same, the new build overwrites the existing JAR file.

    Figure 1. AI agent writing the Java logic in the custom workflow repository
  2. In the BPMN file of the workflow, confirm that each step that calls your Java logic names the class together with its package, in the form <package>.<ClassName>.

    Under Java Classes, each class shows its package beside its name. If the name in the BPMN file does not match the class, the workflow fails when it runs.

  3. Check the Java logic against the custom workflow review checklist, and then run the build and the tests.

    Among other requirements, the checklist states that you build the classes on JDK 17, and that your tests cover at least 80% of your code. To run the build and the tests, right-click Workflows, and select Open Repository Folder. In a terminal in that folder, run mvn verify. If the build or a test fails, Maven shows the failure in the terminal. Fix the code or the test, and run mvn verify again.

    If the AI agent wrote the Java logic, it runs these checks and reports only the failures that it cannot fix.

To submit the Java logic for review
  1. Commit your changes to a new branch, push the branch to the repository, and then create a pull request to the master branch in Bitbucket.

    Reltio builds the JAR file from the code in the master branch. You cannot update the master branch directly, so create the pull request from your branch. Commit the Java classes, the tests, and the BPMN file of the workflow. The Workflows/bpmn/ folder also contains the workflows that the integrated development experience downloads from the tenant, so stage only the files that belong to your change.

    To open the repository in your browser, right-click Workflows, and select Open Repository in Browser. If the AI agent wrote the Java logic, it asks whether to open the pull request. Confirm, and the AI agent opens the pull request for you. This requires that your editor has access to the repository.

  2. Respond to the review, and then merge the pull request.

    When you create the pull request, Reltio assigns reviewers to it automatically, and automated tools check your code. A requirement of the checklist that is not met blocks the merge.

  3. Wait for the email notification that the JAR file is ready.

    After you merge the pull request, an automated Reltio pipeline builds one JAR file for each module, and uploads it to an AWS S3 bucket that Reltio manages. Reltio then sends you an email notification. The pipeline builds only the JAR file. The BPMN file remains in the Workflows/bpmn/ folder of your tenant folder until you deploy it.

    Note: Do not deploy the workflow yet. Its steps call classes that are not on the tenant until you register the JAR file.
To register the JAR file on the tenant
  1. In the business configuration tree, under the Workflows folder of the tenant, right-click JAR Deployments, and select Refresh JARs.

    The Unregistered folder appears under JAR Deployments when JAR files are available but not registered. If the folder does not appear for your tenant, contact Reltio Support to register the JAR file, and include the module path from the email notification.

  2. Under Unregistered, right-click the JAR file of your build, and select Register JAR.... Alternatively, select the Register JAR... icon on the row.
    Figure 2. Register JAR on an unregistered JAR file
  3. In the Register JAR on <tenant ID> box, enter the name of the JAR file, and then press Enter. In the next box, enter a description, and then press Enter.

    The first box shows the JAR file name. Keep it or enter a different name. The name identifies the JAR file under JAR Deployments. The description is optional. For other ways to register a JAR file, see overview of JAR files.

    A notification confirms the registration: Registered "<name>" on <tenant ID>. The JAR file moves from Unregistered to JAR Deployments.

Result

The JAR file is registered on the tenant, and its classes are available to the steps of your workflows. If you registered a new version of a JAR file, the tenant uses the most recently registered version. Updated classes take effect after about five minutes. The workflow is not deployed yet.

Verification steps

To confirm that the JAR file is registered, perform the following steps:

  1. Under JAR Deployments, hover over the JAR file. In the tooltip, confirm that Custom JAR appears, that Name and Description show what you entered, and that Registered by shows your user name.

  2. Confirm that the JAR file no longer appears under Unregistered.

Next steps

Deploy the workflow, as described in Deploy a workflow. If a step fails, see Troubleshoot workflows.