使用 WebSphere Process Server 关系开发集成解决方案
2010-09-27 08:19:05 来源:WEB开发网[create|retrieve|deactivate|delete|exists]Participant 创建、检索、禁用或删除参与者。参与者是给定实例中的角色的值,可以为简单值,也可以为业务对象。 [exists|deactivate|delete]ParticipantByID 按实例 ID(与按值操作的方式相对)检查参与者是否存在、禁用或删除。 addParticipantWithID 将新参与者添加到给定实例(仅用于多对多关系) retrieveInstanceIDs 返回给定角色的参与者的 ID 数组。对于身份关系,该数组最多只能包括一个实例 ID。 staticLookup 根据输入业务对象中的属性值在输出业务对象中查询属性值(6.1 中新推出的功能) correlate 在动态关系中自动维护两个业务对象间的相关性(6.1 中新推出的;以前为 maintainIdentity) [get|set|unset][Relationship|Role]Property 将属性(如创建时间)与角色或关系实例关联
清单 1 显示了采用编程方式检索、添加和删除实例数据的代码示例。
清单 1. 使用关系实例数据的 CRUD API 元素
//locate the Relationship Service
RelationshipService relService = (RelationshipService)ServiceManager.INSTANCE.
locateService("com/ibm/wbiserver/rel/RelationshipService");
//The names of our relationship and its roles
String relationshipName = "http://CRMLib/StateCode";
String roleName_full = "http://CRMLib/FullStateName";
String roleName_code = "http://CRMLib/StateCode";
//programmatically query a lookup relationship
String fullName = "California";
String code = null;
int[] ids =
relService.retrieveInstanceIDsByString(relationshipName, roleName_full, fullName);
if( ids.length > 0 ){
List codes = relService.retrieveParticipants(relationshipName, roleName_code, ids[0]);
if( !codes.isEmpty() )
code = (String)codes.get(0);
}
//add a new relationship instance
String newFullName = "Alabama";
String newCode = "AL";
int genId =
relService.addParticipantString(relationshipName, roleName_full, newFullName);
relService.addParticipantStringWithID(relationshipName, roleName_code, genId, newCode);
//remove relationship instance
relService.deleteParticipantString( relationshipName, roleName_full, newFullName);
relService.deleteParticipantString(relationshipName, roleName_code, newCode);
编缉推荐阅读以下文章
- 使用 WebSphere Process Server 修复流程
- WebSphere Process Server V6.0.2 集群,第 1 部分:了解拓扑
- WebSphere Process Server V6.0.2 集群,第 2 部分:安装和配置 WebSphere Process Server 集群
- WebSphere Process Server 产品的运行时升级和移植策略及参考实现
- WebSphere Process Server V6 体系结构概述
更多精彩
赞助商链接