コメント付きドキュメントの照会
以下の Java™ および C# の例では、指定されたバージョン・シリーズ内のコメントを照会します。
以下のコードは、結果セットからドキュメントとコメントのプロパティー値を出力します。
Java の例
PropertyFilter pf= new PropertyFilter();
pf.addIncludeProperty(new FilterElement(null, null, null, "VersionSeries Name", null));
// Get a document from the version series to be checked for comments.
Document documentObj = Factory.Document.fetchInstance(os, new Id("{81AAD22B-E20C-4C00-9D6B-88DD1A64FA8E}"),pf);
// Get version series Id from document, which will be used
// to compare with the version series property in comment objects.
Id vsId = documentObj.get_VersionSeries().get_Id();
// searchSQL インスタンスを作成し、SQL ステートメントを指定 (ヘルパー・メソッド使用)
SearchSQL sqlObject = new SearchSQL();
sqlObject.setSelectList("ClbDocumentMajorVersion, ClbDocumentMinorVersion, ClbCommentText");
sqlObject.setFromClauseInitialValue("ClbDocumentComment",null, false);
sqlObject.setWhereClause("ClbCommentedVersionSeries="+vsId);
sqlObject.setOrderByClause("ClbDocumentMajorVersion ASC");
// SearchScope インスタンスを作成// (オブジェクト・ストア・オブジェクトが存在すると仮定)
SearchScope search = new SearchScope(os);
// 指定したパラメーターを使用して fetchRows メソッドを実行
Boolean continuable = new Boolean(true);
RepositoryRowSet myRows = search.fetchRows(sqlObject, null, null, continuable);
// Iterate the collection of rows to access the properties.
Iterator iter = myRows.iterator();
while (iter.hasNext())
{
RepositoryRow row = (RepositoryRow) iter.next();
// Print properties from the result set.
System.out.print("¥nDocumentTitle: " + documentObj.get_Name() +
"¥nMajorVersion: " + row.getProperties().get("ClbDocumentMajorVersion").getInteger32Value() +
" MinorVersion: " + row.getProperties().get("ClbDocumentMinorVersion").getInteger32Value() +
"¥nComment: " + row.getProperties().get("ClbCommentText").getStringValue() + "¥n" );
}
C# の例
pf.AddIncludeProperty(new FilterElement(null, null, null, "VersionSeries Name", null));
// Get a document from the version series to be checked for comments.
IDocument documentObj = Factory.Document.FetchInstance(os, new Id("{81AAD22B-E20C-4C00-9D6B-88DD1A64FA8E}"),pf);
// Get version series Id from document, which will be used
// to compare with the version series property in comment objects.
Id vsId = documentObj.VersionSeries.Id;
// searchSQL インスタンスを作成し、SQL ステートメントを指定 (ヘルパー・メソッド使用)
SearchSQL sqlObject = new SearchSQL();
sqlObject.SetSelectList("ClbDocumentMajorVersion, ClbDocumentMinorVersion, ClbCommentText");
sqlObject.SetFromClauseInitialValue("ClbDocumentComment",null, false);
sqlObject.SetWhereClause("ClbCommentedVersionSeries="+vsId);
sqlObject.SetOrderByClause("ClbDocumentMajorVersion ASC");
// SearchScope インスタンスを作成// (オブジェクト・ストア・オブジェクトが存在すると仮定)
SearchScope search = new SearchScope(os);
// 指定したパラメーターを使用して fetchRows メソッドを実行
bool continuable = true;
IRepositoryRowSet myRows = search.FetchRows(sqlObject, null, null, continuable);
// Iterate the collection of rows to access the properties.
foreach(IRepositoryRow row in myRows)
{
// Print properties from the result set.
System.Console.WriteLine("¥nDocumentTitle: " + documentObj.Name +
"¥nMajorVersion: " + row.Properties.GetProperty("ClbDocumentMajorVersion").GetInteger32Value() +
"¥nMinorVersion: " + row.Properties.GetProperty("ClbDocumentMinorVersion").GetInteger32Value() +
"¥nComment: " + row.Properties.GetProperty("ClbCommentText").GetStringValue() );
}