01-31-2006 06:22 AM
01-31-2006 07:34 AM
01-31-2006 10:12 PM
02-01-2006 05:40 AM
// Upload binary content into the repository
Reference reference = WebServiceSample2.executeSearch();
ParentReference parentReference = new ParentReference(ASSOC_CONTAINS, ASSOC_CONTAINS);
parentReference.setStore(reference.getStore());
parentReference.setUuid(reference.getUuid());
// Create the content
NamedValue[] properties = new NamedValue[]{new NamedValue(Constants.PROP_NAME, "test.jpg")};
CMLCreate create = new CMLCreate("1", parentReference, Constants.TYPE_CONTENT, properties);
CML cml = new CML();
cml.setCreate(new CMLCreate[]{create});
UpdateResult[] result = WebServiceFactory.getRepositoryService().update(cml);
// Get the created node and create the format
Reference newContentNode = result[0].getDestination();
ContentFormat format = new ContentFormat("image/jpeg", "UTF-8");
// Open the file and convert to byte array
InputStream viewStream = newContentNode.getClass().getClassLoader().getResourceAsStream("org/alfresco/webservice/test/resources/test.jpg");
byte[] bytes = ContentUtils.convertToByteArray(viewStream);
// Write the content
WebServiceFactory.getContentService().write(newContentNode, Constants.PROP_CONTENT, bytes, format);
————————————————————————
r2133 | royw | 2006-01-18 11:25:06 +0000 (Wed, 18 Jan 2006) | 2 lines
Changed paths:
M /alfresco/HEAD/root/projects/remote-api/source/java/org/alfresco/repo/webservice/content/ContentWebService.java
02-02-2006 12:49 AM
02-02-2006 06:58 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.