AnsweredAssumed Answered

Add/Submit automatically content to the WCM Staging Repos.

Question asked by fmurialdo on Oct 17, 2007
I would like to bypass the Alfresco WebForm UI to create content. I would like to create the XML myself and put that file directly into the WCM repository to -Staging-
I am wondering if there is any option to do that that could be explained to me. The part that I see as blocking is the submission to Staging.
(putting aside for now a proper workflow that would have to go along to permit that)

The possible options I am thinking of:

# FTP?

I could use a FTP java client to upload my file but the file would be written to the logged-in user Sandbox. Then the content has to be pushed to Staging.
How could the submission to staging be automated? I would need to call into Alfresco through a URL to submit my file. I have heard about scheduling it through scheduled-jobs-content.xml, but that remains asynchronous and I am not sure if it would work yet for this case.

# WebScript?

Otherwise, ideally everything could be done through a webscript if there is an API to 'submit' a node.

Using the AVM Store API and the "Modifying and Creating API" http://wiki.alfresco.com/wiki/JavaScript_API it seems possible to create a new item in the WCM repository.
something like:
var avmStore = avm.lookupStore("MyAlfrescoWebProject");
var avmFolderNode = avm.lookupNode(pathToFolder) ;
avmFileNode = avmFolderNode.createFile("newFile.xml");
avmFileNode.content = xmlContent;
>>> avmFileNode.submit(); ???

In this case which sandbox is the new file going to be created in? The sandbox of the user matching the credentials of the user under which the webscript is running?

But again here, how does this new file can be pushed to Staging from the webscript? (or at least just submitted)

Is there any javascript/webscript example somewhere showing an example achieving something like this?

Thanks.

Franck.

Outcomes