vegemite4me
vegemite4me

Reputation: 6856

Alfresco: Define a custom type that contains files as properties

I would like to create a custom model for a whitepaper that consists of the following properties:

How can I specify that two of the last two are files?

<types>
    <type name="sc:whitepaper">
        <title>Whitepaper</title>
        <parent>cm:content</parent>
        <properties>
            <property name="sc:publishedDate">
                <type>d:datetime</type>
            </property>
            <property name="sc:author">
                <type>d:text</type>
            </property>
            <property name="sc:audioFile">
                <type>d:text</type>     <!-- How do I state this property is a file? -->
            </property>
            <property name="sc:pdfFile">
                <type>d:text</type>     <!-- How do I state this property is a file? -->
            </property>
        </properties>
    </type>
</types>

Upvotes: 0

Views: 640

Answers (2)

user3420847
user3420847

Reputation: 220

One of the way is to create association i would advice you to do this:

<associations>
            <association name="sc:pdfFiles">
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>cm:content</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </association>
         </associations>

Or if this does not fix your problem you can set that property to be of type <type>d:content</type>.

Like so: d:content

If you are not familiar with custom models you can read more here http://alfrescoblog.com/2014/05/19/alfresco-tutorial-custom-content-types/

Hope it helps.

Upvotes: 1

Andreas Steffan
Andreas Steffan

Reputation: 6159

It might be a bad idea doing that. Amongst other things, the system will not give you decent ootb support to search or access the values. Make sure to check associations as an alternative.

That said, if you still want to do that, use a property of type d:content. Have a look at http://wiki.alfresco.com/wiki/Data_Dictionary_Guide for further details.

Upvotes: 2

Related Questions