AnsweredAssumed Answered

Resouce Bundle Not Working???

Question asked by phlpittsny on Jan 5, 2011
Latest reply on Jan 26, 2011 by frankb
I am running Alfresco 3.3 CE. I am trying to add a new content model to Alfresco and expose it in Share.
Altogether it's going OK (slow, but OK). However, now I am stumped.

I am trying to use a Resource Bundle to specify the strings to use for added types in the Change Type
dialog. I cannot get the Resource Bundle to work.

MORE DETAIL
I have added a number of new types (such as sc:doc, sc:marketingDoc, gccis:doc, gccis:CPF, etc) to the system and exposed
them to share via alfresco/web-extension/share-config-custom.xml. See snippet below…


      <types>
         <type name="cm:content">
               <subtype name="sc:doc" />
               <subtype name="sc:marketingDoc" />
               <subtype name="sc:whitepaper" />
               <subtype name="sc:hrDoc" />
               <subtype name="sc:salesDoc" />
               <subtype name="sc:opsDoc" />
               <subtype name="sc:legalDoc" />

               <subtype name="gccis:doc" />
               <subtype name="gccis:CPF" />
         </type>

         <type name="cm:folder">
         </type>

      </types>

However, when I try (in share) to Change Type of a document the new types all show up as
type.sc_doc, type.sc_marketingDoc, type.gccis_doc, type.gccis_CPF, etc. I would like to use more
human consumable strings than this.

I have tried to solve this with a Resource Bundle as follows:

In the file alfresco/web-extension/custom-slingshot-application-context.xml I added the code:

   <!– override WebScript Messages - add slingshot application messages –>

   <bean id="webscripts.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
      <property name="resourceBundles">
         <list>
            <value>webscripts.messages.webscripts</value>
            <value>alfresco.messages.common</value>
            <value>alfresco.messages.slingshot</value>
            <value>alfresco.web-extension.messages.gccis</value>
         </list>
      </property>
   </bean>

THEN, in alfresco/web-extension/messages/gccis.properties (I created the messages directory and the
gccis.properties file) I placed the following text in the gccis.properties file.


description="GCCIS Content Model"

type.gccis_doc=GCCIS Document
gccis_doc=GCCIS Document
type.gccis_CPF=Course Proposal Form
gccis_CPF=Course Proposal Form
property.approval_id=APPROVAL:
approval_id=APPROVAL:

This is a little overkill, I know, but I tried several iterations of this …
The gccis:doc and gccis:CPF types still show up in Change Type as type.gccis_doc and type.gccis_CPF
in the Change Type dialog.

Can anyone give me a pointer???



EVEN MORE DETAIL FOR BACKGROUND
The sc: namespace is the vaunted someCo namespace from the Potts book. The gccis: namespace is a new namespace I
am trying to add for a new content model. These are defined in separate files in alfresco/extension (someco-model-context.xml
and gccis-model-context.xml) and in the files referenced respecitvely from these (model/scModel.xml and model/gccisModel.xml).

someco-model-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>
    <!– Registration of new models –>
    <bean id="someco.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/model/scModel.xml</value>
                <value>alfresco/extension/model/scWorkflowModel.xml</value>
            </list>
        </property>
    </bean>

    <bean id="extension.workflowBootstrap" parent="workflowDeployer">
        <property name="labels">
            <list>
                <value>alfresco.extension.scWorkflow</value>
            </list>
        </property>
    </bean>
</beans>

gccis-model-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>
    <!– Registration of new models –>
    <bean id="gccis.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/model/gccisModel.xml</value>
            </list>
        </property>
    </bean>

</beans>

ALSO … scModel.xml

<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="sc:somecomodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>
   <description>Someco Model</description>
   <author>Optaros</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" />
      <import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />
   </imports>

   <!– Introduction of new namespaces defined by this model –>
   <namespaces>
      <namespace uri="http://www.someco.com/model/content/1.0" prefix="sc" />
   </namespaces>

    <constraints>
           <constraint name="sc:campaignList" type="LIST">
              <parameter name="allowedValues">
                 <list>
                    <value>Application Syndication</value>
                    <value>Private Event Retailing</value>
                    <value>Social Shopping</value>
                 </list>
              </parameter>
           </constraint>
        </constraints>

   <types>
      <!– Enterprise-wide generic document type –>
      <type name="sc:doc">
         <title>Someco Document</title>
         <parent>cm:content</parent>
                        <associations>
                           <association name="sc:relatedDocuments">
                              <title>Related Documents</title>
                              <source>
                                 <mandatory>false</mandatory>
                                 <many>true</many>
                              </source>
                              <target>
                                 <class>sc:doc</class>
                                 <mandatory>false</mandatory>
                                 <many>true</many>
                              </target>
                           </association>
                        </associations>

                        <mandatory-aspects>
                           <aspect>cm:generalclassifiable</aspect>
                        </mandatory-aspects>
      </type>

      <type name="sc:marketingDoc">
         <title>Someco Marketing Document</title>
         <parent>sc:doc</parent>
                        <properties>
                           <property name="sc:campaign">
                              <type>d:text</type>
                              <multiple>true</multiple>
                              <constraints>
                                 <constraint ref="sc:campaignList" />
                              </constraints>
                           </property>
                        </properties>
      </type>

      <type name="sc:whitepaper">
         <title>Someco Whitepaper</title>
         <parent>sc:marketingDoc</parent>
      </type>   

                <type name="sc:hrDoc">
                        <title>Someco HR Document</title>
                        <parent>sc:doc</parent>
                </type>

                <type name="sc:salesDoc">
                        <title>Someco Sales Document</title>
                        <parent>sc:doc</parent>
                </type>

                <type name="sc:opsDoc">
                        <title>Someco Operations Document</title>
                        <parent>sc:doc</parent>
                </type>

                <type name="sc:legalDoc">
                        <title>Someco Legal Document</title>
                        <parent>sc:doc</parent>
                </type>

   </types>
       
        <aspects>
           <aspect name="sc:webable">
              <title>SomeCo Webable</title>
              <properties>
                 <property name="sc:published">
                    <type>d:date</type>
                 </property>
                 <property name="sc:isActive">
                    <type>d:boolean</type>
                    <default>false</default>
                 </property>
              </properties>
           </aspect>
           
           <aspect name="sc:clientRelated">
              <title>SomeCo Client Related</title>
              <properties>
                 <property name="sc:clientName">
                    <type>d:text</type>
                    <mandatory>true</mandatory>
                 </property>
                 <property name="sc:projectName">
                    <type>d:text</type>
                    <mandatory>false</mandatory>
                 </property>
              </properties>
           </aspect>
        </aspects>

</model>

and finally gccisModel.xml

<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="gccis:gccismodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>
   <description>GCCIS Model</description>
   <author>GCCIS</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" />
      <import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />
   </imports>

   <!– Introduction of new namespaces defined by this model –>
   <namespaces>
      <namespace uri="http://www.gccis.rit.edu/model/content/1.0" prefix="gccis" />
   </namespaces>

    <constraints>
        </constraints>

   <types>
      <!– Enterprise-wide generic document type –>
      <type name="gccis:doc">
         <title>GCCIS Document</title>
         <parent>cm:content</parent>
                        <associations>
                        </associations>

                        <mandatory-aspects>
                           <aspect>cm:generalclassifiable</aspect>
                        </mandatory-aspects>
      </type>

      <type name="gccis:CPF">
         <title>Course Proposal Form</title>
         <parent>gccis:doc</parent>
                        <properties>
                           <property name="gccis:approval">
                              <type>d:text</type>
                              <multiple>false</multiple>
                              <constraints>
                              </constraints>
                           </property>
                        </properties>
      </type>
   </types>
       
        <aspects>
        </aspects>

</model>

Thanks in advance …

Outcomes