Examples of AOGGameCardHiber


Examples of si.unimb.cot.mgbl.gamemgmt.aog.datamodel.AOGGameCardHiber

    return newGame.getId();
  }

 
  public static void deleteGameCard(long id,Session hibernateSession) {
    AOGGameCardHiber gt=findGameCardHiber(id,hibernateSession);
    if (gt==null) return;
    Transaction t=null;
    if (USE_TRANSACTIONS_INSIDE) t=hibernateSession.beginTransaction();

    //do it recursively, if it has links to next cards
    if (gt.getNextCardA()!=null) {
      deleteGameCard(gt.getNextCardA().getId(), hibernateSession);
      gt.setNextCardA(null);
    }
    if (gt.getNextCardB()!=null) {
      deleteGameCard(gt.getNextCardB().getId(), hibernateSession);
      gt.setNextCardB(null);
    }
    if (gt.getNextCardC()!=null) {
      deleteGameCard(gt.getNextCardC().getId(), hibernateSession);
      gt.setNextCardC(null);
    }
    if (gt.getNextCardD()!=null) {
      deleteGameCard(gt.getNextCardD().getId(), hibernateSession);
      gt.setNextCardD(null);
    }
   
    hibernateSession.delete(gt);
    if (t!=null) t.commit();
  }
View Full Code Here

Examples of si.unimb.cot.mgbl.gamemgmt.aog.datamodel.AOGGameCardHiber

  //change self-assessment card
  public ActionForward defaultMethodChangeSACard(ActionMapping am, ActionForm af, HttpServletRequest req, HttpServletResponse res,Game g,GameHiber gh,AOGGameHiber ag) {
    String levelIdParameter=req.getParameter("levelId");
    long levelId=Long.parseLong(levelIdParameter);
   
    AOGGameCardHiber ach=AOGGameCardDao.findGameCardHiber(Long.parseLong(req.getParameter("changeCardId")), session);
    //fill data
    ach.setAnsA(req.getParameter("opt1"));
    try {
      ach.setAnsAScore(Integer.parseInt(req.getParameter("poin1")));
    } catch (Exception e) {
      ach.setAnsAScore(0);
    }

    ach.setAnsB(req.getParameter("opt2"));
    try {
      ach.setAnsBScore(Integer.parseInt(req.getParameter("poin2")));
    } catch (Exception e) {
      ach.setAnsBScore(0);
    }

    ach.setAnsC(req.getParameter("opt3"));
    try {
      ach.setAnsCScore(Integer.parseInt(req.getParameter("poin3")));
    } catch (Exception e) {
      ach.setAnsCScore(0);
    }

    ach.setAnsD(req.getParameter("opt4"));
    try {
      ach.setAnsDScore(Integer.parseInt(req.getParameter("poin4")));
    } catch (Exception e) {
      ach.setAnsDScore(0);
    }
   
    ach.setAnsE(req.getParameter("opt5"));
    try {
      ach.setAnsEScore(Integer.parseInt(req.getParameter("poin5")));
    } catch (Exception e) {
      ach.setAnsEScore(0);
    }
   
    ach.setAnsF(req.getParameter("opt6"));
    try {
      ach.setAnsFScore(Integer.parseInt(req.getParameter("poin6")));
    } catch (Exception e) {
      ach.setAnsFScore(0);
    }
   
    ach.setCardText(req.getParameter("qetxt"));

    ag.setRepublishNeeded(true);
    AOGGameDao.updateGame(ag, session);

    //persist
    AOGGameCardDao.updateGameCard(ach, session);
    MessageBean.setMyMessage(req, "Self-Assessment card updated");
    try {
      res.sendRedirect("authAOG.do?id="+req.getParameter("id")+"#card"+ach.getId());
    } catch (Exception e) {
    }
    return null;

 
View Full Code Here

Examples of si.unimb.cot.mgbl.gamemgmt.aog.datamodel.AOGGameCardHiber

    long cardId=Long.parseLong(req.getParameter("cardId"));
   
    ArrayList<AOGGameCardHiber> cards=AOGGameCardDao.getOrderedCardsForLevel(levelId, session);
   
    //change card numbers
    AOGGameCardHiber prevCard=null;
    for (AOGGameCardHiber gc : cards) {
      if (gc.getId()==cardId)
        if (prevCard!=null) {
          //change numbers, persist, that's it
          int nr=gc.getCardNumber();
          gc.setCardNumber(prevCard.getCardNumber());
          prevCard.setCardNumber(nr);
         
          AOGGameCardDao.updateGameCard(gc, session);
          AOGGameCardDao.updateGameCard(prevCard, session);
         
          break;
View Full Code Here

Examples of si.unimb.cot.mgbl.gamemgmt.aog.datamodel.AOGGameCardHiber

    long cardId=Long.parseLong(req.getParameter("cardId"));
   
    ArrayList<AOGGameCardHiber> cards=AOGGameCardDao.getOrderedCardsForLevel(levelId, session);
   
    //change card numbers
    AOGGameCardHiber prevCard=null;
    for (AOGGameCardHiber gc : cards) {
      if (prevCard!=null)
        if (prevCard.getId()==cardId) {
          //change numbers, persist, that's it
          int nr=gc.getCardNumber();
          gc.setCardNumber(prevCard.getCardNumber());
          prevCard.setCardNumber(nr);
         
          AOGGameCardDao.updateGameCard(gc, session);
          AOGGameCardDao.updateGameCard(prevCard, session);
         
          break;
View Full Code Here

Examples of si.unimb.cot.mgbl.gamemgmt.aog.datamodel.AOGGameCardHiber

    if (req.getParameter("changeCardId")!=null) return defaultMethodChangeImageCard(am, af, req, res, g, gh, ag);
   
    String levelIdParameter=req.getParameter("levelId");
    long levelId=Long.parseLong(levelIdParameter);
   
    AOGGameCardHiber ach=new AOGGameCardHiber();
   
    //fill data
   
    ach.setCardType(AOGGameCardDao.CARD_TYPE_IMAGE);
    ach.setPicture(req.getParameter("selectedPicture")+"");
   
    //get max card number
    int max=-1;
    ArrayList<AOGGameCardHiber> cards=AOGGameCardDao.getOrderedCardsForLevel(levelId, session);
    for (AOGGameCardHiber gameLevelHiber : cards) {
      if (gameLevelHiber.getCardNumber()>max) max=gameLevelHiber.getCardNumber();
    }
   
    ach.setCardNumber(max+1);
   
    ag.setRepublishNeeded(true);
    AOGGameDao.updateGame(ag, session);
   
    AOGGameCardDao.persistAOGGameCardHiber(ach, session);
   
    AOGGameLevelHiber lvl=AOGGameLevelDao.findGameLevelHiber(levelId, session);
    lvl.getCards().add(ach);
   
    AOGGameLevelDao.updateGameLevel(lvl, session);
   
    MessageBean.setMyMessage(req, "Image card inserted");
   
    try {
      res.sendRedirect("authAOG.do?id="+req.getParameter("id")+"#card"+ach.getId());
    } catch (Exception e) {
    }
    return null;

   
View Full Code Here

Examples of si.unimb.cot.mgbl.gamemgmt.aog.datamodel.AOGGameCardHiber

    if (req.getParameter("changeCardId")!=null) return defaultMethodChangeImageTextCard(am, af, req, res, g, gh, ag);
   
    String levelIdParameter=req.getParameter("levelId");
    long levelId=Long.parseLong(levelIdParameter);
   
    AOGGameCardHiber ach=new AOGGameCardHiber();
   
    //fill data
   
    ach.setCardType(AOGGameCardDao.CARD_TYPE_IMAGE_TEXT);
    ach.setCardText(req.getParameter("infotext"));
    ach.setPicture(req.getParameter("selectedPicture")+"");
    ach.setAnsAIsCorrect(req.getParameter("corr1").equals("Y"));
   
    //get max card number
    int max=-1;
    ArrayList<AOGGameCardHiber> cards=AOGGameCardDao.getOrderedCardsForLevel(levelId, session);
    for (AOGGameCardHiber gameLevelHiber : cards) {
      if (gameLevelHiber.getCardNumber()>max) max=gameLevelHiber.getCardNumber();
    }
   
    ach.setCardNumber(max+1);
   
    ag.setRepublishNeeded(true);
    AOGGameDao.updateGame(ag, session);
   
    AOGGameCardDao.persistAOGGameCardHiber(ach, session);
   
    AOGGameLevelHiber lvl=AOGGameLevelDao.findGameLevelHiber(levelId, session);
    lvl.getCards().add(ach);
   
    AOGGameLevelDao.updateGameLevel(lvl, session);
   
    MessageBean.setMyMessage(req, "Image Text card inserted");
   
    try {
      res.sendRedirect("authAOG.do?id="+req.getParameter("id")+"#card"+ach.getId());
    } catch (Exception e) {
    }
    return null;

   
View Full Code Here

Examples of si.unimb.cot.mgbl.gamemgmt.aog.datamodel.AOGGameCardHiber

    if (req.getParameter("changeCardId")!=null) return defaultMethodChangeTxtFreeCard(am, af, req, res, g, gh, ag);
   
    String levelIdParameter=req.getParameter("levelId");
    long levelId=Long.parseLong(levelIdParameter);
   
    AOGGameCardHiber ach=new AOGGameCardHiber();
   
    //fill data
   
    ach.setCardType(AOGGameCardDao.CARD_TYPE_FREE_TEXT_QUESTION);
    ach.setCardText(req.getParameter("infotext"));
    ach.setAnsA(req.getParameter("opt1"));

    //get max card number
    int max=-1;
    ArrayList<AOGGameCardHiber> cards=AOGGameCardDao.getOrderedCardsForLevel(levelId, session);
    for (AOGGameCardHiber gameLevelHiber : cards) {
      if (gameLevelHiber.getCardNumber()>max) max=gameLevelHiber.getCardNumber();
    }
   
    ach.setCardNumber(max+1);
   
    ag.setRepublishNeeded(true);
    AOGGameDao.updateGame(ag, session);
   
    AOGGameCardDao.persistAOGGameCardHiber(ach, session);
   
    AOGGameLevelHiber lvl=AOGGameLevelDao.findGameLevelHiber(levelId, session);
    lvl.getCards().add(ach);
   
    AOGGameLevelDao.updateGameLevel(lvl, session);
   
    MessageBean.setMyMessage(req, "Free-Text Question card inserted");
   
    try {
      res.sendRedirect("authAOG.do?id="+req.getParameter("id")+"#card"+ach.getId());
    } catch (Exception e) {
    }
    return null;

   
View Full Code Here

Examples of si.unimb.cot.mgbl.gamemgmt.aog.datamodel.AOGGameCardHiber

  //update image card 
  public ActionForward defaultMethodChangeImageCard(ActionMapping am, ActionForm af, HttpServletRequest req, HttpServletResponse res,Game g,GameHiber gh,AOGGameHiber ag) {
    String levelIdParameter=req.getParameter("levelId");
    long levelId=Long.parseLong(levelIdParameter);

    AOGGameCardHiber ach=AOGGameCardDao.findGameCardHiber(Long.parseLong(req.getParameter("changeCardId")), session);
    //fill data
    ach.setPicture(req.getParameter("selectedPicture")+"");
   
    ag.setRepublishNeeded(true);
    AOGGameDao.updateGame(ag, session);
   
    AOGGameCardDao.updateGameCard(ach, session);
   
    MessageBean.setMyMessage(req, "Image card updated");
   
    try {
      res.sendRedirect("authAOG.do?id="+req.getParameter("id")+"#card"+ach.getId());
    } catch (Exception e) {
    }
    return null;

   
View Full Code Here

Examples of si.unimb.cot.mgbl.gamemgmt.aog.datamodel.AOGGameCardHiber

  //new imagetext card 
  public ActionForward defaultMethodChangeImageTextCard(ActionMapping am, ActionForm af, HttpServletRequest req, HttpServletResponse res,Game g,GameHiber gh,AOGGameHiber ag) {
    String levelIdParameter=req.getParameter("levelId");
    long levelId=Long.parseLong(levelIdParameter);
   
    AOGGameCardHiber ach=AOGGameCardDao.findGameCardHiber(Long.parseLong(req.getParameter("changeCardId")), session);
    //fill data
    ach.setCardText(req.getParameter("infotext"));
    ach.setPicture(req.getParameter("selectedPicture")+"");
    ach.setAnsAIsCorrect(req.getParameter("corr1").equals("Y"));
   
    ag.setRepublishNeeded(true);
    AOGGameDao.updateGame(ag, session);
   
    AOGGameCardDao.updateGameCard(ach, session);
   
    MessageBean.setMyMessage(req, "Image Text card updated");
   
    try {
      res.sendRedirect("authAOG.do?id="+req.getParameter("id")+"#card"+ach.getId());
    } catch (Exception e) {
    }
    return null;

   
View Full Code Here

Examples of si.unimb.cot.mgbl.gamemgmt.aog.datamodel.AOGGameCardHiber

  //update text free question card 
  public ActionForward defaultMethodChangeTxtFreeCard(ActionMapping am, ActionForm af, HttpServletRequest req, HttpServletResponse res,Game g,GameHiber gh,AOGGameHiber ag) {
    String levelIdParameter=req.getParameter("levelId");
    long levelId=Long.parseLong(levelIdParameter);
   
    AOGGameCardHiber ach=AOGGameCardDao.findGameCardHiber(Long.parseLong(req.getParameter("changeCardId")), session);
    //fill data
    ach.setCardText(req.getParameter("infotext"));
    ach.setAnsA(req.getParameter("opt1"));

    ag.setRepublishNeeded(true);
    AOGGameDao.updateGame(ag, session);
   
    AOGGameCardDao.updateGameCard(ach, session);
   
    MessageBean.setMyMessage(req, "Free-Text Question card update");
   
    try {
      res.sendRedirect("authAOG.do?id="+req.getParameter("id")+"#card"+ach.getId());
    } catch (Exception e) {
    }
    return null;

   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.