// Find non-empty workspaces (has more than 0 children). public 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( m_userAuth, m_kpRoot, null, // no parent workspace "Saved Workspace Search", "Some Notes", query, null ); workspaceManager.assignToWorkspace(m_userAuth, savedSeachUuid, rootCollectionInfo.getUuid(),new Integer(0), new HashMap()); Collection savedWorkspaceInfos = workspaceManager.getChildrenWorkspaceInfo(m_userAuth, savedSeachUuid, //parent workspace uuid null, // any children workspace types 0, // start index at 0 10 ); // return max of 10 count // ExampleUtil.printWorkspaceInfo(savedWorkspaceInfos); }