2 Replies Latest reply on May 15, 2009 5:24 PM by locrianmode

    Wicket Jbpm

    locrianmode

      Hi,


      I'm trying to port the seam todo example to Wicket. I've managed to insert task instances but how do I retrieve the task list like in the seam todo example? In the todo.jsp in the example, task lists are retrieved with the #{taskInstancePriorityList} variable. How do I do this in Wicket?


      What would be the correct scope for the injected TaskInstancePriorityList?


      Below is what I have. In this case, taskInstancePriorityList is always null.


      Thanks.


      public class HomePage extends BasePage {
      
          @In
          Actor actor;
          @In(create = true)
          Login login;
          @In(required = false, scope = ScopeType.APPLICATION)
          TaskInstancePriorityList taskInstancePriorityList;
          @In(create = true)
          TodoList todoList;
          List<TaskInstance> taskInstances = new ArrayList<TaskInstance>();
      
          public HomePage() {
              if (taskInstancePriorityList != null) {
                  setTaskInstances(taskInstancePriorityList.getTaskInstanceList());
              }
              ListView view = new ListView("taskInstances", new PropertyModel(this, "taskInstances")) {
      
                  @Override
                  protected void populateItem(ListItem item) {
                      TaskInstance taskInstance = (TaskInstance) item.getModelObject();
                      item.add(new Label("id", new Model(taskInstance.getId())));
                  }
              };
              add(view);
              Form form = new Form("form") {
      
                  @Override
                  protected void onSubmit() {
                      ValueMap values = (ValueMap) getModelObject();
                      String description = values.getString("description");
                      todoList.setDescription(description);
                      todoList.createTodo();
                      super.onSubmit();
                  }
              };
              form.setModel(new CompoundPropertyModel(new ValueMap()));
              form.add(new TextField("description"));
              add(form);
          }
      
          public List<TaskInstance> getTaskInstances() {
              return taskInstances;
          }
      
          public void setTaskInstances(List<TaskInstance> taskInstances) {
              this.taskInstances = taskInstances;
          }
      }
      

        • 1. Re: Wicket Jbpm
          cpopetz

          Your injection needs to be:


          @In(create=true) List<TaskInstance> taskInstancePriorityList;



          Because the JSF EL you're replicating will autocreate the taskInstancePriorityList if it doesn't exist and taskInstancePriorityList unwraps itself as a list of TaskInstances.


          Note that BPM annotations won't work on Wicket components directly, but for this example that's ok, as the annotations are on TodoList itself.


          -Clint

          • 2. Re: Wicket Jbpm
            locrianmode

            Works! Thanks Clint.