Package si.unimb.cot.mgbl.gameauth.formbeans

Examples of si.unimb.cot.mgbl.gameauth.formbeans.DefaultAuthorForm


  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");
  }
View Full Code Here

TOP

Related Classes of si.unimb.cot.mgbl.gameauth.formbeans.DefaultAuthorForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.