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.
<aspect name="cm:attachable"> <title>Attachable</title> <associations> <association name="cm:attachments"> <source> <mandatory>false</mandatory> <many>true</many> </source> <target> <class>cm:cmobject</class> <mandatory>false</mandatory> <many>true</many> </target> </association> </associations> </aspect>
CMLAddAspect attachableAspect = new CMLAddAspect("{http://www.alfresco.org/model/content/1.0}attachable", new NamedValue[] { Utils.createNamedValue("{http://www.alfresco.org/model/content/1.0}attachments", **********) }, null, contentId);
CMLCreate create = new CMLCreate(); create.setId("id1"); create.setType(Constants.TYPE_CONTENT); ParentReference parentReference = new ParentReference(); parentReference.setAssociationType(Constants.ASSOC_CHILDREN); parentReference.setChildName(Constants.ASSOC_CHILDREN); parentReference.setStore(BaseWebServiceSystemTest.store); parentReference.setUuid(BaseWebServiceSystemTest.rootReference.getUuid()); create.setParent(parentReference); create.setProperty(new NamedValue[] { new NamedValue( Constants.PROP_NAME, false, "name.txt", null)}); // Create a folder used for later tests CMLCreate createFolder = new CMLCreate(); createFolder.setId("folder1"); createFolder.setType(Constants.TYPE_FOLDER); createFolder.setParent(parentReference); createFolder.setProperty(new NamedValue[] { new NamedValue( Constants.PROP_NAME, false, "tempFolder", null)}); CMLAddAspect aspect = new CMLAddAspect(); aspect.setAspect(Constants.ASPECT_VERSIONABLE); aspect.setWhere_id("id1"); ContentFormat format = new ContentFormat(Constants.MIMETYPE_TEXT_PLAIN, "UTF-8"); CMLWriteContent write = new CMLWriteContent(); write.setProperty(Constants.PROP_CONTENT); write.setContent("this is a test".getBytes()); write.setFormat(format); write.setWhere_id("id1"); CML cml = new CML(); cml.setCreate(new CMLCreate[]{create, createFolder}); cml.setAddAspect(new CMLAddAspect[]{aspect}); cml.setWriteContent(new CMLWriteContent[]{write}); UpdateResult[] results = WebServiceFactory.getRepositoryService().update(cml);