cancel
Showing results for 
Search instead for 
Did you mean: 

DocumentLibrary: Custom Content Type and Aspect

lamba
Champ on-the-rise
Champ on-the-rise
Hello everybody,

I try the following example http: // blogs.alfresco.com / wp / wabson / 201 sco-share / to add an aspect personalized in Share:

I created the following files:

kb-model.xml in share\WEB-INF\classes\alfresco\extension

    <?xml version="1.0" encoding="UTF-8"?>

    <!– Definition of new Model –>

    <!– The important part here is the name - Note: the use of the my: namespace
         which is defined further on in the document –>
    <model name="kb:knowledgebase" xmlns="http://www.alfresco.org/model/dictionary/1.0">

       <!– Optional meta-data about the model –>
       <description>Knowledge Base Model</description>
       <author>Will Abson</author>
       <version>1.0</version>

       <!– Imports are required to allow references to definitions in other models –>
       <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 my.new.model should be changed to reflect your own namespace –>
       <namespaces>
          <namespace uri="http://www.alfresco.com/model/knowledgebase/1.0" prefix="kb"/>
       </namespaces>

        <aspects>

          <!– Definition of new Content Aspect: Knowledge Base Document –>
          <aspect name="kb:referencable">
             <title>Knowledge Base Referencable</title>
             <properties>
                <property name="kb:documentRef">
                   <type>d:text</type>
                </property>
             </properties>
          </aspect>

       </aspects>

    </model>


kb-model-context.xml in share\WEB-INF\classes\alfresco\extension

    <?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/kb-model.xml</value>
                </list>
            </property>
        </bean>

    </beans>


custom-slingshot-application-context.xml in share\WEB-INF\classes\alfresco\web-extension

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

    <beans>

       <!– Override WebScript Messages - add slingshot application messages –>
       <bean id="webscripts.resources" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
          <property name="resourceBundles">
             <list>
                <value>webscripts.messages.webscripts</value>
                <value>alfresco.messages.slingshot</value>
                <value>alfresco.web-extension.messages.knowledgebase</value>
             </list>
          </property>
       </bean>

    </beans>


share-config-custom.xml in share\WEB-INF\classes\alfresco\web-extension

    <alfresco-config>
    <config evaluator="aspect" condition="kb:referencable">
        <forms>
           <form>
              <field-visibility>
                 <!– inherited from cm:content –>
                 <show id="cm:name" />
                 <show id="cm:title" force="true" />
                 <show id="cm:description" force="true" />
                 <show id="mimetype" />
                 <show id="cm:author" force="true" />
                 <show id="size" for-mode="view" />
                 <show id="cm:creator" for-mode="view" />
                 <show id="cm:created" for-mode="view" />
                 <show id="cm:modifier" for-mode="view" />
                 <show id="cm:modified" for-mode="view" />
              
                 <!–  aspect orb:referencable –>            
                 <show id="kb:documentRef" />
               </field-visibility>
            
              <appearance>
                 <field id="kb:documentRef" label-id="label.kb_documentRef" />
              </appearance>
           </form>
        </forms>
    </config>
    </alfresco-config>

knowledgebase.properties in share\WEB-INF\classes\alfresco\messages

    # Custom knowledge base messages
    label.kb_documentRef=KB Reference
    kb_referencable=Knowledge Base Referencable


And I added the aspect in the aspects.get.config.xml file so that it appears in the window of dialogue " Manage Aspect ". I added:

    <aspect name="{http://www.alfresco.org/model/content/1.0}referencable" />


The problem is, when I try to apply the aspect to a document, it return me the error message " Could not update aspect ".

For those who have already success this, is these steps that I try to add my custom aspect are correct?
What is that I missed anything?

Thank you.
1 REPLY 1

lamba
Champ on-the-rise
Champ on-the-rise
another question, how to add a custom content type? The approach for the addition of a custom aspect is it valid for a custom content type?

the link of the example I tried is: http://blogs.alfresco.com/wp/wabson/2010/02/25/adding-custom-aspect-support-in-alfresco-share/


thanks in advance.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.