AnsweredAssumed Answered

cannot locate content via the web client

Question asked by shay on Jun 19, 2007
Hi,

I added some content using the following code:

Map<QName, Serializable> contentProps = new HashMap<QName, Serializable>();
           contentProps.put(ContentModel.PROP_NAME, contentName);
   
           // create content node
           ChildAssociationRef association = nodeService.createNode(fatherNode,
                 ContentModel.ASSOC_CONTAINS,
                 QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, contentName),
                   ContentModel.TYPE_CONTENT,
                   contentProps);
           content = association.getChildRef();
          
           // add titled aspect (for Web Client display)
           Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>();
           titledProps.put(ContentModel.PROP_TITLE, contentName);
           titledProps.put(ContentModel.PROP_DESCRIPTION, contentName);
           nodeService.addAspect(content, ContentModel.ASPECT_TITLED, titledProps);
          
           // write some content to new node
           ContentWriter writer = contentService.getWriter(content, ContentModel.PROP_CONTENT, true);
          
           //writer.setMimetype(MimetypeMap.MIMETYPE_BINARY);
           writer.setMimetype(MimetypeMap.MIMETYPE_IMAGE_JPEG);
           writer.putContent(new File(contentPath + contentName));

I can see it in the web client but when i try to use one of these content files (which i just added via the java api) with the web client i can not locate it. What I mean is that I add association from one content to another. When I search in the association search box for all contents I can not see them. The strange thing is that when i change some of the content properties (edit and save) I can locate it in the search box.

when i add thses files manually using the web client it works fine.

did i miss something in my code?

Thanks in advance,
Shay.

Outcomes