AnsweredAssumed Answered

CMIS-Web Script problem

Question asked by raptus on May 17, 2010
Hello folks,

How can I implement (with cmis and javascript) a dynamic folder creation while uploading a document?

For example:  my java-rest-atom code with Abdera atom feeds put a document on "company home" folder… I wish to move or (better) create a folder named "today date" and put the document inside this new folder without other operations (like rules).

Is it possible with web scripts?

I have seen this script listed in the default alfresco cmis scripts repository, called when I use a rest-java code (children.post.atom.js) but I cannot understand how does it work..
…….
if (objectId == null)
    {
        // create node
        node = createNode(model.parent, entry, slug, versioningState);
        if (node == null)
        {
            break script;
        }
        node.save();
    }
else if (sourceFolderId == null || sourceFolderId.length == 0)
    {
       // Add node
       var object = getObjectFromObjectId(objectId);
       if (object.node == null)
       {
           break script;
       }
       node = object.node;
      
      //code to add?
     
     
       cmis.addObjectToFolder(node, model.parent);
    }
    //———————————-
    // success
    model.node = node;
    // TODO: set Content-Location
    status.code = 201;
    status.location = url.server + url.serviceContext + "/cmis/s/" + node.nodeRef.storeRef.protocol + ":" + node.nodeRef.storeRef.identifier + "/i/" + node.nodeRef.id;
    status.redirect = true;

Can I mod this file?
Thanks in advance for any help,

Raptus

Outcomes