Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Home

mfarid edited this page · 31 revisions
Clone this wiki locally

Grails Flow Manager Plugin

This plugin helps you to make an application with shopping cart like functionality. It's an easy way to have alternative of grails webflow. This plugin has been created using Grails-1.3.7..

Example- I have a use case like for creating an Appointment for a Student with an Adviser. There would be steps like as follows:

If an Admin Initiating creation of Appointment

  • first step: Select appointment Type of that appointment
  • second step: Select adviser of that appointment.
  • third step: Select student.
  • fourth step: Select location for appointment.
  • final step: make appointment.

If a student Initiating creation of Appointment

  • first step: Select appointment Type of that appointment
  • second step: Select adviser of that appointment.
  • third step: Select location for appointment.
  • final step: make appointment.

As you have seen the above example, you are creating an appointment by following step by step procedure like shopping cart that depends on some business logic. In this you would need to maintain steps and also would need the information in all of these steps. Here, this plugin comes into picture.It helps you in maintaining the steps of flow and information collected at each step.

Advantage

  • With this plugin a developer will be able to get the functionality of webFlow in his/her application easily.
  • Highly productive.
  • Quick development.

Installation

Usage

  • To use this plugin , user needs to def bean flowManagerService in his/her controller, which he/she is using for creating actions for flow. Please copy following line into you controller class.
  def flowManagerService
  • Names of actions for saving the submitted value at each step should start with 'save' only like if i have selectStudent page for getting the student name info then we should create saveSelectStudent action for saving the student info to flowManager.flowInfo.flowData object.
  • Give implementations of interface class flowDecider. In which he/she will need to give implementation of method 'getSequenceAsPerFlowType' to give sequence of flow based on the logic he or she has.Like following example
class AppointmentFlowDecider implements FlowDecider {

   List getSequenceAsPerFlowType(def flowType) {
       List sequence
       switch (flowType) {

           case 'studentBookingAppointment':
               sequence = ['selectAppointmentType', 'selectAdviser', 'summary', 'success']
               break;


           case 'adminBookingAppointment':
               sequence = ['selectAppointmentType', 'selectStudent', 'selectAdviser', 'selectLocation', 'summary', 'success']
               break;


       }
       return sequence
   }
}
  • create an action named as init, which he/she using for flow actions.It will be called whenever a user would go for fresh start.
  • A command object to store the informations collected at each step and also assigned it to flowManager.flowInfo.flowData in the init action and save the information in this object collected at each save Action.
  • Buttons for submission of each step on each page should be same as following code
<g:submitButton name="submit" value="back" />
<g:submitButton name="submit" value="cancel"/>
<g:submitButton name="submit" value="next"/>

For any queries and suggestions mail us at

Something went wrong with that request. Please try again.