[ http://jira.andromda.org/browse/BPM-245?page=comments#action_11971 ]
     
Wouter Zoons commented on BPM-245:
----------------------------------

Well, the only thing I can tell you is that I never-ever intended this to be 
the behavior. If you want to go back to the input page after all messages are 
saved, and you are sure you want to do this without throwing an exception, then 
why not simply model a transition back into the source page ?

The solution as it exists today is complete:

1. exceptions can be directed using transitions carrying the <<Exception>> 
stereotype
2. 3 types of messages can be recorded automatically (error, success and 
warning), just put the proper tagged value on the corresponding transition
3. you can call these methods yourself if you like, without any side-effects 
such as exception handling etc...
4. use regular transitions to direct the process flow into a certain direction

the case you gave me does not fall into a category that cannot be solved with 
these items, unless I have not well understood the issue you're facing

> saveErrorMessages don't work anymore
> ------------------------------------
>
>          Key: BPM-245
>          URL: http://jira.andromda.org/browse/BPM-245
>      Project: Bpm4Struts Cartridge
>         Type: Bug
>     Versions: 3.1M1
>  Environment: JDK 1.5, Struts 1.2.7, Windows XP Pro
>     Reporter: Bobby Peterson
>     Assignee: Wouter Zoons
>     Priority: Critical

>
> After upgrading to 3.1 I have had many problems with the error messages and 
> validation. The custom validation is still not working.  In the controller 
> methods I call saveErrorMessage given it the request and a valid message key. 
>  The error is saved into the session but the flow of the application 
> continues to go to the next action state, JSP which causes major problems 
> because an error has occured.  
> With some investigation I found that the code generated in 3.0 wrapped the 
> next call in an if block like the following:  
> if (this.errorsNotPresent(request))
> {
>     forward = _retrieveData(mapping, form, request, response);
> }
> in 3.1 the code looks like:
> forward = _retrieveData(mapping, form, request, response);
> Is there a reason this change was made?  Did I not set a property?  If so, 
> shouldn't the old behavior be the default?  
> Thanks for the help or the fix.
> The complete methods are below:
> ###############################################         3.0      
> ###########################################
> ActionForward forward = null;
>     private ActionForward _detailsOk(ActionMapping mapping, ActionForm form, 
> HttpServletRequest request, HttpServletResponse response) throws Exception
>     {
>         ActionForward forward = null;
>         final org.apache.struts.action.ActionMessages errors = 
> this.getExceptionHandlerErrors(request);
>         try
>         {
>             if (this.errorsNotPresent(request))
>             {
>                 
> PlanControllerFactory.getPlanControllerInstance().saveDetails(mapping,  
> DetailsSummarySaveDetailsFormImpl)form, request, response);
>             }
>             if (this.errorsNotPresent(request))
>             {
>                 forward = _retrieveData(mapping, form, request, response);
>             }
>         }
>         catch (Exception ex)
>         {
>             final String messageKey = 
> org.andromda.presentation.bpm4struts.PatternMatchingExceptionHandler.instance().handleException(ex);
>             
> errors.add(org.apache.struts.action.ActionMessages.GLOBAL_MESSAGE, new 
> org.apache.struts.action.ActionMessage(messageKey));
>         }
>         finally
>         {
>         }
>         if (!errors.isEmpty())
>         {
>             forward = mapping.getInputForward();
>         }
>         return forward;
>     }
> ######################################    3.1  
> #########################################################
> private org.apache.struts.action.ActionForward 
> _detailsOk(org.apache.struts.action.ActionMapping mapping, 
> org.apache.struts.action.ActionForm form, 
> javax.servlet.http.HttpServletRequest request, 
> javax.servlet.http.HttpServletResponse response) throws java.lang.Exception
>     {
>         org.apache.struts.action.ActionForward forward = null;
>         try
>         {
>             
> com.sys.uswdss.web.planning.plan.PlanControllerFactory.getPlanControllerInstance().saveDetails(mapping,
>  (DetailsSummarySaveDetailsFormImpl)form, request, response);
>             forward = _retrieveData(mapping, form, request, response);
>         }
>         catch (java.lang.Exception exception)
>         {
>             final java.lang.String messageKey = 
> org.andromda.presentation.bpm4struts.PatternMatchingExceptionHandler.instance().handleException(exception);
>             
> com.sys.uswdss.web.planning.plan.PlanControllerFactory.getPlanControllerInstance().saveErrorMessage(request,
>  messageKey);
>             throw exception;
>         }
>         return forward;
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.andromda.org/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

Reply via email to