AnsweredAssumed Answered

Sharing edits among users and sandboxes

Question asked by jack.jin on Apr 23, 2009
Latest reply on Sep 21, 2009 by tommorris
I'd like to thank you for reading my long post ahead of time.  Hopefully it'll help the community solve the issue of file sharing across sandboxes.  Any suggestions is highly welcome and I'll try to answer any questions to the best of my ability.

What we have -
We've built a custom in-context editing platform on top of Alfresco's AVM repository for a few clients.  We're using a library of alfresco webscripts to interact with Alfresco, and we've chosen use the AVM platform to store content.
We're current using Alfresco 3.0C

Business case -
We want users to be able to share their edits without putting the file in a workflow.  Currently, our implementation reads and saves from the user's sandbox, and they're allowed to submit files into workflows.  But they can't see other user's changes, until the other user put the file in a workflow
In other words, We need users to look at each other's edits, and make further edits on top of that.

Possible solutions we've came up with -
1) Have a common sandbox - Basically, we can copy the user's edit to a common sandbox when the user checks his/her file in, then when another user tries to retrieve the file, he/she would get the file from the common repository, and see the first user's change
2) Look in other user's sandboxes
3) Have all the users read and write from the same sandbox at all times - have a workaround the whole sandbox implementation
4) Everytime the user checks in the file, we put it in a workflow - essentially branching the file out for everyone to read/edit.  But we don't like using workflows as a workaround to share files.

Our Attempts to implement common sandbox -
We came up with this design last week and we've made an attempt to implement it.
Design: Have a common sandbox that's shared among users, so when a user checks in a file, the file gets copied into the common sandbox.  Further gets of the file will be made from the common sandbox, unless the file is checked out by the user getting the file.

Changes to our webscripts (common sandbox implementation):
1) When we check-in a file, we make a copy of the file that's in the user's sandbox and throw it in the common sandbox
2) When we read a file, unless the file is checked out, we'll read from the common sandbox
3) When we checkout a file, we'll make a copy of the file from the common repository and put it in the user's repository
4) We'll keep the save the way it is - saving it to the user's sandbox.
This way, when the user checks in a file, the file gets read by all the other users.

Issue we're having -
Right now we're using the following code to copy the files around -
var newPath = crossRepoCopy.copy(avm.lookupNode(srcPath), avm.lookupNode(destPath), destName);
The problem with copying files around like that across repository is, the version history gets messed up and our workflow doesn't seem to start half of the time.  When copying files with the cross repository copy, the version history descriptor ID seems to be merged, such that now we have multiple version 1, and multiple version 2.  As if when we copy the files together, its version history just all merged together.

We also have our custom nodeCopy code, which reads the source node and overwrite the destination node with a save.  But we don't want to use use our custom nodeCopy code.  Is there another copy function we can use?

function nodeCopy(srcPath, destPath, destName) {

    var srcNode = avm.lookupNode(srcPath);
    var destNode = avm.lookupNode(destPath + "/" + destName);
    // Check to see if dest exists, if not, create it
    if(destNode == null) {
        var destParentNode = avm.lookupNode(destPath);
        destNode = destParentNode.createNode(destName, "wcm:avmplaincontent");
    // For every aspect, attach it if it's not attached
    var srcAspects = srcNode.getAspectsSet().toArray();
    for(idx in srcAspects) {
        var currentAspect = srcAspects[idx];
        // Need to fix - need to extract aspect name from current aspect
        if(!destNode.hasAspect(currentAspect)) {

    // Copy all the properties over
    for(idx in {
        var currentProperty =[idx];[idx] = currentProperty;

    // Copy over the content (include in mimetype and encoding)
    destNode.content = srcNode.content;
    destNode.mimetype = srcNode.mimetype; =;;

    return destNode.path;


Back to our business case -
We need users to be able to look at each other's edits, and make further edits on top of that.  Having a common sandbox makes sense, but is it the right approach to this issue?  Also, if we were to copy files around, what's the best way to do it in an AVM environment?

Thanks again.