Search code examples
ofbiz

org.ofbiz.base.util.UtilMisc "error"


I got a problem with a function of ofbiz, which I can't explain:

The following code is marked with an error (in eclipse):

UtilMisc = org.ofbiz.base.util.UtilMisc

The method toList(T, T, T, T, T, T) in the type UtilMisc is not applicable for the arguments (Object, Object, Object, Object, Object, Object, Object, Object)

List fieldValues = UtilMisc.toList(
                            dataObj.get("object_name"),
                            dataObj.get("mte_name"),
                            dataObj.get("system_id"),
                            dataObj.get("sap_ref"),
                            dataObj.get("limit_1"),
                            dataObj.get("limit_2"),
                            dataObj.get("editable"),
                            dataObj.get("id"));         

If I remove two objects (does not matter which one), the error is gone.

Can anybody tell me what's wrong here?

Regards LStrike


Solution

  • I figured it out.

    http://opensourcejavaphp.net/java/ofbiz/org/ofbiz/base/util/UtilMisc.java.html

    You can pass at maximum six single objects or a collection. So I made two lists and concatenated them.

    List fieldValues = UtilMisc.toList(
                                dataObj.get("object_name"),
                                dataObj.get("mte_name"),
                                dataObj.get("system_id"),
                                dataObj.get("sap_ref"), 
                                dataObj.get("limit_1"),
                                dataObj.get("limit_2"));
    
                        List fieldValues2 = UtilMisc.toList(
                                dataObj.get("editable"), 
                                dataObj.get("id"));
    
                        fieldValues.addAll(fieldValues2);