AnsweredAssumed Answered

store renditions

Question asked by anweber on May 23, 2006
Latest reply on May 23, 2006 by kevinr
Hello,

   I try to find a way to store renditions of a file (renditions are alternate formats of the same content, for example a "doc" file has also representations in PDF, HTML, …).  I think it should be nice to store it in the same object as the main content.

   I have created a custom class.  I have defined an attribute named "renditionPdf" with the type "d:content".


      <type name="custom:ep_doc">
         <title>EP's concrete document</title>
         <parent>cm:content</parent>
         <properties>
            <property name="custom:language">
               <type>d:text</type>
            </property>
            <property name="custom:renditionPdf">
               <type>d:content</type>
               <mandatory>false</mandatory>
               <!— Index content in the background –>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>false</stored>
                  <tokenised>true</tokenised>
               </index>
            </property>
         </properties>
    </type>

    Then by code, I have no problem to fill this attribute with some content (it creates a second internal file stored in the file system, the attribute "renditionPdf" receive a string where the localization of the internal file and the format are written).  Until this point, all is wright.

    Now, I should like to obtain the possibility to store several renditions of the same file.  My first idea was to define my custom attribute as multi-valued :


      <type name="custom:ep_doc">
         <title>EP's concrete document</title>
         <parent>cm:content</parent>
         <properties>
            <property name="custom:language">
               <type>d:text</type>
            </property>
             <property name="custom:renditions">
               <type>d:content</type>
               <mandatory>false</mandatory>
               <multiple>true</multiple>
               <!— Index content in the background –>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>false</stored>
                  <tokenised>true</tokenised>
               </index>
            </property>
         </properties>
    </type>

    My problem is that I do not see how I can obtain the writer to fill the content in such a multivalue attribute.  In the previous version (with an mono-valued attribute), I used the following instruction :


       ContentWriter writer = contentService.getWriter(nodeRef, propRendition, true);

   But now, I should specify the indice in my custom attribute and it seems that the method "getWriter" doesn't offer this possibility.

           Thanks for your help,

                    Andre

Outcomes