One way to do it (from TestRepositoryAPI):
        List<Object> files = new ArrayList<Object>(2);
        Map<String, Object> f = new HashMap<String, Object>();
        f.put("filename", "f1");
        files.add(f);
        f = new HashMap<String, Object>();
        f.put("filename", "f2");
        f.put("file", new StringBlob("myfile", "text/test", "UTF-8"));
        files.add(f);
        doc.setProperty("files", "files", files);

another way (from EditorImageActionsBean):


        final List<Map<String, Object>> filesList = (List<Map<String, Object>>) 
doc.getProperty(
                "files", "files");
        final int fileIndex = filesList == null ? 0 : filesList.size();

        final Map<String, Object> props = new HashMap<String, Object>();
        uploadedImageName = FileUtils.getCleanFileName(uploadedImageName);
        props.put("filename", uploadedImageName);
        props.put("file", FileUtils.createSerializableBlob(uploadedImage,
                uploadedImageName, null));
        final ListDiff listDiff = new ListDiff();
        listDiff.add(props);
        doc.setProperty("files", "files", listDiff);
--
Posted by "arussel" at Nuxeo Discussions <http://nuxeo.org/discussions>
View the complete thread: 
<http://www.nuxeo.org/discussions/thread.jspa?threadID=2394#6465>
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

Reply via email to