AnsweredAssumed Answered

Simpe test. Problem with .properties

Question asked by sversh71 on Aug 27, 2009
Latest reply on Aug 27, 2009 by sversh71
Hello, people!

I’m newbie in alfresco and my current learning theme is advanced workflow.  As the base for my experiments I took an example from the book “Alfresco Developers Guide” by J.Potts.
It’s a simple workflow process with the simple UI for the first and only task in it.
So what I did …

1. HelloWorldModel.xml

<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="hw:workflowmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <!– Optional meta-data about the model –>
   <description>Someco Workflow Model</description>
   <author>SeVer</author>
   <version>1.0</version>
   <!– Imports are required to allow references to definitions in other models –>
   <imports>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
      <import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm" />
   </imports>
   <!– Introduction of new namespaces defined by this model –>
   <namespaces>
      <namespace uri="http://www.someco.com/model/workflow/1.0" prefix="hw" />
   </namespaces>
   <types>
      <type name="hw:submitHelloWorldTask">
         <parent>bpm:startTask</parent>
         <properties>
            <property name="hw:helloName">
               <type>d:text</type>
               <mandatory>true</mandatory>
               <multiple>false</multiple>
            </property>
            <property name="hw:helloOther">
               <type>d:text</type>
               <mandatory>false</mandatory>
               <multiple>false</multiple>
            </property>
         </properties>
      </type>
   </types>
</model>

I loaded this as document into Data Dictionary > Models space and made it active.



2.  HelloWorldProcessDefinition.xml


<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="hw:helloWorld">
   <start-state name="start">
      <task name="hw:submitHelloWorldTask" />
      <transition name="" to="hello"></transition>
   </start-state>   

   <node name="hello">
      <transition name="" to="end1">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
               <variable name="hw_helloName" access="write"/>
               <expression>
                  logger.log("Hello, " + hw_helloName + "!");
               </expression>
            </script>
         </action>
      </transition>
   </node>

   <end-state name="end1"/>
</process-definition>

I loaded this as document into Data Dictionary > Workflow Definitions space and made it active. As you can see it has only one action which do nothing except writes into the log the string entered by user in startTask.

3. web-client-config-custom.xml

<alfresco-config>
   <config evaluator="string-compare" condition="Languages">
      <languages>
         <language locale="ru_RU">Russian</language>
      </languages>
   </config>
   <config evaluator="node-type" condition="hw:submitHelloWorldTask" replace="true">
      <property-sheet>
         <show-property name="hw:helloName" />
         <show-property name="hw:helloOther" />
      </property-sheet>
   </config>
</alfresco-config>

I added appropriate settings to the web-client-config-custom.xml


4. HelloWorld.properties


#
# Hello World UI Workflow
#

# HelloWorldModel related strings
hw_workflowmodel.type.hw_submitHelloWorldTask.title=Start Hello World UI Workflow
hw_workflowmodel.type.hw_submitHelloWorldTask.description=Submit a workflow that says hello in the log
hw_workflowmodel.property.hw_helloName.title=Name
hw_workflowmodel.property.hw_helloName.description=Say hello to this person
hw_workflowmodel.property.hw_helloOther.title=Something Other
hw_workflowmodel.property.hw_helloOther.description=Enter something here

# processdefinition related strings
hw_helloWorld.workflow.title=Hello World UI
hw_helloWorld.workflow.description=A simple hello world process

I loaded this as document into Data Dictionary > Messages space and made it active in Repository Admin console entered a command “reload messages HelloWorld”


After that steps all are working as I expect except some little problems with resources - HelloWorld.properties.
This problems are:

The processdefinition related strings works properly – I see name and description of my process in alfresco User Interface as described in hw_helloWorld.workflow.title and hw_helloWorld.workflow.description.
But I don’t see titles for my custom properties as described in hw_workflowmodel.property.hw_helloName.title and hw_workflowmodel.property.hw_helloOther.title.
Certainly I can set these titles in web-client-config-custom.xml something like that:

<property-sheet>
   <show-property name="hw:helloName" display-label="Hello Name"/>
   <show-property name="hw:helloOther" display-label="Other Name"/>
</property-sheet>

But it’s not suit me. I need this strings to be internationalized. English or Russian depends on login.
I can’t find where is the problem. Maybe in names? (hw_workflowmodel.property.hw_helloName.title, hw_workflowmodel.property.hw_helloOther.title)

And one more problem. The resource file HelloWorld.properties doesn’t load automatically when server is restarted. Every time I should reload it by hand in Repository Admin console. What should I do for loading resources automatically?


Thank you.
Serg.

Outcomes