IBM FileNet P8, Version 5.2.1            

Querying for Commented Documents

The following Java™ and C# examples query for comments in a specified version series. The code prints document and comment property values from the result set.

Java Example

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();
    	
// Create a SearchSQL instance and specify the SQL statement (using the helper methods).
SearchSQL sqlObject = new SearchSQL();
sqlObject.setSelectList("ClbDocumentMajorVersion, ClbDocumentMinorVersion, ClbCommentText");
sqlObject.setFromClauseInitialValue("ClbDocumentComment",null, false); 
sqlObject.setWhereClause("ClbCommentedVersionSeries="+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() +
        "  MinorVersion: " + row.getProperties().get("ClbDocumentMinorVersion").getInteger32Value() + 
        "\nComment: " + row.getProperties().get("ClbCommentText").getStringValue() + "\n" );
}

C# Example

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;
           
// Create a SearchSQL instance and specify the SQL statement (using the helper methods).
SearchSQL sqlObject = new SearchSQL();
sqlObject.SetSelectList("ClbDocumentMajorVersion, ClbDocumentMinorVersion, ClbCommentText");
sqlObject.SetFromClauseInitialValue("ClbDocumentComment",null, false); 
sqlObject.SetWhereClause("ClbCommentedVersionSeries="+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() +
        "\nComment: " + row.Properties.GetProperty("ClbCommentText").GetStringValue() );
}


Last updated: October 2015
socialCollab_comments_snip2.htm

© Copyright IBM Corporation 2015.