Creating, updating, and deleting content
We now know how to list folder content and how to get the available content type hierarchy. It's time to look at how we can create objects.
Creating folders
Creating folders is easy, just get a Folder
object for the parent folder in which you want to create a new folder and then use the createFolder
method on the parent folder object as in the following code:
public Folder createFolder(Session session) { String folderName = "OpenCMISTest"; Folder parentFolder = session.getRootFolder(); // Make sure the user is allowed to create a folder // under the root folder if (parentFolder.getAllowableActions().getAllowableActions(). contains(Action.CAN_CREATE_FOLDER) == false) { throw new CmisUnauthorizedException( "Current user does not have permission to create a " + "sub-folder in " + parentFolder.getPath()); } // Check if folder already exist, if not create it Folder newFolder = (Folder) getObject(...