6 Replies Latest reply on Aug 20, 2009 11:47 AM by Donald Hook

    ListShuttle Illegal Argument Exception

    Donald Hook Newbie

      I am getting the following exception:

      09:18:01,156 SEVERE [viewhandler] Error Rendering View[/BackTestEdit.xhtml]
      java.lang.IllegalArgumentException
      at org.richfaces.component.UIOrderingBaseComponent.createDataModel(UIOrderingBaseComponent.java:193)
      at org.richfaces.component.UIListShuttle.createDataModel(UIListShuttle.java:358)
      at org.ajax4jsf.component.UIDataAdaptor.getExtendedDataModel(UIDataAdaptor.java:621)
      at org.ajax4jsf.component.UIDataAdaptor.walk(UIDataAdaptor.java:1151)

      Here is my list shuttle Code:

      <rich:listShuttle sourceValue="#{entryTriggerList}"
      targetValue="#{backTestHome.entryTriggers}" var="trigger" listHeight="300"
      listWidth="300" sourceCaptionLabel="Available Entry Triggers"
      converter="#{entryTriggerConverter}"
      targetCaptionLabel="Selected Entry Triggers">
      <rich:column>
      <h:outputText value="#{trigger.entryTriggerName}"></h:outputText>
      </rich:column>
      </rich:listShuttle>

      Here is the converter:

      public class EntryTriggerConverter implements Converter {

      @Override
      public Object getAsObject(FacesContext context, UIComponent component,
      String value) {
      System.out.println("getAsObject executed...");
      System.out.println("Value has this " + value);
      //int index = value.indexOf(':');
      //return new EntryTrigger(value.substring(0, index), value.substring(index + 1));
      return new EntryTrigger();
      }

      @Override
      public String getAsString(FacesContext context, UIComponent component,
      Object value) {
      System.out.println("getAsString executed...");
      System.out.println("Value has this " + value.toString());
      EntryTrigger entryTrigger = (EntryTrigger) value;
      return entryTrigger.getEntryTriggerName();
      }
      }


      Thanks for your help!

        • 1. Re: ListShuttle Illegal Argument Exception
          Ilya Shaikovsky Master

          show your model code also.

          • 2. Re: ListShuttle Illegal Argument Exception
            Donald Hook Newbie

            Here is the model code. Thanks for your insight!

            package com.ddh.model;
            // Generated May 30, 2009 8:20:52 AM by Hibernate Tools 3.2.2.GA

            import java.util.Date;
            import javax.persistence.Column;
            import javax.persistence.Entity;
            import javax.persistence.GeneratedValue;
            import static javax.persistence.GenerationType.IDENTITY;
            import javax.persistence.Id;
            import javax.persistence.Table;
            import javax.persistence.Temporal;
            import javax.persistence.TemporalType;
            import org.hibernate.validator.Length;
            import org.hibernate.validator.NotNull;

            /**
            * EntryTrigger generated by hbm2java
            */
            @Entity
            @Table(name = "ENTRY_TRIGGER")
            public class EntryTrigger implements java.io.Serializable {

            private Integer entryTriggerId;
            private String entryTriggerName;
            private String entryTriggerDescription;
            private String entryTriggerClassName;
            private Date createDate;
            private Date lastUpdateDate;
            private int lastUpdaatedBy;

            public EntryTrigger() {
            }

            public EntryTrigger(String entryTriggerName,
            String entryTriggerDescription, String entryTriggerClassName,
            Date createDate, Date lastUpdateDate, int lastUpdaatedBy) {
            this.entryTriggerName = entryTriggerName;
            this.entryTriggerDescription = entryTriggerDescription;
            this.entryTriggerClassName = entryTriggerClassName;
            this.createDate = createDate;
            this.lastUpdateDate = lastUpdateDate;
            this.lastUpdaatedBy = lastUpdaatedBy;
            }

            @Id
            @GeneratedValue(strategy = IDENTITY)
            @Column(name = "ENTRY_TRIGGER_ID", unique = true, nullable = false)
            public Integer getEntryTriggerId() {
            return this.entryTriggerId;
            }

            public void setEntryTriggerId(Integer entryTriggerId) {
            this.entryTriggerId = entryTriggerId;
            }

            @Column(name = "ENTRY_TRIGGER_NAME", nullable = false, length = 50)
            @NotNull
            @Length(max = 50)
            public String getEntryTriggerName() {
            return this.entryTriggerName;
            }

            public void setEntryTriggerName(String entryTriggerName) {
            this.entryTriggerName = entryTriggerName;
            }

            @Column(name = "ENTRY_TRIGGER_DESCRIPTION", nullable = false)
            @NotNull
            public String getEntryTriggerDescription() {
            return this.entryTriggerDescription;
            }

            public void setEntryTriggerDescription(String entryTriggerDescription) {
            this.entryTriggerDescription = entryTriggerDescription;
            }

            @Column(name = "ENTRY_TRIGGER_CLASS_NAME", nullable = false, length = 50)
            @NotNull
            @Length(max = 50)
            public String getEntryTriggerClassName() {
            return this.entryTriggerClassName;
            }

            public void setEntryTriggerClassName(String entryTriggerClassName) {
            this.entryTriggerClassName = entryTriggerClassName;
            }
            @Temporal(TemporalType.TIMESTAMP)
            @Column(name = "CREATE_DATE", nullable = false, length = 19)
            @NotNull
            public Date getCreateDate() {
            return this.createDate;
            }

            public void setCreateDate(Date createDate) {
            this.createDate = createDate;
            }
            @Temporal(TemporalType.TIMESTAMP)
            @Column(name = "LAST_UPDATE_DATE", nullable = false, length = 19)
            @NotNull
            public Date getLastUpdateDate() {
            return this.lastUpdateDate;
            }

            public void setLastUpdateDate(Date lastUpdateDate) {
            this.lastUpdateDate = lastUpdateDate;
            }

            @Column(name = "LAST_UPDAATED_BY", nullable = false)
            @NotNull
            public int getLastUpdaatedBy() {
            return this.lastUpdaatedBy;
            }

            public void setLastUpdaatedBy(int lastUpdaatedBy) {
            this.lastUpdaatedBy = lastUpdaatedBy;
            }

            }

            • 3. Re: ListShuttle Illegal Argument Exception
              Ilya Shaikovsky Master

              I mean where this list defined? sourceValue="#{entryTriggerList}"

              • 4. Re: ListShuttle Illegal Argument Exception
                Donald Hook Newbie

                here is the definition.

                @Name("backTestHome")
                public class BackTestHome extends EntityHome {

                // DDH added
                private List entryTriggers = new ArrayList();
                private List exitTriggers = new ArrayList();

                /**
                * @return the entryTriggers
                */
                public List getEntryTriggers() {
                return entryTriggers;
                }

                I had put an @DataModel before the definition, but that did not help.

                • 5. Re: ListShuttle Illegal Argument Exception
                  Ilya Shaikovsky Master

                  should be sourceValue="#{backTestHome.entryTriggerList}"

                  • 6. Re: ListShuttle Illegal Argument Exception
                    Donald Hook Newbie

                    This is what I have been using the entityQuery as the source:

                    import com.ddh.model.*;
                    import org.jboss.seam.annotations.Name;
                    import org.jboss.seam.framework.EntityQuery;
                    import java.util.Arrays;

                    @Name("entryTriggerList")
                    public class EntryTriggerList extends EntityQuery {

                    private static final String EJBQL = "select entryTrigger from EntryTrigger entryTrigger";

                    private static final String[] RESTRICTIONS = {
                    "lower(entryTrigger.entryTriggerClassName) like concat(lower(#{entryTriggerList.entryTrigger.entryTriggerClassName}),'%')",
                    "lower(entryTrigger.entryTriggerDescription) like concat(lower(#{entryTriggerList.entryTrigger.entryTriggerDescription}),'%')",
                    "lower(entryTrigger.entryTriggerName) like concat(lower(#{entryTriggerList.entryTrigger.entryTriggerName}),'%')",};

                    private EntryTrigger entryTrigger = new EntryTrigger();

                    public EntryTriggerList() {
                    setEjbql(EJBQL);
                    setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
                    setMaxResults(25);
                    }

                    public EntryTrigger getEntryTrigger() {
                    return entryTrigger;
                    }
                    }


                    I was thinking that the entryTriggerList would be instantiated since it was the source value... but maybe not....