[virtualcommons-svn] SF.net SVN: virtualcommons:[267] mentalmodels/trunk
Status: Beta
Brought to you by:
alllee
From: <see...@us...> - 2009-08-21 22:09:37
|
Revision: 267 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=267&view=rev Author: seematalele Date: 2009-08-21 22:09:28 +0000 (Fri, 21 Aug 2009) Log Message: ----------- 1) Resolve the bug for sending the current round to the client 2) Created RoundLocation entity in flex and java which maps with round and location, so removed the many to many mapping between round and location 3) made changes in the actionscript files accordingly. 4) Changed the test.mxml which will show alert message for getcurrent round function. Modified Paths: -------------- mentalmodels/trunk/flex/src/actionscript/Location.as mentalmodels/trunk/flex/src/actionscript/Round.as mentalmodels/trunk/flex/src/test.mxml mentalmodels/trunk/src/main/db/init-mme.sql mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/CategoricalQuestion.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Game.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Module.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/ModuleRoundConfig.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Round.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml mentalmodels/trunk/src/main/webapp/test.html mentalmodels/trunk/src/main/webapp/test.swf Added Paths: ----------- mentalmodels/trunk/flex/src/actionscript/RoundLocation.as mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundLocation.java Modified: mentalmodels/trunk/flex/src/actionscript/Location.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Location.as 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/flex/src/actionscript/Location.as 2009-08-21 22:09:28 UTC (rev 267) @@ -11,5 +11,6 @@ public var maxCapacity:int; public var growthRate:Number; public var initialPopulation:int; + public var roundLocations:ArrayCollection; } } \ No newline at end of file Modified: mentalmodels/trunk/flex/src/actionscript/Round.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Round.as 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/flex/src/actionscript/Round.as 2009-08-21 22:09:28 UTC (rev 267) @@ -9,5 +9,6 @@ public var roundNo:int; public var game:Game; public var communicationFlag:Boolean; + public var roundLocations:ArrayCollection; } } \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/RoundLocation.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/RoundLocation.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/RoundLocation.as 2009-08-21 22:09:28 UTC (rev 267) @@ -0,0 +1,15 @@ +package actionscript +{ + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.RoundLocation")] + public class RoundLocation + { + + public var id:int; + + public var round:Round; + + public var location:Location; + + } +} \ No newline at end of file Modified: mentalmodels/trunk/flex/src/test.mxml =================================================================== --- mentalmodels/trunk/flex/src/test.mxml 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/flex/src/test.mxml 2009-08-21 22:09:28 UTC (rev 267) @@ -25,6 +25,7 @@ <mx:Script> <![CDATA[ + import actionscript.Round; import mx.core.UIComponent; import mx.controls.Alert; import mx.rpc.events.FaultEvent; @@ -37,6 +38,10 @@ str += "event.result == null : " + (event.result == null) + "\n"; Alert.show(str, "resultHandler()"); + var round:actionscript.Round = event.result as actionscript.Round; + Alert.show("round no is : " + round.roundNo + " " + round.id); + //Alert.show + } public function faultHandler(event:FaultEvent):void Modified: mentalmodels/trunk/src/main/db/init-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/init-mme.sql 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2009-08-21 22:09:28 UTC (rev 267) @@ -1,8 +1,8 @@ --- MySQL dump 10.13 Distrib 5.1.36, for Win32 (ia32) +-- MySQL dump 10.13 Distrib 5.1.33, for Win32 (ia32) -- -- Host: localhost Database: mme -- ------------------------------------------------------ --- Server version 5.1.36-community +-- Server version 5.1.33-community /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -283,7 +283,7 @@ KEY `FK304BF219A3AF27` (`current_round_id`), CONSTRAINT `FK304BF219A3AF27` FOREIGN KEY (`current_round_id`) REFERENCES `round_config` (`id`), CONSTRAINT `FK304BF2F1265AC7` FOREIGN KEY (`current_block_id`) REFERENCES `block` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -292,7 +292,7 @@ LOCK TABLES `game` WRITE; /*!40000 ALTER TABLE `game` DISABLE KEYS */; -INSERT INTO `game` VALUES (1,'First game','island.jpg',30,5,0,4,4,'2009-07-19 17:30:35','Mental Model Experiment',3,2); +INSERT INTO `game` VALUES (1,'First game','island.jpg',30,5,0,4,4,'2009-07-19 17:30:35','Mental Model Experiment',3,2),(2,'dell2','null',30,100,0.01,0,2,'2009-08-21 14:58:14','test Game Title',1,1); /*!40000 ALTER TABLE `game` ENABLE KEYS */; UNLOCK TABLES; @@ -402,34 +402,6 @@ UNLOCK TABLES; -- --- Table structure for table `location_round_config` --- - -DROP TABLE IF EXISTS `location_round_config`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `location_round_config` ( - `location_id` bigint(20) NOT NULL, - `rounds_id` bigint(20) NOT NULL, - PRIMARY KEY (`location_id`,`rounds_id`), - KEY `FK979C4B5D224FD013` (`location_id`), - KEY `FK979C4B5D479268AA` (`rounds_id`), - CONSTRAINT `FK979C4B5D479268AA` FOREIGN KEY (`rounds_id`) REFERENCES `round_config` (`id`), - CONSTRAINT `FK979C4B5D224FD013` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `location_round_config` --- - -LOCK TABLES `location_round_config` WRITE; -/*!40000 ALTER TABLE `location_round_config` DISABLE KEYS */; -INSERT INTO `location_round_config` VALUES (1,1),(1,2),(2,1),(2,2),(3,1),(3,2),(4,1),(4,2); -/*!40000 ALTER TABLE `location_round_config` ENABLE KEYS */; -UNLOCK TABLES; - --- -- Table structure for table `module` -- @@ -623,33 +595,6 @@ UNLOCK TABLES; -- --- Table structure for table `round_config_game` --- - -DROP TABLE IF EXISTS `round_config_game`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `round_config_game` ( - `round_config_id` bigint(20) NOT NULL, - `game_id` bigint(20) NOT NULL, - UNIQUE KEY `game_id` (`game_id`), - KEY `FKDF98659E7AC42F73` (`game_id`), - KEY `FKDF98659E2B8C177C` (`round_config_id`), - CONSTRAINT `FKDF98659E2B8C177C` FOREIGN KEY (`round_config_id`) REFERENCES `round_config` (`id`), - CONSTRAINT `FKDF98659E7AC42F73` FOREIGN KEY (`game_id`) REFERENCES `game` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `round_config_game` --- - -LOCK TABLES `round_config_game` WRITE; -/*!40000 ALTER TABLE `round_config_game` DISABLE KEYS */; -/*!40000 ALTER TABLE `round_config_game` ENABLE KEYS */; -UNLOCK TABLES; - --- -- Table structure for table `round_config_location` -- @@ -657,13 +602,14 @@ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `round_config_location` ( - `round_config_id` bigint(20) NOT NULL, - `locations_id` bigint(20) NOT NULL, - PRIMARY KEY (`round_config_id`,`locations_id`), - KEY `FKC67B0361FDF88BCA` (`locations_id`), - KEY `FKC67B03612B8C177C` (`round_config_id`), - CONSTRAINT `FKC67B03612B8C177C` FOREIGN KEY (`round_config_id`) REFERENCES `round_config` (`id`), - CONSTRAINT `FKC67B0361FDF88BCA` FOREIGN KEY (`locations_id`) REFERENCES `location` (`id`) + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `location_id` bigint(20) NOT NULL, + `round_id` bigint(20) NOT NULL, + PRIMARY KEY (`id`), + KEY `FKC67B0361224FD013` (`location_id`), + KEY `FKC67B036147CF2321` (`round_id`), + CONSTRAINT `FKC67B036147CF2321` FOREIGN KEY (`round_id`) REFERENCES `round_config` (`id`), + CONSTRAINT `FKC67B0361224FD013` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -673,7 +619,6 @@ LOCK TABLES `round_config_location` WRITE; /*!40000 ALTER TABLE `round_config_location` DISABLE KEYS */; -INSERT INTO `round_config_location` VALUES (1,1),(2,1),(1,2),(2,2),(1,3),(2,3),(1,4),(2,4); /*!40000 ALTER TABLE `round_config_location` ENABLE KEYS */; UNLOCK TABLES; @@ -812,15 +757,15 @@ `repeated_decisions` tinyint(1) NOT NULL, `threshold` double NOT NULL, `location_id` bigint(20) NOT NULL, - `roundConfig_id` bigint(20) NOT NULL, + `round_id` bigint(20) NOT NULL, `student_id` bigint(20) NOT NULL, PRIMARY KEY (`id`), - KEY `FK9615A4F7297B31F` (`roundConfig_id`), KEY `FK9615A4F7224FD013` (`location_id`), + KEY `FK9615A4F747CF2321` (`round_id`), KEY `FK9615A4F7992B5A41` (`student_id`), CONSTRAINT `FK9615A4F7992B5A41` FOREIGN KEY (`student_id`) REFERENCES `student` (`id`), CONSTRAINT `FK9615A4F7224FD013` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`), - CONSTRAINT `FK9615A4F7297B31F` FOREIGN KEY (`roundConfig_id`) REFERENCES `round_config` (`id`) + CONSTRAINT `FK9615A4F747CF2321` FOREIGN KEY (`round_id`) REFERENCES `round_config` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -872,4 +817,4 @@ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2009-08-21 12:00:07 +-- Dump completed on 2009-08-21 22:03:41 Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/CategoricalQuestion.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/CategoricalQuestion.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/CategoricalQuestion.java 2009-08-21 22:09:28 UTC (rev 267) @@ -1,11 +1,8 @@ package edu.asu.commons.mme.entity; -import java.util.Iterator; import java.util.List; - - import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.JoinColumn; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Game.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Game.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Game.java 2009-08-21 22:09:28 UTC (rev 267) @@ -13,7 +13,6 @@ import javax.persistence.Lob; import javax.persistence.ManyToMany; import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; import javax.persistence.Table; import org.hibernate.annotations.CollectionOfElements; @@ -57,7 +56,7 @@ // FIXME: should this be many-to-many instead? @ManyToMany - @CollectionOfElements(fetch=FetchType.EAGER) + @CollectionOfElements private List<Round> rounds; @ManyToOne @@ -95,12 +94,12 @@ return money; } - public void setRoundconfig(List<Round> roundconfig) { + /*public void setRoundconfig(List<Round> roundconfig) { this.rounds = roundconfig; } public List<Round> getRoundconfig() { return rounds; - } + }*/ public void setTimestamp(Timestamp timestamp) { this.timestamp = timestamp; } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java 2009-08-21 22:09:28 UTC (rev 267) @@ -7,8 +7,6 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; import javax.persistence.Table; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java 2009-08-21 22:09:28 UTC (rev 267) @@ -5,15 +5,11 @@ import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToMany; +import javax.persistence.OneToMany; import javax.persistence.Table; -import org.hibernate.annotations.CollectionOfElements; - @Entity @Table(name = "location") public class Location implements Serializable{ @@ -24,9 +20,8 @@ @GeneratedValue private Long id; - @ManyToMany - @CollectionOfElements - private List<Round> rounds; + @OneToMany(mappedBy = "location") + private List<RoundLocation> roundLocations; @Column(nullable=false,name="location_name") private String locationName; @@ -51,7 +46,6 @@ return id; } - public Double getGrowthRate() { return growthRate; } @@ -76,17 +70,18 @@ public void setInitialPopulation(Integer initialPopulation) { this.initialPopulation = initialPopulation; } - public void setRounds(List<Round> rounds) { - this.rounds = rounds; - } - public List<Round> getRounds() { - return rounds; - } + public void setCurrentPopulation(Integer currentPopulation) { this.currentPopulation = currentPopulation; } public Integer getCurrentPopulation() { return currentPopulation; } + public void setRoundLocations(List<RoundLocation> roundLocations) { + this.roundLocations = roundLocations; + } + public List<RoundLocation> getRoundLocations() { + return roundLocations; + } } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Module.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Module.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Module.java 2009-08-21 22:09:28 UTC (rev 267) @@ -3,16 +3,11 @@ import java.io.Serializable; import java.util.List; -import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToMany; -import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.OrderBy; import javax.persistence.Table; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/ModuleRoundConfig.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/ModuleRoundConfig.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/ModuleRoundConfig.java 2009-08-21 22:09:28 UTC (rev 267) @@ -1,7 +1,6 @@ package edu.asu.commons.mme.entity; import java.io.Serializable; -import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; @@ -9,8 +8,6 @@ import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; -import javax.persistence.OrderBy; import javax.persistence.Table; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java 2009-08-21 22:09:28 UTC (rev 267) @@ -3,13 +3,11 @@ import java.io.Serializable; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Round.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Round.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Round.java 2009-08-21 22:09:28 UTC (rev 267) @@ -3,20 +3,15 @@ import java.io.Serializable; import java.util.List; -import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToMany; import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; import javax.persistence.Table; -import org.hibernate.annotations.CollectionOfElements; - @Entity @Table(name="round_config") public class Round implements Serializable { @@ -30,9 +25,9 @@ @Column(name="round_no",nullable=false) private Integer roundNo; - @ManyToMany - @CollectionOfElements(fetch=FetchType.EAGER) - private List<Game> game; + /*@ManyToMany + @CollectionOfElements + private List<Game> game;*/ @Column(name="communication_flag",nullable=false,columnDefinition="Boolean default false") private boolean communicationFlag; @@ -41,9 +36,8 @@ private ModuleRoundConfig round_config;*/ - @ManyToMany - @CollectionOfElements(fetch=FetchType.EAGER) - private List<Location> locations; + @OneToMany(mappedBy = "round") + private List<RoundLocation> roundLocations; public void setId(Long id) { this.id = id; @@ -64,24 +58,24 @@ public boolean getCommunicationFlag() { return communicationFlag; } - - public List<Location> getLocations() { - return locations; + public void setRoundLocations(List<RoundLocation> roundLocations) { + this.roundLocations = roundLocations; } - public void setLocations(List<Location> locations) { - this.locations = locations; + public List<RoundLocation> getRoundLocations() { + return roundLocations; } + /*public void setRound_config(ModuleRoundConfig round_config) { this.round_config = round_config; } public ModuleRoundConfig getRound_config() { return round_config; }*/ - public void setGame(List<Game> game) { + /*public void setGame(List<Game> game) { this.game = game; } public List<Game> getGame() { return game; - } + }*/ } Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundLocation.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundLocation.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundLocation.java 2009-08-21 22:09:28 UTC (rev 267) @@ -0,0 +1,57 @@ +package edu.asu.commons.mme.entity; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name="round_config_location") +public class RoundLocation implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3215898164475817212L; + + @Id + @GeneratedValue + private Long id; + + @ManyToOne + @JoinColumn(nullable=false) + private Round round; + + @ManyToOne + @JoinColumn(nullable=false) + private Location location; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setRound(Round round) { + this.round = round; + } + + public Round getRound() { + return round; + } + + public void setLocation(Location location) { + this.location = location; + } + + public Location getLocation() { + return location; + } + +} Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java 2009-08-21 22:09:28 UTC (rev 267) @@ -5,8 +5,6 @@ import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java 2009-08-21 22:09:28 UTC (rev 267) @@ -2,7 +2,6 @@ import java.io.Serializable; -import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; @@ -10,7 +9,6 @@ import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; import javax.persistence.Table; 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 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java 2009-08-21 22:09:28 UTC (rev 267) @@ -4,13 +4,9 @@ import org.springframework.transaction.annotation.Transactional; -import edu.asu.commons.mme.dao.HibernateDayByDayDecisionsDao; -import edu.asu.commons.mme.dao.HibernateStudentDao; import edu.asu.commons.mme.dao.HibernateStudentResponseDao; import edu.asu.commons.mme.dao.HibernateStudentStrategyDao; -import edu.asu.commons.mme.entity.Block; import edu.asu.commons.mme.entity.DayByDayDecisions; -import edu.asu.commons.mme.entity.Location; import edu.asu.commons.mme.entity.Student; import edu.asu.commons.mme.entity.StudentResponse; import edu.asu.commons.mme.entity.StudentStrategy; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java 2009-08-21 22:09:28 UTC (rev 267) @@ -6,7 +6,6 @@ import org.springframework.transaction.annotation.Transactional; import edu.asu.commons.mme.dao.HibernateDayByDayDecisionsDao; -import edu.asu.commons.mme.dao.HibernateLocationDao; import edu.asu.commons.mme.entity.DayByDayDecisions; import edu.asu.commons.mme.entity.Location; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 2009-08-21 22:09:28 UTC (rev 267) @@ -1,18 +1,13 @@ package edu.asu.commons.mme.service; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; - - import org.hibernate.Hibernate; import org.springframework.transaction.annotation.Transactional; import edu.asu.commons.mme.dao.HibernateLocationDao; -import edu.asu.commons.mme.entity.Game; import edu.asu.commons.mme.entity.Location; -import edu.asu.commons.mme.entity.Round; @Transactional public class LocationService extends Service.Base<Location, HibernateLocationDao>{ @@ -27,27 +22,9 @@ { initLocation = locations.get(i); Hibernate.initialize(initLocation); - List<Round> rounds = initLocation.getRounds(); - for(int j = 0; j < rounds.size(); j++) - { - Round round = rounds.get(j); - Hibernate.initialize(round); - - Iterator <Game> games = round.getGame().iterator(); - while(games.hasNext()) - { - Hibernate.initialize(games.next()); - - } - - List<Location> roundlocations = round.getLocations(); - for(int k=0;k<roundlocations.size();k++) - { - Hibernate.initialize(roundlocations.get(k)); - } - //round.getLocations() - } + Hibernate.initialize(initLocation.getRoundLocations()); + } return locations; } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java 2009-08-21 22:09:28 UTC (rev 267) @@ -23,6 +23,7 @@ import edu.asu.commons.mme.entity.Question; import edu.asu.commons.mme.entity.QuestionGroup; import edu.asu.commons.mme.entity.Round; +import edu.asu.commons.mme.entity.RoundLocation; @Transactional public class RoundService extends Service.Base<Round, HibernateRoundConfigDao> { @@ -37,7 +38,7 @@ private Round currentRound; private Block currentBlock; private Game currentGame; - + private int blockSeqNo; private ModuleRoundConfig currentModuleRoundConfig; @@ -57,33 +58,52 @@ public Game createGame(Game game) { + currentGame = new Game(); - currentGame = game; + //currentGame = game; + + currentGame.setDescription(game.getDescription()); + currentGame.setMaxDays(game.getMaxDays()); + currentGame.setMaxFishHarvest(game.getMaxFishHarvest()); + currentGame.setMoney(game.getMoney()); + currentGame.setNumberOfRounds(game.getNumberOfRounds()); + currentGame.setNumberOfLocations(game.getNumberOfLocations()); + currentGame.setTimestamp(game.getTimestamp()); + currentGame.setTitle(game.getTitle()); + currentGame.setImageLocation("null"); +// currentGame.setro// getGameDao().save(currentGame); String str = currentGame.getDescription()+currentGame.getId(); - if(getGameDao().findAllByProperty("description", str) !=null) + + if(getGameDao().findAllByProperty("description", str).size() != 0) { - setCurrentGame(null); + getLogger().debug("in if loop "); + currentGame = null; + setCurrentGame(currentGame); } else { currentGame.setDescription(str); getGameDao().save(currentGame); + getLogger().debug("in else loop 1 " + str); setCurrentGame(currentGame); - initializeGame(currentGame); + getLogger().debug("in else loop 2 " + str); + //initializeGame(currentGame); + getLogger().debug("in else loop 3 " + str); } - return getCurrentGame(); + getLogger().debug("current game from flex is: " + currentGame.getDescription()); + return currentGame; } private void initializeGame(Game game) { // TODO Auto-generated method stub Hibernate.initialize(game); Hibernate.initialize(game.getCurrentBlock()); Hibernate.initialize(game.getCurrentRound()); - Iterator<Round> rounds = game.getRounds().iterator(); + /*Iterator<Round> rounds = game.getRounds().iterator(); while(rounds.hasNext()) { initializeRound(rounds.next()); - } + }*/ } public Module getNextModule(int sequenceNo) @@ -99,10 +119,12 @@ public Block getBlock() { /* - *1) Find out the current module number - *2) check if it is finished, if yes find out the current round number - *3) Find out the current block number - *4) Return the next block + *1) Check if the current module round config is null, this object keeps track of which round + * and which module in that round is going on + *2) Find out the current module number + *3) check if it is finished, if yes find out the current round number + *4) Find out the current block number + *5) Return the next block */ //getLogger().debug("in getBlock "); //setCurrentModuleRoundConfig(currentModuleRoundConfig); @@ -210,6 +232,7 @@ currentRound = new Round(); currentRound = getDao().findByProperty("roundNo", 1); setCurrentRound(currentRound); + initializeRound(currentRound); } else { @@ -422,10 +445,11 @@ private void saveGameState(Block currentBlock) { //FIXME: Game id 1 is hard coded but needs to make it dynamic - Game game = gameDao.find(1L); - game.setCurrentBlock(currentBlock); - game.setCurrentRound(currentRound); - gameDao.save(game); + //Game game = gameDao.find(1L); + + currentGame.setCurrentBlock(currentBlock); + currentGame.setCurrentRound(currentRound); + gameDao.save(currentGame); } public Integer getTimerforBlock(Block block) @@ -477,9 +501,9 @@ public Block getCurrentBlock() { //FIXEME: game id 1 is hard coded, it should be dynamic - Game game = gameDao.find(1L); +// Game game = gameDao.find(1L); Block block = new Block(); - block = game.getCurrentBlock(); + block = currentGame.getCurrentBlock(); // Hibernate.initialize(block); return block; @@ -502,40 +526,30 @@ public Round getCurrentRound() { - initializeRound(currentRound); + getLogger().debug("in get current round funciton"); + /*Round round = currentGame.getCurrentRound(); + //Round round = getDao().find(getCurrentRound().getId()); + + initializeRound(round);*/ + getLogger().debug("round no is " + currentRound.getRoundNo() + " " + currentRound.getId()); return currentRound; } - private void initializeRound(Round currentRound) { + private void initializeRound(Round round) { // TODO Auto-generated method stub - Hibernate.initialize(currentRound); + Hibernate.initialize(round); - Iterator <Game> games = currentRound.getGame().iterator(); - while(games.hasNext()) - { + Hibernate.initialize(round.getRoundLocations()); + + /*for (RoundLocation roundLocation: round.getRoundLocations()) { + Hibernate.initialize(roundLocation); + //hibernateroundLocation.getLocation(); + }*/ - initializeGame(games.next()); - - } - - List<Location> roundlocations = currentRound.getLocations(); - for(int k=0;k<roundlocations.size();k++) - { - Hibernate.initialize(roundlocations.get(k)); - } + //Hibernate.initialize(currentRound.getLocations()); } - /*public void setStartModule(Boolean startModule) { - this.startGame = startModule; - } - - - public Boolean getStartModule() { - return startGame; - }*/ - - public void setGameDao(HibernateGameDao gameDao) { this.gameDao = gameDao; } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java 2009-08-21 22:09:28 UTC (rev 267) @@ -10,6 +10,7 @@ import flex.messaging.messages.AsyncMessage; import flex.messaging.util.UUIDUtils; + public class StartGame extends Thread { private boolean running; @@ -44,6 +45,7 @@ public Game createGame(Game game) { + System.out.println("game came from flex is: " + game.getDescription()); return roundService.createGame(game); } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java 2009-08-21 22:09:28 UTC (rev 267) @@ -16,26 +16,29 @@ @Transactional public class StartupService implements ApplicationContextAware { - + //private QuestionCreatorService questionCreatorService; private StartGame startGame; private ApplicationContext ctx; - + /*public void setQuestionCreatorService(QuestionCreatorService questionCreatorService) { this.questionCreatorService = questionCreatorService; }*/ + public Student createStudent(Student student) { - public Student createStudent(Student student) { - return getStartGame().createStudent(student); } - + public Game createGame(Game game) { - return getStartGame().createGame(game); + if(getStartGame() == null) + { + setStartGame(); + } + return startGame.createGame(game); } - + public void assignGroups() { MessageBroker msgBroker = MessageBroker.getMessageBroker(null); @@ -47,20 +50,20 @@ msg.setMessageId(UUIDUtils.createUUID()); msg.setTimestamp(System.currentTimeMillis()); List<Student> students = new ArrayList<Student>(); - + msg.setBody(students); System.out.println("Message broker is: "+ msgBroker); System.out.println("Students size is: " + students.size()); - + msgBroker.routeMessageToService(msg, null); - + } - + public void startGame() { //push assign groups to all the students assignGroups(); - + //start the game this.startGame.run(); } @@ -69,8 +72,8 @@ startGame.setRunning(false); startGame = null; } - - + + @Override public void setApplicationContext(ApplicationContext context) throws BeansException { @@ -78,12 +81,12 @@ this.ctx = context; } - + public void setStartGame() { try{ if (startGame == null) { this.startGame = (StartGame)ctx.getBean("startGame"); - + } }catch(Exception e) { @@ -92,9 +95,9 @@ } public StartGame getStartGame() { - + return startGame; } - + } Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-08-21 22:09:28 UTC (rev 267) @@ -10,9 +10,12 @@ <mapping class='edu.asu.commons.mme.entity.Game'/> <mapping class='edu.asu.commons.mme.entity.Round'/> <mapping class='edu.asu.commons.mme.entity.Location'/> + <mapping class='edu.asu.commons.mme.entity.RoundLocation'/> <mapping class='edu.asu.commons.mme.entity.Communication'/> <mapping class='edu.asu.commons.mme.entity.Group'/> <mapping class='edu.asu.commons.mme.entity.Student'/> + + <mapping class='edu.asu.commons.mme.entity.StudentRoundConfig'/> <mapping class='edu.asu.commons.mme.entity.StudentStrategy'/> Modified: mentalmodels/trunk/src/main/webapp/test.html =================================================================== --- mentalmodels/trunk/src/main/webapp/test.html 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/webapp/test.html 2009-08-21 22:09:28 UTC (rev 267) @@ -28,15 +28,6 @@ <style> body { margin: 0px; overflow:hidden } </style> - -<script language="JavaScript"> - window.onbeforeunload = confirmExit; - function confirmExit() - { - return "If you are connected to the server, you will be disconnected if the page closes. Students in the experiment will be removed if the window closes."; - } -</script> - <script language="JavaScript" type="text/javascript"> <!-- // ----------------------------------------------------------------------------- @@ -53,12 +44,8 @@ </head> <body scroll="no"> - <script language="JavaScript" type="text/javascript"> <!-- - -var clientIP = '<!--#echo var="REMOTE_ADDR"-->'; - // Version check for the Flash Player that has the ability to start Player Product Install (6.0r65) var hasProductInstall = DetectFlashVer(6, 0, 65); @@ -70,12 +57,12 @@ // Location visited after installation is complete if installation is required var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn"; var MMredirectURL = window.location; - document.title = document.title.slice(0, 47) + " - Flash Player Installation"; - var MMdoctitle = document.title; + document.title = document.title.slice(0, 47) + " - Flash Player Installation"; + var MMdoctitle = document.title; AC_FL_RunContent( "src", "playerProductInstall", - "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+'&ip=test'+clientIP+"", + "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"", "width", "100%", "height", "100%", "align", "middle", @@ -95,30 +82,27 @@ "width", "100%", "height", "100%", "align", "middle", - "valign", "middle", "id", "test", "quality", "high", "bgcolor", "#869ca7", "name", "test", "allowScriptAccess","sameDomain", "type", "application/x-shockwave-flash", - "pluginspage", "http://www.adobe.com/go/getflashplayer", - "FlashVars", "ip=test"+clientIP+"" + "pluginspage", "http://www.adobe.com/go/getflashplayer" ); -} else { // flash is too old or we can't detect the plugin - var alternateContent = 'Alternate HTML content should be placed here. ' - + 'This content requires the Adobe Flash Player. ' - + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>'; - document.write(alternateContent); // insert non-flash content + } else { // flash is too old or we can't detect the plugin + var alternateContent = 'Alternate HTML content should be placed here. ' + + 'This content requires the Adobe Flash Player. ' + + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>'; + document.write(alternateContent); // insert non-flash content } // --> </script> <noscript> - <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" + <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="test" width="100%" height="100%" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"> <param name="movie" value="test.swf" /> - <PARAM NAME=FlashVars VALUE="ip=test${clientIP}"> <param name="quality" value="high" /> <param name="bgcolor" value="#869ca7" /> <param name="allowScriptAccess" value="sameDomain" /> Modified: mentalmodels/trunk/src/main/webapp/test.swf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |