08-23-2013 09:44 PM
I'd like to create a proxy that always points to the live representation of a document, so that the proxy always reflects the changes to its target (and so edits to the proxy apply to the target).
I see that the javadoc for CoreSession says this for the createProxy() method:
Creates a generic proxy to the given document inside the given folder. The document may be a version, or a working copy (live document) in which case the proxy will be a "shortcut".
My code to create a shortcut does the following:
DocumentModel childWorkingCopyDoc = coreSession.getWorkingCopy(sourceDoc.getRef());
childDoc = coreSession.createProxy(childWorkingCopyDoc.getRef(), destinationDir.getRef());
childDoc = coreSession.createDocument(childDoc);
I use this code in the following way:
What I see when viewing the doc and its shortcut in Nuxeo DM after all of this is that the original document has the properties set in step 3, but the shortcut does not.
Am I interpreting "shortcut" in the javadoc incorrectly (does a shortcut always point to the live document or not?) If a shortcut does indeed do what I'd like it to, can you provide a code snippet that illustrates how to create it correctly?
08-23-2013 10:29 PM
I had copied/pasted my code for creating a new document (step 1 above) to use as the base for my proxy creation code. I changed the above code to:
DocumentModel childWorkingCopyDoc = coreSession.getWorkingCopy(sourceDoc.getRef());
childDoc = coreSession.createProxy(childWorkingCopyDoc.getRef(), destinationDir.getRef());
coreSession.saveDocument(childDoc);
And now my live proxies work as expected. I can edit the proxy target and see the change reflected in the proxy, and can also edit the proxy and see the change in the target.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.