06-28-2010 05:54 AM
<namespaces>
<namespace uri="mf.modFatture" prefix="mf"/>
</namespaces>
ParentReference parentReference = new ParentReference(
STORE,
Uuid,
null,
Constants.ASSOC_CONTAINS,
Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, idCartella));
// Create the content
NamedValue[] properties = new NamedValue[]{Utils.createNamedValue(Constants.PROP_NAME, nomeFile)};
CMLCreate create = new CMLCreate("1", parentReference, null, null, null, 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("c:\\Agenti\\" + nomeFile);
// Write the content
InputStream inpStr = new FileInputStream("c:\\Agenti\\" + nomeFile);
byte[] bytes = ContentUtils.convertToByteArray(inpStr);
WebServiceFactory.getContentService().write(newContentNode, Constants.PROP_CONTENT, bytes, format);
07-08-2010 08:32 AM
String contentType = "{mf.modFatture}yourCustomContentTypeLocalName";
CMLCreate create = new CMLCreate("1", parentReference, null, null, null, contentType, properties);
Hope this helps.
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.