AnsweredAssumed Answered

Create Site in Alfresco using Apache Chemistry

Question asked by nickath on Nov 29, 2018

Greetings to the community! I am using alfresco Community Edition 6.0.0 with the Apache Chemistry API. I have successfully managed so far to create/fetch content from the alfresco repository through it (Folder and Document files).

Now what I would like to do is use the Apache Chemistry API to create an alfresco site (like I would do using the alfresco/api/-default-/public/alfresco/versions/1/sites POST method in the Alfresco REST API).

Is that feasible?? What I have done following the way I already created folders in the repository is:

Folder folder = retrieveSitesFolder(); // this returns the folder object using the node id of the "Sites" node
Map<String, Object> props = new HashMap<String, Object>();
props.put(PropertyIds.OBJECT_TYPE_ID, "F:st:site");
 //this is recognized fineprops.put("st:siteVisibility", "PUBLIC");
props.put("st:sitePreset", "something");props.put("cmis:name", "something"); 
Folder subFolder = folder.createFolder(props);

I am following the site model from here concerning the properties I add

Unfortunately, when I run this piece of code I get the following error:

Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: 10290059 Site something does not exist.

which seems to me very strange as what I expect my code to do is create that site not search for it in anyway.

What makes this more strange is when I created a site with name "something" via the REST API and re-run the code, the code run successfully, but I did not get any extra site in the alfresco/api/-default-/public/alfresco/versions/1/sites endpoint of the REST API.

Could anyone shed some light on this please? Any help would be greatly appreciated!