要約データの照会
以下の Java™ および C# の例では、すべてのドキュメント・バージョン・シリーズに関連付けられている要約データ・オブジェクトを照会します。
以下のコードは、結果セットからドキュメントと要約データのプロパティーを出力します。
Java の例
// searchSQL インスタンスを作成し、SQL ステートメントを指定 (ヘルパー・メソッド使用)
SearchSQL sqlObject = new SearchSQL();
sqlObject.setSelectList("T1.DocumentTitle, T2.ClbRecommendationCount, "
+ "T2.ClbCommentCount, T2.ClbDownloadCount, T2.ClbSummaryVersionSeries");
sqlObject.setFromClauseInitialValue("Document", "T1", true); // retrieve subclasses
sqlObject.setFromClauseAdditionalJoin(JoinOperator.LEFT_OUTER,"ClbSummaryData","T2",
"T1.VersionSeries", JoinComparison.EQUAL, "T2.ClbSummaryVersionSeries", false);
sqlObject.setOrderByClause("T2.ClbRecommendationCount DESC");
sqlObject.setDistinct(); // suppress redundant rows
// 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: " + row.getProperties().get("DocumentTitle").getStringValue() +
"¥nNo. Recommendations: " + row.getProperties().get("ClbRecommendationCount").getInteger32Value() +
"¥nNo. Comments: " + row.getProperties().get("ClbCommentCount").getInteger32Value() +
"¥nNo. Downloads: " + row.getProperties().get("ClbDownloadCount").getInteger32Value() + "¥n" );
}
C# の例
// searchSQL インスタンスを作成し、SQL ステートメントを指定 (ヘルパー・メソッド使用)
SearchSQL sqlObject = new SearchSQL();
sqlObject.SetSelectList("T1.DocumentTitle, T2.ClbRecommendationCount, "
+ "T2.ClbCommentCount, T2.ClbDownloadCount, T2.ClbSummaryVersionSeries");
sqlObject.SetFromClauseInitialValue("Document", "T1", true); // retrieve subclasses
sqlObject.SetFromClauseAdditionalJoin(JoinOperator.LEFT_OUTER,"ClbSummaryData","T2",
"T1.VersionSeries", JoinComparison.EQUAL, "T2.ClbSummaryVersionSeries", false);
sqlObject.SetOrderByClause("T2.ClbRecommendationCount DESC");
sqlObject.SetDistinct(); // supress redundant rows
// 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: " + row.Properties.GetProperty("DocumentTitle").GetStringValue() +
"¥nNo. Recommendations: " + row.Properties.GetProperty("ClbRecommendationCount").GetInteger32Value() +
"¥nNo. Comments: " + row.Properties.GetProperty("ClbCommentCount").GetInteger32Value() +
"¥nNo. Downloads: " + row.Properties.GetProperty("ClbDownloadCount").GetInteger32Value() + "¥n" );
}