AnsweredAssumed Answered

Solved: New Aspect Registration

Question asked by jk3us on Jul 1, 2009
I'm in the beginning stages of creating types and aspects for our alfresco installation (obviously, still a newbie).  I've created a model with just a single aspect with some simple properties… the TestModel class says it is valid.  But I can't figure out how to get that new aspect to show up when adding an aspect to an item in alfresco.  What I've got is below:

extensions/c4k_model.xml:

<model name="c4k:c4k_model" xmlns="http://www.alfresco.org/model/dictionary/1.0">
    <description>Cure4Kids Content Model</description>
    <author>Jay Knight</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"/>
    </imports>

    <namespaces>
        <!– Define a Namespace for my new definitions –>
        <namespace uri="org.cure4kids.model" prefix="c4k"/>
    </namespaces>

    <types></types>

    <!– Type and Aspect definitions go here –>
    <aspects>
        <aspect name="c4k:Cure4KidsMetadata">
            <title>Cure4Kids Metadata</title>
            <properties>
                <property name="c4k:language">
                    <type>d:text</type>
                </property>
                <property name="c4k:context">
                    <type>d:text</type>
                </property>
                <property name="c4k:obj_location">
                    <type>d:text</type>
                </property>
                <property name="c4k:event_location">
                    <type>d:text</type>
                </property>
                <property name="c4k:date">
                    <type>d:datetime</type>
                </property>
                <property name="c4k:exp_date">
                    <type>d:datetime</type>
                </property>
                <property name="c4k:rights_restricted">
                    <type>d:boolean</type>
                </property>
                <property name="c4k:rights_description">
                    <type>d:text</type>
                </property>
                <property name="c4k:reading_level">
                    <type>d:text</type>
                </property>
                <property name="c4k:audience">
                    <type>d:text</type>
                </property>
            </properties>
        </aspect>
    </aspects>

</model>

model-context*:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
   
    <!– Registration of new models –>
    <bean id="c4k.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/c4k_model.xml</value>
            </list>
        </property>
    </bean>

</beans>

That second listing is the "Registration" as described at http://wiki.alfresco.com/wiki/Data_Dictionary_Guide#Step_4:_Register_the_Model_with_the_Repository.  I've tried naming it example-model-context.xml as mentioned in the docs, but I'm not sure it the name is important (I'd like it to be named something more descriptive). And I'm not sure how alfresco finds these new registration files, does it just search through all the xml files in that directory?  This seems to me to be the part that alfresco isn't picking up, but I'm not sure.

How do I make alfresco find and register this new model and aspect so that I can assign the aspect to content? What can I look for in the logs to determine what is going on?  I was getting errors in the log for a while, because the definitions were wrong, but now I don't see anything about it.

Edit: after looking a bit more, I'm thinking it may have to do with the bean's id attribute… but it's not at all clear what that should be.

Solution:  The missing piece was in the web-client-config-custom.xml file… Needed to add the "Action Wizard" bit tell alfresco to use that new aspect.  I'm on my way now, but still don't know if that id has anything to do with it :) (I changed in to extension.dictionaryBootstrap like I've seen in a few examples.)

Outcomes