/ Published in: Java
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
throws Exception { // Update name // Create a parent reference, this contains information about the association we are createing to the new content and the // parent of the new content (the space retrived from the search) ParentReference parentReference = new ParentReference(STORE, null, "/app:company_home/cm:sample_folder", ASSOC_CONTAINS, "{" + Constants.NAMESPACE_CONTENT_MODEL + "}" + name); // Define the content format for the content we are adding ContentFormat contentFormat = new ContentFormat("text/plain", "UTF-8"); CMLCreate create = new CMLCreate("1", parentReference, null, null, null, Constants.TYPE_CONTENT, properties); CML cml = new CML(); cml.setCreate(new CMLCreate[]{create}); // [email protected], Sat Jan 9, 2010 {{ CMLAddAspect addaspect = new CMLAddAspect(); addaspect.setAspect("{custom.model}CustomerDetails"); addaspect.setProperty(ascProperties); addaspect.setWhere_id("1"); cml.setAddAspect(new CMLAddAspect[]{addaspect}); // }} UpdateResult[] result = WebServiceFactory.getRepositoryService().update(cml); Content content = contentService.write(newContentNode, Constants.PROP_CONTENT, contentString.getBytes(), contentFormat); // Get a reference to the newly created content return content.getNode(); }