// Get the Library named 'Workteam'.
Library library = session.getLibraryByName("Workteam");
// The desired Facility.
Facility facility = null;
Collection facilityCollection = library.getAllFacilities();
// Iterate the colection, looking for "Facility-1".
Iterator fiter = facilityCollection.iterator();
while(fiter.hasNext())
{
facility = (Facility)iter.next();
if (facility.getName().equals("Facility-1"))
break;
}
// Make sure the Facility is found.
if (facility==null)
{
System.out.println("Could not find Facility-1! Exiting.");
System.exit(1).
}
// Construct a SearchArgument object.
SearchArgument searchArgument = new SearchArgument();
///////////////////////////////////////////////////////////////
//
// The profile condition can have the "where" clause
// of a SQL stmt. may look like
// "APP::URL like \"word s%\" OR APP::URL like \"word a%\".
//
// The setProfileCondition and setFullTextCondition combined
// together form a logical sql "AND" condition.
//
///////////////////////////////////////////////////////////////
// Set a condition on the APP::NAME
searchArgument.setProfileCondition("APP::NAME like \"Amazon\"");
// Set a condition on the full text search.
searchArgument.setFullTextCondition("confidential rain forest study");
// Set the number of items returned as a result of the search.
searchArgument.setItemsToReturn(new Integer(20));
// Construct the SearchReturnedItem for Item properties.
SearchArgument.SearchReturnedItem[] searchReturnedItems =
new SearchArgument.SearchReturnedItem[1];
// Set which properties will be filled in the return Item.
String[] properties = new String[3];
props[0] = "BASE::CREATED_TIME";
props[1] = "BASE:

ESCRIPTION";
props[2] = "BASE::NAME
// Set the SearchReturnedItem[] element to return Document items.
searchReturnedItems [0] =
new SearchArgument.SearchReturnedItem(Document.class,
properties);
// Set the SearchArgument SearchReturnedItem elements.
searchArgument.setReturnedItems(searchItems);
// Execute the search.
SearchResultList results = facility.searchWorkspaces(searchArgument); // Exeption is coming here ClassCastException
// Iterate the results, displaying the properties.
Iterator iter = results.iterator();
while(iter.hasNext())
{
SearchResult result = (SearchResult)iter.next();
Document document = (Document)result.getItem();
System.out.println("The Name is: " + document.getName());
System.out.println("The description is: " + document.getDescription());
System.out.println("The CreatedDate is: " + document.getCreatedDate());
}
In this program
SearchResultList results = wsmp.selectedFacility.searchWorkspaces(searchArgument);
i am getting
ClassCastException.Please anybody help me?What's the wrong in this?