AnsweredAssumed Answered

Custom Model Creation

Question asked by thaneshk on Mar 9, 2006
Latest reply on Mar 10, 2006 by gavinc
Hi, I created a sample model called tkflowmodel.xml and tkflow-model-context.xml, including the web-client-config.xml.

I am currently using Alfresco .1.2 RC

I placed all three {removing everything else that existed in the dirs before } under

alfresco\boss\server\default\conf\alfresco\extension &

alfresco\jboss\server\default\deploy\alfresco.war\WEB-INF\classes\alfresco\extension

My code is as follows



[b]tkflowModel.xml[/b]

<?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 name="tk:tkflowModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>  
   <description>Custom Model</description>
   <author></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>

   <!– 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="tk.flow.model" prefix="tk"/>
   </namespaces>
     
</model>
  
   <types>
     
         <!– Definition of new Content Type: Image Type –>
         <type name="tk:asset">
            <title>Asset</title>
            <parent>cm:content</parent>
            <properties>
               <property name="tk:assettype">
                  <type>d:text</type>
               </property>
               <property name="tk:thumbnail">
                  <type>d:text</type>
               </property>
            </properties>
           
         </type>
        
    </types>
   
   
      <aspects>
         
          <!– Definition of new Content Aspect: Image Classification –>
          <aspect name="tk:imageClassification">
             <title>Image Classfication</title>
             <properties>
                <property name="tk:width">
                   <type>d:int</type>
                </property>
                <property name="tk:height">
                   <type>d:int</type>
                </property>
                <property name="tk:resolution">
                   <type>d:int</type>
                </property>
             </properties>
          </aspect>
         
   </aspects>
     
</model>





[b]tkflow-model-context.xml[/b]

<?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="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/tkflowModel.xml</value>
            </list>
        </property>
    </bean>
         
</beans>





[b]
web-client-config.xml[/b]

<alfresco-config>

   <!– The config below shows how to incorporate the –>
   <!– example model into the web client             –>
   <!–
   <config evaluator="string-compare" condition="Custom Content Types">
      <content-types>
         <type name="tk:asset" />
      </content-types>
   </config>

   <config evaluator="node-type" condition="tk:asset">
      <property-sheet>
         <show-property name="name" showInEditMode="false" />
         <show-property name="mimetype" displayLabelId="mimetype" converter="org.alfresco.faces.MimeTypeConverter" showInEditMode="false" />
         <show-property name="title" showInEditMode="false" />
         <show-property name="description" showInEditMode="false" />
         <show-property name="size" displayLabelId="size" converter="org.alfresco.faces.ByteSizeConverter" showInEditMode="false" />
         <show-property name="tk:assettype" />
         <show-property name="tk:thumbnail" />
      </property-sheet>
   </config>

   <config evaluator="aspect-name" condition="tk:imageClassification">
      <property-sheet>
         <show-property name="tk:width"/>
         <show-property name="tk:height"/>
         <show-property name="tk:resolution"/>
      </property-sheet>
   </config>

   <config evaluator="string-compare" condition="Action Wizards">
      <aspects>
         <aspect name="tk:imageClassification"/>
      </aspects>
   </config>
   –>

</alfresco-config>


Now when i did this with "exampleModel.xml" I was atleast able to see the content type " Standard Procedure Operation" when creating a piece of content. Now I cannot even see my own type. What more modification should I make.

Please let me know.

Thank You

Outcomes