History | Log In     View a printable version of the current page. Get help!  
Issue Details [XML]

Key: BPM-152
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Wouter Zoons
Reporter: Alexander Gordt
Votes: (View)
Watchers: (View)
Operations

If you were logged in you would be able to see more operations.
Bpm4Struts Cartridge

Decision transition - form bean doesn't implement required interface

Created: 22/Mar/05 11:16 AM   Updated: 22/Mar/05 11:43 PM
Component/s: None
Affects Version/s: 3.0 M3
Fix Version/s: 3.0 RC1

File Attachments: 1. Zip Archive StrutsandHibernateExampleModel.xml.zip (13 kb)

Environment: winxp, maven


 Description   
The modeled activity diagram:

-> Inital Node
-> FrontEndView: Show Login Screen
-> Transition with call-trigger(named: "check user credentials"), pointing to the controller operation "checkCredentials"; the call-trigger has two parameters for the arguments required by the operation.
-> Decision...

The controller has an operation "checkCredentials(username:String, password: String): String".


Generated source codes:

############## Controller - checkCredentials operation ################

public abstract java.lang.String checkCredentials(ActionMapping mapping, de.objectivepartner.mda.strutshibernate.login.CheckCredentialsForm form, HttpServletRequest request, HttpServletResponse response) throws Exception;



############## FormBean with attributes for the parameters, but it doesn't implement the CheckCredentialsForm interface ################

public class ShowLoginScreenCheckUserCredentialsForm
    extends org.apache.struts.validator.ValidatorForm
    implements java.io.Serializable
{


############## Action Class ################

public final class ShowLoginScreenCheckUserCredentials extends Action

[...]

private ActionForward checkCredentials(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
    {
        final String value = String.valueOf(LoginControllerFactory.getLoginControllerInstance().checkCredentials(mapping, (ShowLoginScreenCheckUserCredentialsForm)form, request, response));

if (value.equals("valid credentials"))
        {
            return mapping.findForward("login.succesful");
        }
        if (value.equals("invalid credentials"))
        {
            return mapping.findForward("login.failed");
        }

// we take the last action in case we have an invalid return value from the controller
        return mapping.findForward("login.failed");
    }


############## Error generating the project... ################

[javac] [VERBOSE] Files to be compiled:
    C:\MDASeminar\Projekte\strutshibernate\web\src\java\de\objectivepartner\mda\strutshibernate\login\LoginControllerImpl.java
    C:\MDASeminar\Projekte\strutshibernate\web\target\src\de\objectivepartner\mda\strutshibernate\login\CheckCredentialsForm.java
    C:\MDASeminar\Projekte\strutshibernate\web\target\src\de\objectivepartner\mda\strutshibernate\login\Login.java
    C:\MDASeminar\Projekte\strutshibernate\web\target\src\de\objectivepartner\mda\strutshibernate\login\LoginController.java
    C:\MDASeminar\Projekte\strutshibernate\web\target\src\de\objectivepartner\mda\strutshibernate\login\LoginControllerFactory.java
    C:\MDASeminar\Projekte\strutshibernate\web\target\src\de\objectivepartner\mda\strutshibernate\login\LoginForm.java
    C:\MDASeminar\Projekte\strutshibernate\web\target\src\de\objectivepartner\mda\strutshibernate\login\ShowLoginScreenCheckUserCredentials.java
    C:\MDASeminar\Projekte\strutshibernate\web\target\src\de\objectivepartner\mda\strutshibernate\login\ShowLoginScreenCheckUserCredentialsForm.java
    C:\MDASeminar\Projekte\strutshibernate\web\target\src\de\objectivepartner\mda\strutshibernate\login\ShowWelcomeScreenRestart.java
    C:\MDASeminar\Projekte\strutshibernate\web\target\src\de\objectivepartner\mda\strutshibernate\login\ShowWelcomeScreenRestartForm.java
    C:\MDASeminar\Projekte\strutshibernate\web\target\src\org\andromda\presentation\bpm4struts\PatternMatchingExceptionHandler.java
    C:\MDASeminar\Projekte\strutshibernate\web\target\src\org\andromda\presentation\bpm4struts\StrutsValidator.java

C:\MDASeminar\Projekte\strutshibernate\web\target\src\de\objectivepartner\mda\strutshibernate\login\ShowLoginScreenCheckUserCredentials.java:38: checkCredentials(org.apache.struts.action.ActionMapping,de.objectivepartner.mda.strutshibernate.login.CheckCredentialsForm,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) in de.objectivepartner.mda.strutshibernate.login.LoginController cannot be applied to (org.apache.struts.action.ActionMapping,de.objectivepartner.mda.strutshibernate.login.ShowLoginScreenCheckUserCredentialsForm,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
        final String value = String.valueOf(LoginControllerFactory.getLoginControllerInstance().checkCredentials(mapping, (ShowLoginScreenCheckUserCredentialsForm)form, request, response));
                                                                                             ^
1 error

BUILD FAILED
File...... C:\Dokumente und Einstellungen\agordt\.maven\cache\maven-multiproject-plugin-1.3.1\plugin.jelly
Element... maven:reactor
Line...... 217
Column.... 9


 All   Comments   Change History      Sort Order:
Comment by Wouter Zoons [22/Mar/05 01:10 PM]
hi Alexander, I just tried it and I see what the problem is.

you have modeled a 'call' trigger going out of a page, this is actually not allowed, .. it's an interesting thing you modeled it that way and I think it should be supported so I will add it tonight

Anyway, to already get things running you should simply do this:

1) model an action state in between the decision point and the first page, you can call it 'verify credentials'
2) the existing transition will exit this new action state but will still enter the decision point
3) create a new transition going out of the page into the new action state
4) on this transition add the password and username parameters

the problem is that from the perspective of the cartridge you have modeled a page-to-page transition, and actually this is not true because there's a decision node in between

the more I think about it the more I'm convinced this is something we should support (otherwise you should at least receive an error message or something from AndroMDA)

thanks for your feedback, it will be in CVS tonight so the RC1-SNAPSHOT release will be up-to-date tomorrow (I'll close this issue as soon as I have committed it)