Sunday, October 3, 2010

Creating Shuttle Component in Oracle ADF


In this post we will see how to create select many Shuttle component in Oracle ADF.

af:selectManyShuttle component requires leading and trailing values  as java.util.List you can create a List from your iterator or static values.

Download sample code

More info in this video

Happy Jdeveloping,
Zeeshan Baig


  1. Hey Baig I watched your video and I tried implementing your application but I get the following error

    javax.faces.el.EvaluationException: java.lang.ClassCastException: java.lang.Integer cannot be cast to oracle.jbo.domain.Number

    I checked all of my entities and views and i don't have an integer value anywhere.

    I also checked the source of my bean, my page and my pagedef file and no integer anywhere

  2. Hi,

    Problem is in your code. check your bean code must be some attribute with Integer.

    make sure you import oracle.jbo.domain.Number in your bean class

  3. Baig

    I copied the code from your bean and the only thing I can think of is this piece of code you have in your multi shuttle. Any chance I could convert this to a number before I put it into the database and that way avoid the error?

    if (this.getSelectedFruits().size() > 0) {
    for (int i = 0; i < selectedFruits.size(); i++) {

    Row row = iter.getRowSetIterator().createRow();

    row.setAttribute("TehOprId", getCurrentPersonId());
    row.setAttribute("AdslId", getSelectedFruits().get(i));

  4. its hard to tell how you are doing this.

    make sure the data type in Entity is Number. you can email me your project

  5. The data type in entity is number and I have imported number in the bean. I don't have your email

  6. there is a big button on the top

    zeeshan dot baig82 at gmail dot com

  7. I sent you the email with my project, I just wanna say thanks for taking the time and effort to help me with this.

  8. Baig I solved it.

    In the page definition where we create a binding for the ID file there was a mistake, since I already have that id file binded (to a different iterator for something completely different) it added a 1 when I binded it again. And I didn't even notice it, I just looked past it, and in the backing bean I wrote it without the 1 at the end. Que billion errors raining upon me like a hailstorm of hate.

    Anyhoo just wanna say thanks for your support, the fact that people who actually know this stuff will help in case I get stuck is what gives me hope and gets me through most of my problems with Jdev.

  9. well i havnt received any email from you. any ways nice to see that you have resolved.


  10. Hello Zeeshan,
    This may sound as a dumb question, but I am more interested in the selectOneChoice list at the top for displaying the person name. How did you accomplish that so that it pulled the names from the database. I am having a hard time doing that. Can you kind of point out the "outline" on how you accomplished that? Would really really appreciate that.

  11. I dropped the Persons executable from data control as selectOneChoice.

  12. Can it be done without using View Object? Using a session bean instead?? Any ideas!!

  13. There is only 2 methods to get data dynamic and static

    Dynamic will come from any stored data in my case it is coming from table.

    Static can be build in the bean.

    so what is you use case i dont understand.

    a good example is there of doing both but i think you are aware of this post

  14. Yeah. I have looked at TOO many places =D
    But thanks for your help! I think something is wrong in my java code that I am not able to figure out so I was trying to see if there could be a way without the coding.

  15. Hey Baig

    I made my multishuttle based on your blog post about creating it, except I used select one choice instead of tree. The problem I have now is that I need it to be a detail in a master detail relationship. So no select one choice, it changes when I press the navigation buttons for the master form which is based on a database table which is part of a many to many relationship that I need the shuttle for (am using an intersection table obviously).

    If you can help I would really appreciate it greatly.

  16. Hi Baig

    Thank you for your shuttle component sample. We used it in a project.
    Let's say you had hundreds of users in the persons table and the VO was a read only VO, and you wanted to add an auto suggest behaviour in order to make it more convenient.
    How would you do it?

    Many thanks

    1. I believe in that case shuttle component is not suitable item but you can filter the shuttle source based on some parameters.

      1. I would say create input text and a button.
      2. Pass parameter to your VO via bind variable from that input text.
      3. Refresh the iterator of Shuttle source.

      Hope it helps,

  17. hi ZB,

    nice post i am using the same.but some more complex.
    could you please help me on this requirement.
    I have some role with different categories in search i will search role based on categories and i ll shuttle those and i ll search aging from other category i need to add here the proble i am not able to maintain added role.

    how to achieve this,help me on this

  18. ZB,
    Great work.
    One question:
    Does the framework automatically filter "seleced tfruits" for a person from the "all fruits" (Leading list)?

  19. Hi Baig,

    I am new on adf, got stuck into af:selectManyShuttle, My query is that, I have two af:selectManyShuttle
    1. Shuttle is for all the countries and
    2. Shuttle is all the port which is dependent on the country

    now after selecting country, i get country code which is i m passing into port vo, after executing port vo i m getting all the port which is dependent on country, when i m selecting multiple or single port, then on commit port array list got blank, i don't know whts the error is coming, please do the needful. please see below given 2 methods and tell me wheres i m going wrong.
    public static List selectItemsForIterator(String iteratorName, String valueAttrName,
    String displayAttrName) {
    BindingContext bc = BindingContext.getCurrent();
    DCBindingContainer binding = (DCBindingContainer)bc.getCurrentBindingsEntry();
    DCIteratorBinding iter = binding.findIteratorBinding(iteratorName);
    List selectItems = new ArrayList();
    for (Row r : iter.getAllRowsInRange()) {
    selectItems.add(new SelectItem(r.getAttribute(valueAttrName), (String)r.getAttribute(displayAttrName)));
    return selectItems;
    public List getAllPorts() {
    if (allPorts == null) {
    //getSelectedCountries() by this method i m getting array list of all the countries
    String formatedString = getSelectedCountries().toString().replace("[", "") .replace("]", "");
    //formatedString array list converted into string
    ViewObjectImpl portVO = this.getAm().getPortMasShuttle1();
    portVO.setWhereClause(" id_country in (0" + formatedString + ")");
    allPorts = selectItemsForIterator("PortMasShuttle1Iterator", "Id", "Description");
    return allPorts;

    Thanks a Lot

    1. Hi,

      Looks like the problem is where you are constructing a 'formatString'.

      Try to put that string in System.out.println and see what is actually building.


  20. HI Zeeshan
    I am new to adf so let me know how to implement below senario

    we have dep dropdown list wen select on any deptid then the corresponding employee details are we`ll get.let me konw how to do

    1. Hi,

      You can use the same example just replace with Dept and Emp tables.


  21. Thanks for this example!!! I managed to customize this for my own case. On the way I had few small problems (forgot to set Autosubmit on the list with Persons (because of this Shuttle component did not get refresh - yes I know this is basics ;-), also had to set some bindings and iterators by hand)

  22. Hi Zeeshan,

    Can we add ADF Tree component instead of List inside Shuffle component ?


    1. Hi,

      Why you would need a tree inside shuttle. I hardly see any use case for it. Can you show any example ?

      Search this blog for Drag and Drop collection you will find table to table copy example which might fit if you need multi attribute assignments.


  23. Hi Zeeshan,
    I've created a project similar to yours bud,
    instead of getting the selected part filled I'm just getting a list of values on the page, also the shuffle itself is disappeared.
    Any idea on how to fix this issue?