Chapter 33. Database connection


Business Central provides a dedicated UserGroupCallback implementation for database server with Red Hat Decision Manager to enable the user task service. The user task service helps in retrieving information on users and groups (roles) directly from databases.

You can configure the following database UserGroupCallback implementation properties:

Table 33.1. Database UserGroupCallback properties
PropertyDescription

db.ds.jndi.name

JNDI name of the data source used for connections

db.user.query

Verifies the user existence

db.user.roles.query

Collects the groups for a given user

db.roles.query

Verifies the group existence

33.1. Database UserGroupCallback implementation

In database UserGroupCallback implementation, you must create the required database. You can use this implementation by configuring the respective database properties in one of the following ways:

  • Programmatically: Build a properties object with the respective DBUserGroupCallbackImpl properties and create DBUserGroupCallbackImpl using the same properties object as its parameter.

    For example:

    import static org.jbpm.services.task.identity.DBUserGroupCallbackImpl.DS_JNDI_NAME;
    import static org.jbpm.services.task.identity.DBUserGroupCallbackImpl.PRINCIPAL_QUERY;
    import static org.jbpm.services.task.identity.DBUserGroupCallbackImpl.ROLES_QUERY;
    import static org.jbpm.services.task.identity.DBUserGroupCallbackImpl.USER_ROLES_QUERY;
    ...
    props = new Properties();
    props.setProperty(DS_JNDI_NAME, "jdbc/jbpm-ds");
    props.setProperty(PRINCIPAL_QUERY, "select userId from Users where userId = ?");
    props.setProperty(ROLES_QUERY, "select groupId from UserGroups where groupId = ?");
    props.setProperty(USER_ROLES_QUERY, "select groupId from UserGroups where userId = ?");
    
    callback = new DBUserGroupCallbackImpl(props);
  • Declaratively: Create the jbpm.usergroup.callback.properties file in the root of your application or specify the file location as a system property.

    For example:

    -Djbpm.usergroup.callback.properties=FILE_LOCATION_ON_CLASSPATH

    Ensure that you register the database callback when starting the user task server.

    For example:

    System.setProperty("jbpm.usergroup.callback.properties", "/jbpm.usergroup.callback.db.properties");
    callback = new DBUserGroupCallbackImpl(true);
    ...
    db.ds.jndi.name = jdbc/jbpm-ds
    db.user.query = select userId from Users where userId = ?
    db.roles.query = select groupId from UserGroups where groupId = ?
    db.user.roles.query = select groupId from UserGroups where userId = ?

Additional resources

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.