搜索

第 33 章 数据库连接

download PDF

Business Central 为使用红帽 Decision Manager 的数据库服务器提供专用 用户GroupCallback 实现,以启用用户任务服务。用户任务服务有助于检索直接来自数据库的用户和组(角色)的信息。

您可以配置以下数据库 UserGroupCallback 实现属性:

表 33.1. 数据库用户GroupCallback 属性
属性描述

db.ds.jndi.name

用于连接的数据源的 JNDI 名称

db.user.query

验证用户是否存在

db.user.roles.query

为给定用户收集组

db.roles.query

验证组是否存在

33.1. 数据库用户GroupCallback 实现

在数据库 UserGroupCallback 实现中,您必须创建所需的数据库。您可以通过使用以下方法之一配置对应的数据库属性:

  • 以编程方式:使用对应的 DBUserGroupCallbackImpl 属性构建属性对象,并使用同样的属性对象创建 DBUserGroupCallbackImpl

    例如:

    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);
  • 声明性:在应用程序的根目录中创建 jbpm.usergroup.callback.properties 文件,或者将文件位置指定为系统属性。

    例如:

    -Djbpm.usergroup.callback.properties=FILE_LOCATION_ON_CLASSPATH

    确保在启动用户任务服务器时注册数据库回调。

    例如:

    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 = ?

其他资源

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.