[CPS-devel] computeId customisation

Georges Racinet gracinet at nuxeo.com
Thu Feb 15 11:47:01 CET 2007


On Feb 15, 2007, at 10:26 AM, Winterflood, Jonathan wrote:

> Thanks a lot
>
> >It is indeed some kind of a hack: generateId is suppose to provide
> >disambiguation within the given container.
> >If you're really new to Zope, I should maybe point out that this
> >notion of id is by no means global.
>
> I understand this script is used by CPS to create id's for the  
> proxies to documents
Right, but only for user-triggered creation of a fresh document and  
first proxy to it.  The "invokeFactory" script expects a valid Id and  
is the one to be used
in programmatic situations. It's actually just a wrapper to the  
workflow tool's invokeFactoryFor method

> these proxies circulate different workspaces in CPS (passed from  
> private per-user spaces to common spaces, mostly)
They can be moved, duplicated, or be merged. Each proxy refers to a  
collection of revisions (one per language). The workflow concepts  
apply to proxies.
> The Id being generated in private-spaces, it would be possible that  
> at one point there will be a clash when the proxies are moved to  
> the common spaces, am I right?
It would, if there weren't further disambiguation systems in the  
workflow engine. For example, CPS allows resubmission of a document  
to the very same destination. In this case you have two proxies in  
the same section, a published one and a pending one. Of course they  
have different Ids (typically my_doc and my_doc_1). Same for the  
draft check-in/out system ("Créer une version" in the french UI)
>
> >The fact that it uses numbers for that purpose is coincidental (it's
> >not likely to change soon).
> >A cleaner way would be to implement you own logic using
> >container.hasObject() to check prior existence.
>
> I'm thinking of something like a global counter, somehow stored by  
> computeId, incremented for each document.
Then you wanna check CPSUid (checkout URL: https://svn.nuxeo.org/pub/ 
CPS3/products/CPSUid/trunk)
For an example usage, check CPSCourrier's cpsdocument_create_do and  
default profile.

A naive global counter is a database conflicts factory. CPSUid takes  
care of this.

Yours,

---------
Georges Racinet,   Nuxeo SAS
Open Source Enterprise Content Management (ECM)
Web: http://www.nuxeo.com/ and http://www.nuxeo.org/ - Tel: +33 1 40  
33 79 87






This list archive provided by Nuxeo, the leaders of open source ECM. Check out the Nuxeo 5 open source, standards-based ECM project.