3 Replies Latest reply on Jan 25, 2010 8:38 PM by cbensemann

    JBPM task description localization via EL

    roben

      As stated before, i am trying to create a dynamic jbpm toto-List for my app. I also want do include the task description for each task, which should be dynamic resolved for internationalization.


      For example this task:


      <task-node name="approve request">
           <task name="consider request">
                <description>
                     #{msg.license_request_consider}
                </description>
                <assignment pooled-actors="#{licenseRequestAssigner.approvers}"></assignment>
           </task>
           <transition to="acknowledge denial" name="denied"></transition>
           <transition to="acknowledge approval" name="approved"></transition>
      </task-node>



      The pooled-actors are resolved properly but the description remains unchanged so that the el-expression will be printed out in the view. Is this the normal behaviour?

        • 1. Re: JBPM task description localization via EL
          cbensemann

          I have found the same behaviour. Basically the EL in description appears to resolve variables that are stored in the BUSINESS_CONTEXT only. I will try to document the work around I am using below.


          In your task definition do something like this:


          <task\-node name\="approve request">
              <task name\="consider request" description="#{description}">
              </task>
          </task\-node>



          Then in your controller bean you would have something like:


              @Out(scope = ScopeType.BUSINESS_PROCESS, required = false)
              private String description;
          
              @In private Map<String, String> messages;
          
              //other class code omitted
          
              @EndTask
              public String save() {
                  description = messages.get("my_descripton_key");
                  // your other processing code here
              }
          



          Hope this makes sense.

          • 2. Re: JBPM task description localization via EL
            roben

            Thank you. But I solved this problem in a different way: i simply stored the message-key in the task description and let the view resolve it. This has some benefits i didn't think of the first time. Firstly if you update your message-bundle the task-descriptions will be updated too and secondly if people with different locales are working on the same task they would get only the translation from the actor who started the task if it were resolved upon task-deployment.

            • 3. Re: JBPM task description localization via EL
              cbensemann

              I figured you had solved it as it was such an old post. I just found it while I was looking for a solution to a similar problem and thought I would share my solution. Thanks for sharing yours - I hadn't thought of sharing a message key but I'm sure that will come in handy in the future. I needed to store the actual values as they are user entered description fields so I don't need to worry about internationalization.