cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot add more then 1 Custom Content Type

ctraversa
Champ in-the-making
Champ in-the-making
Hi all.
I'd like to extend the content model with 2 additional Custom Content Type
To do this, according to the wiki documentation, I do as following:


1. I Create, in the extension folder, the file cct-context.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
  <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
    <property name="models">
      <list>
        <value>alfresco/extension/cctModel1.xml</value>
        <value>alfresco/extension/cctModel2.xml</value>
      </list>
    </property>
  </bean>
</beans>


2. I create, in the extension folder, the file cctModel1.xml for Custom Content Type Model 1
<?xml version="1.0" encoding="UTF-8"?>
<model name="cct1:mycctmodel1" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <imports>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>
   <namespaces>
      <namespace uri="my.cct.model1" prefix="cct1"/>
   </namespaces>
   <types>
      <type name="cct1:custconttyp1">
      <title>Custom Content 1</title>
      <parent>cm:content</parent>
      <properties>
         <property name="cct1:cctfield1">
         <title>Custom Content Field 1</title>
         <type>d:text</type>
         </property>
      </properties>
      </type>
   </types>
</model>


3. Create, in the extension folder, the file cctModel2.xml for Custom Content Type Model 2
<?xml version="1.0" encoding="UTF-8"?>
<model name="cct2:mycctmodel2" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <imports>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>
   <namespaces>
      <namespace uri="my.cct.model2" prefix="cct2"/>
   </namespaces>
   <types>
      <type name="cct2:custconttyp2">
      <title>Custom Content 2</title>
      <parent>cm:content</parent>
      <properties>
         <property name="cct2:cctfield2">
         <title>Custom Content Field 2</title>
         <type>d:text</type>
         </property>
      </properties>
      </type>
   </types>
</model>


4. In the extension folder, in the file web-client-config-custom.xml I configure the web client for the Custom Content Type Models
<alfresco-config>
   <config evaluator="node-type" condition="cct1:custconttyp1">
      <property-sheet>
         <show-property name="mimetype" display-label-id="mimetype"
                        converter="org.alfresco.faces.MimeTypeConverter"
                        show-in-edit-mode="false" />
         <show-property name="size" display-label-id="size"
                        converter="org.alfresco.faces.ByteSizeConverter"
                        show-in-edit-mode="false" />         
         <show-property name="cct1:cctfield1" />
      </property-sheet>
   </config>   
   <config evaluator="node-type" condition="cct2:custconttyp2">
      <property-sheet>
         <show-property name="mimetype" display-label-id="mimetype"
                        converter="org.alfresco.faces.MimeTypeConverter"
                        show-in-edit-mode="false" />
         <show-property name="size" display-label-id="size"
                        converter="org.alfresco.faces.ByteSizeConverter"
                        show-in-edit-mode="false" />         
         <show-property name="cct2:cctfield2" />
      </property-sheet>
   </config>
   <config evaluator="string-compare" condition="Content Wizards">
      <content-types>
         <type name="cct1:custconttyp1" />
         <type name="cct2:custconttyp2" />        
      </content-types>
   </config>
   <config evaluator="string-compare" condition="Action Wizards">
      <subtypes>
         <type name="cct1:custconttyp1"/>
         <type name="cct2:custconttyp2"/>
      </subtypes>
   </config>
</alfresco-config>

Now, when I click on the button "Add Content" (in any space), I choose the content to upload, I upload it and my expectation is to see in the Add Content Dialog page, in the "Type" drop down list:
- Content
- Custom Content 1
- Custom Content 2
and if i.e. I choose Custom Content 1, my expectation is to be able to add the Custom Content Field 1 while if I choose Custom Content 2, my expectation is to be able to add the Custom Content Field 2 but it doesn't work. I can see only the Custom Content 1.
Can somebody help me to understand why?
Does anybody have any idea about which is my mistake?
Of course if I use only 1 custom content type it works fine.
Thanks in advance,
Carlo Traversa.
3 REPLIES 3

gavinc
Champ in-the-making
Champ in-the-making
Can you clarify some things for me…

Your expectations are correct but I'm not sure what you are actually seeing, do you only see one item in the drop down list of types?

Or do you see both types but it always creates nodes with the first custom type?

Do you see any warnings in the app server console window? If there is a problem with the config you should see some warnings.

Your config looks fine on first inspection so answers to the above may help to narrow down the issue.

ctraversa
Champ in-the-making
Champ in-the-making
I can see in the dropo down list only:
- Content (the standard entry)
- Custom Content 1
I cannot see Custom Content 2

Can you clarify some things for me…

Your expectations are correct but I'm not sure what you are actually seeing, do you only see one item in the drop down list of types?

Or do you see both types but it always creates nodes with the first custom type?


The only WARN I see, during the start up, is:

WARN  [remoting.rmi.RmiRegistryFactoryBean] Could not detect RMI registry - creating new one

but I'm pretty sure that there is no relationship between this warning and this problem also because it's a warning I saw also when I launched alfresco for the first time. Except this warning and about ten INFO messages during the startup, I don't see anythingelse.
Also when I "Add Content" to a space, I choose content type "Custom Content 1", I can see in the Modify Content Properties page the "Custom Content Field 1" properly and I don't have any error in the server console window.


Do you see any warnings in the app server console window? If there is a problem with the config you should see some warnings.

Your config looks fine on first inspection so answers to the above may help to narrow down the issue.

I hope this help you a little bit more to understand my problem.
Regards,
Carlo Traversa

gavinc
Champ in-the-making
Champ in-the-making
I'm not sure what it is going wrong for you as I have tested this with your exact file names and contents as posted above and it works for me, I see the expected 3 options in the drop down list.

Also, you're right, the warning RMI registry warning has nothing to do with this.

Where have you placed your files? Which extension folder? in <tomcat>/shared/classes/alfresco/extension?

The only thing I can think of is that you are loading an older web-client-config-custom.xml that only has the one option configured in it. Is this possible?

To see what config files are being loaded from where add the following to your log4j.properties file:

log4j.logger.org.alfresco.config=debug

You should then see something like:

09:02:23,578 DEBUG [config.source.ClassPathConfigSource] Loaded 'alfresco/extension/web-client-config-custom.xml' from:
file:/C:/development/projects/community/software/apache-tomcat-5.5.23/shared/classes/alfresco/extension/web-client-confi
g-custom.xml

Hope this helps.