Announcement Announcement Module
Collapse
No announcement yet.
Complex workflow and AbstractWizardFormController Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Complex workflow and AbstractWizardFormController

    Hi all, I am working with spring for the past two weeks and am discovering step by step all its nice features. This is really a great job, thanks to the designers.

    I came around an issue when trying to adapt a complex workflow to the AbstractWizardFormController. The main point here, is that we have a list of pages, let say from 1 to 20, and that depending on the user's choices on these pages, the workflow will be set up dynamicaly.

    For now, my first guess, will be to set up, the longuest workflow with the setPages method like
    Code:
    setPages(new String[] {1,2,3,4,5,6,7,8...,20})
    and then to check on each submit, inside the getTargetPage which will be the next page do display depending on the user's choices.
    (like)
    Code:
    protected int getTargetPage(HttpServletRequest request, Object command, Errors errors, int currentPage) {
                       int nextPage = currentPage + 1; 
                       while(!isAuthorized(nextPage,command)) {
                                    nextPage = nextPage + 1;
                       }
    return nextPage;
    }
    The isAuthorized method, will return true or false for each page, depending on the bean command containing all the user's choices. like
    Code:
    public boolean isAuthorized(int page, Object command) {
                     MyBean l_bean = (MyBean) command; 
                     switch (page) {
                               case 2 : if (l_bean.isBox2checked) {true;} else {false;}
                                .....
                               default : true; 
                    }
    }
    In order to handle the back button, and because, first we don't want to use the session, second, we don't want to go to the process of isAuthorized a second time, we were thinking about having the history of the visited pages in a hidden field of each form sent to the user. The history will be a list of all the pages visited in order, so we ll know which one was the last one before the user clicked on back.

    The main problem of this solution from my point of view is that, since we have several worflows to determine (around 40), they will be all hardcoded in the isAuthorized methods, and not in a configuration file. This will make our workflow hard to maintain, if a bean property disappear, or a step is added.

    Here is my guess, I would like to have your advices, and share your experience, if some of you did work on the same kind of issue.

    Thanks a lot.

    Olivier
Working...
X