[jboss-user] [JBoss jBPM] - Re: selectManyCheckbox and jBPM variables

javalau do-not-reply at jboss.com
Fri Jun 1 01:41:36 EDT 2007


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>

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050378#4050378

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050378



More information about the jboss-user mailing list