Hi, I tried to rebuild the animal quiz project using Magic Draw 7.5. I have two questions:
1. I didn't find states "ask if user is ready to restart" and "ready to continue" in the "guessing the animal" activity diagram and their related transitions.
2. I tried to use ant to build my animal quiz project. There is one file called AnswerQuestionYes.java generated.
In the sample animal quiz, it has the following code in that file:
private ActionForward lastAnswerWasYes(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
{
final String value = String.valueOf(GuessController.getInstance().lastAnswerWasYes(mapping, (GuessForm)form, request, response));
if (value.equals("true")) return mapping.findForward("i.win.continue");
if (value.equals("false")) return askForAnimal(mapping, form, request, response);
{
final String value = String.valueOf(GuessController.getInstance().lastAnswerWasYes(mapping, (GuessForm)form, request, response));
if (value.equals("true")) return mapping.findForward("i.win.continue");
if (value.equals("false")) return askForAnimal(mapping, form, request, response);
// we take the last action in case we have an invalid return value from the controller
return askForAnimal(mapping, form, request, response);
}
return askForAnimal(mapping, form, request, response);
}
But in the file generated by my project, it is:
private ActionForward lastAnswerWasYes(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
{
final String value = String.valueOf(GuessController.getInstance().lastAnswerWasYes(mapping, (GuessForm)form, request, response));
if (value.equals("false")) return askForAnimal(mapping, form, request, response);
if (value.equals("true")) return mapping.findForward("i.win.continue");
{
final String value = String.valueOf(GuessController.getInstance().lastAnswerWasYes(mapping, (GuessForm)form, request, response));
if (value.equals("false")) return askForAnimal(mapping, form, request, response);
if (value.equals("true")) return mapping.findForward("i.win.continue");
// we take the last action in case we have an invalid return value from the controller
return iWinContinue(mapping, form, request, response);
}
return iWinContinue(mapping, form, request, response);
}
Since iWinContinue is not a valid method, the compiler threw exception here:
compile:
[javac] Compiling 17 source files to C:\andromda\andromda-bin-3.0M1\ant\myanimalquiz\web\target\classes
[javac] C:\andromda\andromda-bin-3.0M1\ant\myanimalquiz\web\target\src\org\andromda\samples\myanimalquiz\guess\Answe
rQuestionNo.java:117: cannot resolve symbol
[javac] symbol : method iWinContinue (org.apache.struts.action.ActionMapping,org.apache.struts.action.ActionForm,ja
vax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
[javac] location: class org.andromda.samples.myanimalquiz.guess.AnswerQuestionNo
[javac] return iWinContinue(mapping, form, request, response);
[javac] ^
[javac] Compiling 17 source files to C:\andromda\andromda-bin-3.0M1\ant\myanimalquiz\web\target\classes
[javac] C:\andromda\andromda-bin-3.0M1\ant\myanimalquiz\web\target\src\org\andromda\samples\myanimalquiz\guess\Answe
rQuestionNo.java:117: cannot resolve symbol
[javac] symbol : method iWinContinue (org.apache.struts.action.ActionMapping,org.apache.struts.action.ActionForm,ja
vax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
[javac] location: class org.andromda.samples.myanimalquiz.guess.AnswerQuestionNo
[javac] return iWinContinue(mapping, form, request, response);
[javac] ^
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger