cancel
Showing results for 
Search instead for 
Did you mean: 

How to crete a new space? Example 'create space Wizard'

spizzico7
Champ in-the-making
Champ in-the-making
Hello,
i must write a code for create a new space using java.
The creation of new space must be similar to creation space wizard in Alfresco…


Simone
1 REPLY 1

tim-erwin
Champ in-the-making
Champ in-the-making
Hello Simone,

you need to collect the information from the user by yourself and when everything is collected you can create the space via CML like so:


NamedValue valueName = new NamedValue(Constants.PROP_NAME, false, folderName, null);
folderName = Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, folderName);
ParentReference parentRef = new ParentReference(parent.getStore(),
                              parent.getUuid(),
                              parent.getPath(),
                              Constants.ASSOC_CONTAINS,
                              folderName);
CMLCreate newFolder = new CMLCreate(null, parentRef, null, Constants.ASSOC_CONTAINS,
                              folderName, Constants.TYPE_FOLDER, new NamedValue[]{valueName});
CML cml = new CML();
cml.setCreate(new CMLCreate[]{newFolder});
UpdateResult[] result = repositoryService.update(cml);
‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Regards,
Tim