[virtualcommons-svn] SF.net SVN: virtualcommons:[436] mentalmodels/trunk/src/main/java/edu/asu/ com
Status: Beta
Brought to you by:
alllee
From: <see...@us...> - 2010-01-15 21:43:53
|
Revision: 436 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=436&view=rev Author: seematalele Date: 2010-01-15 21:43:09 +0000 (Fri, 15 Jan 2010) Log Message: ----------- Modified Paths: -------------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Communication.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/CommunicationService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/QuestionCreatorService.java Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Communication.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Communication.java 2010-01-15 21:26:11 UTC (rev 435) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Communication.java 2010-01-15 21:43:09 UTC (rev 436) @@ -26,6 +26,7 @@ private Long id; @Lob + @Column private String message; @Column Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java 2010-01-15 21:26:11 UTC (rev 435) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java 2010-01-15 21:43:09 UTC (rev 436) @@ -1,13 +1,9 @@ package edu.asu.commons.mme.service; -import java.util.ArrayList; import java.util.Iterator; import java.util.List; - - import org.hibernate.Query; - import org.springframework.transaction.annotation.Transactional; import edu.asu.commons.mme.dao.HibernateDayByDayDecisionsDao; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/CommunicationService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/CommunicationService.java 2010-01-15 21:26:11 UTC (rev 435) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/CommunicationService.java 2010-01-15 21:43:09 UTC (rev 436) @@ -28,7 +28,6 @@ { //log the message communication.setMessage(comm.getMessage()); - communication.setRound(roundConfigDao.find(comm.getRound().getId())); communication.setStudent(studentDao.find(comm.getStudent().getId())); communication.setTimestamp(comm.getTimestamp()); @@ -36,12 +35,13 @@ getLogger().debug("timestamp is: '" + comm.getTimestamp() + "' student id is: " + comm.getStudent().getId()); getDao().save(communication); + }catch(Exception e) { e.printStackTrace(); } //send the message to the respective group - try + /*try { msgHandler = new MessageHandler(null); msgHandler.setDestination("mme"); @@ -52,7 +52,7 @@ }catch(Exception e) { e.printStackTrace(); - } + }*/ } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java 2010-01-15 21:26:11 UTC (rev 435) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java 2010-01-15 21:43:09 UTC (rev 436) @@ -37,6 +37,7 @@ import edu.asu.commons.mme.entity.Location; import edu.asu.commons.mme.entity.Module; import edu.asu.commons.mme.entity.ModuleRoundConfig; +import edu.asu.commons.mme.entity.PsychometricQuestion; import edu.asu.commons.mme.entity.Question; import edu.asu.commons.mme.entity.QuestionGroup; import edu.asu.commons.mme.entity.Round; @@ -207,23 +208,22 @@ { getLogger().debug("game state is NOT null..."); block = newGameState.getCurrentBlock(); - initializeGame(newGameState); + //test saving data in communication + //FIXME: Remove this part if(newGameState.getCurrentBlock().getId() == 1) { Communication communication = new Communication(); communication.setMessage("hello"); communication.setRound(newGameState.getCurrentRound()); - communication.setStudent(studentDao.find(1)); + communication.setStudent(studentDao.find(1L)); Timestamp time = null; - communication.setTimestamp(time); - - communicationDao.save(communication); } + initializeGame(newGameState); msgHandler.sendBlock(newGameState); } @@ -586,19 +586,19 @@ getLogger().info("Starting of the game...." + game.getGameCode()); currentRound = getNextRound(game); - getLogger().info("Next Round object is "+ currentRound.getId()); + // getLogger().info("Next Round object is "+ currentRound.getId()); currentModuleRoundConfig = getModuleRoundConfig(0, currentRound); - getLogger().info("Next ModuleRound Config object is "+ currentModuleRoundConfig.getId()); + // getLogger().info("Next ModuleRound Config object is "+ currentModuleRoundConfig.getId()); Module currentModule = getModuleForCurrentRound(currentModuleRoundConfig); - getLogger().info("Next Module object is "+ currentModule.getId()); + // getLogger().info("Next Module object is "+ currentModule.getId()); currentBlock = getBlock(currentModule,1); } else { - getLogger().debug("Current Round is : " + game.getCurrentRound().getId()); - getLogger().debug("Current block is : " + game.getCurrentBlock().getId()); + // getLogger().debug("Current Round is : " + game.getCurrentRound().getId()); + // getLogger().debug("Current block is : " + game.getCurrentBlock().getId()); currentBlock = game.getCurrentBlock(); currentRound = game.getCurrentRound(); if(isModuleFinished(game.getCurrentBlock())) @@ -618,27 +618,27 @@ { //set the next round currentRound = getNextRound(game); - getLogger().info("Next Round object is "+ currentRound.getId()); + // getLogger().info("Next Round object is "+ currentRound.getId()); currentModuleRoundConfig = getModuleRoundConfig(0, currentRound); - getLogger().info("Next ModuleRound Config object is "+ currentModuleRoundConfig.getId()); +// getLogger().info("Next ModuleRound Config object is "+ currentModuleRoundConfig.getId()); Module currentModule = getModuleForCurrentRound(currentModuleRoundConfig); - getLogger().info("Next Module object is "+ currentModule.getId()); + // getLogger().info("Next Module object is "+ currentModule.getId()); currentBlock = getBlock(currentModule,1); } } else { - getLogger().debug("current round is not finished"); + //getLogger().debug("current round is not finished"); //currentRound = getNextRound(game.getCurrentRound()); currentModuleRoundConfig = getModuleRoundConfig(getPreviousModuleConfigSequenceNo(game), currentRound); - getLogger().info("Next ModuleRound Config object is "+ currentModuleRoundConfig.getId()); + //getLogger().info("Next ModuleRound Config object is "+ currentModuleRoundConfig.getId()); Module currentModule = getModuleForCurrentRound(currentModuleRoundConfig); - getLogger().info("Next Module object is "+ currentModule.getId()); + // getLogger().info("Next Module object is "+ currentModule.getId()); currentBlock = getBlock(currentModule,1); @@ -649,12 +649,12 @@ //get the next block in the module //getLogger().debug("currentmodule is " + game.getCurrentBlock().getModule().getId()); currentBlock = getNextBlock(game.getCurrentBlock()); - getLogger().debug("the next block for the game is: " + game.getCurrentBlock().getDescription()); + // getLogger().debug("the next block for the game is: " + game.getCurrentBlock().getDescription()); } } Game newGame = saveGameState(currentBlock,currentRound,game); - getLogger().debug("question group sizes is : " + newGame.getCurrentBlock().getQuestionGroups().size()); + //getLogger().debug("question group sizes is : " + newGame.getCurrentBlock().getQuestionGroups().size()); //initializeCurrentBlock(newGame.getCurrentBlock()); //initializeGame(newGame); getLogger().debug("Module is " + newGame.getCurrentBlock().getModule().getId() + "Block sent to the server is: " + currentBlock.getDescription()); @@ -771,9 +771,10 @@ // TODO Auto-generated method stub try{ Hibernate.initialize(game); - Hibernate.initialize(game.getCurrentBlock()); + //Hibernate.initialize(game.getCurrentBlock()); + if(game.getCurrentBlock() != null) + initializeBlock(game.getCurrentBlock()); - GameConfig gameconfig = game.getGameConfig(); Hibernate.initialize(gameconfig); @@ -799,6 +800,8 @@ while(iterateBlock.hasNext()) { Block block = iterateBlock.next(); + //initializeBlock(block); + Hibernate.initialize(block); List<BlockInformationWindow> infoWindow = block.getInformationWindows(); for(int j = 0; j < infoWindow.size(); j++) @@ -832,7 +835,7 @@ } - private void initializeCurrentBlock(Block block) { + private void initializeBlock(Block block) { Hibernate.initialize(block); Hibernate.initialize(block.getQuestionGroups()); @@ -854,6 +857,13 @@ Iterator<CategoricalOption> categoricalOption = categoricalQ.getCategoricalOptions().iterator(); Hibernate.initialize(categoricalOption); } + if(questions.get(j).getClass().getName().equalsIgnoreCase("edu.asu.commons.mme.entity.PsychometricQuestion")) + { + PsychometricQuestion psychometricQ = (PsychometricQuestion)questions.get(j); + Hibernate.initialize(psychometricQ); + Iterator<String>choices = psychometricQ.getChoices().iterator(); + Hibernate.initialize(choices); + } } } } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/QuestionCreatorService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/QuestionCreatorService.java 2010-01-15 21:26:11 UTC (rev 435) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/QuestionCreatorService.java 2010-01-15 21:43:09 UTC (rev 436) @@ -421,6 +421,13 @@ for(int j = 0; j < questions.size(); j++) { Hibernate.initialize(questions.get(j)); + if(questions.get(j).getClass().getName().equalsIgnoreCase("edu.asu.commons.mme.entity.PsychometricQuestion")) + { + PsychometricQuestion psychometricQ = (PsychometricQuestion)questions.get(j); + Hibernate.initialize(psychometricQ); + Iterator<String>choices = psychometricQ.getChoices().iterator(); + Hibernate.initialize(choices); + } if(questions.get(j).getClass().getName().equalsIgnoreCase("edu.asu.commons.mme.entity.CategoricalQuestion")) { CategoricalQuestion categoricalQ = (CategoricalQuestion)questions.get(j); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |