Examples of AOGGameCardHiber


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

    if (req.getParameter("changeCardId")!=null) return defaultMethodChangeRewardCard(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_REWARD);

    ach.setAnsA(req.getParameter("txt1"));
    ach.setRewardPictureA(req.getParameter("selectedPicture1"));
    try {
      ach.setAnsAScore(Integer.parseInt(req.getParameter("points1")));
    } catch (Exception e) {
      ach.setAnsAScore(0);
    }
    ach.setExpA(req.getParameter("critery1"));
    
    ach.setAnsB(req.getParameter("txt2"));
    ach.setRewardPictureB(req.getParameter("selectedPicture2"));
    try {
      ach.setAnsBScore(Integer.parseInt(req.getParameter("points2")));
    } catch (Exception e) {
      ach.setAnsBScore(0);
    }
    ach.setExpB(req.getParameter("critery2"));
    
    ach.setAnsC(req.getParameter("txt3"));
    ach.setRewardPictureC(req.getParameter("selectedPicture3"));
    try {
      ach.setAnsCScore(Integer.parseInt(req.getParameter("points3")));
    } catch (Exception e) {
      ach.setAnsCScore(0);
    }
    ach.setExpC(req.getParameter("critery3"));
    
    ach.setAnsD(req.getParameter("txt4"));
    ach.setRewardPictureD(req.getParameter("selectedPicture4"));
    try {
      ach.setAnsDScore(Integer.parseInt(req.getParameter("points4")));
    } catch (Exception e) {
      ach.setAnsDScore(0);
    }
    ach.setExpD(req.getParameter("critery4"));
    
    ach.setAnsE(req.getParameter("txt5"));
    ach.setRewardPictureE(req.getParameter("selectedPicture5"));
    try {
      ach.setAnsEScore(Integer.parseInt(req.getParameter("points5")));
    } catch (Exception e) {
      ach.setAnsEScore(0);
    }
    ach.setExpE(req.getParameter("critery5"));
    
    ach.setAnsF(req.getParameter("txt6"));
    ach.setRewardPictureF(req.getParameter("selectedPicture6"));
    try {
      ach.setAnsFScore(Integer.parseInt(req.getParameter("points6")));
    } catch (Exception e) {
      ach.setAnsFScore(0);
    }
    ach.setExpF(req.getParameter("critery6"));
   
    //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, "Reward 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

  public ActionForward defaultMethodChangeRewardCard(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("txt1"));
    ach.setRewardPictureA(req.getParameter("selectedPicture1"));
    try {
      ach.setAnsAScore(Integer.parseInt(req.getParameter("points1")));
    } catch (Exception e) {
      ach.setAnsAScore(0);
    }
    ach.setExpA(req.getParameter("critery1"));
    
    ach.setAnsB(req.getParameter("txt2"));
    ach.setRewardPictureB(req.getParameter("selectedPicture2"));
    try {
      ach.setAnsBScore(Integer.parseInt(req.getParameter("points2")));
    } catch (Exception e) {
      ach.setAnsBScore(0);
    }
    ach.setExpB(req.getParameter("critery2"));
    
    ach.setAnsC(req.getParameter("txt3"));
    ach.setRewardPictureC(req.getParameter("selectedPicture3"));
    try {
      ach.setAnsCScore(Integer.parseInt(req.getParameter("points3")));
    } catch (Exception e) {
      ach.setAnsCScore(0);
    }
    ach.setExpC(req.getParameter("critery3"));
    
    ach.setAnsD(req.getParameter("txt4"));
    ach.setRewardPictureD(req.getParameter("selectedPicture4"));
    try {
      ach.setAnsDScore(Integer.parseInt(req.getParameter("points4")));
    } catch (Exception e) {
      ach.setAnsDScore(0);
    }
    ach.setExpD(req.getParameter("critery4"));
    
    ach.setAnsE(req.getParameter("txt5"));
    ach.setRewardPictureE(req.getParameter("selectedPicture5"));
    try {
      ach.setAnsEScore(Integer.parseInt(req.getParameter("points5")));
    } catch (Exception e) {
      ach.setAnsEScore(0);
    }
    ach.setExpE(req.getParameter("critery5"));
    
    ach.setAnsF(req.getParameter("txt6"));
    ach.setRewardPictureF(req.getParameter("selectedPicture6"));
    try {
      ach.setAnsFScore(Integer.parseInt(req.getParameter("points6")));
    } catch (Exception e) {
      ach.setAnsFScore(0);
    }
    ach.setExpF(req.getParameter("critery6"));
   
    AOGGameCardDao.updateGameCard(ach, session);
   
    MessageBean.setMyMessage(req, "Reward 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

  public ActionForward defaultMethodCreateSimulationCard(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=new AOGGameCardHiber();
   
    //create
    ach.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO);
   
    //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);
    //create all additonal cards to support simulation component
    //simulation
    AOGGameCardHiber achSim1=new AOGGameCardHiber(); achSim1.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_SIMULATION); achSim1.setAnsAOrded(1); ach.setNextCardA(achSim1);
    AOGGameCardHiber achSim2=new AOGGameCardHiber(); achSim2.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_SIMULATION); achSim2.setAnsAOrded(2); ach.setNextCardB(achSim2);
    AOGGameCardHiber achSim3=new AOGGameCardHiber(); achSim3.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_SIMULATION); achSim3.setAnsAOrded(3); ach.setNextCardC(achSim3);
    AOGGameCardHiber achSim4=new AOGGameCardHiber(); achSim4.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_SIMULATION); achSim4.setAnsAOrded(4); ach.setNextCardD(achSim4);

    achSim1.setCardText("What are you going to do first?");
    achSim2.setCardText("What are you going to do next?");
    achSim3.setCardText("What are you going to do next?");
    achSim4.setCardText("What are you going to do next?");
    achSim1.setPicture("-1");
    achSim2.setPicture("-1");
    achSim3.setPicture("-1");
    achSim4.setPicture("-1");
    achSim1.setHintText("Deterioration level 1 hint");
    achSim2.setHintText("Deterioration level 2 hint");
    achSim3.setHintText("Deterioration level 3 hint");
    achSim4.setHintText("Deterioration level 4 hint");
    achSim1.setHintScore(-1);
    achSim2.setHintScore(-1);
    achSim3.setHintScore(-1);
    achSim4.setHintScore(-1);
   
    //Incidents
    AOGGameCardHiber achSim1Inc1=new AOGGameCardHiber(); achSim1Inc1.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_INCIDENT); achSim1Inc1.setAnsAOrded(1); achSim1.setNextCardA(achSim1Inc1);
    AOGGameCardHiber achSim1Inc2=new AOGGameCardHiber(); achSim1Inc2.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_INCIDENT); achSim1Inc2.setAnsAOrded(2); achSim1.setNextCardB(achSim1Inc2);
    AOGGameCardHiber achSim1Inc3=new AOGGameCardHiber(); achSim1Inc3.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_INCIDENT); achSim1Inc3.setAnsAOrded(3); achSim1.setNextCardC(achSim1Inc3);
    AOGGameCardHiber achSim1Inc4=new AOGGameCardHiber(); achSim1Inc4.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_INCIDENT); achSim1Inc4.setAnsAOrded(4); achSim1.setNextCardD(achSim1Inc4);
    achSim1Inc1.setCardText("Case 1");
    achSim1Inc2.setCardText("Case 2");
    achSim1Inc3.setCardText("Case 3");
    achSim1Inc4.setCardText("Case 4");
    achSim1Inc1.setAnsAScore(1);
    achSim1Inc2.setAnsAScore(2);
    achSim1Inc3.setAnsAScore(3);
    achSim1Inc4.setAnsAScore(4);
    achSim1Inc1.setAnsBScore(1);
    achSim1Inc2.setAnsBScore(1);
    achSim1Inc3.setAnsBScore(1);
    achSim1Inc4.setAnsBScore(1);
   
    AOGGameCardHiber achSim2Inc1=new AOGGameCardHiber(); achSim2Inc1.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_INCIDENT); achSim2Inc1.setAnsAOrded(1); achSim2.setNextCardA(achSim2Inc1);
    AOGGameCardHiber achSim2Inc2=new AOGGameCardHiber(); achSim2Inc2.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_INCIDENT); achSim2Inc2.setAnsAOrded(2); achSim2.setNextCardB(achSim2Inc2);
    AOGGameCardHiber achSim2Inc3=new AOGGameCardHiber(); achSim2Inc3.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_INCIDENT); achSim2Inc3.setAnsAOrded(3); achSim2.setNextCardC(achSim2Inc3);
    AOGGameCardHiber achSim2Inc4=new AOGGameCardHiber(); achSim2Inc4.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_INCIDENT); achSim2Inc4.setAnsAOrded(4); achSim2.setNextCardD(achSim2Inc4);
    achSim2Inc1.setCardText("Case 1");
    achSim2Inc2.setCardText("Case 2");
    achSim2Inc3.setCardText("Case 3");
    achSim2Inc4.setCardText("Case 4");
    achSim2Inc1.setAnsAScore(1);
    achSim2Inc2.setAnsAScore(2);
    achSim2Inc3.setAnsAScore(3);
    achSim2Inc4.setAnsAScore(4);
    achSim2Inc1.setAnsBScore(1);
    achSim2Inc2.setAnsBScore(1);
    achSim2Inc3.setAnsBScore(1);
    achSim2Inc4.setAnsBScore(1);
   
    AOGGameCardHiber achSim3Inc1=new AOGGameCardHiber(); achSim3Inc1.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_INCIDENT); achSim3Inc1.setAnsAOrded(1); achSim3.setNextCardA(achSim3Inc1);
    AOGGameCardHiber achSim3Inc2=new AOGGameCardHiber(); achSim3Inc2.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_INCIDENT); achSim3Inc2.setAnsAOrded(2); achSim3.setNextCardB(achSim3Inc2);
    AOGGameCardHiber achSim3Inc3=new AOGGameCardHiber(); achSim3Inc3.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_INCIDENT); achSim3Inc3.setAnsAOrded(3); achSim3.setNextCardC(achSim3Inc3);
    AOGGameCardHiber achSim3Inc4=new AOGGameCardHiber(); achSim3Inc4.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_INCIDENT); achSim3Inc4.setAnsAOrded(4); achSim3.setNextCardD(achSim3Inc4);
    achSim3Inc1.setCardText("Case 1");
    achSim3Inc2.setCardText("Case 2");
    achSim3Inc3.setCardText("Case 3");
    achSim3Inc4.setCardText("Case 4");
    achSim3Inc1.setAnsAScore(1);
    achSim3Inc2.setAnsAScore(2);
    achSim3Inc3.setAnsAScore(3);
    achSim3Inc4.setAnsAScore(4);
    achSim3Inc1.setAnsBScore(1);
    achSim3Inc2.setAnsBScore(1);
    achSim3Inc3.setAnsBScore(1);
    achSim3Inc4.setAnsBScore(1);

    AOGGameCardHiber achSim4Inc1=new AOGGameCardHiber(); achSim4Inc1.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_INCIDENT); achSim4Inc1.setAnsAOrded(1); achSim4.setNextCardA(achSim4Inc1);
    AOGGameCardHiber achSim4Inc2=new AOGGameCardHiber(); achSim4Inc2.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_INCIDENT); achSim4Inc2.setAnsAOrded(2); achSim4.setNextCardB(achSim4Inc2);
    AOGGameCardHiber achSim4Inc3=new AOGGameCardHiber(); achSim4Inc3.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_INCIDENT); achSim4Inc3.setAnsAOrded(3); achSim4.setNextCardC(achSim4Inc3);
    AOGGameCardHiber achSim4Inc4=new AOGGameCardHiber(); achSim4Inc4.setCardType(AOGGameCardDao.CARD_TYPE_SIMCELO_INCIDENT); achSim4Inc4.setAnsAOrded(4); achSim4.setNextCardD(achSim4Inc4);
    achSim4Inc1.setCardText("Case 1");
    achSim4Inc2.setCardText("Case 2");
    achSim4Inc3.setCardText("Case 3");
    achSim4Inc4.setCardText("Case 4");
    achSim4Inc1.setAnsAScore(1);
    achSim4Inc2.setAnsAScore(2);
    achSim4Inc3.setAnsAScore(3);
    achSim4Inc4.setAnsAScore(4);
    achSim4Inc1.setAnsBScore(1);
    achSim4Inc2.setAnsBScore(1);
    achSim4Inc3.setAnsBScore(1);
    achSim4Inc4.setAnsBScore(1);

    //Questions
    AOGGameCardHiber achSim1Inc1Que=initQuestion(1,1); achSim1Inc1.setNextCardA(achSim1Inc1Que);
    AOGGameCardHiber achSim1Inc2Que=initQuestion(1,2); achSim1Inc2.setNextCardA(achSim1Inc2Que);
    AOGGameCardHiber achSim1Inc3Que=initQuestion(1,3); achSim1Inc3.setNextCardA(achSim1Inc3Que);
    AOGGameCardHiber achSim1Inc4Que=initQuestion(1,4); achSim1Inc4.setNextCardA(achSim1Inc4Que);
   
    AOGGameCardHiber achSim2Inc1Que=initQuestion(2,1); achSim2Inc1.setNextCardA(achSim2Inc1Que);
    AOGGameCardHiber achSim2Inc2Que=initQuestion(2,2); achSim2Inc2.setNextCardA(achSim2Inc2Que);
    AOGGameCardHiber achSim2Inc3Que=initQuestion(2,3); achSim2Inc3.setNextCardA(achSim2Inc3Que);
    AOGGameCardHiber achSim2Inc4Que=initQuestion(2,4); achSim2Inc4.setNextCardA(achSim2Inc4Que);
   
    AOGGameCardHiber achSim3Inc1Que=initQuestion(3,1); achSim3Inc1.setNextCardA(achSim3Inc1Que);
    AOGGameCardHiber achSim3Inc2Que=initQuestion(3,2); achSim3Inc2.setNextCardA(achSim3Inc2Que);
    AOGGameCardHiber achSim3Inc3Que=initQuestion(3,3); achSim3Inc3.setNextCardA(achSim3Inc3Que);
    AOGGameCardHiber achSim3Inc4Que=initQuestion(3,4); achSim3Inc4.setNextCardA(achSim3Inc4Que);
   
    AOGGameCardHiber achSim4Inc1Que=initQuestion(4,1); achSim4Inc1.setNextCardA(achSim4Inc1Que);
    AOGGameCardHiber achSim4Inc2Que=initQuestion(4,2); achSim4Inc2.setNextCardA(achSim4Inc2Que);
    AOGGameCardHiber achSim4Inc3Que=initQuestion(4,3); achSim4Inc3.setNextCardA(achSim4Inc3Que);
    AOGGameCardHiber achSim4Inc4Que=initQuestion(4,4); achSim4Inc4.setNextCardA(achSim4Inc4Que);
   
    AOGGameCardDao.persistAOGGameCardHiber(achSim1Inc1Que, session);
    AOGGameCardDao.persistAOGGameCardHiber(achSim1Inc2Que, session);
    AOGGameCardDao.persistAOGGameCardHiber(achSim1Inc3Que, session);
    AOGGameCardDao.persistAOGGameCardHiber(achSim1Inc4Que, session);
View Full Code Here

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

   
  }
 
  private AOGGameCardHiber initQuestion(int i1,int i2) {
    AOGGameCardHiber questioncard=new AOGGameCardHiber();
    questioncard.setCardType(AOGGameCardDao.CARD_TYPE_QUESTION);
    questioncard.setCardText("Question "+i1+"."+i2+"");
    questioncard.setTimeAvailable(60);
    questioncard.setMultiChoice(false);
    questioncard.setPicture("-1");
    questioncard.setHintScore(-1);
    questioncard.setHintText("Question "+i1+"."+i2+" hint");
    questioncard.setAnsA("Answer 1");
    questioncard.setAnsB("Answer 2");
    questioncard.setExpA("Explanation 1");
    questioncard.setExpB("Explanation 2");
    questioncard.setAnsAScore(1);
    questioncard.setAnsBScore(0);
    questioncard.setAnsAIsCorrect(true);
    questioncard.setAnsBIsCorrect(false);
    return questioncard;
  }
View Full Code Here

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

  //delete card
  public ActionForward defaultMethodDeleteCard(ActionMapping am, ActionForm af, HttpServletRequest req, HttpServletResponse res,Game g,GameHiber gh,AOGGameHiber ag) {
    String levelIdParameter=req.getParameter("levelId");
    long levelId=Long.parseLong(levelIdParameter);
    AOGGameLevelHiber level=null;
    AOGGameCardHiber card=null;
    long cardId=Long.parseLong(req.getParameter("cardId"));
   
    Set<AOGGameLevelHiber> lvls=ag.getLevels();
    for (Iterator iterator = lvls.iterator(); iterator.hasNext();) {
      AOGGameLevelHiber l = (AOGGameLevelHiber) iterator.next();
      if (l.getId()==levelId) {
        level=l;
        break;
      }
    }

    Set<AOGGameCardHiber> cards=level.getCards();
    for (AOGGameCardHiber gameCardHiber : cards) {
      if (gameCardHiber.getId()==cardId) card=gameCardHiber;
    }
   
    //delete it
    level.getCards().remove(card);
    AOGGameLevelDao.updateGameLevel(level, session);
    AOGGameCardDao.deleteGameCard(card.getId(), session);

    ag.setRepublishNeeded(true);
    AOGGameDao.updateGame(ag, session);
   
    MessageBean.setMyMessage(req, "Card deleted");
View Full Code Here

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

    if (req.getParameter("changeCardId")!=null) return defaultMethodChangeOQuestionCard(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_ORDER_QUESTION);
   
    //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);

    //fill question specific data
   
    ach.setPicture(req.getParameter("selectedPicture")+"");
   
    ach.setAnsA(req.getParameter("opt1"));
    ach.setExpA(req.getParameter("exp1"));
    try {
      ach.setAnsAScore(Integer.parseInt(req.getParameter("poin1")));
    } catch (Exception e) {
      ach.setAnsAScore(0);
    }

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

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

    ach.setAnsD(req.getParameter("opt4"));
    ach.setExpD(req.getParameter("exp4"));
    try {
      ach.setAnsDScore(Integer.parseInt(req.getParameter("poin4")));
    } catch (Exception e) {
      ach.setAnsDScore(0);
    }
   
    try {
      ach.setAnsAOrded(Integer.parseInt(req.getParameter("order1")));
    } catch (Exception e) {
      ach.setAnsAOrded(0);
    }
    try {
      ach.setAnsBOrder(Integer.parseInt(req.getParameter("order2")));
    } catch (Exception e) {
      ach.setAnsBOrder(0);
    }
    try {
      ach.setAnsCOrder(Integer.parseInt(req.getParameter("order3")));
    } catch (Exception e) {
      ach.setAnsCOrder(0);
    }
    try {
      ach.setAnsDOrder(Integer.parseInt(req.getParameter("order4")));
    } catch (Exception e) {
      ach.setAnsDOrder(0);
    }

    try {
      ach.setTimeAvailable(Integer.parseInt(req.getParameter("timeavailable")));
    } catch (Exception e) {
      ach.setTimeAvailable(0);
    }
    ach.setCardText(req.getParameter("qetxt"));
   
    ach.setHintText(req.getParameter("hint"));
    try {
      ach.setHintScore(Integer.parseInt(req.getParameter("hintp")));
    } catch (Exception e) {
      ach.setHintScore(0);
    }
   
    ach.setCardText(req.getParameter("qetxt"));
   
    ag.setRepublishNeeded(true);
    AOGGameDao.updateGame(ag, session);

    //persist
    AOGGameCardDao.persistAOGGameCardHiber(ach, session);
    AOGGameLevelHiber lvl=AOGGameLevelDao.findGameLevelHiber(levelId, session);
    lvl.getCards().add(ach);
    AOGGameLevelDao.updateGameLevel(lvl, session);
    MessageBean.setMyMessage(req, "Order-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

  //change order-question card
  public ActionForward defaultMethodChangeOQuestionCard(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"));
    ach.setExpA(req.getParameter("exp1"));
    try {
      ach.setAnsAScore(Integer.parseInt(req.getParameter("poin1")));
    } catch (Exception e) {
      ach.setAnsAScore(0);
    }

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

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

    ach.setAnsD(req.getParameter("opt4"));
    ach.setExpD(req.getParameter("exp4"));
    try {
      ach.setAnsDScore(Integer.parseInt(req.getParameter("poin4")));
    } catch (Exception e) {
      ach.setAnsDScore(0);
    }

    try {
      ach.setAnsAOrded(Integer.parseInt(req.getParameter("order1")));
    } catch (Exception e) {
      ach.setAnsAOrded(0);
    }
    try {
      ach.setAnsBOrder(Integer.parseInt(req.getParameter("order2")));
    } catch (Exception e) {
      ach.setAnsBOrder(0);
    }
    try {
      ach.setAnsCOrder(Integer.parseInt(req.getParameter("order3")));
    } catch (Exception e) {
      ach.setAnsCOrder(0);
    }
    try {
      ach.setAnsDOrder(Integer.parseInt(req.getParameter("order4")));
    } catch (Exception e) {
      ach.setAnsDOrder(0);
    }

    try {
      ach.setTimeAvailable(Integer.parseInt(req.getParameter("timeavailable")));
    } catch (Exception e) {
      ach.setTimeAvailable(0);
    }
    ach.setCardText(req.getParameter("qetxt"));
   
    ach.setHintText(req.getParameter("hint"));
    try {
      ach.setHintScore(Integer.parseInt(req.getParameter("hintp")));
    } catch (Exception e) {
      ach.setHintScore(0);
    }
   
    ach.setCardText(req.getParameter("qetxt"));
   
    ach.setPicture(req.getParameter("selectedPicture")+"");

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

    //persist
    AOGGameCardDao.updateGameCard(ach, session);
    MessageBean.setMyMessage(req, "Order-Question 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

    if (req.getParameter("changeCardId")!=null) return defaultMethodChangeSACard(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_SELF_ASSESSMENT);
   
    //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);

    //fill question specific 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.persistAOGGameCardHiber(ach, session);
    AOGGameLevelHiber lvl=AOGGameLevelDao.findGameLevelHiber(levelId, session);
    lvl.getCards().add(ach);
    AOGGameLevelDao.updateGameLevel(lvl, session);
    MessageBean.setMyMessage(req, "Self-Assessment 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

    ag.setRepublishNeeded(true);
   
    AOGGameDao.updateGame(ag, session);
   
    //add an introduction card to level
    AOGGameCardHiber ach=new AOGGameCardHiber();
    //fill data
   
    ach.setCardType(AOGGameCardDao.CARD_TYPE_INTRODUCTION);
    ach.setCardText(req.getParameter("levelintro"));
   
    ach.setCardNumber(0);
   
    AOGGameCardDao.persistAOGGameCardHiber(ach, session);
   
    newOne.getCards().add(ach);
   
View Full Code Here

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

    if (req.getParameter("changeCardId")!=null) return defaultMethodChangeInfoCard(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_INFO);
    ach.setCardText(req.getParameter("infotext"));
   
    //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, "Info card inserted");
   
    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.