IBM FileNet P8, Version 5.2.1            

Querying for Downloaded Documents

The following Java™ and C# examples query for downloaded documents that are associated with a specified version series. The code prints document and download record properties from the result set.

Java Example

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();
    	
// Create a SearchSQL instance and specify the SQL statement (using the helper methods).
SearchSQL sqlObject = new SearchSQL();
sqlObject.setSelectList("ClbOriginator, ClbDownloadTime, ClbDocumentMajorVersion, ClbDocumentMinorVersion");
sqlObject.setFromClauseInitialValue("ClbDownloadRecord",null, false); 
sqlObject.setWhereClause("ClbDownloadVersionSeries="+vsId);
sqlObject.setOrderByClause("ClbDocumentMajorVersion ASC");
        
// Create a SearchScope instance. (Assumes you have the object store object.)
SearchScope search = new SearchScope(os);
        
// Execute the fetchRows method using the specified parameters.
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# Example

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;

// Create a SearchSQL instance and specify the SQL statement (using the helper methods).
SearchSQL sqlObject = new SearchSQL();
sqlObject.SetSelectList("ClbOriginator, ClbDownloadTime, ClbDocumentMajorVersion, ClbDocumentMinorVersion");
sqlObject.SetFromClauseInitialValue("ClbDownloadRecord", null, false);
sqlObject.SetWhereClause("ClbDownloadVersionSeries=" + vsId);
sqlObject.SetOrderByClause("ClbDocumentMajorVersion ASC");

// Create a SearchScope instance. (Assumes you have the object store object.)
SearchScope search = new SearchScope(os);
            
// Execute the fetchRows method using the specified parameters.
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() );
}


Last updated: October 2015
socialCollab_downloads_snip1.htm

© Copyright IBM Corporation 2015.