Announcement Announcement Module
Collapse
No announcement yet.
Validation model in flow/subflow Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Validation model in flow/subflow

    Hi *,
    I have a question about validation.
    Is it possible to tell SWF to validate model in flow and sublfow with different validators? I'll give you an example:
    In flow:
    <view-state id="state" model="item".../>
    In subflow
    <view-state id="state" model="item".../>

    Can I use different validator beans for both validations?
    By default I can create bean with id itemValidator and method validateState, but how can I recognized if I'm in flow or subflow?

    Thanx in advance,
    Lubos

  • #2
    I am facing the same problem. I ve created an abstract flow named Search and have to subflows named SimpleSearch and ComplexSearch.

    My view state is defined in the Search Flow as following:

    Code:
    <view-state id="enterSearchCriteria" model="kundenSearchCriteria" view="/WEB-INF/flows/search/enterSearchCriteria.xhtml">
    </view-state>
    The Subflows add the following information to that view-state:
    Code:
    <view-state id="enterSearchCriteria">
    		<transition on="search" to="resultList">
    			<evaluate expression="kundenSearchAction.search(kundenSearchCriteria)" result="flowScope.resultList" />
    		</transition>
    	</view-state>
    rather

    Code:
    <view-state id="enterSearchCriteria">
    		<transition on="search" to="detailedResultList">
    			<evaluate expression="kundenSearchAction.detailedSearch(kundenSearchCriteria)" result="flowScope.resultList" />
    		</transition>
    	</view-state>
    The problem now is, that I do need different validation logic for both transitions. With build in Validator mechanisms, I could only specify a Validator for a combination of ViewState + Model. As both of these are identical in both situations, I dont see how i could implement the usage of two different Validators.

    Is there any way to retrieve the concrete flow type/name from within the validator? I checked the ValidationContext, but couldnt find anything helpful in there.

    Furthermore, I believe this is not only a problem occuring with flow inheritance, but with multiple flows in general. From my perspective it looks like I am not able to have two viewstates with the same name using the same name for their model, and validate these with different Validators. So wouldnt it be helpfull to either append the Flowname to the Validator Binding Rules validate<$flowname><$viewstatename> or at least pass in some more inforation to determine the concrete flow?

    Any suggestions to tackle this issue?

    Comment

    Working...
    X