cancel
Showing results for 
Search instead for 
Did you mean: 

get node Content

ericc
Champ in-the-making
Champ in-the-making
Hello, I'm new in Alfresco so it might be "stupid" question.

I display on  a menu all my recordrer research, all is fine. When I click on one of the research I want to replay it.

So first step I try to get the content of the recorded research (and after use it for things I want to do), but I can't have the node content…

Here is my code :
public void navigate(ActionEvent event)
      {
         // work out which node was clicked from the event data
         UIRecentSpacesShelfItem.RecentSpacesEvent spaceEvent = (UIRecentSpacesShelfItem.RecentSpacesEvent)event;
         Node selectedNode = this.shortcuts.get(spaceEvent.Index);
         NodeRef nodeRef = selectedNode.getNodeRef();
         try
         {
            // then navigate to the appropriate node in UI
            // use browse bean functionality for this as it will update the breadcrumb for us
            //this.browseBean.updateUILocation(nodeRef);
           
           
            //this.nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT);
            ContentReader contentReader = this.contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
           

             contentReader.getContentString();


When getContent is call an exeption occured :

contentUrl=store://2007/12/18/16/55/b52af51c-ad81-11dc-895d-d76a1b20d501.bin| mimetype=text/xml|size=463|encoding=UTF-8|locale=fr_FR_ ) la méthode getContentString me renvois une exeption :
org.alfresco.service.cmr.repository.ContentIOException: Failed to open stream onto channel:
accessor: ContentAccessor[ contentUrl=store://2007/12/18/16/55/b52af51c-ad81-11dc-895d-d76a1b20d501.bin, mimetype=text/xml, size=463, encoding=UTF-8, locale=fr_FR]
caused by:
java.lang.RuntimeException: A channel has already been opened

Someone have an idea to help me? (maybe I'm not on the right way…)

Thanks.
3 REPLIES 3

ericc
Champ in-the-making
Champ in-the-making
I respond to myself : the code was right but my node might be already read and not properly closed and get an exeption when I try to do things on it.

nowhere
Champ in-the-making
Champ in-the-making
Hi Eric.

I'm facing the same problem as you when using contentService.transform method().

Caused by: org.alfresco.service.cmr.repository.ContentIOException: 03110010 Fail
ed to open stream onto channel:
   accessor: ContentAccessor[ contentUrl=store://2010/4/11/16/29/37b91ac2-82e2-4
032-8e08-e0a611b500dc.bin, mimetype=application/msword, size=6176770, encoding=U
TF-8, locale=it_IT]

my code is:

 System.out.println("Transformable?  " + contentService.isTransformable(actionedFileReader, writer));
     System.out.println("isChannelOpen:  " + actionedFileReader.isChannelOpen());
            
               
   contentService.transform(actionedFileReader, writer);

I get true on contentService.isTransformable(actionedFileReader, writer) and false on actionedFileReader.isChannelOpen().

Could you say me what to check to ensure that any channel is properly closed?

Thanks in advance!

nowhere
Champ in-the-making
Champ in-the-making
I solved: even closing inputStream it failed.

Thanks anyway