webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Manually create result provider for dropdown selection list

    Posted Mon March 07, 2011 09:36 PM

    The CAF object “dropdown - single-select dropdown” requires an Option or Option Group of type “SelectItem”, which are usually generated automatically using a Content Provider of type “com.webMethods.caf.faces.data.object.BoundPropertiesSelectItemGroupProvider”, associated with a service result set.

    I need to create a set of selections manually in CAF, but so far have not been able to create a result provider and manipulate its contents, such as:

    private com.webMethods.caf.faces.data.object.BoundPropertiesSelectItemGroupProvider resultProvider = null;
    this.getResultProvider().getList().clear();
    javax.faces.model.SelectItem item = new javax.faces.model.SelectItem();
    item.setLabel(“SOME LABEL”);
    item.setValue(“SOME VALUE”);
    this.getResultProvider().getList().add(item);

    The above does not work. Is there a better way to do this?
    Thanks!


    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods


  • 2.  RE: Manually create result provider for dropdown selection list

    Posted Mon March 07, 2011 11:58 PM

    Ok, so I found a way to make it work, based on the SAG documentation for “BoundPropertiesSelectItemGroupProvider”:

    I declared a bean managed property to store the provider:

    private com.webmethods.caf.faces.data.object.BoundPropertiesSelectItemGroupProvider resultProvider = null;
    

    Then, I created a class of my very own to store the items:

    public class MyItem {
    public String value;
    public String label;
    public MyItem() {}
    public String getValue() {
    return this.value;
    }
    public String getLabel() {
    return this.label;
    }
    public void setLabel(String label) {
    this.label=label;
    }
    public void setValue(String value) {
    this.value=value;
    }
    }

    Then in the view class I had to use my class to populate a List:

    	    java.util.List list = new java.util.ArrayList();
    MyItem item = new MyItem();
    item.setLabel("label text");
    item.setValue("value text");
    list.add(item);
    

    Then I added the list to the Provider:

    	    this.resultProvider = new BoundPropertiesSelectItemGroupProvider(list, "item", "#{item.value}", "#{item.label}");
    

    Finally I could bind the Option Group of the dropdown to the provider, and it works!


    #webMethods-BPMS
    #MWS-CAF-Task-Engine
    #webMethods


  • 3.  RE: Manually create result provider for dropdown selection list

    Posted Fri April 29, 2011 12:16 AM

    Hi Paul -
    Thanks for posting your resolution. I need to do something similar!


    #webMethods-BPMS
    #webMethods
    #MWS-CAF-Task-Engine


  • 4.  RE: Manually create result provider for dropdown selection list

    Posted Tue July 16, 2013 08:38 AM

    Hi

    Thanks for this explanation - brilliant. Just a note to future generations: when you bind to this in your Option Group value, it (at least version 8.2) will show a warning saying:

    Ignore this. A BoundPropertiesSelectItemGroupProvider falls into this category; it’s just a bug in the Designer warnings code.


    #webMethods-BPMS
    #webMethods
    #MWS-CAF-Task-Engine