ダウンロードされたドキュメントの照会
以下の Java™ および C# の例では、指定されたバージョン・シリーズに関連付けられているダウンロードされたドキュメントを照会します。
以下のコードは、結果セットからドキュメントとダウンロード・レコードのプロパティーを出力します。
Java の例
pf.addIncludeProperty(new FilterElement(null, null, null, "VersionSeries Name", null));
// Get a document from the version series to be checked for downloads.
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 download record objects.
Id vsId = documentObj.get_VersionSeries().get_Id();
// searchSQL インスタンスを作成し、SQL ステートメントを指定 (ヘルパー・メソッド使用)
SearchSQL sqlObject = new SearchSQL();
sqlObject.setSelectList("ClbOriginator, ClbDownloadTime, ClbDocumentMajorVersion, ClbDocumentMinorVersion");
sqlObject.setFromClauseInitialValue("ClbDownloadRecord",null, false);
sqlObject.setWhereClause("ClbDownloadVersionSeries="+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() +
"¥nMinorVersion: " + row.getProperties().get("ClbDocumentMinorVersion").getInteger32Value() +
"¥nOriginator: " + row.getProperties().get("ClbOriginator").getStringValue() +
"¥nDownloadTime " + row.getProperties().get("ClbDownloadTime").getDateTimeValue() + "¥n");
}
C# の例
pf.AddIncludeProperty(new FilterElement(null, null, null, "VersionSeries Name", null));
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 download record objects.
Id vsId = documentObj.VersionSeries.Id;
// searchSQL インスタンスを作成し、SQL ステートメントを指定 (ヘルパー・メソッド使用)
SearchSQL sqlObject = new SearchSQL();
sqlObject.SetSelectList("ClbOriginator, ClbDownloadTime, ClbDocumentMajorVersion, ClbDocumentMinorVersion");
sqlObject.SetFromClauseInitialValue("ClbDownloadRecord", null, false);
sqlObject.SetWhereClause("ClbDownloadVersionSeries=" + 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() +
"¥nOriginator: " + row.Properties.GetProperty("ClbOriginator").GetStringValue() +
"¥nDownloadTime: " + row.Properties.GetProperty("ClbDownloadTime").GetDateTimeValue() );
}