AnsweredAssumed Answered

Automatic site creation : surf-config not generated

Question asked by tonyrivet on Sep 7, 2012
Latest reply on Jul 16, 2013 by bug.develop
Hi everyone,

I would like to create a workflow task which could automatically create a Share site on transition.

I have created a Java JBPM action (extending JBPMSpringActionHandler), executed in my workflow task transition.
As the site pages creation must be done on the Share side, this action simply makes a remote call to the create site Share module:

   
RemoteClient remote = new RemoteClient(); 
   remote.setEndpoint("http");
   remote.setRequestMethod(HttpMethod.POST);
   remote.setRequestContentType("application/json");
   remote.setTicket(ticket);
                  
   Map<String, String> properties = new HashMap<String, String>();
   properties.put("shortName", siteShortName);
   properties.put("sitePreset", sitePreset);
   properties.put("title", siteTitle);
   properties.put("description", siteDesc);
   properties.put("visibility", "PUBLIC");
   properties.put("ticket", ticket);

   JSONObject json = new JSONObject(properties);
                  
   Response response = remote.call("http://localhost:8080/share/service/modules/create-site", json.toString());

I have also extended the create-site module to forward the session ticket to the site creation request:

   if(clientJSON.ticket)
   {
      repoResponse = scriptRemoteConnector.post("/api/sites?alf_ticket="+clientJSON.ticket, clientRequest, "application/json");
   }
   else
   {
      repoResponse = scriptRemoteConnector.post("/api/sites", clientRequest, "application/json");
   }

The action is executed well and the site seems to be correctly created : it appears in the sites list and I can access to the site pages.
However, the created "st:site" node does not contain the surf configuration ("surf-config" node) useful to access the site pages, which must be generated when calling the
"sitedata.newPreset()" method in the module…
And indeed, after restarting the server, the site is not accessible anymore…

It's quite weird because I think I am doing exaclty the same way as a manual site creation (i.e. calling the create-site Share module), and the manual site creation is working perfectly.

So I would like to know if someone has a clue on why the "surf-config" node isn't generated ?
All information about automatic site creation is welcomed !

Thank you in advance.

Outcomes