使用SearchSQL时如何加入Document和ClassDefinition对象?
How to join the Document and ClassDefinition objects when using SearchSQL?
我正在使用 FileNet P8 Content Engine 5.5.x 和 Java API 来使用 SearchSQL 构建临时查询。根据文档 class 创建 select 语句非常简单:
SearchSQL sql = new SearchSQL();
String selectList = "d.This, d.Id, d.Name, d.ClassDescription";
sql.setSelectList(selectList);
sql.setFromClauseInitialValue("Document", "d", true);
SearchScope scope = new SearchScope(conn.getObjectStore());
RepositoryRowSet rows = scope.fetchRows(sql, 8, null, null);
注意:上面的语句使用的是您 'could' 使用的 ClassDescription 对象,但需要导航该对象才能到达 SymbolicName。您还必须小心并制作 属性 过滤器,以免导致返回服务器的往返行程。
但是,向 ClassDefinition 添加连接 class 没有成功:
SearchSQL sql = new SearchSQL();
String selectList = "d.This, d.Id, d.Name, d.ClassDescription";
sql.setSelectList(selectList);
sql.setFromClauseInitialValue("Document", "d", true);
sql.setFromClauseAdditionalJoin(JoinOperator.INNER,"ClassDefinition","cd","d.This", JoinComparison.EQUAL,"cd.Id",false);
SearchScope scope = new SearchScope(conn.getObjectStore());
RepositoryRowSet rows = scope.fetchRows(sql, 8, null, null);
注意:此版本与第一个版本存在相同问题。
问题是使用什么作为文档 class 中的连接变量(“d.This”),我尝试过的所有方法都抛出了某种类型的 SQL 语法异常.更重要的是,如果我可以访问 Oracle 数据库,我相信连接很简单。
SELECT dv.object_id, dv.u2e_documenttitle, cd.symbolic_name
FROM DocVersion dv
INNER JOIN ClassDefinition cd ON
dv.object_class_id = cd.object_id
归根结底,我要实现的是在返回的结果集中获取 ClassDefinition class 的符号名称。
阅读了大部分在线 API 文档,但仍然没有得到更接近的答案,我向 IBM 支持部门开了一张票。这是通过 ad-hock SQL 查询 API
将文档 Class 加入 Class 定义 Class 的正确方法
var sql = new SearchSQL();
sql.setFromClauseInitialValue("Document", "d", true);
sql.setFromClauseAdditionalJoin(JoinOperator.INNER, "ClassDefinition","cd","d.ClassDescription", JoinComparison.EQUAL,"cd.This",true);
var scope = new SearchScope(os);
var pf = new PropertyFilter();
pf.addIncludeProperty(new FilterElement(1, null, null, PropertyNames.THIS, null));
pf.addIncludeProperty(new FilterElement(1, null, null, PropertyNames.ID, null));
pf.addIncludeProperty(new FilterElement(1, null, null, "DocumentTitle", null));
pf.addIncludeProperty(new FilterElement(1, null, null, PropertyNames.MIME_TYPE, null));
pf.addIncludeProperty(new FilterElement(1, null, null, PropertyNames.DATE_CREATED, null));
pf.addIncludeProperty(new FilterElement(1, null, null, PropertyNames.SYMBOLIC_NAME, null));
pf.addIncludeProperty(new FilterElement(1, null, Boolean.FALSE, PropertyNames.CLASS_DESCRIPTION, null));
pf.addIncludeProperty(new FilterElement(1, null, Boolean.FALSE, PropertyNames.CLASS_DEFINITION, null));
pf.addIncludeProperty(new FilterElement(1, null, Boolean.FALSE, PropertyNames.PROPERTY_DEFINITIONS, null));
pf.addIncludeProperty(new FilterElement(1, null, null, PropertyNames.CONTENT_ELEMENTS_PRESENT, null));
RepositoryRowSet rows = scope.fetchRows(sql, 256, pf, null);
我正在使用 FileNet P8 Content Engine 5.5.x 和 Java API 来使用 SearchSQL 构建临时查询。根据文档 class 创建 select 语句非常简单:
SearchSQL sql = new SearchSQL();
String selectList = "d.This, d.Id, d.Name, d.ClassDescription";
sql.setSelectList(selectList);
sql.setFromClauseInitialValue("Document", "d", true);
SearchScope scope = new SearchScope(conn.getObjectStore());
RepositoryRowSet rows = scope.fetchRows(sql, 8, null, null);
注意:上面的语句使用的是您 'could' 使用的 ClassDescription 对象,但需要导航该对象才能到达 SymbolicName。您还必须小心并制作 属性 过滤器,以免导致返回服务器的往返行程。
但是,向 ClassDefinition 添加连接 class 没有成功:
SearchSQL sql = new SearchSQL();
String selectList = "d.This, d.Id, d.Name, d.ClassDescription";
sql.setSelectList(selectList);
sql.setFromClauseInitialValue("Document", "d", true);
sql.setFromClauseAdditionalJoin(JoinOperator.INNER,"ClassDefinition","cd","d.This", JoinComparison.EQUAL,"cd.Id",false);
SearchScope scope = new SearchScope(conn.getObjectStore());
RepositoryRowSet rows = scope.fetchRows(sql, 8, null, null);
注意:此版本与第一个版本存在相同问题。
问题是使用什么作为文档 class 中的连接变量(“d.This”),我尝试过的所有方法都抛出了某种类型的 SQL 语法异常.更重要的是,如果我可以访问 Oracle 数据库,我相信连接很简单。
SELECT dv.object_id, dv.u2e_documenttitle, cd.symbolic_name
FROM DocVersion dv
INNER JOIN ClassDefinition cd ON
dv.object_class_id = cd.object_id
归根结底,我要实现的是在返回的结果集中获取 ClassDefinition class 的符号名称。
阅读了大部分在线 API 文档,但仍然没有得到更接近的答案,我向 IBM 支持部门开了一张票。这是通过 ad-hock SQL 查询 API
将文档 Class 加入 Class 定义 Class 的正确方法 var sql = new SearchSQL();
sql.setFromClauseInitialValue("Document", "d", true);
sql.setFromClauseAdditionalJoin(JoinOperator.INNER, "ClassDefinition","cd","d.ClassDescription", JoinComparison.EQUAL,"cd.This",true);
var scope = new SearchScope(os);
var pf = new PropertyFilter();
pf.addIncludeProperty(new FilterElement(1, null, null, PropertyNames.THIS, null));
pf.addIncludeProperty(new FilterElement(1, null, null, PropertyNames.ID, null));
pf.addIncludeProperty(new FilterElement(1, null, null, "DocumentTitle", null));
pf.addIncludeProperty(new FilterElement(1, null, null, PropertyNames.MIME_TYPE, null));
pf.addIncludeProperty(new FilterElement(1, null, null, PropertyNames.DATE_CREATED, null));
pf.addIncludeProperty(new FilterElement(1, null, null, PropertyNames.SYMBOLIC_NAME, null));
pf.addIncludeProperty(new FilterElement(1, null, Boolean.FALSE, PropertyNames.CLASS_DESCRIPTION, null));
pf.addIncludeProperty(new FilterElement(1, null, Boolean.FALSE, PropertyNames.CLASS_DEFINITION, null));
pf.addIncludeProperty(new FilterElement(1, null, Boolean.FALSE, PropertyNames.PROPERTY_DEFINITIONS, null));
pf.addIncludeProperty(new FilterElement(1, null, null, PropertyNames.CONTENT_ELEMENTS_PRESENT, null));
RepositoryRowSet rows = scope.fetchRows(sql, 256, pf, null);