public void query(long processId, Role role, ObjectIdentifier assigneeRefKey, ObjectReference businessObjReference)
throws Exception {
// 构造一个查询对象QuerySpec
QuerySpec qs = new QuerySpec();
// 设置返回集Class
int i = qs.appendClassList(WfVotingEventAudit.class, true);
// 设置关联的Class
int j = qs.appendClassList(WfProcess.class, false);
// 不查询子类?
qs.setDescendantQuery(false);
// 设置联合查询的等价条件
qs.appendWhere(new SearchCondition(WfVotingEventAudit.class, "processKey", WfProcess.class, "key"), i, j);
// 附加条件1: id是long型
if (processId != 0) {
qs.appendAnd();
qs.appendWhere(
new SearchCondition(WfProcess.class, "thePersistInfo.theObjectIdentifier.id", "=", processId), j);
}
// 附加条件2: role是枚举型
if (role != null) {
qs.appendAnd();
qs.appendWhere(new SearchCondition(WfVotingEventAudit.class, "role", "=", role), i);
}
// 附加条件3: ke
在ACM中使用QuerySpec进行联合查询的示例
最新推荐文章于 2021-06-14 15:35:18 发布