5 Replies Latest reply on Jun 1, 2007 1:41 AM by javalau

    selectManyCheckbox and jBPM variables

    jcv

      Hi,
      i'm using the current console, and in one field i'm trying to use a selectManyCheckbox JSF component for data input, but i got a conversion error. If i use my own bean to capture it, i got no problem, but then i cant set the workflow variable to it's correct value. Any idea on how to use selectManyCheckbox? or change the value of the workflow variable without coupling the bean with the workflow code?

        • 1. Re: selectManyCheckbox and jBPM variables
          kukeltje

          - what conversion error
          - debug info?
          - example process and form?

          or change the value of the workflow variable without coupling the bean with the workflow code?

          What do you mean by this???

          • 2. Re: selectManyCheckbox and jBPM variables
            javalau

            Maybe the selectManyCheckbox value attribute must be a value-binding expression to a property of type List, but the object of list type can not persist in jbpm3.2.

            How to solve the problem ?

            • 3. Re: selectManyCheckbox and jBPM variables
              jcv

               

              "javalau" wrote:
              Maybe the selectManyCheckbox value attribute must be a value-binding expression to a property of type List, but the object of list type can not persist in jbpm3.2.

              How to solve the problem ?


              The problem was that the value attribute was actually a list.
              To solve the problem i had to do something like this:
              <h:inputHidden binding="mybean.binding" value="#{var['workflow value']}" />
              <h:selectManyCheckbox value="mybean.valuehandler">
              ...
              </h:selectManyCheckbox>
              


              The valuehandler property on "set" also set the value for the input hidden as a csv string.

              My knoledge of JSF and JSP isnt too good, but this is the best thing i could do so far.

              • 5. Re: selectManyCheckbox and jBPM variables
                javalau

                I always get the error:
                Conversion Error setting value 'XXX1 XXX2 XXX3 XXX4' for '#{var[XXXX]}'.

                public class ArrayStringConverter implements Converter {

                private static final long serialVersionUID = 1L;

                public boolean supports(Object value) {
                if (value == null)
                return true;
                return (value.getClass() == String[].class);
                }

                public Object convert(Object o) {
                StringBuffer convertedValue = null;
                if (o != null) {
                // String[] strArray = (String[]) ((Collection) o).toArray();
                String[] strArray = (String[]) o;
                for (int i = 0; i < strArray.length; i++) {
                convertedValue.append(strArray);
                if (i != strArray.length - 1) {
                convertedValue.append("|");
                }
                }
                }
                return convertedValue.toString();
                }

                public Object revert(Object o) {
                // Map revertedValue = null;
                String[] strArray = null;
                if (o != null) {
                strArray = ((String) o).split("\\|");
                /*
                * revertedValue = new HashMap(); for (int i = 0; i <
                * strArray.length; i++) { revertedValue.put(strArray
                ,
                * strArray); }
                */
                }
                return strArray;
                }
                }


                <!-- String[] -->
                <jbpm-type>






                <variable-instance class="org.jbpm.context.exe.variableinstance.StringInstance" />
                </jbpm-type>