How to write and read aspect property of type d:content ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2010 05:19 AM
Hi all,
I have created the following custom aspect:
The purpose of myNs:user is to store a list of users who modified myNs:content(using a java applet).
At first I`m adding an aspect myNs:myAspect with myNs:user property to node and then I`m using the following
code snippet to write and read myNs:content property:
always main document content (property {http://www.alfresco.org/model/content/1.0}content).
What is the proper way to write and read myNs:content property?
Thanks in advance !
I have created the following custom aspect:
….<namespace uri="http://www.alfresco.org/model/myNameSpace/1.0" prefix="myNs"/>….<aspects> <aspect name="myNs:myAspect"> <title>MyAspect</title> <properties> <property name="myNs:content"> <title>MyContent</title> <type>d:content</type> </property> <property name="myNs:user"> <title>User</title> <type>d:text</type> <multiple>true</multiple> </property> </properties> </aspect></aspects>
The purpose of myNs:content is to store binary data(application/octet-stream).The purpose of myNs:user is to store a list of users who modified myNs:content(using a java applet).
At first I`m adding an aspect myNs:myAspect with myNs:user property to node and then I`m using the following
code snippet to write and read myNs:content property:
Write:String propertyName = "{http://www.alfresco.org/model/myNameSpace/1.0}content";Content propertyContent = WebServiceFactory.getContentService().write(nodeReference, propertyName, ContentUtils.convertToByteArray(new FileInputStream(propertyFilePath)), new ContentFormat("application/octet-stream", "UTF-8")); Read:Content[] contents = WebServiceFactory.getContentService().read(new Predicate(new Reference[]{nodeReference}, store, null), propertyName); for (Content content : contents) { System.out.println("Content.length:" + content.getLength()); ContentUtils.copyContentToFile(content, new File("./propertyContent"));}
In the result I`m getting valid content size(content.getLength()) but the result of calling ContentUtils.copyContentToFile is invalid - it isalways main document content (property {http://www.alfresco.org/model/content/1.0}content).
What is the proper way to write and read myNs:content property?
Thanks in advance !
Labels:
- Labels:
-
Archive
3 REPLIES 3

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2010 10:44 AM
Hi,
I've taken a quick look at this and there is a bug in content web service repository code.
The URL being returned is pointing to the content in the cm:content property, not your custom property.
It would be good to raise this as an issue in JIRA (issues.alfresco.com) so we can schedule a fix.
Cheers,
Roy
I've taken a quick look at this and there is a bug in content web service repository code.
The URL being returned is pointing to the content in the cm:content property, not your custom property.
It would be good to raise this as an issue in JIRA (issues.alfresco.com) so we can schedule a fix.
Cheers,
Roy
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2010 04:13 AM
Thanks for the reply.
I have raised an issue in JIRA for this bug.
Lukasz
I have raised an issue in JIRA for this bug.
Lukasz

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2010 06:19 AM
Thanks
