1. Even though there are no documents in them, workspaces have objects associated with them like security policies, groups, labels, trashed items etc.2. Making a SQL statement is possbile but the query will be complicated spanning atleast 7 tables, I think.
/** * @param workspace an instance of WSMP Workspace * @return empty true/false * @throws WorkteamException a WorkteamException */ public boolean isEmptyWorkspace(Workspace workspace) throws WorkteamException { try { workspace.refresh(); Collection collection = null; Iterator iterator = null; collection = workspace.getAllChildren(Folder.class); iterator = collection.iterator(); while (iterator.hasNext()) { return false; } SearchArgument sArg = new SearchArgument(); sArg.setProfileCondition("APP::NAME LIKE \"%\""); Collection wsCategories = workspace.searchCategory("APP::LABEL", sArg); iterator = wsCategories.iterator(); while (iterator.hasNext()) { return false; } collection = workspace.getAllProjects(); iterator = collection.iterator(); while (iterator.hasNext()) { return false; } collection = workspace.getAllChildren(); iterator = collection.iterator(); while (iterator.hasNext()) { return false; } collection = workspace.getAllSecurityPolicies(); iterator = collection.iterator(); while (iterator.hasNext()) { return false; } collection = workspace.getAllWorkgroups(); iterator = collection.iterator(); while (iterator.hasNext()) { return false; } collection = workspace.getAllUserMembers(); iterator = collection.iterator(); while (iterator.hasNext()) { return false; } collection = workspace.getAllGroupMembers(); iterator = collection.iterator(); while (iterator.hasNext()) { return false; } collection = workspace.getAllTrusteeContainerMembers(); iterator = collection.iterator(); while (iterator.hasNext()) { return false; } return true; } catch (WorkteamException e) { throw new WorkteamException(e); } }