Good day.
I create a document in Alfresco using CMIS. Code:
Session session = ...
Folder parent = session.getRootFolder ();
String textFileName = "test.txt"; // prepare content - a simple text file
String content = "Hello World!";
String filename = textFileName;
String mimetype = "text / plain; charset = UTF-8";
byte [] contentBytes = content.getBytes ("UTF-8");
ByteArrayInputStream stream = new ByteArrayInputStream (contentBytes);
ContentStream contentStream = session.getObjectFactory (). CreateContentStream (filename, contentBytes.length, mimetype, stream); // prepare properties
Map <String, Object> properties = new HashMap <String, Object> ();
properties.put (PropertyIds.NAME, textFileName);
properties.put (PropertyIds.OBJECT_TYPE_ID, "cmis: document"); // create the document
Document newDoc = parent.createDocument (properties, contentStream, VersioningState.MAJOR);
However, when I save a file with the same name twice, I get a CmisContentAlreadyExistsException.
When I add files with the same name through Alfresco, suffixes are added to the file names (as file_name-1, file_name-2 ...). Is it possible to save files with the same name via CMIS?
Thanks!