How can I execute loop action with nuxeo-shell ?

I would like to create about 100 workspaces with nuxeo-shell.

  • I tryed from the command line using -f my_batch_file

with my_batch_file :

connect -u Administrator -p Administrator http://localhost:8080/nuxeo/site/automation

cd /default-domain/workspaces

mkdir -title W1 Workspace path_W1

OK to create W1 but how loop to create W2, W3… (and their paths) ?

  • I tryed with groovy (easyer for the loop)… But How create a Workspace with groovy ?
0 votes

1 answers

1686 views

ANSWER



Using groovy, you'll need to use nuxeo-core java api: May be this can help you: http://doc.nuxeo.com/x/VIdH

You can try:

doc = Session.createDocumentModel("/default-domain/workspaces","myWS,"Workspace");
doc.setPropertyValue("dc:title", "my WS");
Session.createDocument(doc);
1 votes



perfect ! it works !
05/23/2012