public ActionForward defaultMethod(ActionMapping am, ActionForm af, HttpServletRequest req, HttpServletResponse res) {
//we use transactions here
//super.defaultMethod(am, af, req, res);
DefaultAuthorForm form=(DefaultAuthorForm)af;
form.setMyUserId(webUser.getId());
if (req.getParameter("cancelChangesSubmit")!=null) {
form.reset();
return am.findForward("cancel");
}
long id=Long.parseLong(req.getParameter("id"));
GameHiber g=GameDao.findGameHiber(id,session);
form.setGh(g);
form.setG(GameDao.findGame(id,session));
if (req.getParameter("change")!=null) {
//TODO - Wo what if some scores exist... scale them???
//for now we just "forget" them...
if (!SecurityCenter.canIEditGame(webUser.getId(), g.getId(),session)) {
MessageBean.setMyMessage(req, ("Error: Insufficient privileges."));
form.reset();
return am.findForward("list");
}
g.setMaksimumScore(form.getMaxScores());
//upload jar
String message="Game content updated.";
if (form.getJar().getFileName()!=null)
if (!form.getJar().getFileName().equals("")) {
try {
Blob b=Hibernate.createBlob(form.getJar().getInputStream());
g.setJarContent(b);
message=message+" New JAR uploaded.";
} catch (Exception e) {
}
}
GameDao.updateGame(g,session);
MessageBean.setMyMessage(req, (message));
form.reset();
return am.findForward("list");
}
form.setMaxScores((int)g.getMaksimumScore());
return am.findForward("ok");
}