[jboss-user] [JBoss jBPM] - variable validation

twiceknightly do-not-reply at jboss.com
Sun Jan 20 13:11:12 EST 2008


Hi,

I have been considering how to integrate jbpm within an application and would like to know how other people have approached this and if they could offer some advice.   I'm new to this kind of approach and it's taking some time to get it straight in my mind how my application will interact with jbpm.

My app consists of a JSF based web app.  The backing beans use a service locator to call out to a stateless session bean.  All the jbpm goodness is contained within the EJB. i.e. separation of layers.   So for example the webapp requests the current task instance by calling the EJB.  I then transform all the variables and values (and if they are readable,writable etc) to my own DTOs.  It is these DTOs that get pass back and forth between the webapp and EJB.

I was thinking about

- How/where to do validation of variables.  How do I store and pass around the variable types.  Perhaps passing their type to the webapp via the DTOs?  Obviously I need to do validation of variable values in the EJB.  Would it be best to subclass the controller class for this?  I'm thinking that I need validation for every node in the graph with variables.  Therefore I need to provide something like struts forms, one for each node,  perhaps using the apache validator stuff?  So perhaps the EJB reads in an XML file that contains a declaration of a "form" for each node in the graph.  Within a single "form" declaration is a declaration for each field and it's type.  The EJB will then validate values from the UI before calling the jbpm api to set them in the process.

- How and when to transform the process variables to my "model" and vice versa.  The process is passing around individual fields as name value pairs.  At somepoint I need to create a new object in my application model and copy the fields into that pojo.  I already have my model sorted out.  Perhaps I do that by having my subclass of action call another "resource" that can transform in both directions when in a start or end state.  
 
- returning the current state of the process.  If I think about an app in terms of MVC my EJB calling jbpm have effectively now become the model and the controller.  My web app is now just a dumb set of views.  Some how I need to pass back info to the webapp to tell it were in the process we are so it can display the correct screen.  Probably I can get away with passing back the current task when calling end on the current task instance.  This feels a bit naff though.  The model is update by the controller (i.e. EJB and jbpm) but there isn't a way to push the current state to the web app.  i.e. there is no way for the controller to tell the view that the model has changed.  I guess the webapp (view) could request the state but that's a bit naff as well.  
 
Any thoughts or suggestions are welcome.

  

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4121643#4121643

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4121643



More information about the jboss-user mailing list