Yeah, what you'd like to be able to do is a SELECT
sum(cmis:contentStreamLength) from cmis:document where...
But you can't. :)
So you'll have to iterate. Couple of thoughts, though:
- Ask for the cmis:contentStreamLength specifically--don't use * if all you
need is that length property. That will speed up performance a bit.
- Be sure to use paging on the result set.
- Using IN_FOLDER will give you just the space taken up by that folder object.
If you want to recurse use IN_TREE instead.
Jeff
On Aug 30, 2012, at 4:21 PM, Mark Streit wrote:
> Hello
>
> I have a question that has been raised about how to get the *number *of
> cmis:Document objects in a cmis:Folder object and also how much space
> (bytes) is being consumed by that cmis:Folder object.
>
> The use case here is each "client" storing information on the ECM being
> used (application is using OpenCMIS Java API) to persist and retrieve
> documents to the ECM. Each has its own Folder and stores its respective
> Document objects.
>
> The closest thing I can envision is to run a SELECT * FROM cmis:document
> WHERE IN_FOLDER("some_folder_id")
>
>
> 1. Then get the size of the ItemIterable<QueryResult> queryResult for
> the count
> 2. Then iterate over the list and the ContentStreamLength property value
> and add it to an accumlator
>
> The notion of SELECT COUNT(*) FROM cmis:document WHERE
> IN_FOLDER("some_folder_id") is not supported in CMIS SQL AFAIK. As for
> cumulative bytes representing the consumed space of the document count,
> this is the only thing that seemed possible.
>
> Is there some feature we may not be leveraging?
>
> Thanks in advance.
>
> Mark