rendered paste body // Find non-empty workspaces (has more than 0 children).
public static void savedSearchFindNonEmptyWorkspace() throws Exception
{
// Get the appropriate manager interfaces from the connector.
Searcher searcher = Connector.getSearcher();
WorkspaceManager workspaceManager = Connector.getWorkspaceManager();
// Create the query object.
Query query = new Query( ObjectType.WORKSPACE );
// Add typical return attributes.
query.addReturnAttribute( "name" );
query.addReturnAttribute( "parentWorkspaces.assets.name" );
query.addReturnAttribute( "NDA_Only" );
query.addReturnAttribute( "CATEGORY" );
query.addReturnAttribute( "childrenCount" );
// Request the permission attribute.
query.addReturnAttribute( Permissions.PERMISSIONS_VAR );
// Add sort by name.
query.addSortBy( "name" );
query.addSortBy( "party.name", Query.DESCENDING + Query.IGNORE_CASE );
query.addCondition( "assetChildrenCount", Query.Operators.GT, IntegerUtil.ZERO );
// Create the saved search.
String savedSeachUuid = workspaceManager.createSavedSearch( s_userAuth,
s_orgUuid,
null, // no parent workspace
"Saved Workspace Search",
"Some Notes",
query,
null );
Collection savedWorkspaceInfos =
workspaceManager.getChildrenWorkspaceInfo(s_userAuth,
savedSeachUuid, //parent workspace uuid
null, // any children workspace types
0, // start index at 0
10 ); // return max of 10 count
ExampleUtil.printWorkspaceInfo(savedWorkspaceInfos);
}