cancel
Showing results for 
Search instead for 
Did you mean: 

custom type that works as an aggregation of files

mzaranto
Champ in-the-making
Champ in-the-making
Hi, I need to have a type of content made up of multiple files. Something like child associations (if I delete the "aggregating" content all files are deleted), but WITHOUT actual content in the type itself (only metadata).
A perfect example is Book/Chapter:
- Chapter is a content type with actual content in it.
- Book is simply a way to collect Chapters (as child associations, I suppose), but without content.
- In addiction, a Book can have 0 Chapters (IF the relation is parent-child, this can be simply done with "mandatory" set to false).

How can I model this? If I use associations, when I create a Book it asks me for content, but it is not needed! And if I import a file from my file system (using "add content") it lets me apply the Book type, but it is conceptually wrong!

Can anyone help me?
8 REPLIES 8

mrogers
Star Contributor
Star Contributor
If you look at the implementation of "cm:folder" then this does exactly that.   You could even use cm:folder as the base for your types.

mzaranto
Champ in-the-making
Champ in-the-making
Thanks. I will definitely give it a try.

mzaranto
Champ in-the-making
Champ in-the-making
Ok Mark, I started trying what you suggested by creating a type "custom:mytype" which simply has "cm:folder" as a parent:

<type name="custom:mytype">
   <title>MyType</title>
   <parent>cm:folder</parent>
</type>
Then, on web-client-config-custom.xml I added:

<config evaluator="string-compare" condition="Action Wizards">
   <subtypes>
      <type name="custom:mytype"/>
   </subtypes>
</config>
<config evaluator="string-compare" condition="Content Wizards">
   <content-types>
      <type name="custom:mytype"/>
   </content-types>
</config>
While I'm able to find mytype in the action wizards, I can't find it in the content wizards, probably because it is NOT a content type (it doesn't extend cm:content). This is a problem, since I can't create a content of mytype…
Any suggestion?

steffen
Champ in-the-making
Champ in-the-making
Hi,

you can add the custom folder in the web-client-config-custom.xml at the "Space Wizards" section:

<config evaluator="string-compare" condition="Space Wizards">
<folder-types>

<type name="custom:mytype"
icon="/images/icons/mytype.gif"
description-id="type.mytype_desc"
display-label-id="type.mytypeFolder" />

</folder-types>
</config>

then it should appear in the create space wizard

regards

steffen

mzaranto
Champ in-the-making
Champ in-the-making
ok thanks a lot, now I'll try this. But what are the pros and cons of having this type of data I want to implement (say Book) as a space type and not as a content type?

norgan
Champ in-the-making
Champ in-the-making
Folder is created via Space wizard or via "create space". since there i no "content", no content-editing window is included.
Content is created via "create content" or "add content". Since it has a "content" field, an online/offline editing dialog is included in the actions

You could also use cmSmiley Surprisedbject or sys:base as parent. The contra is - you do not have the "edit" dialogs and need to set up your own. Did somebody do this already ? How about posting an example in the Wiki ?

Norgan

groberts
Champ on-the-rise
Champ on-the-rise
I found this thread because I am trying to do the same thing.

I've got my model working in the Web Client as long as I use cm:content as the parent.  But if
I try cmSmiley Surprisedbject I get an exception

Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 00150000 
Parent class cm:object of class custom:clinicalstudy is not found

Am I missing an import or something ?   I just want to define a type of model with properties but without content.

Thanks for any clues,

Guy.

My customStudyModel.xml looks like this; (I know I should change the name)

<?xml version="1.0" encoding="UTF-8"?>
<!– Custom Model –>
<!– Note: This model is pre-configured to load at startup of the Repository.  So, all custom –>
<!–       types and aspects added here will automatically be registered –>
<model xmlns="http://www.alfresco.org/model/dictionary/1.0" name="custom:customStudyModel">
        <!– Optional meta-data about the model –>
        <description>Custom Study Model</description>
        <author>G</author>
        <version>1.0</version>
        <imports>
                <!– Import Alfresco Dictionary Definitions –>
                <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
                <!– Import Alfresco Content Domain Model Definitions –>
                <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
                <import uri="http://www.alfresco.org/model/content/1.0" prefix="sys"/>
        </imports>
        <!– Introduction of new namespaces defined by this model –>
        <!– NOTE: The following namespace custom.model should be changed to reflect your own namespace –>
        <namespaces>
                <namespace uri="custom.model" prefix="custom"/>
        </namespaces>


        <types>
                <type name="custom:clinicalstudy">
                        <title>Clinical Study</title>
                        <parent>cm:content</parent>
                        <!– Error DictionaryException: 00150000 Parent class xxxx not found –>
                        <!–<parent>sys:base</parent>–>
                        <!–<parent>cm:object</parent>–>

groberts
Champ on-the-rise
Champ on-the-rise
Solved.

Sorry, typo in an import,   I mistakenly used content instead of system.

<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />