Posts

Showing posts from January, 2020

Update content in Webscript

private void updateContent(NodeRef nodeRef, String path, String fileName, boolean newFile)     {         // Make versionable         nodeService.addAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE, null);         // Update content         InputStream is = this.getClass().getClassLoader().getResourceAsStream(path + fileName);         if (is != null)         {             ContentWriter contentWriter = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);             if (newFile == true)             {                 contentWriter.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);                 contentWriter.setEncoding("UTF-8");             }             contentWriter.putContent(is);         }     }