As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
400
Session session = getSession(); // Grab a reference to the folder where we want to create content Folder folder = (Folder) session.getObjectByPath("/" + getFolderName()); String timeStamp = new Long(System.currentTimeMillis()).toString(); String filename = docName + " (" + timeStamp + ")"; // Create a Map of objects with the props we want to set Map <String, Object> properties = new HashMap<String, Object>(); // Following sets the content type and adds the titled aspect // This works because we are using the OpenCMIS extension for Alfresco properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document,P:cm:titled"); properties.put("cm:title", "some title"); properties.put("cm:description", "some description"); String docText = "This is a sample " + contentType + " document called " + docName; byte[] content = docText.getBytes(); InputStream stream = new ByteArrayInputStream(content); ContentStream contentStream = new ContentStreamImpl(filename, BigInteger.valueOf(content.length), "text/plain", stream); Document doc = folder.createDocument( properties, contentStream, VersioningState.MAJOR); System.out.println("Created: " + doc.getId()); System.out.println("Content Length: " + doc.getContentStreamLength());
parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
org.apache.chemistry.opencmis.objectfactory.classname=org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl