Thread: [virtualcommons-svn] SF.net SVN: virtualcommons:[86] mentalmodels/trunk
Status: Beta
Brought to you by:
alllee
From: <al...@us...> - 2009-04-01 16:40:49
|
Revision: 86 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=86&view=rev Author: alllee Date: 2009-04-01 16:40:43 +0000 (Wed, 01 Apr 2009) Log Message: ----------- Currently going with a minimalist/simplistic pom + maven project setup. Refine this later as we figure out what works best with FlexBuilder + BlazeDS + Spring integration. Added Paths: ----------- mentalmodels/trunk/pom.xml mentalmodels/trunk/src/ mentalmodels/trunk/src/main/ mentalmodels/trunk/src/main/java/ mentalmodels/trunk/src/main/resources/ Added: mentalmodels/trunk/pom.xml =================================================================== --- mentalmodels/trunk/pom.xml (rev 0) +++ mentalmodels/trunk/pom.xml 2009-04-01 16:40:43 UTC (rev 86) @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <organization> + <name>The Digital Archaeological Record</name> + <url>http://tdar.org</url> + </organization> + <modelVersion>4.0.0</modelVersion> + <groupId>edu.asu.commons</groupId> + <artifactId>mme</artifactId> + <version>0.1-SNAPSHOT</version> + <name>Mental Models Spring Application</name> + <packaging>war</packaging> + <repositories> + <repository> + <id>dev.commons.asu.edu</id> + <url>http://dev.commons.asu.edu/archiva/internal/repository/</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + </repositories> + <dependencies> + <!-- mysql jdbc --> + <dependency> + <groupId>mysql</groupId> + <artifactId>mysql-connector-java</artifactId> + <version>5.1.6</version> + </dependency> + <!-- spring dependencies --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring</artifactId> + <version>2.5.6</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-hibernate3</artifactId> + <version>2.0-m4</version> + </dependency> + <!-- hibernate and JPA persistence --> + <dependency> + <groupId>javax.persistence</groupId> + <artifactId>persistence-api</artifactId> + <version>1.0</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-core</artifactId> + <version>3.3.1.GA</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-entitymanager</artifactId> + <version>3.3.2.GA</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-annotations</artifactId> + <version>3.4.0.GA</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-ehcache</artifactId> + <version>3.3.1.GA</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-tools</artifactId> + <version>3.2.3.GA</version> + </dependency> + + </dependencies> + +</project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-04-02 20:13:04
|
Revision: 87 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=87&view=rev Author: alllee Date: 2009-04-02 20:12:53 +0000 (Thu, 02 Apr 2009) Log Message: ----------- adding hibernate tools ant build script for generating the schema Modified Paths: -------------- mentalmodels/trunk/pom.xml Added Paths: ----------- mentalmodels/trunk/init-db.ant.xml Added: mentalmodels/trunk/init-db.ant.xml =================================================================== --- mentalmodels/trunk/init-db.ant.xml (rev 0) +++ mentalmodels/trunk/init-db.ant.xml 2009-04-02 20:12:53 UTC (rev 87) @@ -0,0 +1,82 @@ +<?xml version="1.0"?> +<!-- +vim:sts=2:sw=2 +$Id: init-db.ant.xml 239 2009-03-20 17:49:19Z alllee $ +$Revision: 239 $ +Master build file for TDAR deployment. +--> +<project name="tdar" default="help"> + <!-- get environment vars --> + <property file="hibernate.properties"/> + <!-- + define some sane default values for db connection if undefined in + build.properties + --> + <property name='db.name' value='mme'/> + <property name='hibernate.connection.url' value='jdbc:postgresql://localhost/${db.name}'/> + <property name='hibernate.connection.username' value='mme'/> + <property name='hibernate.connection.password' value=''/> + <property name='hibernate.connection.driver_class' value='com.mysql.jdbc.Driver'/> + <property name='hibernate.dialect' value='org.hibernate.dialect.MySQLInnoDBDialect'/> + <property name='createdb.url' value='jdbc:postgresql://localhost/template1'/> + + <!-- where the applicationContext.xml and hibernate.cfg.xml are currently located, this may change --> + <property name='web.inf.dir' value='src/main/webapp/WEB-INF'/> + <property name='db.dir' value='src/main/db'/> + <property name='db.generated.dir' value='${db.dir}/generated'/> + <!-- + this should always be available, connect to this if we need to create + the tdardev database + --> + + <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpath="${compile.classpath}"/> + <target name="init-db" depends="create-db-schema, create-indexes"/> + <target name='create-db-schema'> + <mkdir dir='${db.generated.dir}'/> + <echo message="You must have valid database connection information within hibernate.properties for this task to succeed."/> + <hibernatetool destdir='${db.generated.dir}'> + <!-- annotated class/packages are specified in the hibernate.cfg.xml --> + <annotationconfiguration propertyFile="hibernate.properties" configurationfile="${web.inf.dir}/hibernate.cfg.xml"/> + <hbm2ddl export="true" drop="true" outputfilename="tdar.sql"/> + </hibernatetool> + </target> + <target name='create-indexes'> + <sql onerror='continue' autocommit='true' driver="${hibernate.connection.driver_class}" url="${hibernate.connection.url}" userid="${hibernate.connection.username}" password="${hibernate.connection.password}" classpath="${compile.classpath}"> + <transaction src="${db.dir}/create-indexes.sql"/> + </sql> + </target> + <target name="initialize-data" depends="init-db"> + <sql driver="${hibernate.connection.driver_class}" + url="${hibernate.connection.url}" + userid="${hibernate.connection.username}" + password="${hibernate.connection.password}" + classpath="${compile.classpath}" + src="${db.dir}/init-tdar.sql"/> + </target> + + <target name='create-db'> + <sql driver='${hibernate.connection.driver_class}' + url='${createdb.url}' + userid='${hibernate.connection.username}' + password='${hibernate.connection.password}' + onerror='continue' + classpath='${compile.classpath}' autocommit='true'> + DROP DATABASE ${db.name}; + CREATE DATABASE ${db.name} WITH ENCODING 'UTF8'; + </sql> + </target> + + <!-- not needed here. + <target name='load-data' depends='create-db'> + <bunzip2 src='${db.dir}/tdar-data.sql.bz2' dest='${db.dir}/tdar-data.sql'/> + <sql driver='${hibernate.connection.driver_class}' + url='${hibernate.connection.url}' + userid='${hibernate.connection.username}' + password='${hibernate.connection.password}' + classpath='${compile.classpath}'> + <transaction src='${db.dir}/tdar-data.sql'/> + <transaction src='${db.dir}/upgrade-db-tdar.struts.sql'/> + </sql> + </target> + --> +</project> Modified: mentalmodels/trunk/pom.xml =================================================================== --- mentalmodels/trunk/pom.xml 2009-04-01 16:40:43 UTC (rev 86) +++ mentalmodels/trunk/pom.xml 2009-04-02 20:12:53 UTC (rev 87) @@ -1,19 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <organization> - <name>The Digital Archaeological Record</name> - <url>http://tdar.org</url> + <name>The Virtual Commons</name> + <url>http://dev.commons.asu.edu</url> </organization> <modelVersion>4.0.0</modelVersion> <groupId>edu.asu.commons</groupId> <artifactId>mme</artifactId> <version>0.1-SNAPSHOT</version> - <name>Mental Models Spring Application</name> + <name>Mental Models Application</name> <packaging>war</packaging> <repositories> <repository> <id>dev.commons.asu.edu</id> - <url>http://dev.commons.asu.edu/archiva/internal/repository/</url> + <url>http://dev.commons.asu.edu/archiva/repository/internal/</url> <releases> <enabled>true</enabled> </releases> @@ -37,6 +37,11 @@ </dependency> <dependency> <groupId>org.springframework</groupId> + <artifactId>spring-flex</artifactId> + <version>1.0.0.M2</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> <artifactId>spring-hibernate3</artifactId> <version>2.0-m4</version> </dependency> @@ -71,7 +76,45 @@ <artifactId>hibernate-tools</artifactId> <version>3.2.3.GA</version> </dependency> - </dependencies> + <profiles> + <profile> + <id>ant</id> + <build> + <defaultGoal>antrun:run</defaultGoal> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <goals> + <goal>load</goal> + </goals> + <configuration> + <tasks> + <!-- + can be invoked via + mvn -P ant -D target=initialize-data + --> + <property name="compile.classpath" refid="maven.compile.classpath" /> + <property name="runtime.classpath" refid="maven.runtime.classpath" /> + <property name="test.classpath" refid="maven.test.classpath" /> + <property name="plugin.classpath" refid="maven.plugin.classpath" /> + <ant antfile="${basedir}/init-db.ant.xml" inheritRefs="true" inheritAll="true"> + <target name="${target}" /> + </ant> + </tasks> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>ant-contrib</groupId> + <artifactId>ant-contrib</artifactId> + <version>1.0b2</version> + </dependency> + </dependencies> + </profile> + </profiles> </project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-04-02 21:50:52
|
Revision: 88 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=88&view=rev Author: alllee Date: 2009-04-02 21:50:46 +0000 (Thu, 02 Apr 2009) Log Message: ----------- adding skeletal spring/hibernate setup with maven jetty plugin. Still need to configure spring service definitions properly and also set up web.xml properly. Modified Paths: -------------- mentalmodels/trunk/pom.xml Added Paths: ----------- mentalmodels/trunk/src/main/webapp/ mentalmodels/trunk/src/main/webapp/WEB-INF/ mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml mentalmodels/trunk/src/main/webapp/WEB-INF/classes/ mentalmodels/trunk/src/main/webapp/WEB-INF/classes/log4j.properties mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml mentalmodels/trunk/src/main/webapp/WEB-INF/web.xml Modified: mentalmodels/trunk/pom.xml =================================================================== --- mentalmodels/trunk/pom.xml 2009-04-02 20:12:53 UTC (rev 87) +++ mentalmodels/trunk/pom.xml 2009-04-02 21:50:46 UTC (rev 88) @@ -77,6 +77,42 @@ <version>3.2.3.GA</version> </dependency> </dependencies> + <build> + <finalName>mme</finalName> + <testResources> + <testResource> + <directory>src/main/webapp</directory> + </testResource> + </testResources> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.6</source> + <target>1.6</target> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>tomcat-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.mortbay.jetty</groupId> + <artifactId>maven-jetty-plugin</artifactId> + <configuration> + <connectors> + <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> + <port>8080</port> + <maxIdleTime>60000</maxIdleTime> + </connector> + </connectors> + <scanIntervalSeconds>10</scanIntervalSeconds> + <stopKey>tdar</stopKey> + <stopPort>12919</stopPort> + </configuration> + </plugin> + </plugins> + </build> <profiles> <profile> <id>ant</id> Added: mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml (rev 0) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-04-02 21:50:46 UTC (rev 88) @@ -0,0 +1,50 @@ +<?xml version="1.0"?> +<!-- + vim:sts=2:sw=2: +--> +<!-- + $Id: applicationContext.xml 617 2008-03-28 17:27:23Z alllee $ +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:tx="http://www.springframework.org/schema/tx" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd + "> + + <bean id="mmeDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> + <property name="driverClassName" value="com.mysql.jdbc.Driver"/> + <property name="url" value="jdbc:mysql://localhost/mme"/> + <property name="username" value="mme"/> + <property name="password" value=""/> + </bean> + + <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> + <property name="location" value="/WEB-INF/hibernate.properties"/> + <property name="beanName" value="mmeDataSource"/> + </bean> + + + <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> + <property name="configLocation" value="/WEB-INF/hibernate.cfg.xml"/> + <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"/> + <property name="hibernateProperties"> + <props> + <prop key="hibernate.cglib.use_reflection_optimizer">false</prop> + <prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop> + <prop key="hibernate.show_sql">false</prop> + </props> + </property> + <property name="dataSource" ref="mmeDataSource"/> + </bean> + + <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> + <property name="sessionFactory" ref="sessionFactory"/> + </bean> + <!-- XXX: don't need proxy-target-class if services are interfaces instead..? --> + <tx:annotation-driven proxy-target-class='true'/> + +</beans> Added: mentalmodels/trunk/src/main/webapp/WEB-INF/classes/log4j.properties =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/classes/log4j.properties (rev 0) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/classes/log4j.properties 2009-04-02 21:50:46 UTC (rev 88) @@ -0,0 +1,15 @@ +# Set root category priority to ERROR and its only appender to A1. +log4j.rootCategory=ERROR, A1 + +# A1 is set to be a ConsoleAppender. +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%-4r [%t] (%F:%L) %-5p %c %x - %m%n + +# Add packages to log +log4j.logger.edu.asu.commons=DEBUG + +#log4j.logger.org.springframework=DEBUG +#log4j.logger.org.hibernate=DEBUG Added: mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml (rev 0) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-04-02 21:50:46 UTC (rev 88) @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<!-- +vim:sts=2:sw=2: +--> +<!DOCTYPE hibernate-configuration PUBLIC + "-//Hibernate/Hibernate Configuration DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> +<hibernate-configuration> + <session-factory> + <mapping class='edu.asu.commons.mme.entity.Student'/> + </session-factory> +</hibernate-configuration> + Added: mentalmodels/trunk/src/main/webapp/WEB-INF/web.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/web.xml (rev 0) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/web.xml 2009-04-02 21:50:46 UTC (rev 88) @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +vim:sts=2:sw=2 +--> +<web-app> + <display-name>Mental Models Experiment</display-name> +</web-app> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-04-07 01:00:56
|
Revision: 90 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=90&view=rev Author: alllee Date: 2009-04-07 01:00:46 +0000 (Tue, 07 Apr 2009) Log Message: ----------- adding dependency for slf4j (still not sure why it's needed) and adding hibernate.properties.template in /WEB-INF. Modified Paths: -------------- mentalmodels/trunk/init-db.ant.xml mentalmodels/trunk/pom.xml Added Paths: ----------- mentalmodels/trunk/src/main/db/ mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.properties.template Modified: mentalmodels/trunk/init-db.ant.xml =================================================================== --- mentalmodels/trunk/init-db.ant.xml 2009-04-02 23:53:20 UTC (rev 89) +++ mentalmodels/trunk/init-db.ant.xml 2009-04-07 01:00:46 UTC (rev 90) @@ -6,38 +6,38 @@ Master build file for TDAR deployment. --> <project name="tdar" default="help"> - <!-- get environment vars --> - <property file="hibernate.properties"/> + <!-- where the applicationContext.xml and hibernate.cfg.xml are currently located, this may change --> + <property name='web.inf.dir' value='src/main/webapp/WEB-INF'/> + <property name='db.dir' value='src/main/db'/> + <property name='db.generated.dir' value='${db.dir}/generated'/> + + <!-- first load environment vars from hibernate directly--> + <property file="${web.inf.dir}/hibernate.properties"/> <!-- define some sane default values for db connection if undefined in build.properties --> <property name='db.name' value='mme'/> - <property name='hibernate.connection.url' value='jdbc:postgresql://localhost/${db.name}'/> + <property name='hibernate.connection.url' value='jdbc:mysql://localhost/${db.name}'/> <property name='hibernate.connection.username' value='mme'/> - <property name='hibernate.connection.password' value=''/> + <property name='hibernate.connection.password' value='mme.mme'/> <property name='hibernate.connection.driver_class' value='com.mysql.jdbc.Driver'/> <property name='hibernate.dialect' value='org.hibernate.dialect.MySQLInnoDBDialect'/> - <property name='createdb.url' value='jdbc:postgresql://localhost/template1'/> - <!-- where the applicationContext.xml and hibernate.cfg.xml are currently located, this may change --> - <property name='web.inf.dir' value='src/main/webapp/WEB-INF'/> - <property name='db.dir' value='src/main/db'/> - <property name='db.generated.dir' value='${db.dir}/generated'/> <!-- this should always be available, connect to this if we need to create the tdardev database --> <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpath="${compile.classpath}"/> - <target name="init-db" depends="create-db-schema, create-indexes"/> + <target name="init-db" depends="create-db-schema"/> <target name='create-db-schema'> <mkdir dir='${db.generated.dir}'/> <echo message="You must have valid database connection information within hibernate.properties for this task to succeed."/> <hibernatetool destdir='${db.generated.dir}'> <!-- annotated class/packages are specified in the hibernate.cfg.xml --> - <annotationconfiguration propertyFile="hibernate.properties" configurationfile="${web.inf.dir}/hibernate.cfg.xml"/> - <hbm2ddl export="true" drop="true" outputfilename="tdar.sql"/> + <annotationconfiguration propertyFile="${web.inf.dir}/hibernate.properties" configurationfile="${web.inf.dir}/hibernate.cfg.xml"/> + <hbm2ddl export="true" drop="true" outputfilename="mme-db.sql"/> </hibernatetool> </target> <target name='create-indexes'> @@ -51,32 +51,6 @@ userid="${hibernate.connection.username}" password="${hibernate.connection.password}" classpath="${compile.classpath}" - src="${db.dir}/init-tdar.sql"/> + src="${db.dir}/init-db.sql"/> </target> - - <target name='create-db'> - <sql driver='${hibernate.connection.driver_class}' - url='${createdb.url}' - userid='${hibernate.connection.username}' - password='${hibernate.connection.password}' - onerror='continue' - classpath='${compile.classpath}' autocommit='true'> - DROP DATABASE ${db.name}; - CREATE DATABASE ${db.name} WITH ENCODING 'UTF8'; - </sql> - </target> - - <!-- not needed here. - <target name='load-data' depends='create-db'> - <bunzip2 src='${db.dir}/tdar-data.sql.bz2' dest='${db.dir}/tdar-data.sql'/> - <sql driver='${hibernate.connection.driver_class}' - url='${hibernate.connection.url}' - userid='${hibernate.connection.username}' - password='${hibernate.connection.password}' - classpath='${compile.classpath}'> - <transaction src='${db.dir}/tdar-data.sql'/> - <transaction src='${db.dir}/upgrade-db-tdar.struts.sql'/> - </sql> - </target> - --> </project> Modified: mentalmodels/trunk/pom.xml =================================================================== --- mentalmodels/trunk/pom.xml 2009-04-02 23:53:20 UTC (rev 89) +++ mentalmodels/trunk/pom.xml 2009-04-07 01:00:46 UTC (rev 90) @@ -76,6 +76,12 @@ <artifactId>hibernate-tools</artifactId> <version>3.2.3.GA</version> </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.5.2</version> + </dependency> + </dependencies> <build> <finalName>mme</finalName> Added: mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.properties.template =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.properties.template (rev 0) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.properties.template 2009-04-07 01:00:46 UTC (rev 90) @@ -0,0 +1,5 @@ +hibernate.connection.user=mme +hibernate.connection.password= +hibernate.connection.url=jdbc:mysql://localhost/mme +hibernate.connection.driver_class=com.mysql.jdbc.Driver +hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-04-07 01:51:28
|
Revision: 91 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=91&view=rev Author: seematalele Date: 2009-04-07 01:51:17 +0000 (Tue, 07 Apr 2009) Log Message: ----------- added game package which contains GameConfig.java, LocationConfig.java, RoundConfig.java. LocationConfig.java is not correct that needs to be corrected but I have not mention in the hibernate.cfg.xml file. Modified Paths: -------------- mentalmodels/trunk/init-db.ant.xml mentalmodels/trunk/pom.xml mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml Added Paths: ----------- mentalmodels/trunk/src/main/java/game/ mentalmodels/trunk/src/main/java/game/GameConfig.java mentalmodels/trunk/src/main/java/game/LocationConfig.java mentalmodels/trunk/src/main/java/game/RoundConfig.java Modified: mentalmodels/trunk/init-db.ant.xml =================================================================== --- mentalmodels/trunk/init-db.ant.xml 2009-04-07 01:00:46 UTC (rev 90) +++ mentalmodels/trunk/init-db.ant.xml 2009-04-07 01:51:17 UTC (rev 91) @@ -3,30 +3,33 @@ vim:sts=2:sw=2 $Id: init-db.ant.xml 239 2009-03-20 17:49:19Z alllee $ $Revision: 239 $ -Master build file for TDAR deployment. +Master build file for MME deployment. --> -<project name="tdar" default="help"> +<project name="mme" default="help"> <!-- where the applicationContext.xml and hibernate.cfg.xml are currently located, this may change --> <property name='web.inf.dir' value='src/main/webapp/WEB-INF'/> <property name='db.dir' value='src/main/db'/> <property name='db.generated.dir' value='${db.dir}/generated'/> + <property name='hibernate.properties.file' value='${web.inf.dir}/hibernate.properties'/> + <!-- first load environment vars from hibernate directly--> + <property file="${hibernate.properties.file}"/> - <!-- first load environment vars from hibernate directly--> - <property file="${web.inf.dir}/hibernate.properties"/> <!-- define some sane default values for db connection if undefined in build.properties --> <property name='db.name' value='mme'/> + <property name='hibernate.connection.url' value='jdbc:mysql://localhost/${db.name}'/> <property name='hibernate.connection.username' value='mme'/> + <property name='hibernate.connection.password' value='mme.mme'/> <property name='hibernate.connection.driver_class' value='com.mysql.jdbc.Driver'/> <property name='hibernate.dialect' value='org.hibernate.dialect.MySQLInnoDBDialect'/> <!-- this should always be available, connect to this if we need to create - the tdardev database + the mmedev database --> <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpath="${compile.classpath}"/> @@ -36,8 +39,10 @@ <echo message="You must have valid database connection information within hibernate.properties for this task to succeed."/> <hibernatetool destdir='${db.generated.dir}'> <!-- annotated class/packages are specified in the hibernate.cfg.xml --> - <annotationconfiguration propertyFile="${web.inf.dir}/hibernate.properties" configurationfile="${web.inf.dir}/hibernate.cfg.xml"/> - <hbm2ddl export="true" drop="true" outputfilename="mme-db.sql"/> + + <annotationconfiguration propertyFile="${hibernate.properties.file}" configurationfile="${web.inf.dir}/hibernate.cfg.xml"/> + <hbm2ddl export="true" drop="true" outputfilename="mme.sql"/> + </hibernatetool> </target> <target name='create-indexes'> @@ -51,6 +56,8 @@ userid="${hibernate.connection.username}" password="${hibernate.connection.password}" classpath="${compile.classpath}" - src="${db.dir}/init-db.sql"/> + + src="${db.dir}/init-mme.sql"/> + </target> </project> Modified: mentalmodels/trunk/pom.xml =================================================================== --- mentalmodels/trunk/pom.xml 2009-04-07 01:00:46 UTC (rev 90) +++ mentalmodels/trunk/pom.xml 2009-04-07 01:51:17 UTC (rev 91) @@ -33,7 +33,7 @@ <dependency> <groupId>org.springframework</groupId> <artifactId>spring</artifactId> - <version>2.5.6</version> + <version>2.5.5</version> </dependency> <dependency> <groupId>org.springframework</groupId> Added: mentalmodels/trunk/src/main/java/game/GameConfig.java =================================================================== --- mentalmodels/trunk/src/main/java/game/GameConfig.java (rev 0) +++ mentalmodels/trunk/src/main/java/game/GameConfig.java 2009-04-07 01:51:17 UTC (rev 91) @@ -0,0 +1,119 @@ +package game; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.Lob; + +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Column; +import javax.persistence.GeneratedValue; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import java.util.Date; + + +@Entity +@Table(name="game") +public class GameConfig { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + private Integer no_of_rounds; + private Integer no_of_location; + private Integer max_no_of_days; + private Integer max_fish_harvest; + + @Temporal(TemporalType.DATE) + private Date timestamp; + + private String title; + + @Lob + private String description; + + @Column(scale=2) + private Float money; + private String img_address; + + @OneToMany(cascade=CascadeType.ALL) + private List<RoundConfig> roundconfig= new ArrayList<RoundConfig>(); + + + public void setId(Long id) { + this.id = id; + } + public Long getId() { + return id; + } + public void setNo_of_rounds(Integer no_of_rounds) { + this.no_of_rounds = no_of_rounds; + } + public Integer getNo_of_rounds() { + return no_of_rounds; + } + public void setNo_of_location(Integer no_of_location) { + this.no_of_location = no_of_location; + } + public Integer getNo_of_location() { + return no_of_location; + } + public void setMax_fish_harvest(Integer max_fish_harvest) { + this.max_fish_harvest = max_fish_harvest; + } + public Integer getMax_fish_harvest() { + return max_fish_harvest; + } + public void setMax_no_of_days(Integer max_no_of_days) { + this.max_no_of_days = max_no_of_days; + } + public Integer getMax_no_of_days() { + return max_no_of_days; + } + public void setTimestamp(Date timestamp) { + this.timestamp = timestamp; + } + public Date getTimestamp() { + return timestamp; + } + public void setTitle(String title) { + this.title = title; + } + public String getTitle() { + return title; + } + public void setDescription(String description) { + this.description = description; + } + public String getDescription() { + return description; + } + public void setMoney(Float money) { + this.money = money; + } + public Float getMoney() { + return money; + } + public void setImg_address(String img_address) { + this.img_address = img_address; + } + public String getImg_address() { + return img_address; + } + public void setRoundconfig(List<RoundConfig> roundconfig) { + this.roundconfig = roundconfig; + } + public List<RoundConfig> getRoundconfig() { + return roundconfig; + } + + +} Added: mentalmodels/trunk/src/main/java/game/LocationConfig.java =================================================================== --- mentalmodels/trunk/src/main/java/game/LocationConfig.java (rev 0) +++ mentalmodels/trunk/src/main/java/game/LocationConfig.java 2009-04-07 01:51:17 UTC (rev 91) @@ -0,0 +1,65 @@ +package game; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "location_config") +public class LocationConfig { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @OneToMany(cascade=CascadeType.ALL) + private Long id; + + + private Long round_config_id; + private String location_name; + private Integer max_capacity; + private Float growth_rate; + private Integer start_population; + + public void setId(Long id) { + this.id = id; + } + public Long getId() { + return id; + } + public void setRound_config_id(Long round_config_id) { + this.round_config_id = round_config_id; + } + public Long getRound_config_id() { + return round_config_id; + } + public void setLocation_name(String location_name) { + this.location_name = location_name; + } + public String getLocation_name() { + return location_name; + } + public void setMax_capacity(Integer max_capacity) { + this.max_capacity = max_capacity; + } + public Integer getMax_capacity() { + return max_capacity; + } + public void setGrowth_rate(Float growth_rate) { + this.growth_rate = growth_rate; + } + public Float getGrowth_rate() { + return growth_rate; + } + public void setStart_population(Integer start_population) { + this.start_population = start_population; + } + public Integer getStart_population() { + return start_population; + } + +} Added: mentalmodels/trunk/src/main/java/game/RoundConfig.java =================================================================== --- mentalmodels/trunk/src/main/java/game/RoundConfig.java (rev 0) +++ mentalmodels/trunk/src/main/java/game/RoundConfig.java 2009-04-07 01:51:17 UTC (rev 91) @@ -0,0 +1,66 @@ +package game; + +import java.util.HashSet; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.ManyToMany; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name="round_config") +public class RoundConfig { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + private Integer round_no; + + @ManyToOne(cascade=CascadeType.ALL) + private GameConfig game; + + private Boolean communication_flag; + + /*@ManyToMany (mappedBy= "question_group_id")*/ + private Set<Long> questionGroupId = new HashSet<Long>(); + + public void setId(Long id) { + this.id = id; + } + public Long getId() { + return id; + } + public void setRound_no(Integer round_no) { + this.round_no = round_no; + } + public Integer getRound_no() { + return round_no; + } + + public void setCommunication_flag(Boolean communication_flag) { + this.communication_flag = communication_flag; + } + public Boolean getCommunication_flag() { + return communication_flag; + } + public void setQuestionGroupId(Set<Long> questionGroupId) { + this.questionGroupId = questionGroupId; + } + public Set<Long> getQuestionGroupId() { + return questionGroupId; + } + public void setGame(GameConfig game) { + this.game = game; + } + public GameConfig getGame() { + return game; + } + + + +} Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-04-07 01:00:46 UTC (rev 90) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-04-07 01:51:17 UTC (rev 91) @@ -7,7 +7,10 @@ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> - <mapping class='edu.asu.commons.mme.entity.Student'/> +<!-- <mapping class='edu.asu.commons.mme.entity.Student'/>--> +<mapping class='game.GameConfig'/> +<mapping class='game.RoundConfig'/> + </session-factory> </hibernate-configuration> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-04-18 02:47:47
|
Revision: 109 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=109&view=rev Author: alllee Date: 2009-04-18 02:47:45 +0000 (Sat, 18 Apr 2009) Log Message: ----------- adding cglib-nodep to dependencies so we don't need to have an interface per DAO. Modified Paths: -------------- mentalmodels/trunk/pom.xml mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateStudentDao.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml Modified: mentalmodels/trunk/pom.xml =================================================================== --- mentalmodels/trunk/pom.xml 2009-04-18 02:36:30 UTC (rev 108) +++ mentalmodels/trunk/pom.xml 2009-04-18 02:47:45 UTC (rev 109) @@ -53,6 +53,11 @@ <artifactId>spring-hibernate3</artifactId> <version>2.0-m3</version> </dependency> + <dependency> + <groupId>cglib</groupId> + <artifactId>cglib-nodep</artifactId> + <version>2.2</version> + </dependency> <!-- hibernate and JPA persistence --> <dependency> <groupId>javax.persistence</groupId> Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateStudentDao.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateStudentDao.java 2009-04-18 02:36:30 UTC (rev 108) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateStudentDao.java 2009-04-18 02:47:45 UTC (rev 109) @@ -19,7 +19,6 @@ * @author <a href='mailto:All...@as...'>Allen Lee</a> * @version $Rev$ */ -@Transactional public class HibernateStudentDao extends HibernateDao<Student> { Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java 2009-04-18 02:36:30 UTC (rev 108) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java 2009-04-18 02:47:45 UTC (rev 109) @@ -1,16 +1,10 @@ package edu.asu.commons.mme.service; -import org.apache.log4j.Logger; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.Transaction; import org.springframework.transaction.annotation.Transactional; import edu.asu.commons.mme.dao.HibernateStudentDao; -import edu.asu.commons.mme.entity.GameConfig; -import edu.asu.commons.mme.entity.Gender; -import edu.asu.commons.mme.entity.Student; import edu.asu.commons.mme.entity.Group; +import edu.asu.commons.mme.entity.Student; /** * @@ -21,7 +15,7 @@ * @version $Rev$ */ - +@Transactional public class StudentService extends Service.Base<Student, HibernateStudentDao> { Student newstudent; Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-04-18 02:36:30 UTC (rev 108) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-04-18 02:47:45 UTC (rev 109) @@ -26,8 +26,7 @@ <!-- Flex related information started --> - <flex:message-broker > - </flex:message-broker> + <flex:message-broker /> <!-- XXX: Split these out into separate XML files and import them if this file gets too large --> <!-- spring managed daos --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-07-10 21:02:32
|
Revision: 175 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=175&view=rev Author: seematalele Date: 2009-07-10 21:02:20 +0000 (Fri, 10 Jul 2009) Log Message: ----------- Database initialization working fine. It loads data from database if any. Rename some files. Clean up the folder flex folder. Deleted duplicated files. Modified Paths: -------------- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml mentalmodels/trunk/flex/src/actionscript/Block.as mentalmodels/trunk/flex/src/actionscript/Module.as mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as mentalmodels/trunk/flex/src/custom/db/Block.mxml mentalmodels/trunk/flex/src/custom/db/Module.mxml mentalmodels/trunk/flex/src/custom/db/Question.mxml mentalmodels/trunk/flex/src/custom/db/QuestionGroup.mxml mentalmodels/trunk/flex/src/custom/db/questions/Categorical.mxml mentalmodels/trunk/flex/src/custom/db/questions/CategoricalRelative.mxml mentalmodels/trunk/flex/src/custom/db/questions/CategoricalSimple.mxml mentalmodels/trunk/flex/src/custom/db/questions/Psychometric.mxml mentalmodels/trunk/src/main/db/init-mme.sql mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateModuleDao.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Block.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/CategoricalOption.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Game.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Module.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/PsychometricQuestion.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Question.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundConfig.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/QuestionCreatorService.java mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml Added Paths: ----------- mentalmodels/trunk/flex/src/actionscript/Categorical.as mentalmodels/trunk/flex/src/actionscript/CategoricalOption.as mentalmodels/trunk/flex/src/actionscript/Psychometric.as mentalmodels/trunk/flex/src/actionscript/Question.as mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateQuestionGroupDao.java Removed Paths: ------------- mentalmodels/trunk/flex/src/actionscript/ASCategorical.as mentalmodels/trunk/flex/src/actionscript/ASPsychometric.as mentalmodels/trunk/flex/src/actionscript/ASQuestion.as mentalmodels/trunk/flex/src/actionscript/ASResults.as Modified: mentalmodels/trunk/flex/src/InitialiseDatabase.mxml =================================================================== --- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-07-10 07:04:06 UTC (rev 174) +++ mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-07-10 21:02:20 UTC (rev 175) @@ -1,28 +1,41 @@ <?xml version="1.0" encoding="utf-8"?> -<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:net="flash.net.*" xmlns:comp="customComponents.db.*" +<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:net="flash.net.*" xmlns:comp="customComponents.db.questions.*" xmlns:basicComp="customComponents.db.*" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #80FFAA]" - width="100%" height="100%" clipContent="false" layout="absolute" currentState="none"> + width="100%" height="100%" clipContent="false" layout="absolute" currentState="none" initialize="init()"> <mx:Script> <![CDATA[ + import mx.binding.utils.BindingUtils; + import customComponents.db.questions.Psychometric; import customComponents.db.questions.CategoricalSimple; import customComponents.db.questions.CategoricalRelative; import customComponents.db.questions.Categorical; + + import actionscript.Block; + import actionscript.Module; + import actionscript.Question; + import actionscript.QuestionGroup; + import actionscript.Categorical; + import actionscript.CategoricalOption; + + import mx.collections.ArrayCollection; import mx.effects.Fade; import mx.collections.XMLListCollection; import mx.controls.Alert; + import mx.rpc.events.FaultEvent; + import mx.rpc.events.ResultEvent; - import actionscript.*; + /* id field of module, block and questiongroup and questions should come from database, so when module info is transfered to the server, it should return the id for that module */ - public static var Qid:int = 2; + //public static var Qid:int = 2; + [Bindable] - private var company:XML = - <list> - - <module title="Preexperiment" sequenceNo="1" hours="0" min="3" sec="0" id="1"> + private var survey:XML = + <list> + <module title="Preexperiment" sequenceNo="1" hours="0" min="3" sec="0" id="1"> <block name="Introduction" sequenceNo="1" hours="0" min="3" sec="0" id="1"> <questiongroup header="Welcome to E-Fishery Experiment" description="In this experiment you will design..." sequenceNo="1" id="1"/> @@ -32,29 +45,295 @@ <module title ="Game Round" sequenceNo="2" hours="1" min="30" sec="0" id="2"> <block name="Characterizing Own Strategy" sequenceNo="1" hours="0" min="30" sec="0" id="2"> <questiongroup header="What goals did you follow when designing your strategy" description="Please specify three goals..." sequenceNo="1" id="2"> - <question title="Most important goal" type="psychometric" sequenceNo="1" id="1"> - + <question title="Most important goal" type="categorical" sequenceNo="1" id="1" > </question> - <question title="second important goal" type="catgorical" sequenceNo="2" id="2"> - </question> + <question title="second important goal" type="psychometric" sequenceNo="2" id="2" > + </question> + + </questiongroup> </block> - </module> - - </list>; - + </module> + </list>; + /*[Bindable] + private var survey:XML = + <list> + <module title="Survey Questions" /> + </list>;*/ + + + /*[Bindable] + private var questions:XML = + <list> + <categorical id="1" type="relative"> + <optionKey name="fish" > + + </optionKey> + </categorical> + <categorical id="2" type="simple"> + <optionKey name="poeple" > + + </optionKey> + </categorical> + <psychometric id="1" scale="bipolar" numberOfIntervals="21"> + + </psychometric> + + </list>; */ + + + [Bindable] + private var categoricalQuestions:XML = + <list> + <categorical type="Categorical Questions" id="0"/> + <categorical type="relative" id="2"> + <option name="focus on earning" choice1="less" choice2="more" choice3="most" /> + <option name="focus on fish" choice1="123" choice2="more than 123" choice3="none" /> + </categorical> + <categorical type="simple" id="1"> + <option choice1="less" choice2="more" choice3="most" /> + + </categorical> + + </list>; + + [Bindable] + private var psychometricQuestions:XML = + <list> + <psychometric scale="Psychometric Questions" id="0"/> + <psychometric scale="bipolar" id="2" choice1="good" choice2="better" choice3="best" interval="21" /> + + + </list>; + + [Bindable] - private var companyData:XMLListCollection = new XMLListCollection(company.module); + private var surveyData:XMLListCollection = new XMLListCollection(survey.module); + + private var CategoricalquestionsData:XMLListCollection = new XMLListCollection(categoricalQuestions.categorical); + + private var PsychometricquestionsData:XMLListCollection = new XMLListCollection(psychometricQuestions.psychometric); - public var tempQuestion:ArrayCollection = new ArrayCollection(); + public var tempQuestion:ArrayCollection = new ArrayCollection(); + + private function init():void + { + roQuestionCreator.initializeData(); + } + + private function resultInitializeDataHandler(event:ResultEvent):void + { + //Alert.show(event.result.toString()); + var modulelist:ArrayCollection = new ArrayCollection(); + modulelist = event.result as ArrayCollection; + + + if(modulelist != null) + { + for(var i:int = 0 ; i < modulelist.length ; i++) + { + var module:Module = new Module(); + module = modulelist[i]; + + + //create module node and add into the tree + var newModuleNode:XML = createModuleNode(module); + + survey.appendChild(newModuleNode); + + //if any blocks, add into the module + if(module.blocks != null) + { + for(var blockCounter:int = 0; blockCounter < module.blocks.length; blockCounter++) + { + var block:Block = new Block(); + block = module.blocks[blockCounter]; + + var newBlockNode:XML = createBlockNode(block); + newModuleNode.appendChild(newBlockNode); + + + if(block.questionGroups != null) + { + //if any question Group, add into the block + for(var qgCounter:int = 0; qgCounter < block.questionGroups.length; qgCounter++) + { + var qg:QuestionGroup = new QuestionGroup(); + qg = block.questionGroups[qgCounter]; + + var newQuestionGroupNode:XML = createQuestionGroupNode(qg); + newBlockNode.appendChild(newQuestionGroupNode); + if(qg.questions != null) + { + for(var QCounter:int = 0; QCounter < qg.questions.length; QCounter++) + { + var question:Question = new Question(); + question = qg.questions[QCounter]; + var newQuestionNode:XML = createQuestionNode(question); + newQuestionGroupNode.appendChild(newQuestionNode); + } + } + + } + } + } + } + } + + } + + } + + private function createModuleNode(module:Module):XML + { + + + var newModuleNode:XML = <module/>; + newModuleNode.setLocalName("module"); + newModuleNode.@title= module.description; + newModuleNode.@sequenceNo = module.sequenceNo; + newModuleNode.@hours = module.getHours(); + newModuleNode.@min = module.getMinutes(); + newModuleNode.@sec = module.getSeconds(); + newModuleNode.@id = module.id; + + + return newModuleNode; + + } + private function createBlockNode(block:Block):XML + { + var newBlockNode:XML = <block/>; + newBlockNode.setLocalName("block"); + newBlockNode.@name = block.description; + newBlockNode.@sequenceNo = block.sequenceNo; + newBlockNode.@hours = block.getHours(); + newBlockNode.@min = block.getMinutes(); + newBlockNode.@sec = block.getSeconds(); + newBlockNode.@id = block.id; + + return newBlockNode; + + } + + private function createQuestionGroupNode(questionGroup:QuestionGroup):XML + { + var newNode:XML = <questiongroup/>; + newNode.setLocalName("questiongroup"); + newNode.@header = questionGroup.header; + newNode.@description = questionGroup.description; + newNode.@sequenceNo = questionGroup.sequenceNo; + newNode.@id = questionGroup.id; + + return newNode; + + } + + private function createQuestionNode(question:Question):XML + { + var newQNode:XML = <question/>; + newQNode.setLocalName("question"); + if(question.type.toLowerCase() == "psychometric") + { + var psychometricResult:Psychometric = Psychometric(question); + Alert.show("Id is: " + psychometricResult.id); + Alert.show("Question is: " + psychometricResult.question); + Alert.show("Type is: " + psychometricResult.type); + Alert.show("SeQNo is: " + psychometricResult.sequenceNo); + + var newPNode:XML = <psychometric/>; + newPNode.setLocalName("psychometric"); + newPNode.@id = psychometricResult.id; + newPNode.@scale = psychometricResult.scale; + newPNode.@noOfInterval = psychometricResult.maxSliderValue; + + newQNode.@sequenceNo = psychometricResult.sequenceNo; + newQNode.@title = psychometricResult.question; + newQNode.@type = psychometricResult.type; + newQNode.@id = psychometricResult.id; + + + for(var j:int = 0; j < psychometricResult.choices.length; j++) + { + var str:String = "choice"; + str = str + j; + newPNode.@str = psychometricResult.choices[j]; + } + + psychometricQuestions.appendChild(newPNode); + + } + else if(question.type.toLowerCase() == "categorical") + { + var categoricalResult:Categorical = Categorical(question); + + newQNode.@sequenceNo = categoricalResult.sequenceNo; + newQNode.@title = categoricalResult.question; + newQNode.@type = categoricalResult.type; + newQNode.@id = categoricalResult.id; + /*var questionGroup:XMLList =survey.module.block.questiongroup.(@header == node.@header); + + if( questionGroup.length() > 0 ) + { + questionGroup[0].appendChild(newQNode); + currentState = "none"; + btnsaveQuestion.enabled = false; + }*/ + + var newCNode:XML = <categorical/>; + newCNode.setLocalName("categorical"); + newCNode.@id = categoricalResult.id; + categoricalQuestions.appendChild(newCNode); + + for(var i:int = 0; i < categoricalResult.categoricalOptions.length ; i++) + { + var options:CategoricalOption = new CategoricalOption(); + options = CategoricalOption(categoricalResult.categoricalOptions.getItemAt(i)); + var newOptionNode:XML = <option/>; + newOptionNode.setLocalName("option"); + newOptionNode.@name = options.optionKey; + if(options.choices.length <= 0) + { + newCNode.@type = "simple"; + + } + else + { + newCNode.@type = "relative"; + for(var k:int = 0; k < options.choices.length; k++) + { + var choice:String = "choice"; + choice = choice + k; + newOptionNode.@choice = options.choices[k]; + } + } + + /*var module:XMLList = survey.module.(@id == tempmodule.id); + if( module.length() > 0 ) + { + module[0].appendChild(newBlockNode); + }*/ + newCNode.appendChild(newOptionNode); + } + + + } + return newQNode; + + } + + private function faultHandler(event:FaultEvent):void + { + Alert.show("event fault is " + event.fault.getStackTrace()); + } + private function treeLabel(item:Object):String { - var node:XML = XML(item); if( node.localName() == "module" ) @@ -73,17 +352,43 @@ return null; } - + private function treeLabelPsychometricQ(item:Object):String + { + var node:XML = XML(item); + + if( node.localName() == "psychometric" ) + return node.@scale; + + else + return node.@name; + + } + + private function treeLabelCategoricalQ(item:Object):String + { + var node:XML = XML(item); + + if( node.localName() == "categorical" ) + return node.@type; + + + else + return node.@name; + + } + public function isDurationValid(hours:Number,minutes:Number,seconds:Number):Boolean { return (hours == 0 && minutes == 0 && seconds == 0); } + //Module Functionality Start private function addModule():void { currentState = "module"; var obj:DisplayObject = pnlComponent.getChildAt(1); + var moduleInfo:Module = Module(obj); moduleInfo.reset(); btnsaveModule.enabled = true; @@ -91,7 +396,7 @@ btnsaveBlock.enabled = false; btnsaveQuestionGroup.enabled = false; btnsaveQuestion.enabled = false; - + } private function saveModule(event:Event):void @@ -110,18 +415,17 @@ } else { - var newNode:XML = <module/> - newNode.setLocalName("module"); - newNode.@title=moduleInfo.getName(); - newNode.@sequenceNo =moduleInfo.getSequenceNo(); - newNode.@hours = moduleInfo.getHours(); - newNode.@min = moduleInfo.getMinutes(); - newNode.@sec = moduleInfo.getSeconds(); - company.appendChild(newNode); + var title:String = moduleInfo.getName(); + var seqNo:int = int(moduleInfo.getSequenceNo()); + if(moduleInfo.getId() == 0) + { + roQuestionCreator.saveModule(seqNo, title, getDuration(moduleInfo.getHours(),moduleInfo.getMinutes(),moduleInfo.getSeconds())); + } + else + roQuestionCreator.updateModule(moduleInfo.getId(),seqNo, title, getDuration(moduleInfo.getHours(),moduleInfo.getMinutes(),moduleInfo.getSeconds())); currentState = "none"; btnsaveModule.enabled = false; - // pnlComponent.removeChildAt(1); - + //pnlComponent.removeChildAt(1); } } @@ -132,8 +436,50 @@ } + private function getDuration(hours:int,min:int,sec:int):int + { + return hours * 3600 + min * 60 + sec; + } - + //when module is created, the result will come to resultSaveModuleHandler + public function resultSaveModuleHandler(event:ResultEvent):void + { + var module:Module = Module(event.result as Object); + Alert.show("Id is: " + module.id); + var newModuleNode:XML = <module/>; + newModuleNode.setLocalName("module"); + newModuleNode.@title= module.description; + newModuleNode.@sequenceNo = module.sequenceNo; + newModuleNode.@hours = module.getHours(); + newModuleNode.@min = module.getMinutes(); + newModuleNode.@sec = module.getSeconds(); + newModuleNode.@id = module.id; + survey.appendChild(newModuleNode); + if(surveyData == null) + { + surveyData= new XMLListCollection(survey.module); + } + + + + } + + //when module is updated, the result will come to resultUpdateModuleHandler + public function resultUpdateModuleHandler(event:ResultEvent):void + { + var module:Module = Module(event.result as Object); + var moduleXML:XMLList = survey.module.(@id == module.id); + moduleXML.@title = module.description; + moduleXML.@sequenceNo = module.sequenceNo; + moduleXML.@hours = module.getHours(); + moduleXML.@min = module.getMinutes(); + moduleXML.@sec = module.getSeconds(); + + } + + //Module Functionality Stop + + //Block functionality Start private function addBlock():void { currentState = "block"; @@ -144,8 +490,7 @@ btnsaveModule.enabled = false; btnsaveQuestionGroup.enabled = false; btnsaveQuestion.enabled = false; - - + } private function saveBlock(event:Event):void @@ -154,53 +499,114 @@ var obj:DisplayObject = pnlComponent.getChildAt(1); var blockInfo:Block = Block(obj); - var node:XML = tree.selectedItem as XML; - + var selectedNode:XML = tree.selectedItem as XML; + //Alert.show("enter info","",Alert.OK | Alert.); if(tree.selectedItem == null) { Alert.show("Please select the module from tree to which block should be added."); + return; } else { var isBlockFormValid:Boolean = blockInfo.validateForm(event); + //Alert.show("Local name is: " + selectedNode.localName()); + if(isBlockFormValid) { var durationflag:Boolean = this.isDurationValid(blockInfo.getHours(),blockInfo.getMinutes(),blockInfo.getSeconds()); if(durationflag) { Alert.show("Please enter the valid duration for the given block."); + return; } - else + else { - var newNode:XML = <block/> - newNode.setLocalName("block"); - newNode.@name=blockInfo.getName(); - newNode.@sequenceNo =blockInfo.getSequenceNo(); - newNode.@hours = blockInfo.getHours(); - newNode.@min = blockInfo.getMinutes(); - newNode.@sec = blockInfo.getSeconds(); - - - var module:XMLList =company.module.(@title == node.@title); + + var node:XML; + if(selectedNode.localName() == "module") + { + node = selectedNode; + } + else + { + var parentNode:XML = tree.getParentItem(tree.selectedItem) as XML; + node = parentNode; + } + var module:XMLList = survey.module.(@title == node.@title); + //Alert.show("Module length is : " + module.length()); if( module.length() > 0 ) { - module[0].appendChild(newNode); - currentState = "none"; - btnsaveBlock.enabled = false; - - } - - } + // Alert.show("Block id is : " + blockInfo.getId()); + if(blockInfo.getId() == 0) + { + roQuestionCreator.saveBlock(int(blockInfo.getSequenceNo()),blockInfo.getName(),getDuration(blockInfo.getHours(),blockInfo.getMinutes(),blockInfo.getSeconds()),int(module[0].@id)); + } + else + { + roQuestionCreator.updateBlock(blockInfo.getId(), int(blockInfo.getSequenceNo()),blockInfo.getName(),getDuration(blockInfo.getHours(),blockInfo.getMinutes(),blockInfo.getSeconds()),int(module[0].@id)); + } + currentState = "none"; + btnsaveBlock.enabled = false; + // pnlComponent.removeChildAt(1); + } + } } else { Alert.show("Please fill the form correctly"); + return; } } } + //when block is created, the result will come to resultSaveBlockHandler + public function resultSaveBlockHandler(event:ResultEvent):void + { + var block:Block = Block(event.result as Object); + if(block != null) + { + + var newBlockNode:XML = <block/>; + newBlockNode.setLocalName("block"); + newBlockNode.@name = block.description; + newBlockNode.@sequenceNo = block.sequenceNo; + newBlockNode.@hours = block.getHours(); + newBlockNode.@min = block.getMinutes(); + newBlockNode.@sec = block.getSeconds(); + newBlockNode.@id = block.id; + var tempmodule:Module = block.module; + + var module:XMLList = survey.module.(@id == tempmodule.id); + if( module.length() > 0 ) + { + module[0].appendChild(newBlockNode); + } + } + + + } + + public function resultUpdateBlockHandler(event:ResultEvent):void + { + var block:Block = Block(event.result as Object); + + var tempmodule:Module = block.module; + + var blockXML:XMLList = survey.module.block.(@id == block.id); + + blockXML.@name = block.description; + blockXML.@sequenceNo = block.sequenceNo; + blockXML.@hours = block.getHours(); + blockXML.@min = block.getMinutes(); + blockXML.@sec = block.getSeconds(); + + } + //Block functioanlity Stop + + + //QuestionGroup functionality Start private function addQuestionGroup():void { currentState = "questionGroup"; @@ -217,10 +623,11 @@ private function saveQuestionGroup(event:Event):void { - - - var node:XML = tree.selectedItem as XML; - + + var selectedNode:XML = tree.selectedItem as XML; + var obj:DisplayObject = pnlComponent.getChildAt(1); + var questionGroupInfo:QuestionGroup = QuestionGroup(obj); + Alert.show("Question Group Id is: " + questionGroupInfo.getId()); if(tree.selectedItem == null) { Alert.show("Please select the block from tree to which Question Group should be added."); @@ -230,14 +637,14 @@ { //if(tree.getParentItem(tree.selectedItem) == null) - if(node.localName() == "module") + if(selectedNode.localName() == "module") { Alert.show("You can not add QuestionGroup to Module."); return; } else { - if(node.localName() == "questiongroup" ) + if(selectedNode.localName() == "questiongroup" && questionGroupInfo.getId() == 0) { Alert.show("You can not add QuestionGroup to QuestionGroup."); return; @@ -247,33 +654,90 @@ { //find out the parent module var parentModule:XML = tree.getParentItem(tree.selectedItem) as XML; - var obj:DisplayObject = pnlComponent.getChildAt(1); - var questionGroupInfo:QuestionGroup = QuestionGroup(obj); + + var isQuestionGroupFormValid:Boolean = questionGroupInfo.validateForm(event); if(isQuestionGroupFormValid) { - - var newNode:XML = <questiongroup/>; - newNode.setLocalName("questiongroup"); - newNode.@header = questionGroupInfo.getHeader(); - newNode.@description = questionGroupInfo.getDescription(); - newNode.@sequenceNo = questionGroupInfo.getSequenceNo(); - - var block:XMLList =company.module.block.(@name == node.@name); - Alert.show(block.@name + "is name of the block"); + var node:XML; + /** + * Check if the selected node is block, if it is new Question Group needs to be created. + else if selected node is Question Group, then Question Group needs to be updated.*/ + + if(selectedNode.localName() == "block") + { + node = selectedNode; + } + else if(selectedNode.localName() == "questiongroup") + { + var parentNode:XML = tree.getParentItem(tree.selectedItem) as XML; + node = parentNode; + } + var block:XMLList = survey.module.block.(@id == node.@id); + //Alert.show("block id is : " + block[0].@id + "length is: " + block.length()); if( block.length() > 0 ) - { - block[0].appendChild(newNode); - currentState = "none"; - btnsaveQuestionGroup.enabled = false; - - } + { + if(questionGroupInfo.getId() == 0) + { + roQuestionCreator.saveQuestionGroup(int(questionGroupInfo.getSequenceNo()),questionGroupInfo.getHeader(),questionGroupInfo.getDescription(),int(block[0].@id)); + } + else + { + roQuestionCreator.updateQuestionGroup(int(questionGroupInfo.getSequenceNo()),questionGroupInfo.getHeader(),questionGroupInfo.getDescription(),int(block[0].@id),questionGroup.getId()); + } + currentState = "none"; + btnsaveQuestionGroup.enabled = false; + //pnlComponent.removeChildAt(1); + } } } } } } + + //when QuestionGroup is created, the result will come to resultSaveQuestionGroupHandler + public function resultSaveQuestionGroupHandler(event:ResultEvent):void + { + var questionGroup:QuestionGroup = QuestionGroup(event.result as Object); + Alert.show("Id is: " + questionGroup.id); + var newNode:XML = <questiongroup/>; + newNode.setLocalName("questiongroup"); + newNode.@header = questionGroup.header; + newNode.@description = questionGroup.description; + newNode.@sequenceNo = questionGroup.sequenceNo; + newNode.@id = questionGroup.id; + + var block:Block = questionGroup.block; + + var blockXML:XMLList =survey.module.block.(@id == block.id); + + if( blockXML.length() > 0 ) + { + blockXML[0].appendChild(newNode); + + } + + } + + //when QuestionGroup is updated, the result will come to resultUpdateQuestionGroupHandler + public function resultUpdateQuestionGroupHandler(event:ResultEvent):void + { + var questionGroup:QuestionGroup = QuestionGroup(event.result as Object); + Alert.show("Id is: " + questionGroup.id); + var newNode:XML = <questiongroup/>; + newNode.setLocalName("questiongroup"); + newNode.@header = questionGroup.header; + newNode.@description = questionGroup.description; + newNode.@sequenceNo = questionGroup.sequenceNo; + var block:Block = questionGroup.block; + + } + + //QuestionGroup functionality Stop + + + //Question functionality Start private function addQuestion():void { currentState = "question"; @@ -287,6 +751,25 @@ btnsaveQuestion.enabled = true; } + private function QuestionHandler(event:Event):void + { + if(question.cmbType.selectedItem.toString().toLowerCase() == "psychometric") + currentState = "psychometric"; + else if(question.cmbType.selectedItem.toString().toLowerCase() == "categorical") + currentState = "categorical"; + + } + + private function CategoricalTypeHandler(event:Event):void + { + if(categorical.cmbType.selectedItem.toString().toLowerCase() == "relative") + currentState = "relative"; + else if(categorical.cmbType.selectedItem.toString().toLowerCase() == "simple") + currentState = "simple"; + } + + + private function saveQuestion(event:Event):void { var node:XML = tree.selectedItem as XML; @@ -315,49 +798,195 @@ if(isQuestionGroupFormValid) { - - var newNode:XML = <question/>; - newNode.setLocalName("question"); - newNode.@sequenceNo = questionInfo.getSequenceNo(); - newNode.@title = questionInfo.getQuestion(); - newNode.@type = questionInfo.getType(); - newNode.@id = ++Qid; - var questionGroup:XMLList =company.module.block.questiongroup.(@header == node.@header); - - if( questionGroup.length() > 0 ) - { - questionGroup[0].appendChild(newNode); - currentState = "none"; - btnsaveQuestion.enabled = false; - - } - var ques:ASQuestion = new ASQuestion(newNode.@id); - if(questionInfo.getType().toLowerCase() == "categorical") - { - var cat:ASCategorical = new ASCategorical(newNode.@id); - - var compCategorical:Categorical = Categorical(questionInfo.getQuestionInfo()); - if(compCategorical.getCategoricalType().toLowerCase() == "relative") - { - var relative:CategoricalRelative = CategoricalRelative(compCategorical.getCategoricalInfo()); - cat.setDictionary(relative.dict); - } - else - { - var simple:CategoricalSimple = CategoricalSimple(compCategorical.getCategoricalInfo()); - cat.setDictionary(simple.dict); - } - ques.setQtype(cat); - } - - tempQuestion.addItem(ques); + + if(currentState == "psychometric") + { + var psychobj:DisplayObject = pnlComponent.getChildAt(2); + + var compPsychometric:Psychometric = Psychometric(psychobj); + + var asPsychometric:Psychometric = new Psychometric(); + asPsychometric.scale = compPsychometric.getScale(); + asPsychometric.maxSliderValue = int(compPsychometric.getNumberofIntervals()); + asPsychometric.choices = compPsychometric.getChoices(); + asPsychometric.question = questionInfo.getQuestion(); + asPsychometric.sequenceNo = int(questionInfo.getSequenceNo()); + asPsychometric.type = questionInfo.getType(); + + Alert.show("Psychometric Object :"); + Alert.show("Question: " + asPsychometric.question); + Alert.show("SeQ No: " + asPsychometric.sequenceNo); + Alert.show("Type : " + asPsychometric.type); + roQuestionCreator.saveQuestion(asPsychometric,1); + } + else if(currentState == "relative") + { + var catobj:DisplayObject = pnlComponent.getChildAt(3); + var compCategorical:CategoricalRelative = CategoricalRelative(catobj); + var categoricalQuestion:Categorical = new Categorical(); + + var dict:Dictionary = new Dictionary(); + dict = compCategorical.getDictionary(); + for (var key:Object in dict) + { + var Options:CategoricalOption = new CategoricalOption(); + Options.optionKey = key.toString(); + Options.choices = dict[key]; + categoricalQuestion.categoricalOptions.addItem(Options); + } + categoricalQuestion.type = questionInfo.getType(); + categoricalQuestion.question = questionInfo.getQuestion(); + categoricalQuestion.sequenceNo = int(questionInfo.getSequenceNo()); + for(var i:int = 0; i < categoricalQuestion.categoricalOptions.length ; i++) + { + var testoption:CategoricalOption = new CategoricalOption(); + testoption = CategoricalOption(categoricalQuestion.categoricalOptions.getItemAt(i)); + trace(testoption.optionKey); + trace(testoption.choices); + } + roQuestionCreator.saveQuestion(categoricalQuestion,1); + + } + else if(currentState == "simple") + { + Alert.show("simple state"); + var catSimpleobj:DisplayObject = pnlComponent.getChildAt(3); + var compCategoricalSimple:CategoricalSimple = CategoricalSimple(catSimpleobj); + var categoricalSimpleQuestion:Categorical = new Categorical(); + + + var Simpledict:Dictionary = new Dictionary(); + Simpledict = compCategoricalSimple.getDictionary(); + for (var option:Object in Simpledict) + { + var OptionsSimple:CategoricalOption = new CategoricalOption(); + OptionsSimple.optionKey = option.toString(); + Alert.show("Key : " + option.toString()); + OptionsSimple.choices = Simpledict[key]; + categoricalSimpleQuestion.categoricalOptions.addItem(OptionsSimple); + } + categoricalSimpleQuestion.type = questionInfo.getType(); + categoricalSimpleQuestion.question = questionInfo.getQuestion(); + categoricalSimpleQuestion.sequenceNo = int(questionInfo.getSequenceNo()); + /*for(var j:int = 0; j < categoricalSimpleQuestion.categoricalOptions.length ; j++) + { + var testoption:ASCategoricalOption = new ASCategoricalOption(); + testoption = ASCategoricalOption(categoricalSimpleQuestion.categoricalOptions.getItemAt(i)); + trace(testoption.optionKey); + trace(testoption.choices); + }*/ + Alert.show("Question: " + categoricalSimpleQuestion.question); + Alert.show("SeQ No: " + categoricalSimpleQuestion.sequenceNo); + Alert.show("Type : " + categoricalSimpleQuestion.type); + + + roQuestionCreator.saveQuestion(categoricalSimpleQuestion,1); + + } + //roQuestionCreator.saveQuestion(int(questionInfo.getSequenceNo()),questionInfo.getQuestion(),questionInfo.getType(),int(parentModule.@id)); + } + } } - } - + } + public function resultSaveQuestionHandler(event:ResultEvent):void + { + var test_object:Object = event.result as Object; + Alert.show("Type came from server is: " + test_object.type); + if(test_object.type == "psychometric") + { + var questionResult:Psychometric = Psychometric(event.result as Object); + Alert.show("Id is: " + questionResult.id); + Alert.show("Question is: " + questionResult.question); + Alert.show("Type is: " + questionResult.type); + Alert.show("SeQNo is: " + questionResult.sequenceNo); + + var newPNode:XML = <psychometric/>; + newPNode.setLocalName("psychometric"); + newPNode.@id = questionResult.id; + newPNode.@scale = questionResult.scale; + newPNode.@noOfInterval = questionResult.maxSliderValue; + for(var j:int = 0; j < questionResult.choices.length; j++) + { + var str:String = "choice"; + str = str + j; + newPNode.@str = questionResult.choices[j]; + } + + psychometricQuestions.appendChild(newPNode); + + } + else if(test_object.type.toLowerCase() == "categorical") + { + var categoricalResult:Categorical = Categorical(test_object); + var newQNode:XML = <question/>; + newQNode.setLocalName("question"); + newQNode.@sequenceNo = categoricalResult.sequenceNo; + newQNode.@title = categoricalResult.question; + newQNode.@type = categoricalResult.type; + newQNode.@id = categoricalResult.id; + var questionGroup:XMLList =survey.module.block.questiongroup.(@header == node.@header); + + if( questionGroup.length() > 0 ) + { + questionGroup[0].appendChild(newQNode); + currentState = "none"; + btnsaveQuestion.enabled = false; + } + + var newCNode:XML = <categorical/>; + newCNode.setLocalName("categorical"); + newCNode.@id = categoricalResult.id; + categoricalQuestions.appendChild(newCNode); + + for(var i:int = 0; i < categoricalResult.categoricalOptions.length ; i++) + { + var options:CategoricalOption = new CategoricalOption(); + options = CategoricalOption(categoricalResult.categoricalOptions.getItemAt(i)); + var newOptionNode:XML = <option/>; + newOptionNode.setLocalName("option"); + newOptionNode.@name = options.optionKey; + if(options.choices.length <= 0) + { + newCNode.@type = "simple"; + + } + else + { + newCNode.@type = "relative"; + for(var k:int = 0; k < options.choices.length; k++) + { + var choice:String = "choice"; + choice = choice + k; + newOptionNode.@choice = options.choices[k]; + } + } + + /*var module:XMLList = survey.module.(@id == tempmodule.id); + if( module.length() > 0 ) + { + module[0].appendChild(newBlockNode); + }*/ + newCNode.appendChild(newOptionNode); + } + + + } + + currentState = "none"; + btnsaveQuestion.enabled = false; + + + } + + public function resultUpdateQuestionHandler(event:Event):void + { + + } + //Question functionality Stop public function removeItem():void { currentState = "none"; @@ -380,7 +1009,7 @@ if( children[i].@name == node.@name ) { - delete children[i]; + delete children[i].@*; } } @@ -410,6 +1039,7 @@ moduleInfo.setHours(node.@hours); moduleInfo.setMinutes(node.@min); moduleInfo.setSeconds(node.@sec); + moduleInfo.setId(node.@id); } if(node.localName() == "block") @@ -427,7 +1057,8 @@ blockInfo.setSequenceNo(node.@sequenceNo); blockInfo.setHours(node.@hours); blockInfo.setMinutes(node.@min); - blockInfo.setSeconds(node.@sec); + blockInfo.setSeconds(node.@sec); + blockInfo.setId(node.@id); } if(node.localName() == "questiongroup") @@ -446,7 +1077,8 @@ questionGroupInfo.setHeader(node.@header); questionGroupInfo.setDescription(node.@description); questionGroupInfo.setSequenceNo(node.@sequenceNo); - + questionGroupInfo.setId(node.@id); + //Alert.show("Question group id assigned is: " + node.@id); } if(node.localName() == "question") @@ -459,71 +1091,186 @@ btnsaveBlock.enabled = false; btnsaveQuestionGroup.enabled = false; btnsaveQuestion.enabled = true; - //questionInfo.reset(); + questionInfo.reset(); + //set all fields - questionInfo.setType(node.@type); + //get question infromation like sequence number , type, id and title questionInfo.setQuestion(node.@title); questionInfo.setSequenceNo(node.@sequenceNo); - var id:int = node.@id; - var Q:ASQuestion; + questionInfo.setId(node.@id); - for(var i:int = 0; i<tempQuestion.length; i++) + + + if(node.@type == "categorical") { - Q = tempQuestion[i]; - if(Q.getId() == id ) + currentState = "categorical"; + var catobj:DisplayObject = pnlComponent.getChildAt(2); + var compCategorical:Categorical = Categorical(catobj); + compCategorical.reset(); + + questionInfo.cmbType.selectedItem = "Categorical"; + var categoricalQ:XMLList = categoricalQuestions.categorical.(@id == node.@id); + + if(categoricalQ.length() > 0) { - if(Q.getType().toLowerCase() == "categorical") + if(categoricalQ[0].@type == "relative") { - var cat:ASCategorical = ASCategorical(Q.getQtype()); - Alert.show(cat.dict[0]); + compCategorical.setType("relative"); - } + currentState = "relative"; + + var cat1obj:DisplayObject = pnlComponent.getChildAt(3); + var compRelative:CategoricalRelative = CategoricalRelative(cat1obj); + + var dict:Dictionary = new Dictionary(); + var optionList:XMLList = categoricalQ[0].option.@name; + //Alert.show("option key: " + optionList.length()); + for(var j:int = 0; j<optionList.length(); j++) + { + var str:String = optionList[j]; + compRelative.header1List.addItem(str); + + dict[str] = new ArrayCollection(); + var attributeList:XMLList = categoricalQ[0].option[j].attributes(); + + for(var i:int = 0; i < attributeList.length(); i++) + { + if(attributeList[i] != optionList[j]) + { + dict[str].addItem(attributeList[i]); + } + + } + } + + compRelative.setDictionary(dict); + + } + else if(categoricalQ[0].@type == "simple") + { + compCategorical.setType("simple"); + currentState = "simple"; + var cat2obj:DisplayObject = pnlComponent.getChildAt(3); + var compSimple:CategoricalSimple = CategoricalSimple(cat2obj); + + var dictionary:Dictionary = new Dictionary(); + + var attributeSimpleList:XMLList = categoricalQ[0].option.attributes(); + var str1:String; + + for(var k:int = 0; k < attributeSimpleList.length(); k++) + { + str1 = attributeSimpleList[k]; + compSimple.header.addItem(str1); + dictionary[str1] = new ArrayCollection(); + dictionary[str1].addItem(null); + } + + } + compSimple.setDictionary(dictionary); + } - } - } + } - - } + else if(node.@type == "psychometric") + { + currentState = "psychometric"; + var psychobj:DisplayObject = pnlComponent.getChildAt(2); + var compPsychometric:Psychometric = Psychometric(psychobj); + compPsychometric.reset(); + questionInfo.cmbType.selectedItem = "Psychometric"; + var psychometricQ:XMLList = psychometricQuestions.psychometric.(@id == node.@id); + if(psychometricQ.length() > 0) + { + compPsychometric.setScale(psychometricQ[0].@scale); + compPsychometric.setNumberofIntervals(psychometricQ[0].@interval); + var psychometricAttributes:XMLList = psychometricQ[0].attributes(); + + compPsychometric.vboxChoices.visible = true; + for(var l:int =0; l < psychometricAttributes.length(); l++) + { + Alert.show("Attribute is : " +psychometricAttributes[l]); + if((psychometricAttributes[l] != psychometricQ[0].@id) && (psychometricAttributes[l] != psychometricQ[0].@scale) && (psychometricAttributes[l] != psychometricQ[0].@interval)) + { + compPsychometric.choice.addItem(psychometricAttributes[l]); + } + } + } + } + else + currentState = "none"; + } } - - + ]]> </mx:Script> <mx:states> <mx:State name="module"> <mx:AddChild relativeTo="{pnlComponent}"> - <comp:Module id="module"/> + <basicComp:Module id="module"/> </mx:AddChild> </mx:State> <mx:State name="block"> <mx:AddChild relativeTo="{pnlComponent}"> - <comp:Block id="block"/> + <basicComp:Block id="block"/> </mx:AddChild> </mx:State> <mx:State name="questionGroup"> <mx:AddChild relativeTo="{pnlComponent}"> - <comp:QuestionGroup id="questionGroup"/> + <basicComp:QuestionGroup id="questionGroup"/> </mx:AddChild> </mx:State> <mx:State name="question"> <mx:AddChild relativeTo="{pnlComponent}"> - <comp:Question id="question"/> + <basicComp:Question id="question"/> </mx:AddChild> + <mx:SetEventHandler handlerFunction="QuestionHandler" target="{question.cmbType}" name="change" /> </mx:State> + <mx:State name="none"/> + <mx:State name="psychometric" basedOn="question"> + <mx:AddChild relativeTo="{pnlComponent}"> + <comp:Psychometric id="psychometric" width="335"/> + </mx:AddChild> + </mx:State> + + <mx:State name="categorical" basedOn="question" > + <mx:AddChild relativeTo="{pnlComponent}"> + <comp:Categorical id="categorical" width="335"/> + </mx:AddChild> + + <mx:SetEventHandler handlerFunction="CategoricalTypeHandler" target="{categorical.cmbType}" name="change" /> + + </mx:State> + + <mx:State name="relative" basedOn="categorical"> + <mx:AddChild relativeTo="{pnlComponent}"> + <comp:CategoricalRelative id="categoricalRelative" width="100%"/> + </mx:AddChild> + </mx:State> + + + <mx:State name="simple" basedOn="categorical"> + <mx:AddChild relativeTo="{pnlComponent}"> + <comp:CategoricalSimple id="categoricalSimple" width="100%"/> + </mx:AddChild> + <mx:SetProperty target="{categorical}" name="width" value="335"/> + </mx:State> + + <!-- <mx:State name="text" basedOn="question"/> --> - <mx:State name="none"> - </mx:State> + + </mx:states> <mx:Spacer width="40"/> <mx:HDividedBox width="100%" height="100%" id="hdMain"> <mx:Spacer width="40"/> <mx:VBox height="100%" id="vboxLeft" width ="40%"> <mx:Spacer width="40"/> - <mx:Tree id="tree" dataProvider="{companyData}" + <mx:Tree id="tree" dataProvider="{surveyData}" labelFunction="treeLabel" allowMultipleSelection="false" selectable="true" showRoot="true" change="{treeChanged(event)}" height="50%" width="80%" textAlign="center"/> @@ -554,6 +1301,7 @@ <mx:GridRow width="100%" height="100%" id="gridrow2"> <mx:GridItem width="100%" height="100%" id="griditem1"> <mx:Button label="Remove Item" id="butRemModule" click ="{removeItem()}"/> + <mx:Button id="butnTest" label="Test" click="{init()}"/> </mx:GridItem> @@ -561,6 +1309,16 @@ </mx:Grid> </mx:Canvas> + <mx:Tree id="treeCQ" dataProvider="{categoricalQuestions}" + labelFunction="treeLabelCategoricalQ" allowMultipleSelection="false" selectable="true" + showRoot="true" change="{treeChanged(event)}" + height="50%" width="80%" textAlign="center"/> + + <mx:Spacer width="20"/> + <mx:Tree id="treePQ" dataProvider="{psychometricQuestions}" + labelFunction="treeLabelPsychometricQ" allowMultipleSelection="false" selectable="true" + showRoot="true" change="{treeChanged(event)}" + height="50%" width="80%" textAlign="center"/> </mx:VBox> <mx:Panel id = "pnlComponent" height="100%" layout="vertical"> <mx:HBox width="100%"> @@ -573,10 +1331,23 @@ <mx:Spacer width="40"/> <mx:Button id = "btnsaveQuestion" enabled="false" label="Save Question" click="{saveQuestion(event)}" /> <mx:Spacer width="40"/> - + <mx:Label id="lbltest" /> </mx:HBox> </mx:Panel> + </mx:HDividedBox> + <mx:RemoteObject id="roQuestionCreator" destination="questionCreatorService" fault="faultHandler(event)" > + <mx:method name="saveModule" result="resultSaveModuleHandler(event)" /> + <mx:method name="updateModule" result="resultUpdateModuleHandler(event)" /> + <mx:method name="saveBlock" result="resultSaveBlockHandler(event)" /> + <mx:method name="updateBlock" result="resultUpdateBlockHandler(event)" /> + <mx:method name="saveQuestionGroup" result="resultSaveQuestionGroupHandler(event)" /> + <mx:method name="updateQuestionGroup" result="resultUpdateQuestionGroupHandler(event)" /> + <mx:method name="saveQuestion" result="resultSaveQuestionHandler(event)" /> + <mx:method name="updateQuestion" result="resultUpdateQuestionHandler(event)" /> + <mx:method name="initializeData" result="resultInitializeDataHandler(event)" /> + + </mx:RemoteObject> </mx:Application> Deleted: mentalmodels/trunk/flex/src/actionscript/ASCategorical.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/ASCategorical.as 2009-07-10 07:04:06 UTC (rev 174) +++ mentalmodels/trunk/flex/src/actionscript/ASCategorical.as 2009-07-10 21:02:20 UTC (rev 175) @@ -1,30 +0,0 @@ -package actionscript -{ - import flash.utils.Dictionary; - - import mx.collections.ArrayCollection; - - public class ASCategorical - { - public var id:int; - - public function ASCategorical(id:int) - { - this.id = id; - } - - public var type:String; - public var dict:Dictionary = new Dictionary(); - - public function setDictionary(dictionary:Dictionary):void - { - dict = dictionary; - } - - public function getDictionary():Dictionary - { - return dict; - } - - } -} \ No newline at end of file Deleted: mentalmodels/trunk/flex/src/actionscript/ASPsychometric.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/ASPsychometric.as 2009-07-10 07:04:06 UTC (rev 174) +++ mentalmodels/trunk/flex/src/actionscript/ASPsychometric.as 2009-07-10 21:02:20 UTC (rev 175) @@ -1,20 +0,0 @@ -package actionscript -{ - import mx.collections.ArrayCollection; - - public class ASPsychometric - { - public function ASPsychometric() - { - } - - - public var scale:String; - - public var numberOfIntervals:Number; - - public var choices:ArrayCollection; - - - } -} \ No newline at end of file Deleted: mentalmodels/trunk/flex/src/actionscript/ASQuestion.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/ASQuestion.as 2009-07-10 07:04:06 UTC (rev 174) +++ mentalmodels/trunk/flex/src/actionscript/ASQuestion.as 2009-07-10 21:02:20 UTC (rev 175) @@ -1,46 +0,0 @@ -package actionscript -{ - import mx.collections.ArrayCollection; - - public class ASQuestion - { - private var id:int; - public var question:String; - private var type:String; - private var Qtype:Object; - - public function ASQuestion(id:int) - { - this.id = id; - - } - - public function setType(type:String):void - { - this.type = type; - - } - - public function getType():String - { - return type; - } - - public function setQtype(questionInfo:Object):void - { - this.Qtype = questionInfo; - } - - public function getQtype():Object - { - return Qtype; - } - - public function getId():int - { - return id; - } - - - } -} \ No newline at end of file Deleted: mentalmodels/trunk/flex/src/actionscript/ASResults.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/ASResults.as 2009-07-10 07:04:06 UTC (rev 174) +++ mentalmodels/trunk/flex/src/actionscript/ASResults.as 2009-07-10 21:02:20 UTC (rev 175) @@ -1,18 +0,0 @@ -package actionscript -{ - import mx.messaging.channels.StreamingHTTPChannel; - - public class ASResults - { - public function ASResults() - { - } - public function calculateString():String - { - var greeting:String; - greeting="Welcome Kalin!!"; - return String(greeting); - } - - } -} \ No newline at end of file Modified: mentalmodels/trunk/flex/src/actionscript/Block.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Block.as 2009-07-10 07:04:06 UTC (rev 174) +++ mentalmodels/trunk/flex/src/actionscript/Block.as 2009-07-10 21:02:20 UTC (rev 175) @@ -1,6 +1,9 @@ package actionscript { + import mx.collections.ArrayCollection; + import mx.formatters.NumberFormatter; + import mx.formatters.NumberBaseRoundType; [Bindable] [RemoteClass(alias="edu.asu.commons.mme.entity.Block")] @@ -10,7 +13,25 @@ public var sequenceNo:int; public var description:String; public var duration:int; + public var module:ASModule; public var questionGroups:ArrayCollection; public var informationWindows:ArrayCollection; + + public function getHours():int + { + return int(Math.floor(duration/3600)); + } + + public function getMinutes():int + { + var tempDuration:int; + tempDuration = duration - (getHours() * 3600); + return int(Math.floor(tempDuration/60)); + } + + public function getSeconds():int + { + return (duration - (getMinutes() * 60)); + } } } \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/Categorical.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Categorical.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/Categorical.as 2009-07-10 21:02:20 UTC (rev 175) @@ -0,0 +1,12 @@ +package actionscript +{ + import mx.collections.ArrayCollection; + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.CategoricalQuestion")] + public class Categorical extends Question + { + + public var categoricalOptions:ArrayCollection = new ArrayCollection(); + } +} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/CategoricalOption.as =================================================================== --- mentalmode... [truncated message content] |
From: <see...@us...> - 2009-07-11 22:44:09
|
Revision: 178 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=178&view=rev Author: seematalele Date: 2009-07-11 22:43:56 +0000 (Sat, 11 Jul 2009) Log Message: ----------- Fixed errors in the following files - 1)Block.java - removed informationWindow variable 2)InitialiseDatabase.mxml file - due to changes in the folder structure and class names, getting lot of errors. 3)init-mme.sql - round_config_location table was empty. I written insert statement for this table. Modified Paths: -------------- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml mentalmodels/trunk/flex/src/custom/db/Question.mxml mentalmodels/trunk/flex/src/custom/db/questions/Categorical.mxml mentalmodels/trunk/flex/src/custom/db/questions/Psychometric.mxml mentalmodels/trunk/src/main/db/init-mme.sql mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Block.java Removed Paths: ------------- mentalmodels/trunk/flex/.actionScriptProperties mentalmodels/trunk/flex/.flexProperties mentalmodels/trunk/flex/.project mentalmodels/trunk/flex/src/actionscript/questions/PsychometricQuestion.as Deleted: mentalmodels/trunk/flex/.actionScriptProperties =================================================================== --- mentalmodels/trunk/flex/.actionScriptProperties 2009-07-10 22:11:37 UTC (rev 177) +++ mentalmodels/trunk/flex/.actionScriptProperties 2009-07-11 22:43:56 UTC (rev 178) @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<actionScriptProperties mainApplicationPath="FisheryExperiment.mxml" version="3"> - <compiler additionalCompilerArguments="-locale en_US" copyDependentFiles="true" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="true" outputFolderPath="bin-debug" sourceFolderPath="src" strict="true" useApolloConfig="false" verifyDigests="true" warn="true"> - <compilerSourcePath/> - <libraryPath defaultLinkType="1"> - <libraryPathEntry kind="4" path=""/> - <libraryPathEntry kind="1" linkType="1" path="libs"/> - </libraryPath> - <sourceAttachmentPath/> - </compiler> - <applications> - <application path="Socio_demographic.mxml"/> - <application path="TestApp.mxml"/> - <application path="display.mxml"/> - <application path="TableTest.mxml"/> - <application path="MME.mxml"/> - <application path="Mental.mxml"/> - <application path="FisheryExperiment.mxml"/> - </applications> - <modules/> - <buildCSSFiles/> -</actionScriptProperties> Deleted: mentalmodels/trunk/flex/.flexProperties =================================================================== --- mentalmodels/trunk/flex/.flexProperties 2009-07-10 22:11:37 UTC (rev 177) +++ mentalmodels/trunk/flex/.flexProperties 2009-07-11 22:43:56 UTC (rev 178) @@ -1,2 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<flexProperties flexServerType="0" toolCompile="true" useServerFlexSDK="false" version="1"/> Deleted: mentalmodels/trunk/flex/.project =================================================================== --- mentalmodels/trunk/flex/.project 2009-07-10 22:11:37 UTC (rev 177) +++ mentalmodels/trunk/flex/.project 2009-07-11 22:43:56 UTC (rev 178) @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>Fishery</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>com.adobe.flexbuilder.project.flexbuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>com.adobe.flexbuilder.project.flexnature</nature> - <nature>com.adobe.flexbuilder.project.actionscriptnature</nature> - </natures> -</projectDescription> Modified: mentalmodels/trunk/flex/src/InitialiseDatabase.mxml =================================================================== --- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-07-10 22:11:37 UTC (rev 177) +++ mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-07-11 22:43:56 UTC (rev 178) @@ -1,18 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> -<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:net="flash.net.*" xmlns:comp="customComponents.db.questions.*" xmlns:basicComp="customComponents.db.*" +<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:net="flash.net.*" xmlns:comp="custom.db.questions.*" xmlns:basicComp="custom.db.*" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #80FFAA]" width="100%" height="100%" clipContent="false" layout="absolute" currentState="none" initialize="init()"> <mx:Script> <![CDATA[ import mx.binding.utils.BindingUtils; - import customComponents.db.questions.Psychometric; - import customComponents.db.questions.CategoricalSimple; - import customComponents.db.questions.CategoricalRelative; - import customComponents.db.questions.Categorical; + /*import custom.db.questions.Psychometric; + import custom.db.questions.CategoricalSimple; + import custom.db.questions.CategoricalRelative; + import custom.db.questions.Categorical; + import custom.db.Block; */ import actionscript.Block; import actionscript.Module; - import actionscript.Question; + import actionscript.questions.Question; import actionscript.QuestionGroup; import actionscript.questions.Categorical; import actionscript.questions.CategoricalOption; @@ -137,7 +138,7 @@ { for(var i:int = 0 ; i < modulelist.length ; i++) { - var module:Module = new Module(); + var module:actionscript.Module = new actionscript.Module(); module = modulelist[i]; @@ -151,7 +152,7 @@ { for(var blockCounter:int = 0; blockCounter < module.blocks.length; blockCounter++) { - var block:Block = new Block(); + var block:actionscript.Block = new actionscript.Block(); block = module.blocks[blockCounter]; var newBlockNode:XML = createBlockNode(block); @@ -163,7 +164,7 @@ //if any question Group, add into the block for(var qgCounter:int = 0; qgCounter < block.questionGroups.length; qgCounter++) { - var qg:QuestionGroup = new QuestionGroup(); + var qg:actionscript.QuestionGroup = new actionscript.QuestionGroup(); qg = block.questionGroups[qgCounter]; var newQuestionGroupNode:XML = createQuestionGroupNode(qg); @@ -172,7 +173,7 @@ { for(var QCounter:int = 0; QCounter < qg.questions.length; QCounter++) { - var question:Question = new Question(); + var question:actionscript.questions.Question = new actionscript.questions.Question(); question = qg.questions[QCounter]; var newQuestionNode:XML = createQuestionNode(question); newQuestionGroupNode.appendChild(newQuestionNode); @@ -189,7 +190,7 @@ } - private function createModuleNode(module:Module):XML + private function createModuleNode(module:actionscript.Module):XML { @@ -207,7 +208,7 @@ } - private function createBlockNode(block:Block):XML + private function createBlockNode(block:actionscript.Block):XML { var newBlockNode:XML = <block/>; newBlockNode.setLocalName("block"); @@ -222,7 +223,7 @@ } - private function createQuestionGroupNode(questionGroup:QuestionGroup):XML + private function createQuestionGroupNode(questionGroup:actionscript.QuestionGroup):XML { var newNode:XML = <questiongroup/>; newNode.setLocalName("questiongroup"); @@ -235,13 +236,13 @@ } - private function createQuestionNode(question:Question):XML + private function createQuestionNode(question:actionscript.questions.Question):XML { var newQNode:XML = <question/>; newQNode.setLocalName("question"); if(question.type.toLowerCase() == "psychometric") { - var psychometricResult:Psychometric = Psychometric(question); + var psychometricResult:actionscript.questions.Psychometric = actionscript.questions.Psychometric(question); Alert.show("Id is: " + psychometricResult.id); Alert.show("Question is: " + psychometricResult.question); Alert.show("Type is: " + psychometricResult.type); @@ -271,7 +272,7 @@ } else if(question.type.toLowerCase() == "categorical") { - var categoricalResult:Categorical = Categorical(question); + var categoricalResult:actionscript.questions.Categorical = actionscript.questions.Categorical(question); newQNode.@sequenceNo = categoricalResult.sequenceNo; newQNode.@title = categoricalResult.question; @@ -293,8 +294,8 @@ for(var i:int = 0; i < categoricalResult.categoricalOptions.length ; i++) { - var options:CategoricalOption = new CategoricalOption(); - options = CategoricalOption(categoricalResult.categoricalOptions.getItemAt(i)); + var options:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); + options = actionscript.questions.CategoricalOption(categoricalResult.categoricalOptions.getItemAt(i)); var newOptionNode:XML = <option/>; newOptionNode.setLocalName("option"); newOptionNode.@name = options.optionKey; @@ -390,7 +391,7 @@ currentState = "module"; var obj:DisplayObject = pnlComponent.getChildAt(1); - var moduleInfo:Module = Module(obj); + var moduleInfo:custom.db.Module = custom.db.Module(obj); moduleInfo.reset(); btnsaveModule.enabled = true; @@ -404,7 +405,7 @@ { var obj:DisplayObject = pnlComponent.getChildAt(1); - var moduleInfo:Module = Module(obj); + var moduleInfo:custom.db.Module = custom.db.Module(obj); var isModuleFormValid:Boolean = moduleInfo.validateForm(event); if(isModuleFormValid) @@ -445,7 +446,7 @@ //when module is created, the result will come to resultSaveModuleHandler public function resultSaveModuleHandler(event:ResultEvent):void { - var module:Module = Module(event.result as Object); + var module:actionscript.Module = actionscript.Module(event.result as Object); Alert.show("Id is: " + module.id); var newModuleNode:XML = <module/>; newModuleNode.setLocalName("module"); @@ -468,7 +469,7 @@ //when module is updated, the result will come to resultUpdateModuleHandler public function resultUpdateModuleHandler(event:ResultEvent):void { - var module:Module = Module(event.result as Object); + var module:actionscript.Module = actionscript.Module(event.result as Object); var moduleXML:XMLList = survey.module.(@id == module.id); moduleXML.@title = module.description; moduleXML.@sequenceNo = module.sequenceNo; @@ -485,7 +486,7 @@ { currentState = "block"; var obj:DisplayObject = pnlComponent.getChildAt(1); - var blockInfo:Block = Block(obj); + var blockInfo:custom.db.Block = custom.db.Block(obj); blockInfo.reset(); btnsaveBlock.enabled = true; btnsaveModule.enabled = false; @@ -498,7 +499,7 @@ { var obj:DisplayObject = pnlComponent.getChildAt(1); - var blockInfo:Block = Block(obj); + var blockInfo:custom.db.Block = custom.db.Block(obj); var selectedNode:XML = tree.selectedItem as XML; //Alert.show("enter info","",Alert.OK | Alert.); @@ -565,7 +566,7 @@ //when block is created, the result will come to resultSaveBlockHandler public function resultSaveBlockHandler(event:ResultEvent):void { - var block:Block = Block(event.result as Object); + var block:actionscript.Block = actionscript.Block(event.result as Object); if(block != null) { @@ -577,7 +578,7 @@ newBlockNode.@min = block.getMinutes(); newBlockNode.@sec = block.getSeconds(); newBlockNode.@id = block.id; - var tempmodule:Module = block.module; + var tempmodule:actionscript.Module = block.module; var module:XMLList = survey.module.(@id == tempmodule.id); if( module.length() > 0 ) @@ -591,9 +592,9 @@ public function resultUpdateBlockHandler(event:ResultEvent):void { - var block:Block = Block(event.result as Object); + var block:actionscript.Block = actionscript.Block(event.result as Object); - var tempmodule:Module = block.module; + var tempmodule:actionscript.Module = block.module; var blockXML:XMLList = survey.module.block.(@id == block.id); @@ -612,7 +613,7 @@ { currentState = "questionGroup"; var obj:DisplayObject = pnlComponent.getChildAt(1); - var questionGroupInfo:QuestionGroup = QuestionGroup(obj); + var questionGroupInfo:custom.db.QuestionGroup = custom.db.QuestionGroup(obj); questionGroupInfo.reset(); btnsaveModule.enabled = false; @@ -627,7 +628,7 @@ var selectedNode:XML = tree.selectedItem as XML; var obj:DisplayObject = pnlComponent.getChildAt(1); - var questionGroupInfo:QuestionGroup = QuestionGroup(obj); + var questionGroupInfo:custom.db.QuestionGroup = custom.db.QuestionGroup(obj); Alert.show("Question Group Id is: " + questionGroupInfo.getId()); if(tree.selectedItem == null) { @@ -700,7 +701,7 @@ //when QuestionGroup is created, the result will come to resultSaveQuestionGroupHandler public function resultSaveQuestionGroupHandler(event:ResultEvent):void { - var questionGroup:QuestionGroup = QuestionGroup(event.result as Object); + var questionGroup:actionscript.QuestionGroup = actionscript.QuestionGroup(event.result as Object); Alert.show("Id is: " + questionGroup.id); var newNode:XML = <questiongroup/>; newNode.setLocalName("questiongroup"); @@ -709,7 +710,7 @@ newNode.@sequenceNo = questionGroup.sequenceNo; newNode.@id = questionGroup.id; - var block:Block = questionGroup.block; + var block:actionscript.Block = questionGroup.block; var blockXML:XMLList =survey.module.block.(@id == block.id); @@ -724,14 +725,14 @@ //when QuestionGroup is updated, the result will come to resultUpdateQuestionGroupHandler public function resultUpdateQuestionGroupHandler(event:ResultEvent):void { - var questionGroup:QuestionGroup = QuestionGroup(event.result as Object); + var questionGroup:actionscript.QuestionGroup = actionscript.QuestionGroup(event.result as Object); Alert.show("Id is: " + questionGroup.id); var newNode:XML = <questiongroup/>; newNode.setLocalName("questiongroup"); newNode.@header = questionGroup.header; newNode.@description = questionGroup.description; newNode.@sequenceNo = questionGroup.sequenceNo; - var block:Block = questionGroup.block; + var block:actionscript.Block = questionGroup.block; } @@ -743,7 +744,7 @@ { currentState = "question"; var obj:DisplayObject = pnlComponent.getChildAt(1); - var questionInfo:Question = Question(obj); + var questionInfo:custom.db.Question = custom.db.Question(obj); questionInfo.reset(); btnsaveModule.enabled = false; @@ -794,7 +795,7 @@ //find out the parent module var parentModule:XML = tree.getParentItem(tree.selectedItem) as XML; var obj:DisplayObject = pnlComponent.getChildAt(1); - var questionInfo:Question = Question(obj); + var questionInfo:custom.db.Question = custom.db.Question(obj); var isQuestionGroupFormValid:Boolean = questionInfo.validateForm(event); if(isQuestionGroupFormValid) @@ -804,9 +805,9 @@ { var psychobj:DisplayObject = pnlComponent.getChildAt(2); - var compPsychometric:Psychometric = Psychometric(psychobj); + var compPsychometric:custom.db.questions.Psychometric = custom.db.questions.Psychometric(psychobj); - var asPsychometric:Psychometric = new Psychometric(); + var asPsychometric:actionscript.questions.Psychometric = new actionscript.questions.Psychometric(); asPsychometric.scale = compPsychometric.getScale(); asPsychometric.maxSliderValue = int(compPsychometric.getNumberofIntervals()); asPsychometric.choices = compPsychometric.getChoices(); @@ -824,13 +825,13 @@ { var catobj:DisplayObject = pnlComponent.getChildAt(3); var compCategorical:CategoricalRelative = CategoricalRelative(catobj); - var categoricalQuestion:Categorical = new Categorical(); + var categoricalQuestion:actionscript.questions.Categorical = new actionscript.questions.Categorical(); var dict:Dictionary = new Dictionary(); dict = compCategorical.getDictionary(); for (var key:Object in dict) { - var Options:CategoricalOption = new CategoricalOption(); + var Options:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); Options.optionKey = key.toString(); Options.choices = dict[key]; categoricalQuestion.categoricalOptions.addItem(Options); @@ -840,8 +841,8 @@ categoricalQuestion.sequenceNo = int(questionInfo.getSequenceNo()); for(var i:int = 0; i < categoricalQuestion.categoricalOptions.length ; i++) { - var testoption:CategoricalOption = new CategoricalOption(); - testoption = CategoricalOption(categoricalQuestion.categoricalOptions.getItemAt(i)); + var testoption:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); + testoption = actionscript.questions.CategoricalOption(categoricalQuestion.categoricalOptions.getItemAt(i)); trace(testoption.optionKey); trace(testoption.choices); } @@ -852,15 +853,15 @@ { Alert.show("simple state"); var catSimpleobj:DisplayObject = pnlComponent.getChildAt(3); - var compCategoricalSimple:CategoricalSimple = CategoricalSimple(catSimpleobj); - var categoricalSimpleQuestion:Categorical = new Categorical(); + var compCategoricalSimple:custom.db.questions.CategoricalSimple = custom.db.questions.CategoricalSimple(catSimpleobj); + var categoricalSimpleQuestion:actionscript.questions.Categorical = new actionscript.questions.Categorical(); var Simpledict:Dictionary = new Dictionary(); Simpledict = compCategoricalSimple.getDictionary(); for (var option:Object in Simpledict) { - var OptionsSimple:CategoricalOption = new CategoricalOption(); + var OptionsSimple:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); OptionsSimple.optionKey = option.toString(); Alert.show("Key : " + option.toString()); OptionsSimple.choices = Simpledict[key]; @@ -899,7 +900,7 @@ Alert.show("Type came from server is: " + test_object.type); if(test_object.type == "psychometric") { - var questionResult:Psychometric = Psychometric(event.result as Object); + var questionResult:actionscript.questions.Psychometric = actionscript.questions.Psychometric(event.result as Object); Alert.show("Id is: " + questionResult.id); Alert.show("Question is: " + questionResult.question); Alert.show("Type is: " + questionResult.type); @@ -922,7 +923,7 @@ } else if(test_object.type.toLowerCase() == "categorical") { - var categoricalResult:Categorical = Categorical(test_object); + var categoricalResult:actionscript.questions.Categorical = actionscript.questions.Categorical(test_object); var newQNode:XML = <question/>; newQNode.setLocalName("question"); newQNode.@sequenceNo = categoricalResult.sequenceNo; @@ -945,8 +946,8 @@ for(var i:int = 0; i < categoricalResult.categoricalOptions.length ; i++) { - var options:CategoricalOption = new CategoricalOption(); - options = CategoricalOption(categoricalResult.categoricalOptions.getItemAt(i)); + var options:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); + options = actionscript.questions.CategoricalOption(categoricalResult.categoricalOptions.getItemAt(i)); var newOptionNode:XML = <option/>; newOptionNode.setLocalName("option"); newOptionNode.@name = options.optionKey; @@ -1027,7 +1028,7 @@ { currentState = "module"; var module:DisplayObject = pnlComponent.getChildAt(1); - var moduleInfo:Module = Module(module); + var moduleInfo:custom.db.Module = custom.db.Module(module); btnsaveModule.enabled = true; btnsaveBlock.enabled = false; @@ -1047,7 +1048,7 @@ { currentState = "block"; var block:DisplayObject = pnlComponent.getChildAt(1); - var blockInfo:Block = Block(block); + var blockInfo:custom.db.Block = custom.db.Block(block); btnsaveBlock.enabled = true; btnsaveModule.enabled = false; btnsaveQuestionGroup.enabled = false; @@ -1066,7 +1067,7 @@ { currentState = "questionGroup"; var questionGroup:DisplayObject = pnlComponent.getChildAt(1); - var questionGroupInfo:QuestionGroup = QuestionGroup(questionGroup); + var questionGroupInfo:custom.db.QuestionGroup = custom.db.QuestionGroup(questionGroup); questionGroupInfo.reset(); btnsaveModule.enabled = false; @@ -1086,7 +1087,7 @@ { currentState = "question"; var question:DisplayObject = pnlComponent.getChildAt(1); - var questionInfo:Question = Question(question); + var questionInfo:custom.db.Question = custom.db.Question(question); btnsaveModule.enabled = false; btnsaveBlock.enabled = false; @@ -1106,7 +1107,7 @@ { currentState = "categorical"; var catobj:DisplayObject = pnlComponent.getChildAt(2); - var compCategorical:Categorical = Categorical(catobj); + var compCategorical:custom.db.questions.Categorical = custom.db.questions.Categorical(catobj); compCategorical.reset(); questionInfo.cmbType.selectedItem = "Categorical"; @@ -1152,7 +1153,7 @@ compCategorical.setType("simple"); currentState = "simple"; var cat2obj:DisplayObject = pnlComponent.getChildAt(3); - var compSimple:CategoricalSimple = CategoricalSimple(cat2obj); + var compSimple:custom.db.questions.CategoricalSimple = custom.db.questions.CategoricalSimple(cat2obj); var dictionary:Dictionary = new Dictionary(); @@ -1177,7 +1178,7 @@ { currentState = "psychometric"; var psychobj:DisplayObject = pnlComponent.getChildAt(2); - var compPsychometric:Psychometric = Psychometric(psychobj); + var compPsychometric:custom.db.questions.Psychometric = custom.db.questions.Psychometric(psychobj); compPsychometric.reset(); questionInfo.cmbType.selectedItem = "Psychometric"; var psychometricQ:XMLList = psychometricQuestions.psychometric.(@id == node.@id); Deleted: mentalmodels/trunk/flex/src/actionscript/questions/PsychometricQuestion.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/questions/PsychometricQuestion.as 2009-07-10 22:11:37 UTC (rev 177) +++ mentalmodels/trunk/flex/src/actionscript/questions/PsychometricQuestion.as 2009-07-11 22:43:56 UTC (rev 178) @@ -1,13 +0,0 @@ -package actionscript.questions -{ - import mx.collections.ArrayCollection; - - [Bindable] - [RemoteClass(alias="edu.asu.commons.mme.entity.PsychometricQuestion")] - public class PsychometricQuestion extends Question - { - public var scale:String; - public var numberOfIntervals:int; - public var choices:ArrayCollection; - } -} \ No newline at end of file Modified: mentalmodels/trunk/flex/src/custom/db/Question.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/db/Question.mxml 2009-07-10 22:11:37 UTC (rev 177) +++ mentalmodels/trunk/flex/src/custom/db/Question.mxml 2009-07-11 22:43:56 UTC (rev 178) @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<mx:Form xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:net="flash.net.*" xmlns:comp="customComponents.db.questions.*" currentState=""> +<mx:Form xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:net="flash.net.*" xmlns:comp="custom.db.questions.*" currentState=""> <mx:Script> <![CDATA[ import mx.validators.NumberValidator; Modified: mentalmodels/trunk/flex/src/custom/db/questions/Categorical.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/db/questions/Categorical.mxml 2009-07-10 22:11:37 UTC (rev 177) +++ mentalmodels/trunk/flex/src/custom/db/questions/Categorical.mxml 2009-07-11 22:43:56 UTC (rev 178) @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<mx:Form xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:net="flash.net.*" xmlns:comp="customComponents.db.questions.*"> +<mx:Form xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:net="flash.net.*" xmlns:comp="custom.db.questions.*"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; Modified: mentalmodels/trunk/flex/src/custom/db/questions/Psychometric.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/db/questions/Psychometric.mxml 2009-07-10 22:11:37 UTC (rev 177) +++ mentalmodels/trunk/flex/src/custom/db/questions/Psychometric.mxml 2009-07-11 22:43:56 UTC (rev 178) @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<mx:Form xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:net="flash.net.*" xmlns:comp="customComponents.db.questions.*"> +<mx:Form xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:net="flash.net.*" xmlns:comp="custom.db.questions.*"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; Modified: mentalmodels/trunk/src/main/db/init-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/init-mme.sql 2009-07-10 22:11:37 UTC (rev 177) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2009-07-11 22:43:56 UTC (rev 178) @@ -21,14 +21,14 @@ insert into location_round_config(roundConfigs_id,location_id) values(2,3); insert into location_round_config(roundConfigs_id,location_id) values(2,4); -insert into round_config_location(roundConfig_id,locations_id) values(1,1); -insert into round_config_location(roundConfig_id,locations_id) values(1,2); -insert into round_config_location(roundConfig_id,locations_id) values(1,3); -insert into round_config_location(roundConfig_id,locations_id) values(1,4); -insert into round_config_location(roundConfig_id,locations_id) values(2,1); -insert into round_config_location(roundConfig_id,locations_id) values(2,2); -insert into round_config_location(roundConfig_id,locations_id) values(2,3); -insert into round_config_location(roundConfig_id,locations_id) values(2,4); +insert into round_config_location(round_config_id,locations_id) values(1,1); +insert into round_config_location(round_config_id,locations_id) values(1,2); +insert into round_config_location(round_config_id,locations_id) values(1,3); +insert into round_config_location(round_config_id,locations_id) values(1,4); +insert into round_config_location(round_config_id,locations_id) values(2,1); +insert into round_config_location(round_config_id,locations_id) values(2,2); +insert into round_config_location(round_config_id,locations_id) values(2,3); +insert into round_config_location(round_config_id,locations_id) values(2,4); Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Block.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Block.java 2009-07-10 22:11:37 UTC (rev 177) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Block.java 2009-07-11 22:43:56 UTC (rev 178) @@ -100,12 +100,12 @@ return duration; } - public void setInformationWindows(List<Integer> informationWindows) { + /*public void setInformationWindows(List<Integer> informationWindows) { this.informationWindows = informationWindows; } public List<Integer> getInformationWindows() { return informationWindows; - } + }*/ } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-07-12 02:32:20
|
Revision: 180 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=180&view=rev Author: kjonas Date: 2009-07-12 02:32:16 +0000 (Sun, 12 Jul 2009) Log Message: ----------- Today I got online and began updating and installing maven, ant, and mysql at around 15:00. Seema walked me through the process of installing these programs, and I finally managed to get them to work at approximately 16:00. >From 16:00 to 19:15, I worked on fixing the parts of the Flex code that were necessary to make the connection to the server and retrieve a module. The program currently retrieves the first module, allows the user to page through the instructions, and then ceases to function. Modified Paths: -------------- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml mentalmodels/trunk/flex/src/actionscript/PageDisplay.as mentalmodels/trunk/flex/src/custom/FisheryExperimentKalin.mxml mentalmodels/trunk/flex/src/custom/InstructionPage.mxml mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java Property Changed: ---------------- mentalmodels/trunk/ Property changes on: mentalmodels/trunk ___________________________________________________________________ Added: svn:ignore + target Modified: mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml =================================================================== --- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-07-12 00:22:56 UTC (rev 179) +++ mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-07-12 02:32:16 UTC (rev 180) @@ -5,7 +5,7 @@ width="100%" height="100%" xmlns:custom="custom.*" initialize="init()"> - <mx:Button id="btnTemp" label="Update" click="updateObjectA.updateLearned(new ArrayCollection([new ArrayCollection(['test']),new ArrayCollection(['test']),new ArrayCollection(['test'])]))"/> + <!--<mx:Button id="btnTemp" label="Update" click="updateObjectA.updateLearned(new ArrayCollection([new ArrayCollection(['test']),new ArrayCollection(['test']),new ArrayCollection(['test'])]))"/>--> <mx:VBox id="vbxInfo"> <mx:TitleWindow id="InformationWindowA" width="400" height="200" title="Information Window A" Modified: mentalmodels/trunk/flex/src/actionscript/PageDisplay.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-07-12 00:22:56 UTC (rev 179) +++ mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-07-12 02:32:16 UTC (rev 180) @@ -133,19 +133,21 @@ } } } - var head:Label = new Label(); - var desc:Text = new Text(); - head.text = questionGroup.header; - head.setStyle("fontSize", 12); - desc.htmlText = questionGroup.description; - if(head.text.length != 0) tempBox.addChildAt(head,0); - if(desc.htmlText.length != 0) tempBox.addChildAt(desc,1); } else { - msg += "no Questions found\n"; +// msg += "no Questions found\n"; // Alert.show(msg); } + var head:Text = new Text(); + var desc:Text = new Text(); + head.setStyle("fontSize", 12); + head.width = 600; + desc.width = 600; + head.text = questionGroup.header; + desc.htmlText = questionGroup.description; + if(head.text.length != 0) tempBox.addChildAt(head,0); + if(desc.htmlText.length != 0) tempBox.addChildAt(desc,1); pages.addItem(tempBox); // msg += "item added\n"; Modified: mentalmodels/trunk/flex/src/custom/FisheryExperimentKalin.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentKalin.mxml 2009-07-12 00:22:56 UTC (rev 179) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentKalin.mxml 2009-07-12 02:32:16 UTC (rev 180) @@ -4,6 +4,8 @@ currentState="socioDemographic" initialize="init()" width="720" height="490"> + <mx:RemoteObject id="moduleService" destination="moduleService" fault="moduleFaultHandler(event)" result="moduleResultHandler(event)"/> + <mx:states> <mx:State name="socioDemographic"> <mx:AddChild relativeTo="{content}"> @@ -83,19 +85,53 @@ randomNumbers = event.message.body as String; //Alert.show("in ack method" + randomNumbers); } + + public function init():void + { + + } + + private function getModule():Module + { + // server request here + moduleService.getFirstPage(); + + Alert.show("MODULE REQUEST SENT"); + + currModule = null; + return currModule; // set to null for now (clear old) + } + private function moduleResultHandler(event:ResultEvent):void + { + Alert.show("MODULE RECIEVED"); + + Alert.show("module==null:"+(event.result==null)+ + "\nblock==null:"+((event.result as Module).blocks == null)+ + "\nblock.length:"+((event.result as Module).blocks.length)+ + "\nblock1.questionGroups==null:"+(((event.result as Module).blocks.getItemAt(0) as Block).questionGroups==null)+ + "\nblock1.questionGroups.length"+(((event.result as Module).blocks.getItemAt(0) as Block).questionGroups.length) + ); + + currModule = (event.result as actionscript.Module); + currentState = "instructions"; + + btnBack.enabled = btnForward.enabled = true; + } + private function moduleFaultHandler(event:FaultEvent):void + { + Alert.show(event.fault.message + "\n" + event.fault.getStackTrace()); + } + private function resultHandler(event:ResultEvent):void { Id = event.result as uint; - // Alert.show("Student id is " + Id ); consumer.disconnect(); } - private function faultHandler(event:FaultEvent):void { // Alert.show("event fault is " + event.fault.faultDetail); } - private function handleFault(event:MessageFaultEvent):void { // Alert.show("Message event fault is " + event.faultString); @@ -108,19 +144,6 @@ // Alert.show( ""+randomNumbers); } - public function init():void - { - - } - - private function getModule():Module - { - // server request here - - currModule = null; - return currModule; // set to null for now (clear old) - } - public function back():Boolean { if(content.numChildren == 0) @@ -175,11 +198,12 @@ // TEMPORARY CODE // comments indicate changes to be made for legitimate server communication // - currModule = new Module(); //delete - currModule.blocks = new ArrayCollection(); //delete - currModule.blocks.addItem(makeBlock()); //delete - currModule.blocks.addItem(makeBlock()); //delete - currentState = "instructions"; //change to state "wait", which will call getModule() +// currModule = new Module(); //delete +// currModule.blocks = new ArrayCollection(); //delete +// currModule.blocks.addItem(makeBlock()); //delete +// currModule.blocks.addItem(makeBlock()); //delete + currentState = "wait"; + getModule(); // // END TEMPORARY CODE // @@ -208,6 +232,7 @@ obj.visible = false; expiredContent.addChild(obj); currentState = "wait"; + getModule(); //consumer.subscribe(); returnValue = true; } Modified: mentalmodels/trunk/flex/src/custom/InstructionPage.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/InstructionPage.mxml 2009-07-12 00:22:56 UTC (rev 179) +++ mentalmodels/trunk/flex/src/custom/InstructionPage.mxml 2009-07-12 02:32:16 UTC (rev 180) @@ -24,6 +24,21 @@ { module = newModule; currBlock = 0; + if(module == null) + { + debug2.text += "module is null\n"; + return; + } + if(module.blocks == null) + { + debug2.text += "module.blocks is null\n"; + return; + } + if(module.blocks.length < 1) + { + debug2.text += "module.blocks.length is less than 1\n"; + return; + } init(module.blocks.getItemAt(currBlock) as Block); } @@ -31,7 +46,7 @@ { block = newBlock; try{ -// debug.text += "creating pageDisplay...\n"; +// debug2.text += "creating pageDisplay...\n"; var minPagesRead:int = 0; if(block != null && block.questionGroups != null) { @@ -40,26 +55,26 @@ pageDisplay = new PageDisplay(block, minPagesRead); if(pageDisplay == null) { - debug.text += "pageDisplay is null"; + debug2.text += "pageDisplay is null\n"; } // pageDisplay = new PageDisplay(block, block.questionGroups.length); }catch(errObject:Error){ - debug.text += "pageDisplay creation failure\n" + + debug2.text += "pageDisplay creation failure\n" + errObject.message +"\n"+ errObject.getStackTrace() +"\n"; -// Alert.show(debug.text); +// Alert.show(debug2.text); } -// debug.text += "setting currPage...\n"; +// debug2.text += "setting currPage...\n"; currPage = pageDisplay.currentPageNumber; -// debug.text += "setting numPages...\n"; +// debug2.text += "setting numPages...\n"; numPages = pageDisplay.pages.length; -// debug.text += "adding currentPage...\n"; +// debug2.text += "adding currentPage...\n"; content.addChild(pageDisplay.currentPage); -// debug.text += "currentPage added.\n"; +// debug2.text += "currentPage added.\n"; } public function back():Boolean @@ -167,6 +182,7 @@ <mx:Label id="currPageLabel" text="Page {(currPage+1)} / {numPages}"/> <mx:Text id="debug" text="{pageDisplay.msg}" width="300"/> +<mx:Text id="debug2" text="" width="300"/> <mx:VBox id="content"/> Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java 2009-07-12 00:22:56 UTC (rev 179) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java 2009-07-12 02:32:16 UTC (rev 180) @@ -20,7 +20,7 @@ public Module getFirstPage() { // Enter the sequence number in new Integer(Sequence number of module u want to fetch) - Module module = getDao().findByProperty("sequenceNo", new Integer(2)); + Module module = getDao().findByProperty("sequenceNo", new Integer(1)); Hibernate.initialize(module); getLogger().debug("Module object is " + module.getDescription()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-07-26 00:26:36
|
Revision: 208 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=208&view=rev Author: kjonas Date: 2009-07-26 00:26:27 +0000 (Sun, 26 Jul 2009) Log Message: ----------- renamed all variables, entities, services with names including DayByDayDecisions to be spelled with consistent names throughout project. added blocks and question groups (not questions) for Module 3. Flex code should be trying to fetch block-by-block, though java does not return it yet. Modified Paths: -------------- mentalmodels/trunk/flex/src/actionscript/PageDisplay.as mentalmodels/trunk/src/main/db/init-mme.sql mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/EarningService.java mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml Added Paths: ----------- mentalmodels/trunk/flex/src/actionscript/CustomNumericStepper.as mentalmodels/trunk/flex/src/actionscript/DayByDayDecisions.as mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateDayByDayDecisionsDao.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayByDayDecisions.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java Removed Paths: ------------- mentalmodels/trunk/flex/src/actionscript/questions/DayByDayDecisions.as mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateDaybyDayDecisionDao.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DaybyDayDecision.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionService.java Added: mentalmodels/trunk/flex/src/actionscript/CustomNumericStepper.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/CustomNumericStepper.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/CustomNumericStepper.as 2009-07-26 00:26:27 UTC (rev 208) @@ -0,0 +1,20 @@ +package actionscript +{ + import mx.controls.NumericStepper; + + public class CustomNumericStepper extends mx.controls.NumericStepper + { + + public function CustomNumericStepper() + { + super(); + super.stepSize = 1; + super.maximum = 3; + super.minimum = 0; + + } + + + + } +} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/DayByDayDecisions.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/DayByDayDecisions.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/DayByDayDecisions.as 2009-07-26 00:26:27 UTC (rev 208) @@ -0,0 +1,17 @@ +package actionscript.questions +{ + import mx.collections.ArrayCollection; + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.DayByDayDecisions")] + public class DayByDayDecisions + { + public var id:Number; + public var dayNumber:int; + public var location:Location; + public var earnings:Number; + public var money:Number; + public var student:Student; + public var otherStudents:ArrayCollection; + } +} \ No newline at end of file Modified: mentalmodels/trunk/flex/src/actionscript/PageDisplay.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-07-24 23:11:25 UTC (rev 207) +++ mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-07-26 00:26:27 UTC (rev 208) @@ -272,76 +272,5 @@ // Alert.show(messages); } } - - public function getQuestionResults():ArrayCollection - { - var curr:VBox = currentPage as VBox; - var questionResults:ArrayCollection = new ArrayCollection(); - var messages:String = ""; - - if(curr != null) - { - var tempQuestion:DisplayObject; - for(var i:int=0; i < curr.numChildren; i++) - { - tempQuestion = (curr.getChildAt(i) as DisplayObject); - var tempArray:ArrayCollection; - - if(tempQuestion == null) - { - messages += "(-)"; - } - else if(tempQuestion is ForecastingPeopleQuestionC) - { - messages += "(FP)"; - (tempQuestion as ForecastingPeopleQuestionC); - } - else if(tempQuestion is ForecastingFishQuestionC) - { - messages += "(FF)"; - (tempQuestion as ForecastingFishQuestionC); - } - else if(tempQuestion is CategoricalQuestionC) - { - messages += "(C)"; - tempArray = new ArrayCollection(); - tempArray.addItem((tempQuestion as CategoricalQuestionC).comboTopic.selectedItem); - var tempStr:String = (tempQuestion as CategoricalQuestionC).comboSpecific.selectedItem as String; - if(tempStr != null) - { - tempArray.addItem(tempStr); - } - } - else if(tempQuestion is PsychometricQuestionC) - { - messages += "(P)"; - (tempQuestion as PsychometricQuestionC).slider1.getValue(); - } - else if(tempQuestion is StrategyDesignQuestionC) - { - messages += "(S)"; - (tempQuestion as StrategyDesignQuestionC); - } - else if(tempQuestion is DayByDayDecisions) - { - messages += "(D)"; - (tempQuestion as DayByDayDecisionsQuestionC); - } - else if(tempQuestion is TextQuestionC) - { - messages += "(T)"; - (tempQuestion as TextQuestionC).textAnswer.text; - } - else - { - messages += "(-)"; - } - } -// Alert.show(messages); - } - - return questionResults; - } - } } \ No newline at end of file Deleted: mentalmodels/trunk/flex/src/actionscript/questions/DayByDayDecisions.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/questions/DayByDayDecisions.as 2009-07-24 23:11:25 UTC (rev 207) +++ mentalmodels/trunk/flex/src/actionscript/questions/DayByDayDecisions.as 2009-07-26 00:26:27 UTC (rev 208) @@ -1,11 +0,0 @@ -package actionscript.questions -{ - import mx.collections.ArrayCollection; - - [Bindable] - [RemoteClass(alias="edu.asu.commons.mme.entity.DayByDayDecisionsQuestion")] - public class DayByDayDecisions extends Question - { - - } -} \ No newline at end of file Modified: mentalmodels/trunk/src/main/db/init-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/init-mme.sql 2009-07-24 23:11:25 UTC (rev 207) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2009-07-26 00:26:27 UTC (rev 208) @@ -31,7 +31,7 @@ PRIMARY KEY (`id`), KEY `FK597C48D4D4A8AF3` (`module_id`), CONSTRAINT `FK597C48D4D4A8AF3` FOREIGN KEY (`module_id`) REFERENCES `module` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40,7 +40,7 @@ LOCK TABLES `block` WRITE; /*!40000 ALTER TABLE `block` DISABLE KEYS */; -INSERT INTO `block` VALUES (1,'Introduction',1080,1,1),(2,'Design Strategy',1080,1,2),(3,'Characterizing own strategy',1020,2,2),(4,'Editing strategy',300,3,2),(5,'Day-by-day decisions game',360,4,2),(6,'Evaluation of Outcomes',660,5,2),(7,'Communication',840,1,3),(8,'Design Strategy',300,1,4),(9,'Characterizing own strategy',540,2,4),(10,'Editing strategy',180,3,4),(11,'Day-by-day decisions game',360,4,4),(12,'Evaluation of Outcomes',360,5,4),(13,'Final data gathering',120,1,5),(14,'Debriefing',120,2,5); +INSERT INTO `block` VALUES (1,'Introduction',1080,1,1),(2,'Design Strategy',1080,1,2),(3,'Characterizing own strategy',1020,2,2),(4,'Editing strategy',300,3,2),(5,'Day-by-day decisions game',360,4,2),(6,'Evaluation of Outcomes',660,5,2),(7,'Communication',360,1,3),(8,'Design Strategy',300,1,4),(9,'Characterizing own strategy',540,2,4),(10,'Editing strategy',180,3,4),(11,'Day-by-day decisions game',360,4,4),(12,'Evaluation of Outcomes',360,5,4),(13,'Final data gathering',120,1,5),(14,'Debriefing',120,2,5),(15,'Communication - Questions',480,2,3); /*!40000 ALTER TABLE `block` ENABLE KEYS */; UNLOCK TABLES; @@ -207,6 +207,33 @@ UNLOCK TABLES; -- +-- Table structure for table `day_by_day_decision_student` +-- + +DROP TABLE IF EXISTS `day_by_day_decision_student`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `day_by_day_decision_student` ( + `day_by_day_decision_id` bigint(20) NOT NULL, + `otherStudents_id` bigint(20) NOT NULL, + UNIQUE KEY `otherStudents_id` (`otherStudents_id`), + KEY `FK19B3660EED8740B` (`day_by_day_decision_id`), + KEY `FK19B366031A9F4B4` (`otherStudents_id`), + CONSTRAINT `FK19B366031A9F4B4` FOREIGN KEY (`otherStudents_id`) REFERENCES `student` (`id`), + CONSTRAINT `FK19B3660EED8740B` FOREIGN KEY (`day_by_day_decision_id`) REFERENCES `day_by_day_decision` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `day_by_day_decision_student` +-- + +LOCK TABLES `day_by_day_decision_student` WRITE; +/*!40000 ALTER TABLE `day_by_day_decision_student` DISABLE KEYS */; +/*!40000 ALTER TABLE `day_by_day_decision_student` ENABLE KEYS */; +UNLOCK TABLES; + +-- -- Table structure for table `forecasting_question` -- @@ -526,7 +553,7 @@ PRIMARY KEY (`id`), KEY `FK8F8090E61F51CEC1` (`block_id`), CONSTRAINT `FK8F8090E61F51CEC1` FOREIGN KEY (`block_id`) REFERENCES `block` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -535,7 +562,7 @@ LOCK TABLES `question_group` WRITE; /*!40000 ALTER TABLE `question_group` DISABLE KEYS */; -INSERT INTO `question_group` VALUES (1,'In this experiment you will design a strategy to fish in an abstract fishing ground together with three other persons. As we are mainly interested in the reasons <i>why</i> you choose a certain strategy, we will ask you a number of questions. For the same reason, there are no correct or wrong strategies and no correct or wrong answers. However, since for each pound of fish you get during the experiment you will receive $1.00 US, you might be interested in finding a strategy that fits your goals well. For this, you will need to understand the dynamics of the (simulated) fish population and anticipate well the behavior of the other persons of your group.',30,'<b>Welcome to the E-Fishery Experiment</b>',1,1),(2,'<p>The experiment will run as follows:</p> <ul> <li><b>Introduction</b>: We will explain the interface and how the dynamics of the fish population are modeled. We will also ask you some questions about you and you will have the opportunity to make your decisions on how to fish on a (simulated) day-by-day basis to get a feeling for the dynamics of the fish population. </li> <li><b>Strategy design 1</b>: You will design a fishing strategy that will be simulated together with the strategies of the other persons in your group, and we ask you a larger amount of questions to understand your decisions and to help you reflect on those decisions. </li> <li><b>Fishing and evaluation 1</b>: Besides simulating the strategies you will decide on how to fish on a (simulated) day-by-day basis. Then, we will ask you some questions on your evaluation of the results. </li> <li><b>Communication</b>:You will have the opportunity to chat with the other persons in your group. After the chat we will ask some questions to asses your evaluation of the communication. </li> <li><b>Strategy design, fishing and evaluation 2</b>: The strategy design, fishing and evaluation are repeated as described above. </li> <li><b>Finishing the experiment</b>: The experiment closes with some final questions and more information on the experiment, and you will have the opportunity to give a feedback if you wish to do so. </li> </ul> <p> In the <b>information bar above the main window</b> you can see which part of the experiment you are in, your progress and how you are doing with the time. </p>',30,'<b>Experimental procedure</b>',2,1),(3,'<p>The <b>information window "Fishing Ground"</b> gives you an overview that will be explained here.</p> <p> Imagine you are living on an island and your only income is from a species of fish that only survives in the shallow bays formed by the island. The fish can leave crowed bays and move to less crowded bays, but they cannot survive in the ocean. Nor can new fish arrive from the ocean. </p> <p> The fish population grows at a constant rate. Thus, the more fish are in a bay the faster the population grows. However, the population a bay can sustain is limited and fish leave crowed bays to find less crowded bays. The more crowded a bay, the more fish leave and the less fish enter the bay (the movement is directly proportional to the percentage to which a bay is filled up). The number of fish leaving the bay is proportional to the rate of growth, and the number of fish entering the bay is also proportional to the amount of fish leaving the three bays (i.e. fish in the ocean). </p> <p> The equations of these dynamics are given in the information windows. It is, however, not necessary to know them for designing a strategy. For this, you only have to <b>understand the following five principles</b>: </p> <ul> <li>If all bays are <b>filled up</b> with fish, then the total growth is highest, but all additional lbs of fish are lost to the ocean and the amount of fish in the bays stops growing.</li> <li>If the bays are <b>half filled</b>, then the amount of fish in the bays grows fastest.</li> <li>If the bays are <b>nearly empty</b>, the population grows very slowly.</li> <li>If there is <b>no fish</b> in any of the bays, there will be never any fish again.</li> <li>If there are both <b>crowded and empty</b> bays, a lot of fish move from the crowded to the empty bays.</li> </ul> ',120,'<b>How the dynamics of the fish population are modeled</b>',3,1),(4,'<p>The three bays are different in size and characteristics leading to different growth rates and capacities (i.e. the maximal amount of fish the bay can sustain). At the start of the simulation each bay is half filled.</p> <table> <thead> <th></th><th>Bay 1</th><th>Bay 2</th><th>Bay 3</th> </thead> <tbody> <tr> <td>Capacity:</td><td>10 lb</td><td>20 lb</td><td>30 lb</td> </tr> <tr> <td>Starts with:</td><td>5 lb</td><td>10 lb</td><td>15 lb</td> </tr> <tr> <td>Growth rate:</td><td>50% per day</td><td>15% per day</td><td>5% per day</td> </tr> </tbody> </table> <p> <b>How much fish</b> you take out in a day is <b>directly proportional with the extent that the bay is filled up with fish</b>. Your fishing gear allows you to harvest a maximum of 5 lbs. Thus, if the bay is completely filled up you get 5 lb of fish. If the bay is half filled, you get 2.5 lb of fish. If the bay is filled up only to 20 % you will get 1 lb, etc. The fish population is diminished by the same amount. If several persons fish the same bay and together would get more fish than the bay holds, then all the fish in the bay are distributed equally among these fishermen. </p> <p>However, you can <b>stay in the harbor</b> instead of fishing. This way, you do not get anything and the fish population is not diminished. </p> <p> Your task is to design a strategy of how to fish this fishing ground for 30 days together with three other persons (thus, with you the group compromises 4 persons). You will define the number of days that you stay in each bay or in the harbor. Please note that this is not an exam! We do not expect you to find the mathematically optimal solution to this problem. We want to know how you come up with a solution that sufficiently fulfills your goals. As long as we can understand why you choose a certain strategy you can come up with whatever you like. </p> ',120,'<b>Differences of bays and effects of fishing</b>',4,1),(5,'<p>Before designing the strategy, you have the opportunity to make your decisions on a day-by-day basis for the simulation. You will interact with the actual model of the fishing ground together with the other persons of your group. Thus, the problems and possibilities you will experience in this warm-up are relevant for the design of your strategy. </p> <p> The <b>interface</b> you will encounter on the next page has the following elements: <ul> <li>Information on the day of the simulation</li> <li>Buttons for your decision. If you want to fish in Bay 1, for example, click on Button "Bay 1". </li> <li>Time remaining. You have 10 seconds for each decision. If you do not press any button within these 10 seconds then you will stay in the harbor for this day. However, you can change your decision within these 10 seconds (i.e. if you clicked on "Bay 1" after 4 seconds and after another 4 seconds on "Bay 3", you will go to Bay 3). </li> <li>Table of past results. Your previous locations from past days are highlighted. The table shows you how much you fished and who else was in the same location as you. You do not have any information of locations where you not have been. </li> ',60,'<b>A warm-up</b>',5,1),(6,'',345,'<b>Day-by-day-decisions</b>',6,1),(7,'<p>In what we refer to as a \'strategy\' you predefine your decisions of where to go each day of the simulation.\r Al-though only 30 days will be simulated, your strategy should represent your decisions for an indefinite period. Therefore you define a <b>set of decisions that will be repeated</b> until the end of the simulation. The set can contain as many decisions as you want but try to use as few as possible. Remember: Often simple strategies are more effective!</p> <p>It might be that you want to base your set of repeated decisions on another state of the fish population. In this case you can define a set of not repeated decisions that are applied at the beginning of the simulation. For example, you might first stay in the harbor to let the fish population increase or first fish all the bays to reduce the fish population before you start the repeated sequence of decisions.</p> <p>In this strategy you define how many days you stay at a certain location and to which other location you will move on.\r If, for example, you define to repeat the sequence \"2 days in harbor - 3 days in Bay 1 - 2 days in Bay 2\" you will not fish for two days, then fish in Bay 1 for three days, then fish in Bay 2 for two days, then not fish for two days, then fish in Bay 1 for three days, etc.</p> ',480,'<b>Designing your Strategy</b>',1,2),(8,'<p>Your strategy is mainly based on the number of days you stay at a certain location. However, things might run differently than you expected and you might wish to leave a bay earlier than the days you specified because you get too few fish out of that bay. For doing so you can specify a threshold of income. If you fish less then this threshold, the next day you will not fish this bay anymore but move on to the next location specified in your strategy.</p> <p>Note: Thresholds refer to the quantity of fish you get during one day fishing in a bay and not, for example, to the quantity of fish in the bay, fish fished by others, sum of fish already fished, etc.</p> <p>The final option you have is to stop repeating your strategy and stay in the harbor for some days. This op-tion can be used to prevent the total destruction of the fish population. For this you define a threshold and a number of days. If during one repetition of your decision set you never fished the amount defined by the threshold, then you stay in the harbor for the specified number of days before you start the next repetition.</p> <p>Note: Intentionally we do not allow designing \'intelligent\' strategies that search for solutions during the game. You have to think about what would be the best solution for you and express it with the options explained above.</p> ',90,'<b>Some special features of the strategy design</b>',2,2),(9,'<p>Design your strategy by clicking on <b>\'New\'</b> and <b>\'Delete\'</b>. You have to specify at least one repeated decision! If you are not sure about the meaning of the concepts used, refer to the information window \'Help for strategy design\'. </br>\rWhen you are done, click on <b>\'Next\'</b> </p>',480,'<b>Design your strategy</b>',3,2),(10,'<p>Please specify three goals that most influenced the design of your strategy. You can select from 18 different goals grouped in three categories (foci). </p><p>First select the focus of the goal (earnings, fish population or the other fishermen). Based on this selection, the list on the right hand sight will be filled and you can select one of these goals. For the second and third most important goal, also state, how much less important they are in relation to the most important goal.</p><p> The information you write into these fields will be available the next time you edit your strategy.</p>',30,'<b>What goals did you follow when designing your strategy?</b>',3,3),(11,'<p>We will ask you a number of questions on the strategy you just designed. This will help us to better understand how you came up with your strategy and it might help you reflect on certain aspects to improve your strategy.</p>\r<p>Besides <b>large fields</b> to write text and <b>small fields</b> to write numbers, you will encounter drop-down lists for selecting predefined values and scales. </p>\r<p>To give an answer on a scale, click on the location between the labels that comes closest to your opinion. By clicking on the scale, a slider appears that marks the value you selected. You can change the value by clicking on another position on the scale. By clicking on the reset button, the sliders of all scales on a page are removed and you can start selecting values again.</p>\r<p>Please try to answer all questions even if you are not sure. We are not testing your abilities but rather want to understand how you came up with your strategy.</p>\r',30,'<b>Introduction to questionnaire</b>',1,3),(12,'<p>Please explain your strategy with a few sentences. Particularly consider the following aspects:</p>',300,'<b>Explain the strategy in your own words</b>',2,3),(13,'<p>Specify the three goals that you think most influenced the design of the strategy of the other fishermen in your group. You can select from 18 different goals grouped in three categories (foci).</p>\r<p>First select the focus of the goal (earnings, fish population or the other fishermen). Based on this selection, the list on the right hand sight will be filled and you can select one of these goals. For the second and third most important goal, also state, how much less important they are in relation to the most important goal</p>\r',30,'<b>What goals do you think the others follow?</b>',4,3),(14,'',30,'<b>How do you perceive your group?</b>',5,3),(15,'',30,'<b>How much do you count on others and how much can they count on you?</b>',6,3),(16,'',30,'<b>What else influenced your strategy design?</b>',7,3),(17,'',60,'<b>How confident are you in reaching the outcomes you are expecting?</b>',8,3),(18,'<p>Fill in the following table your expectations of the others’ actions (i.e. the number of fishermen in each bay) for the first 15 days. Please note that we ask only for the expectations of where the others will go. </p>',180,'<b>What are you expecting the others will do?</b>',9,3),(19,'<p>Please enter in the table below your expectations of how the fish population develops within the first six days. Note that by clicking on “Update” the earnings and fish remaining in the bays is calculated, using your expecta-tions of the other’s actions and your strategy. Thus, you only have to think about how the fish population changes from one day to the next due to growth and movement of the fish. These estimations can be really rough. We do not expect you do perform detailed calculations.</p>\r<b>Note: You can only change the entries of one day at a time. To calculate the values and activate the next day for entries click on “Update”. You cannot return to previous days!</b>\r',180,'<b>What are you expecting how the fish population will develop?</b>',10,3),(20,'By clicking on “Accept” you will leave this part of the questionnaire and return to the strategy design. <b>You can-not return to this or previous pages!</b> However, important information for the design of your strategy will be available in information windows.',30,'<b>Leaving questionnaire on your strategy</b>',11,3),(21,'<p>The previous questions may have lead to some reflections on your strategy and you may wish to change some elements of it. Among the information windows you will find your previous strategy, your goals and your fore-cast.</p>\r<p>The time for editing your strategy depends on how fast you finished the questionnaire. For the next simulation we have to synchronize the group again. If you have been rather fast, you can think now more deeply about your strategy. If you are rather behind the time suggestion, you have to make your changes quickly.</p>\r<p>The interface for designing your strategy will not be explained again. If you are not sure about some elements, please refer to the information window “Help on strategy design”.</p>\r',30,'<b>Edit your strategy</b>',1,4),(22,'<p>Design your strategy by clicking on <b>\'New\'</b> and <b>\'Delete\'</b>. You have to specify at least one repeated decision! If you are not sure about the meaning of the concepts used, refer to the information window \'Help for strategy design\'. </br>\rWhen you are done, click on <b>\'Next\'</b> </p>',240,'<b>Design your strategy</b>',2,4),(23,'<p>Before we present the results of your strategy, we would like to see again how you make your decisions day-by-day. On the next page you will find the same interface as you already used to decide on how to fish the modeled fishing grounds.</p>',15,'<b>Applying your strategy in day-by-day decisions</b>',1,5),(24,'',345,'<b>Day-by-day-decisions</b>',2,5),(25,'<p>We will now present you the results of your strategy. By clicking on “Accept” you cannot return to this or any previous page, but the results of your day-by-day decisions (and also of your strategy) will be available in an information window.</p>',15,'<b>Leaving day-bay-day decisions</b>',3,5),(26,'',60,'<b>Your strategy resulted in the following actions</b>',1,6),(27,'<p>First we want to know your emotional reactions to the results:</p>',30,'<b>What are your emotional reactions to the outcome?</b>',2,6); +INSERT INTO `question_group` VALUES (1,'In this experiment you will design a strategy to fish in an abstract fishing ground together with three other persons. As we are mainly interested in the reasons <i>why</i> you choose a certain strategy, we will ask you a number of questions. For the same reason, there are no correct or wrong strategies and no correct or wrong answers. However, since for each pound of fish you get during the experiment you will receive $1.00 US, you might be interested in finding a strategy that fits your goals well. For this, you will need to understand the dynamics of the (simulated) fish population and anticipate well the behavior of the other persons of your group.',30,'<b>Welcome to the E-Fishery Experiment</b>',1,1),(2,'<p>The experiment will run as follows:</p> <ul> <li><b>Introduction</b>: We will explain the interface and how the dynamics of the fish population are modeled. We will also ask you some questions about you and you will have the opportunity to make your decisions on how to fish on a (simulated) day-by-day basis to get a feeling for the dynamics of the fish population. </li> <li><b>Strategy design 1</b>: You will design a fishing strategy that will be simulated together with the strategies of the other persons in your group, and we ask you a larger amount of questions to understand your decisions and to help you reflect on those decisions. </li> <li><b>Fishing and evaluation 1</b>: Besides simulating the strategies you will decide on how to fish on a (simulated) day-by-day basis. Then, we will ask you some questions on your evaluation of the results. </li> <li><b>Communication</b>:You will have the opportunity to chat with the other persons in your group. After the chat we will ask some questions to asses your evaluation of the communication. </li> <li><b>Strategy design, fishing and evaluation 2</b>: The strategy design, fishing and evaluation are repeated as described above. </li> <li><b>Finishing the experiment</b>: The experiment closes with some final questions and more information on the experiment, and you will have the opportunity to give a feedback if you wish to do so. </li> </ul> <p> In the <b>information bar above the main window</b> you can see which part of the experiment you are in, your progress and how you are doing with the time. </p>',30,'<b>Experimental procedure</b>',2,1),(3,'<p>The <b>information window "Fishing Ground"</b> gives you an overview that will be explained here.</p> <p> Imagine you are living on an island and your only income is from a species of fish that only survives in the shallow bays formed by the island. The fish can leave crowed bays and move to less crowded bays, but they cannot survive in the ocean. Nor can new fish arrive from the ocean. </p> <p> The fish population grows at a constant rate. Thus, the more fish are in a bay the faster the population grows. However, the population a bay can sustain is limited and fish leave crowed bays to find less crowded bays. The more crowded a bay, the more fish leave and the less fish enter the bay (the movement is directly proportional to the percentage to which a bay is filled up). The number of fish leaving the bay is proportional to the rate of growth, and the number of fish entering the bay is also proportional to the amount of fish leaving the three bays (i.e. fish in the ocean). </p> <p> The equations of these dynamics are given in the information windows. It is, however, not necessary to know them for designing a strategy. For this, you only have to <b>understand the following five principles</b>: </p> <ul> <li>If all bays are <b>filled up</b> with fish, then the total growth is highest, but all additional lbs of fish are lost to the ocean and the amount of fish in the bays stops growing.</li> <li>If the bays are <b>half filled</b>, then the amount of fish in the bays grows fastest.</li> <li>If the bays are <b>nearly empty</b>, the population grows very slowly.</li> <li>If there is <b>no fish</b> in any of the bays, there will be never any fish again.</li> <li>If there are both <b>crowded and empty</b> bays, a lot of fish move from the crowded to the empty bays.</li> </ul> ',120,'<b>How the dynamics of the fish population are modeled</b>',3,1),(4,'<p>The three bays are different in size and characteristics leading to different growth rates and capacities (i.e. the maximal amount of fish the bay can sustain). At the start of the simulation each bay is half filled.</p> <table> <thead> <th></th><th>Bay 1</th><th>Bay 2</th><th>Bay 3</th> </thead> <tbody> <tr> <td>Capacity:</td><td>10 lb</td><td>20 lb</td><td>30 lb</td> </tr> <tr> <td>Starts with:</td><td>5 lb</td><td>10 lb</td><td>15 lb</td> </tr> <tr> <td>Growth rate:</td><td>50% per day</td><td>15% per day</td><td>5% per day</td> </tr> </tbody> </table> <p> <b>How much fish</b> you take out in a day is <b>directly proportional with the extent that the bay is filled up with fish</b>. Your fishing gear allows you to harvest a maximum of 5 lbs. Thus, if the bay is completely filled up you get 5 lb of fish. If the bay is half filled, you get 2.5 lb of fish. If the bay is filled up only to 20 % you will get 1 lb, etc. The fish population is diminished by the same amount. If several persons fish the same bay and together would get more fish than the bay holds, then all the fish in the bay are distributed equally among these fishermen. </p> <p>However, you can <b>stay in the harbor</b> instead of fishing. This way, you do not get anything and the fish population is not diminished. </p> <p> Your task is to design a strategy of how to fish this fishing ground for 30 days together with three other persons (thus, with you the group compromises 4 persons). You will define the number of days that you stay in each bay or in the harbor. Please note that this is not an exam! We do not expect you to find the mathematically optimal solution to this problem. We want to know how you come up with a solution that sufficiently fulfills your goals. As long as we can understand why you choose a certain strategy you can come up with whatever you like. </p> ',120,'<b>Differences of bays and effects of fishing</b>',4,1),(5,'<p>Before designing the strategy, you have the opportunity to make your decisions on a day-by-day basis for the simulation. You will interact with the actual model of the fishing ground together with the other persons of your group. Thus, the problems and possibilities you will experience in this warm-up are relevant for the design of your strategy. </p> <p> The <b>interface</b> you will encounter on the next page has the following elements: <ul> <li>Information on the day of the simulation</li> <li>Buttons for your decision. If you want to fish in Bay 1, for example, click on Button "Bay 1". </li> <li>Time remaining. You have 10 seconds for each decision. If you do not press any button within these 10 seconds then you will stay in the harbor for this day. However, you can change your decision within these 10 seconds (i.e. if you clicked on "Bay 1" after 4 seconds and after another 4 seconds on "Bay 3", you will go to Bay 3). </li> <li>Table of past results. Your previous locations from past days are highlighted. The table shows you how much you fished and who else was in the same location as you. You do not have any information of locations where you not have been. </li> ',60,'<b>A warm-up</b>',5,1),(6,'',345,'<b>Day-by-day-decisions</b>',6,1),(7,'<p>In what we refer to as a \'strategy\' you predefine your decisions of where to go each day of the simulation.\r Al-though only 30 days will be simulated, your strategy should represent your decisions for an indefinite period. Therefore you define a <b>set of decisions that will be repeated</b> until the end of the simulation. The set can contain as many decisions as you want but try to use as few as possible. Remember: Often simple strategies are more effective!</p> <p>It might be that you want to base your set of repeated decisions on another state of the fish population. In this case you can define a set of not repeated decisions that are applied at the beginning of the simulation. For example, you might first stay in the harbor to let the fish population increase or first fish all the bays to reduce the fish population before you start the repeated sequence of decisions.</p> <p>In this strategy you define how many days you stay at a certain location and to which other location you will move on.\r If, for example, you define to repeat the sequence \"2 days in harbor - 3 days in Bay 1 - 2 days in Bay 2\" you will not fish for two days, then fish in Bay 1 for three days, then fish in Bay 2 for two days, then not fish for two days, then fish in Bay 1 for three days, etc.</p> ',480,'<b>Designing your Strategy</b>',1,2),(8,'<p>Your strategy is mainly based on the number of days you stay at a certain location. However, things might run differently than you expected and you might wish to leave a bay earlier than the days you specified because you get too few fish out of that bay. For doing so you can specify a threshold of income. If you fish less then this threshold, the next day you will not fish this bay anymore but move on to the next location specified in your strategy.</p> <p>Note: Thresholds refer to the quantity of fish you get during one day fishing in a bay and not, for example, to the quantity of fish in the bay, fish fished by others, sum of fish already fished, etc.</p> <p>The final option you have is to stop repeating your strategy and stay in the harbor for some days. This op-tion can be used to prevent the total destruction of the fish population. For this you define a threshold and a number of days. If during one repetition of your decision set you never fished the amount defined by the threshold, then you stay in the harbor for the specified number of days before you start the next repetition.</p> <p>Note: Intentionally we do not allow designing \'intelligent\' strategies that search for solutions during the game. You have to think about what would be the best solution for you and express it with the options explained above.</p> ',90,'<b>Some special features of the strategy design</b>',2,2),(9,'<p>Design your strategy by clicking on <b>\'New\'</b> and <b>\'Delete\'</b>. You have to specify at least one repeated decision! If you are not sure about the meaning of the concepts used, refer to the information window \'Help for strategy design\'. </br>\rWhen you are done, click on <b>\'Next\'</b> </p>',480,'<b>Design your strategy</b>',3,2),(10,'<p>Please specify three goals that most influenced the design of your strategy. You can select from 18 different goals grouped in three categories (foci). </p><p>First select the focus of the goal (earnings, fish population or the other fishermen). Based on this selection, the list on the right hand sight will be filled and you can select one of these goals. For the second and third most important goal, also state, how much less important they are in relation to the most important goal.</p><p> The information you write into these fields will be available the next time you edit your strategy.</p>',30,'<b>What goals did you follow when designing your strategy?</b>',3,3),(11,'<p>We will ask you a number of questions on the strategy you just designed. This will help us to better understand how you came up with your strategy and it might help you reflect on certain aspects to improve your strategy.</p>\r<p>Besides <b>large fields</b> to write text and <b>small fields</b> to write numbers, you will encounter drop-down lists for selecting predefined values and scales. </p>\r<p>To give an answer on a scale, click on the location between the labels that comes closest to your opinion. By clicking on the scale, a slider appears that marks the value you selected. You can change the value by clicking on another position on the scale. By clicking on the reset button, the sliders of all scales on a page are removed and you can start selecting values again.</p>\r<p>Please try to answer all questions even if you are not sure. We are not testing your abilities but rather want to understand how you came up with your strategy.</p>\r',30,'<b>Introduction to questionnaire</b>',1,3),(12,'<p>Please explain your strategy with a few sentences. Particularly consider the following aspects:</p>',300,'<b>Explain the strategy in your own words</b>',2,3),(13,'<p>Specify the three goals that you think most influenced the design of the strategy of the other fishermen in your group. You can select from 18 different goals grouped in three categories (foci).</p>\r<p>First select the focus of the goal (earnings, fish population or the other fishermen). Based on this selection, the list on the right hand sight will be filled and you can select one of these goals. For the second and third most important goal, also state, how much less important they are in relation to the most important goal</p>\r',30,'<b>What goals do you think the others follow?</b>',4,3),(14,'',30,'<b>How do you perceive your group?</b>',5,3),(15,'',30,'<b>How much do you count on others and how much can they count on you?</b>',6,3),(16,'',30,'<b>What else influenced your strategy design?</b>',7,3),(17,'',60,'<b>How confident are you in reaching the outcomes you are expecting?</b>',8,3),(18,'<p>Fill in the following table your expectations of the others’ actions (i.e. the number of fishermen in each bay) for the first 15 days. Please note that we ask only for the expectations of where the others will go. </p>',180,'<b>What are you expecting the others will do?</b>',9,3),(19,'<p>Please enter in the table below your expectations of how the fish population develops within the first six days. Note that by clicking on “Update” the earnings and fish remaining in the bays is calculated, using your expecta-tions of the other’s actions and your strategy. Thus, you only have to think about how the fish population changes from one day to the next due to growth and movement of the fish. These estimations can be really rough. We do not expect you do perform detailed calculations.</p>\r<b>Note: You can only change the entries of one day at a time. To calculate the values and activate the next day for entries click on “Update”. You cannot return to previous days!</b>\r',180,'<b>What are you expecting how the fish population will develop?</b>',10,3),(20,'By clicking on “Accept” you will leave this part of the questionnaire and return to the strategy design. <b>You can-not return to this or previous pages!</b> However, important information for the design of your strategy will be available in information windows.',30,'<b>Leaving questionnaire on your strategy</b>',11,3),(21,'<p>The previous questions may have lead to some reflections on your strategy and you may wish to change some elements of it. Among the information windows you will find your previous strategy, your goals and your fore-cast.</p>\r<p>The time for editing your strategy depends on how fast you finished the questionnaire. For the next simulation we have to synchronize the group again. If you have been rather fast, you can think now more deeply about your strategy. If you are rather behind the time suggestion, you have to make your changes quickly.</p>\r<p>The interface for designing your strategy will not be explained again. If you are not sure about some elements, please refer to the information window “Help on strategy design”.</p>\r',30,'<b>Edit your strategy</b>',1,4),(22,'<p>Design your strategy by clicking on <b>\'New\'</b> and <b>\'Delete\'</b>. You have to specify at least one repeated decision! If you are not sure about the meaning of the concepts used, refer to the information window \'Help for strategy design\'. </br>\rWhen you are done, click on <b>\'Next\'</b> </p>',240,'<b>Design your strategy</b>',2,4),(23,'<p>Before we present the results of your strategy, we would like to see again how you make your decisions day-by-day. On the next page you will find the same interface as you already used to decide on how to fish the modeled fishing grounds.</p>',15,'<b>Applying your strategy in day-by-day decisions</b>',1,5),(24,'',345,'<b>Day-by-day-decisions</b>',2,5),(25,'<p>We will now present you the results of your strategy. By clicking on “Accept” you cannot return to this or any previous page, but the results of your day-by-day decisions (and also of your strategy) will be available in an information window.</p>',15,'<b>Leaving day-bay-day decisions</b>',3,5),(26,'',60,'<b>Your strategy resulted in the following actions</b>',1,6),(27,'<p>First we want to know your emotional reactions to the results:</p>',30,'<b>What are your emotional reactions to the outcome?</b>',2,6),(28,'You can now chat for 5 minutes with the other fishermen in your group. You can talk about whatever you want as long as you…\r<ul><li>…do not reveal your identity.</li>\r<li>…do not threaten others with any consequence after the experiment is finished.</li>\r<li>…do not promise others side-payments after the experiment is completed.</li></ul>\rThe interface works like a text messenger. In the text box at the bottom you write your text and by clicking on “Send” you send this text to all other group members. In the large box in the center of the window you see all messages that have been sent during the communication.<br>\rAfter five minutes the “Send” button will be deactivated and the “Next” button activated. Please click then on “Next” to answer some questions about the communication. You can return to this page to see the communication protocol again.\r',360,'<b>Chat with the other fishermen in your group</b>',1,7),(29,'Due to the conversation, I now…',30,'<b>Did the communication have any effect on you?</b>',1,15),(30,'Due to the conversation, the other fishermen in my group…',30,'<b>What do you think were the effects of the communication on the others?</b>',2,15),(31,'',60,'<b>Did the communication lead to some sort of coordination of the fishing?</b>',3,15),(32,'The rule, agreement, or coordination attempt is… ',30,'<b>What is your opinion about the rule(s) that emerged from communication?</b>',4,15),(33,'',30,'<b>What will be the effects of the rule?</b>',5,15),(34,'In the fields below note what you have learned from the communication to improve your strategy.<br>\rThink about your understanding of the dynamics of the fish population, your expectations about the behavior of the other fishermen in your group and possibilities to improve your strategy. For each of these aspects a separate field is offered. This information will be available in the next round of designing your strategy.<br>\rIf you have no entry for one of the fields below, write “none” in the respective field.<br>\rThe information you write into these fields will be available the next time you edit your strategy.',300,'<b>Lessons learned<b>',6,15); /*!40000 ALTER TABLE `question_group` ENABLE KEYS */; UNLOCK TABLES; @@ -792,4 +819,4 @@ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2009-07-23 12:48:05 +-- Dump completed on 2009-07-25 17:05:22 Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateDayByDayDecisionsDao.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateDayByDayDecisionsDao.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateDayByDayDecisionsDao.java 2009-07-26 00:26:27 UTC (rev 208) @@ -0,0 +1,13 @@ +package edu.asu.commons.mme.dao; + +import edu.asu.commons.mme.entity.DayByDayDecisions; + +public class HibernateDayByDayDecisionsDao extends HibernateDao<DayByDayDecisions>{ + + public HibernateDayByDayDecisionsDao() { + super(DayByDayDecisions.class); + // TODO Auto-generated constructor stub + } + + +} Deleted: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateDaybyDayDecisionDao.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateDaybyDayDecisionDao.java 2009-07-24 23:11:25 UTC (rev 207) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateDaybyDayDecisionDao.java 2009-07-26 00:26:27 UTC (rev 208) @@ -1,13 +0,0 @@ -package edu.asu.commons.mme.dao; - -import edu.asu.commons.mme.entity.DaybyDayDecision; - -public class HibernateDaybyDayDecisionDao extends HibernateDao<DaybyDayDecision>{ - - public HibernateDaybyDayDecisionDao() { - super(DaybyDayDecision.class); - // TODO Auto-generated constructor stub - } - - -} Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayByDayDecisions.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayByDayDecisions.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayByDayDecisions.java 2009-07-26 00:26:27 UTC (rev 208) @@ -0,0 +1,106 @@ +package edu.asu.commons.mme.entity; + +import java.io.Serializable; +import java.util.List; + +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.ManyToOne; +import javax.persistence.Table; + +import org.hibernate.annotations.CollectionOfElements; + + +@Entity +@Table(name="day_by_day_decision") +public class DayByDayDecisions implements Serializable { + + private static final long serialVersionUID = 7159061961616165928L; + + @Id + @GeneratedValue + private Long id; + + @Column(nullable=false) + private Integer dayNumber; + + @ManyToOne + @JoinColumn(nullable=false) + private Location location; + + //earning will be in pound + @Column(nullable=false) + private Double earnings; + + + @Column(nullable=false) + private Double money; + + @ManyToOne + @JoinColumn(nullable=false) + private Student student; + + @CollectionOfElements(fetch = FetchType.EAGER) + private List<Student> otherStudents; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setLocation(Location location) { + this.location = location; + } + + public Location getLocation() { + return location; + } + public void setEarnings(Double earnings) { + this.earnings = earnings; + } + + public Double getEarnings() { + return earnings; + } + + + public void setMoney(Double money) { + this.money = money; + } + + public Double getMoney() { + return money; + } + + public void setStudent(Student student) { + this.student = student; + } + + public Student getStudent() { + return student; + } + + public void setDayNumber(Integer dayNumber) { + this.dayNumber = dayNumber; + } + + public Integer getDayNumber() { + return dayNumber; + } + + public void setOtherStudents(List<Student> otherStudents) { + this.otherStudents = otherStudents; + } + + public List<Student> getOtherStudents() { + return otherStudents; + } + +} Deleted: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DaybyDayDecision.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DaybyDayDecision.java 2009-07-24 23:11:25 UTC (rev 207) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DaybyDayDecision.java 2009-07-26 00:26:27 UTC (rev 208) @@ -1,106 +0,0 @@ -package edu.asu.commons.mme.entity; - -import java.io.Serializable; -import java.util.List; - -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.ManyToOne; -import javax.persistence.Table; - -import org.hibernate.annotations.CollectionOfElements; - - -@Entity -@Table(name="day_by_day_decision") -public class DaybyDayDecision implements Serializable { - - private static final long serialVersionUID = 7159061961616165928L; - - @Id - @GeneratedValue - private Long id; - - @Column(nullable=false) - private Integer dayNumber; - - @ManyToOne - @JoinColumn(nullable=false) - private Location location; - - //earning will be in pound - @Column(nullable=false) - private Double earnings; - - - @Column(nullable=false) - private Double money; - - @ManyToOne - @JoinColumn(nullable=false) - private Student student; - - @CollectionOfElements(fetch = FetchType.EAGER) - private List<Student> otherStudents; - - public void setId(Long id) { - this.id = id; - } - - public Long getId() { - return id; - } - - public void setLocation(Location location) { - this.location = location; - } - - public Location getLocation() { - return location; - } - public void setEarnings(Double earnings) { - this.earnings = earnings; - } - - public Double getEarnings() { - return earnings; - } - - - public void setMoney(Double money) { - this.money = money; - } - - public Double getMoney() { - return money; - } - - public void setStudent(Student student) { - this.student = student; - } - - public Student getStudent() { - return student; - } - - public void setDayNumber(Integer dayNumber) { - this.dayNumber = dayNumber; - } - - public Integer getDayNumber() { - return dayNumber; - } - - public void setOtherStudents(List<Student> otherStudents) { - this.otherStudents = otherStudents; - } - - public List<Student> getOtherStudents() { - return otherStudents; - } - -} 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-07-24 23:11:25 UTC (rev 207) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java 2009-07-26 00:26:27 UTC (rev 208) @@ -2,11 +2,11 @@ import java.util.List; -import edu.asu.commons.mme.dao.HibernateDaybyDayDecisionDao; +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.entity.Block; -import edu.asu.commons.mme.entity.DaybyDayDecision; +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; @@ -15,8 +15,8 @@ private HibernateStudentResponseDao studentResponseDao; private HibernateStudentDao studentDao; - //private HibernateDaybyDayDecisionDao dayBydayDecisionDao; - private DayByDayDecisionService daybydayDecisionService; + //private HibernateDayByDayDecisionsDao dayByDayDecisionsDao; + private DayByDayDecisionsService dayByDayDecisionsService; private ModuleService moduleService; @@ -40,25 +40,25 @@ return moduleService.getNextBlock(); } - public void daybydayOutput(DaybyDayDecision studentDecision) + public void daybydayOutput(DayByDayDecisions studentDecision) { - daybydayDecisionService.saveStudentDecision(studentDecision); + dayByDayDecisionsService.saveStudentDecision(studentDecision); } public void setStudentDao(HibernateStudentDao studentDao) { this.studentDao = studentDao; } - /*public void setDayBydayDecisionDao(HibernateDaybyDayDecisionDao dayBydayDecisionDao) { - this.dayBydayDecisionDao = dayBydayDecisionDao; + /*public void setDayByDayDecisionsDao(HibernateDayByDayDecisionsDao dayByDayDecisionsDao) { + this.dayByDayDecisionsDao = dayByDayDecisionsDao; }*/ - public void setDaybydayDecisionService(DayByDayDecisionService daybydayDecisionService) { - this.daybydayDecisionService = daybydayDecisionService; + public void setDayByDayDecisionsService(DayByDayDecisionsService dayByDayDecisionsService) { + this.dayByDayDecisionsService = dayByDayDecisionsService; } - public DayByDayDecisionService getDaybydayDecisionService() { - return daybydayDecisionService; + public DayByDayDecisionsService getDayByDayDecisionsService() { + return dayByDayDecisionsService; } } Deleted: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionService.java 2009-07-24 23:11:25 UTC (rev 207) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionService.java 2009-07-26 00:26:27 UTC (rev 208) @@ -1,46 +0,0 @@ -package edu.asu.commons.mme.service; - -import java.util.ArrayList; -import java.util.List; - -import edu.asu.commons.mme.dao.HibernateDaybyDayDecisionDao; -import edu.asu.commons.mme.entity.DaybyDayDecision; -import edu.asu.commons.mme.entity.Question; -import edu.asu.commons.mme.entity.Student; - -public class DayByDayDecisionService extends Service.Base<DaybyDayDecision, HibernateDaybyDayDecisionDao> { - - private List<DaybyDayDecision> studentdecisions = new ArrayList<DaybyDayDecision>(); - - public void setStudentdecisions(List<DaybyDayDecision> studentdecisions) { - this.studentdecisions = studentdecisions; - } - - public List<DaybyDayDecision> getStudentdecisions() { - return studentdecisions; - } - - public void saveStudentDecision(DaybyDayDecision studentDecision) - { - if (studentdecisions == null) { - studentdecisions = new ArrayList<DaybyDayDecision>(); - studentdecisions.add(studentDecision); - - } - else - { - if(!this.studentdecisions.contains(studentDecision)) - { - studentdecisions.add(studentDecision); - - } - else - { - System.out.println("Student Decision already exists!!"); - } - } - - - } - -} Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java 2009-07-26 00:26:27 UTC (rev 208) @@ -0,0 +1,46 @@ +package edu.asu.commons.mme.service; + +import java.util.ArrayList; +import java.util.List; + +import edu.asu.commons.mme.dao.HibernateDayByDayDecisionsDao; +import edu.asu.commons.mme.entity.DayByDayDecisions; +import edu.asu.commons.mme.entity.Question; +import edu.asu.commons.mme.entity.Student; + +public class DayByDayDecisionsService extends Service.Base<DayByDayDecisions, HibernateDayByDayDecisionsDao> { + + private List<DayByDayDecisions> studentdecisions = new ArrayList<DayByDayDecisions>(); + + public void setStudentdecisions(List<DayByDayDecisions> studentdecisions) { + this.studentdecisions = studentdecisions; + } + + public List<DayByDayDecisions> getStudentdecisions() { + return studentdecisions; + } + + public void saveStudentDecision(DayByDayDecisions studentDecision) + { + if (studentdecisions == null) { + studentdecisions = new ArrayList<DayByDayDecisions>(); + studentdecisions.add(studentDecision); + + } + else + { + if(!this.studentdecisions.contains(studentDecision)) + { + studentdecisions.add(studentDecision); + + } + else + { + System.out.println("Student Decision already exists!!"); + } + } + + + } + +} Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/EarningService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/EarningService.java 2009-07-24 23:11:25 UTC (rev 207) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/EarningService.java 2009-07-26 00:26:27 UTC (rev 208) @@ -2,7 +2,7 @@ import java.util.List; -import edu.asu.commons.mme.entity.DaybyDayDecision; +import edu.asu.commons.mme.entity.DayByDayDecisions; import flex.messaging.MessageBroker; import flex.messaging.messages.AsyncMessage; import flex.messaging.util.UUIDUtils; @@ -10,7 +10,7 @@ public class EarningService extends Thread { - public EarningService(List<DaybyDayDecision> studentDecisions) + public EarningService(List<DayByDayDecisions> studentDecisions) { } Modified: mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-07-24 23:11:25 UTC (rev 207) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-07-26 00:26:27 UTC (rev 208) @@ -1,171 +1,171 @@ -<?xml version="1.0"?> -<!-- - vim:sts=2:sw=2: ---> -<!-- - $Id: applicationContext.xml 617 2008-03-28 17:27:23Z alllee $ ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:flex="http://www.springframework.org/schema/flex" - xmlns:security="http://www.springframework.org/schema/security" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:aop="http://www.springframework.org/schema/aop" - xmlns:tx="http://www.springframework.org/schema/tx" - xsi:schemaLocation=" - - http://www.springframework.org/schema/tx - http://www.springframework.org/schema/tx/spring-tx-2.0.xsd - http://www.springframework.org/schema/aop - http://www.springframe... [truncated message content] |
From: <see...@us...> - 2009-08-13 20:53:21
|
Revision: 249 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=249&view=rev Author: seematalele Date: 2009-08-13 20:53:14 +0000 (Thu, 13 Aug 2009) Log Message: ----------- Solve the bug in simple CategoricalQuestion.java Problems- 1) if you want to update simple categorical question then it enters all the changes in the database but in GUI it does not show those changes. 2)if you want to update relative categorical question then it enters all the changes in the database but in GUI it does not show those changes. Created the HibernateCategoricalOptionDao.java Modified Paths: -------------- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml mentalmodels/trunk/flex/src/custom/db/questions/CategoricalSimple.mxml mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/CategoricalQuestion.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/QuestionCreatorService.java mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml Added Paths: ----------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateCategoricalOptionDao.java Modified: mentalmodels/trunk/flex/src/InitialiseDatabase.mxml =================================================================== --- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-08-12 22:35:58 UTC (rev 248) +++ mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-08-13 20:53:14 UTC (rev 249) @@ -77,7 +77,6 @@ [Bindable] private var categoricalQuestions:XML = <list> <categorical type="Categorical Questions" id="0"/> - </list>; /** @@ -160,7 +159,9 @@ } } } - } + } + + } private function createModuleNode(module:actionscript.Module):XML @@ -290,7 +291,7 @@ var newOptionNode:XML = <option/>; newOptionNode.setLocalName("option"); newOptionNode.@name = options.optionKey; - if(options.choices.length == 0) + if(options.choices == null || options.choices.length == 0) { flagType = false } @@ -304,7 +305,9 @@ if(choices == "") { + //Alert.show("choices is eqaul to : " + choices); choices = options.choices[k]; + //Alert.show("choices is eqaul to : " + choices); } else { @@ -341,6 +344,24 @@ return newQNode; } + private function getCategoricalType(categorical:actionscript.questions.Categorical):String + { + //false means it is simple type, otherwise it is relative type + var type:String = null; + for(var x:int = 0; x < categorical.categoricalOptions.length ; x++) + { + var catOptions:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); + catOptions = actionscript.questions.CategoricalOption(categorical.categoricalOptions.getItemAt(x)); + //Alert.show("options.choices is: " + options.choices); + if((catOptions.choices == null) || (catOptions.choices.length == 0)) + type = "simple"; + else + type = "relative"; + } + return type; + + } + private function faultHandler(event:FaultEvent):void { Alert.show("event fault is " + event.fault.getStackTrace()); @@ -505,7 +526,7 @@ } else { - //Alert.show("Id is: " + module.id); + Alert.show("Id is: " + module.id); var newModuleNode:XML = createModuleNode(module); survey.appendChild(newModuleNode); } @@ -1008,17 +1029,19 @@ Options.choices = dict[key]; categoricalQuestion.categoricalOptions.addItem(Options); } + categoricalQuestion.type = questionInfo.getType(); categoricalQuestion.question = questionInfo.getQuestion(); categoricalQuestion.sequenceNo = int(questionInfo.getSequenceNo()); categoricalQuestion.communicationQ = questionInfo.isCommunicationQuestion(); - /*for(var i:int = 0; i < categoricalQuestion.categoricalOptions.length ; i++) + for(var i:int = 0; i < categoricalQuestion.categoricalOptions.length ; i++) { var testoption:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); testoption = actionscript.questions.CategoricalOption(categoricalQuestion.categoricalOptions.getItemAt(i)); - trace(testoption.optionKey); - trace(testoption.choices); - }*/ + Alert.show(testoption.optionKey); + for(var j:int =0; j<testoption.choices.length ;j++) + Alert.show(testoption.choices.getItemAt(j).toString()); + } if(questionInfo.getId() == 0) { if(checkSeqNoQuestion.length() > 0) @@ -1053,7 +1076,7 @@ { var OptionsSimple:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); OptionsSimple.optionKey = option.toString(); - //Alert.show("Key : " + option.toString()); + // Alert.show("Key : " + option.toString()); OptionsSimple.choices = Simpledict[key]; categoricalSimpleQuestion.categoricalOptions.addItem(OptionsSimple); } @@ -1061,12 +1084,12 @@ categoricalSimpleQuestion.question = questionInfo.getQuestion(); categoricalSimpleQuestion.sequenceNo = int(questionInfo.getSequenceNo()); categoricalSimpleQuestion.communicationQ = questionInfo.isCommunicationQuestion(); - /*for(var j:int = 0; j < categoricalSimpleQuestion.categoricalOptions.length ; j++) + /* for(var j:int = 0; j < categoricalSimpleQuestion.categoricalOptions.length ; j++) { - var testoption:ASCategoricalOption = new ASCategoricalOption(); - testoption = ASCategoricalOption(categoricalSimpleQuestion.categoricalOptions.getItemAt(i)); - trace(testoption.optionKey); - trace(testoption.choices); + var testoption:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); + testoption = actionscript.questions.CategoricalOption(categoricalSimpleQuestion.categoricalOptions.getItemAt(j)); + Alert.show(testoption.optionKey.toString()); + //Alert.show(testoption.choices); }*/ /*Alert.show("Question: " + categoricalSimpleQuestion.question); Alert.show("SeQ No: " + categoricalSimpleQuestion.sequenceNo); @@ -1075,12 +1098,16 @@ if(questionInfo.getId() == 0) { + if(checkSeqNoQuestion.length() > 0) { Alert.show("Sequence number " + questionInfo.getSequenceNo() + " already exists!"); } else + { roQuestionCreator.saveQuestion(categoricalSimpleQuestion,int(node.@id)); + //Alert.show( categoricalSimpleQuestion.question+ " is saved."); + } } else { @@ -1089,7 +1116,10 @@ Alert.show("Sequence number " + questionInfo.getSequenceNo() + " already exists!"); } else + { roQuestionCreator.updateQuestion(categoricalSimpleQuestion,int(node.@id), questionInfo.getId()); + //Alert.show( categoricalSimpleQuestion.question+ " is updated."); + } } } @@ -1166,6 +1196,16 @@ newNode.setLocalName("question"); var newQNode:XML = <question/>; newQNode.setLocalName("question"); + var questionXML:XMLList = survey.module.block.questiongroup.question.(@id == question.id); + + if(questionXML.length() > 0) + { + questionXML[0].@title = question.question; + questionXML[0].@sequenceNo = question.sequenceNo; + questionXML[0].@type = question.type; + questionXML[0].@communication = question.communicationQ; + } + var choices:String=""; if(question.type.toLowerCase() == "psychometric") { @@ -1184,10 +1224,10 @@ newPNode.@scale = psychometricResult.scale; newPNode.@maxSliderValue = psychometricResult.maxSliderValue; - newQNode.@sequenceNo = psychometricResult.sequenceNo; +/* newQNode.@sequenceNo = psychometricResult.sequenceNo; newQNode.@title = psychometricResult.question; newQNode.@type = psychometricResult.type; - newQNode.@communication = psychometricResult.communicationQ; + newQNode.@communication = psychometricResult.communicationQ; */ choices = ""; if(psychometricResult.choices != null) { @@ -1210,11 +1250,11 @@ else if(question.type.toLowerCase() == "categorical") { var categoricalResult:actionscript.questions.Categorical = actionscript.questions.Categorical(question); - newQNode.@sequenceNo = categoricalResult.sequenceNo; +/* newQNode.@sequenceNo = categoricalResult.sequenceNo; newQNode.@title = categoricalResult.question; newQNode.@type = categoricalResult.type; newQNode.@id = categoricalResult.id; - newQNode.@communication = categoricalResult.communicationQ; + newQNode.@communication = categoricalResult.communicationQ; */ //flagType false means it is simple type, otherwise it is relative type var flagType:Boolean = false; @@ -1225,7 +1265,7 @@ if( categoricalList.length() > 0 ) { - //remove all the <option> tags and then add those rather than modifying those. It is simple. + //remove all the <option> tags and then add new ones rather than modifying those. It is simple. var children:XMLList = categoricalList.children(); for(var l:Number=0; l < children.length(); l++) @@ -1235,6 +1275,7 @@ if(categoricalResult.categoricalOptions != null) { + Alert.show("categoricalResult.categoricalOptions.length : "+ categoricalResult.categoricalOptions.length); for(var i:int = 0; i < categoricalResult.categoricalOptions.length ; i++) { var options:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); @@ -1242,7 +1283,7 @@ var newOptionNode:XML = <option/>; newOptionNode.setLocalName("option"); newOptionNode.@name = options.optionKey; - if(options.choices.length == 0) + if((options.choices == null) || options.choices.length == 0) { flagType = false } @@ -1275,8 +1316,10 @@ { newCNode.@type = "simple"; } + newCNode.appendChild(newOptionNode); } + //Alert.show("after inserting into the XML: " + newOptionNode.attributes().toXMLString()); } } } @@ -1446,8 +1489,9 @@ outputchoices = choiceStr.split(","); - for(var i:int = 0; i < outputchoices.length; i++) + for(var i:int = 0; i < outputchoices.length - 1; i++) { + //Alert.show("counter i is: " + i + outputchoices[i]); dict[str].addItem(outputchoices[i]); } } @@ -1455,6 +1499,7 @@ } else if(categoricalQ[0].@type == "simple") { + //Alert.show(categoricalQuestions.categorical); compCategorical.setType("simple"); currentState = "simple"; var cat2obj:DisplayObject = pnlComponent.getChildAt(3); @@ -1463,6 +1508,7 @@ var dictionary:Dictionary = new Dictionary(); var attributeSimpleList:XMLList = categoricalQ[0].option.attributes(); + // Alert.show("attribute list is : " + attributeSimpleList.toXMLString()); var str1:String; for(var k:int = 0; k < attributeSimpleList.length(); k++) @@ -1472,7 +1518,8 @@ dictionary[str1] = new ArrayCollection(); dictionary[str1].addItem(null); } - compSimple.setDictionary(dictionary); + compSimple.setDictionary(dictionary); + } } } @@ -1496,7 +1543,7 @@ choiceStr = psychometricQ[0].@choices; outputchoices = choiceStr.split(","); - for(i = 0; i < outputchoices.length; i++) + for(i = 0; i < outputchoices.length - 1; i++) { compPsychometric.choice.addItem(outputchoices[i]); Modified: mentalmodels/trunk/flex/src/custom/db/questions/CategoricalSimple.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/db/questions/CategoricalSimple.mxml 2009-08-12 22:35:58 UTC (rev 248) +++ mentalmodels/trunk/flex/src/custom/db/questions/CategoricalSimple.mxml 2009-08-13 20:53:14 UTC (rev 249) @@ -89,8 +89,6 @@ public function reset():void { - - txtChoice.text = ""; lblHeader.text = ""; header.removeAll(); @@ -99,7 +97,7 @@ { for(var key:Object in dict) { - dict[key].removeAll(); + //dict[key].removeAll(); delete dict[key]; } } @@ -154,6 +152,12 @@ dict[txtChoice.text] = null; txtChoice.text = ""; } + //use following for loop to see the dictionary items after addition + /* for(var key:Object in dict) + { + //dict[key].removeAll(); + Alert.show("After addition dict item is: "+ key.toString() ); + } */ } @@ -171,15 +175,22 @@ } else { + + //Alert.show("selected item is : " +lstHeader.selectedItem.toString()); + delete dict[lstHeader.selectedItem]; header.removeItemAt(header.getItemIndex(lstHeader.selectedItem)); - delete dict[lstHeader.selectedItem]; + + //use following for loop to see the dictionary items after deletion + /* for(var key:Object in dict) + { + //dict[key].removeAll(); + Alert.show("After deletion dict item is: "+ key.toString() ); + } */ + + } } - - - - ]]> </mx:Script> <!-- <mx:VBox id="vboxHeaders" horizontalAlign="center"> @@ -194,7 +205,7 @@ <mx:HBox id="vboxSecondHeader" > <mx:VBox> <mx:Label text="Values" id="lblHeader" fontSize="12" fontWeight="bold" fontFamily="Verdana"/> - <mx:List id="lstHeader" wordWrap="true" dataProvider="{header}" allowMultipleSelection="false"/> + <mx:List id="lstHeader" wordWrap="false" dataProvider="{header}" allowMultipleSelection="false" height="300"/> <mx:FormItem id="frmitmAddChoice" label="Choice for Values: "> <mx:TextInput id="txtChoice" change="{validateForm(event)}"/> </mx:FormItem> Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateCategoricalOptionDao.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateCategoricalOptionDao.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateCategoricalOptionDao.java 2009-08-13 20:53:14 UTC (rev 249) @@ -0,0 +1,12 @@ +package edu.asu.commons.mme.dao; + +import edu.asu.commons.mme.entity.CategoricalOption; + +public class HibernateCategoricalOptionDao extends HibernateDao<CategoricalOption>{ + + public HibernateCategoricalOptionDao() + { + super(CategoricalOption.class); + } + +} 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-12 22:35:58 UTC (rev 248) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/CategoricalQuestion.java 2009-08-13 20:53:14 UTC (rev 249) @@ -1,8 +1,11 @@ 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; @@ -29,5 +32,7 @@ public List<CategoricalOption> getCategoricalOptions() { return categoricalOptions; } + + } 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 2009-08-12 22:35:58 UTC (rev 248) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/QuestionCreatorService.java 2009-08-13 20:53:14 UTC (rev 249) @@ -8,6 +8,7 @@ import org.springframework.transaction.annotation.Transactional; import edu.asu.commons.mme.dao.HibernateBlockDao; +import edu.asu.commons.mme.dao.HibernateCategoricalOptionDao; import edu.asu.commons.mme.dao.HibernateCategoricalQuestionDao; import edu.asu.commons.mme.dao.HibernateModuleDao; import edu.asu.commons.mme.dao.HibernatePsychometricQuestionDao; @@ -34,31 +35,32 @@ @Transactional public class QuestionCreatorService extends Service.Base<Question, HibernateQuestionDao> { - + private HibernateBlockDao blockDao; private HibernateModuleDao moduleDao; private HibernateQuestionGroupDao questionGroupDao; private HibernatePsychometricQuestionDao psychometricQuestionDao; private HibernateCategoricalQuestionDao categoricalQuestionDao; - + private HibernateCategoricalOptionDao categoricalOptionDao; + Module module; Block block; QuestionGroup questionGroup; Question question; CategoricalQuestion categoricalQ; - + PsychometricQuestion psychometricQ; - + public List<Module> initializeData() { List<Module> modulelist = new ArrayList<Module>(); - + getLogger().debug("In InitializeData function"); modulelist = moduleDao.findAll(); - + getLogger().debug("Module length " + modulelist.size()); - + for(int i = 0; i<modulelist.size(); i++) { Module module = modulelist.get(i); @@ -78,7 +80,7 @@ Hibernate.initialize(questionGroup); // getLogger().debug(questionGroup.getDescription()); List<Question> questions = questionGroup.getQuestions(); - + for(int j = 0; j < questions.size(); j++) { Hibernate.initialize(questions.get(j)); @@ -91,7 +93,7 @@ } } } - + }*/ } /* @@ -100,18 +102,19 @@ * */ //getLogger().debug("questionGroup: " + modulelist.get(0).getBlocks().get(0).getQuestionGroups().get(0).getHeader()); - + return modulelist; - + } - - + + public Module saveModule(Integer sequenceNo, String description, Integer duration) { - Module module = moduleDao.findByProperty("sequenceNo", new Integer(sequenceNo)); + module = new Module(); + module = moduleDao.findByProperty("sequenceNo", new Integer(sequenceNo)); if(module == null) { - createModule(sequenceNo, description, duration); + module = createModule(sequenceNo, description, duration); } else { @@ -120,8 +123,8 @@ } return module; } - - + + public Module createModule(Integer sequenceNo, String description, Integer duration) { module = new Module(); @@ -130,11 +133,11 @@ module.setDuration(duration); moduleDao.save(module); getLogger().debug("module is created with Id: " + module.getId()); - + return module; - + } - + public Module updateModule(Long id, Integer sequenceNo, String description, Integer duration) { getLogger().debug("Id came from client is: " + id); @@ -155,7 +158,7 @@ Hibernate.initialize(questionGroup); // getLogger().debug(questionGroup.getDescription()); List<Question> questions = questionGroup.getQuestions(); - + for(int j = 0; j < questions.size(); j++) { Hibernate.initialize(questions.get(j)); @@ -168,7 +171,7 @@ } } } - + }*/ if( module != null) { @@ -177,22 +180,22 @@ module.setDuration(duration); moduleDao.save(module); getLogger().debug("module is updated with Id: " + module.getId()); - + } - + return module; - + } - + public Block saveBlock(Integer sequenceNo, String description, Integer duration, Long module_Id) { - + Block currentblock = new Block(); - + currentblock.setSequenceNo(sequenceNo); currentblock.setDescription(description); currentblock.setDuration(duration); - + module = moduleDao.find(module_Id); Hibernate.initialize(module); initializeModule(module); @@ -209,7 +212,7 @@ Hibernate.initialize(questionGroup); // getLogger().debug(questionGroup.getDescription()); List<Question> questions = questionGroup.getQuestions(); - + for(int j = 0; j < questions.size(); j++) { Hibernate.initialize(questions.get(j)); @@ -222,7 +225,7 @@ } } } - + }*/ if(currentblock != null) { @@ -231,9 +234,9 @@ } getLogger().debug("Block is created with Id: " + currentblock.getId()); return currentblock; - + } - + public Block updateBlock(Long id, Integer sequenceNo, String description, Integer duration, Long module_Id) { getLogger().debug("Id came from client is: " + id); @@ -246,9 +249,9 @@ { QuestionGroup questionGroup = iteratorquestionGrp.next(); Hibernate.initialize(questionGroup); -// getLogger().debug(questionGroup.getDescription()); + // getLogger().debug(questionGroup.getDescription()); List<Question> questions = questionGroup.getQuestions(); - + for(int j = 0; j < questions.size(); j++) { Hibernate.initialize(questions.get(j)); @@ -283,7 +286,7 @@ Hibernate.initialize(questionGroup); // getLogger().debug(questionGroup.getDescription()); List<Question> questions = questionGroup.getQuestions(); - + for(int j = 0; j < questions.size(); j++) { Hibernate.initialize(questions.get(j)); @@ -296,14 +299,14 @@ } } } - + }*/ block.setModule(module); blockDao.save(block); getLogger().debug("block is updated with Id: " + block.getId()); } return block; - + } public QuestionGroup saveQuestionGroup(Integer sequenceNo,String header, String description, Integer duration, Long block_id) @@ -331,7 +334,7 @@ Hibernate.initialize(questionGroup); // getLogger().debug(questionGroup.getDescription()); List<Question> questions = questionGroup.getQuestions(); - + for(int j = 0; j < questions.size(); j++) { Hibernate.initialize(questions.get(j)); @@ -344,25 +347,25 @@ } } } - + }*/ questionGroup.setBlock(block); questionGroupDao.save(questionGroup); getLogger().debug("QuestionGroup is created with Id: " + questionGroup.getId()); return questionGroup; - + } - + public QuestionGroup updateQuestionGroup(Integer sequenceNo,String header, String description, Integer duration,Long block_id,Long qg_id) { - + getLogger().debug("Id came from client is: " + qg_id); QuestionGroup questionGroup = questionGroupDao.findByProperty("id", qg_id); getLogger().debug(questionGroup); Hibernate.initialize(questionGroup); List<Question> questions = questionGroup.getQuestions(); - + for(int j = 0; j < questions.size(); j++) { Hibernate.initialize(questions.get(j)); @@ -378,7 +381,7 @@ module = block.getModule(); Hibernate.initialize(module); initializeModule(module); - + questionGroup.setSequenceNo(sequenceNo); questionGroup.setDescription(description); questionGroup.setHeader(header); @@ -388,7 +391,7 @@ return questionGroup; } - + private void initializeModule(Module module1) { // TODO Auto-generated method stub @@ -408,9 +411,9 @@ { QuestionGroup questionGroup = iteratorquestionGrp.next(); Hibernate.initialize(questionGroup); - // getLogger().debug(questionGroup.getDescription()); + // getLogger().debug(questionGroup.getDescription()); List<Question> questions = questionGroup.getQuestions(); - + for(int j = 0; j < questions.size(); j++) { Hibernate.initialize(questions.get(j)); @@ -423,10 +426,10 @@ } } } - + } - - + + } @@ -436,7 +439,7 @@ getLogger().debug("questionGroup_id: " + questionGroup_id); if(questionInfo.getClass().getName().equalsIgnoreCase("edu.asu.commons.mme.entity.PsychometricQuestion")) { - + PsychometricQuestion psychometricQ = new PsychometricQuestion(); PsychometricQuestion psychometric = (PsychometricQuestion)questionInfo; psychometricQ.setScale(psychometric.getScale().toLowerCase()); @@ -447,122 +450,138 @@ psychometricQ.setQuestion(psychometric.getQuestion()); psychometricQ.setType(psychometric.getType().toLowerCase()); psychometricQ.setCommunicationQ(psychometric.isCommunicationQ()); - - + + getLogger().debug("Scale: " + psychometric.getScale()); getLogger().debug("Max slider value: " + psychometric.getMaxSliderValue()); for(int i=0;i < psychometric.getChoices().size();i++) { getLogger().debug("Choice" + i+" : "+ psychometric.getChoices().get(i)); - + } - + getLogger().debug("Seq no: " + psychometric.getSequenceNo()); getLogger().debug("Question: " + psychometric.getQuestion()); getLogger().debug("Type: " + psychometric.getType()); - - + + questionGroup = questionGroupDao.findByProperty("id",questionGroup_id); Hibernate.initialize(questionGroup); block = questionGroup.getBlock(); Hibernate.initialize(block); module = block.getModule(); Hibernate.initialize(module); - + initializeModule(module); psychometricQ.setQuestionGroup(questionGroup); - + psychometricQuestionDao.save(psychometricQ); getLogger().debug("Question is created with Id: " + psychometricQ.getId() + "and type is: " + psychometricQ.getType()); Hibernate.initialize(psychometricQ); returnQuestion = psychometricQ; - + } else if(questionInfo.getClass().getName().equalsIgnoreCase("edu.asu.commons.mme.entity.CategoricalQuestion")) { - + CategoricalQuestion categoricalQ = new CategoricalQuestion(); - + CategoricalQuestion categoricalInfo = (CategoricalQuestion)questionInfo; getLogger().debug("Question from client is: " + categoricalInfo.getQuestion()); List<CategoricalOption> options = categoricalInfo.getCategoricalOptions(); - + for(int i = 0; i< options.size(); i++) { CategoricalOption test1 = new CategoricalOption(); test1 = (CategoricalOption)options.get(i); - + getLogger().debug("Option: " + i + test1.getOptionKey()); } - - + + //List<CategoricalOption> options = categoricalInfo.getCategoricalOptions(); categoricalQ.setCategoricalOptions(options); - + categoricalQ.setQuestion(categoricalInfo.getQuestion()); categoricalQ.setSequenceNo(categoricalInfo.getSequenceNo()); categoricalQ.setType(categoricalInfo.getType().toLowerCase()); /*Set<Round> round_configs = categoricalInfo.getRound_configs(); categoricalQ.setRound_configs(round_configs);*/ categoricalQ.setCommunicationQ(categoricalInfo.isCommunicationQ()); - - + + questionGroup = questionGroupDao.findByProperty("id",questionGroup_id); Hibernate.initialize(questionGroup); block = questionGroup.getBlock(); Hibernate.initialize(block); module = block.getModule(); Hibernate.initialize(module); - + initializeModule(module); categoricalQ.setQuestionGroup(questionGroup); - + categoricalQuestionDao.save(categoricalQ); - + returnQuestion = categoricalQ; getLogger().debug("Question is created with Id: " + categoricalQ.getId() + "and type is: " + categoricalQ.getType()); - + } else if(questionInfo.getClass().getName().equalsIgnoreCase("edu.asu.commons.mme.entity.Question")) { question = new Question(); - + Question otherTypeQuestionInfo = (Question)questionInfo; getLogger().debug("Question from client is: " + otherTypeQuestionInfo.getQuestion()); question.setQuestion(otherTypeQuestionInfo.getQuestion()); question.setSequenceNo(otherTypeQuestionInfo.getSequenceNo()); question.setType(otherTypeQuestionInfo.getType().toLowerCase()); question.setCommunicationQ(otherTypeQuestionInfo.isCommunicationQ()); - - + + questionGroup = questionGroupDao.findByProperty("id",questionGroup_id); Hibernate.initialize(questionGroup); block = questionGroup.getBlock(); Hibernate.initialize(block); module = block.getModule(); Hibernate.initialize(module); - + initializeModule(module); question.setQuestionGroup(questionGroup); - + save(question); - + returnQuestion = question; - + } - - + + return returnQuestion; } - + + private void resetCategoricalOptions(CategoricalQuestion categoricalQ) { + // TODO Auto-generated method stub + + try + { + getCategoricalOptionDao().delete(categoricalQ.getCategoricalOptions()); + }catch(Exception e) + { + e.printStackTrace(); + } + + //return categoricalOptions; + + } + + public Object updateQuestion(Object questionInfo,Long questionGroupId, Long questionId) { Object returnQuestion = new Object(); getLogger().debug("questionGroup_id: " + questionGroupId); if(questionInfo.getClass().getName().equalsIgnoreCase("edu.asu.commons.mme.entity.PsychometricQuestion")) { - + //PsychometricQuestion psychometricQ = new PsychometricQuestion(); PsychometricQuestion psychometricQ = psychometricQuestionDao.find(questionId); Hibernate.initialize(psychometricQ); @@ -575,83 +594,85 @@ psychometricQ.setQuestion(psychometric.getQuestion()); psychometricQ.setType(psychometric.getType().toLowerCase()); psychometricQ.setCommunicationQ(psychometric.isCommunicationQ()); - - + + getLogger().debug("Scale: " + psychometric.getScale()); getLogger().debug("Max slider value: " + psychometric.getMaxSliderValue()); for(int i=0;i < psychometric.getChoices().size();i++) { getLogger().debug("Choice" + i+" : "+ psychometric.getChoices().get(i)); - + } - + getLogger().debug("Seq no: " + psychometric.getSequenceNo()); getLogger().debug("Question: " + psychometric.getQuestion()); getLogger().debug("Type: " + psychometric.getType()); - - + + questionGroup = questionGroupDao.findByProperty("id",questionGroupId); Hibernate.initialize(questionGroup); block = questionGroup.getBlock(); Hibernate.initialize(block); module = block.getModule(); Hibernate.initialize(module); - + initializeModule(module); psychometricQ.setQuestionGroup(questionGroup); - + psychometricQuestionDao.save(psychometricQ); - getLogger().debug("Question is created with Id: " + psychometricQ.getId() + "and type is: " + psychometricQ.getType()); + getLogger().debug("Question is updated with Id: " + psychometricQ.getId() + "and type is: " + psychometricQ.getType()); Hibernate.initialize(psychometricQ); returnQuestion = psychometricQ; - + } else if(questionInfo.getClass().getName().equalsIgnoreCase("edu.asu.commons.mme.entity.CategoricalQuestion")) { - + CategoricalQuestion categoricalQ = categoricalQuestionDao.find(questionId); Hibernate.initialize(categoricalQ); Iterator<CategoricalOption> categoricalOption = categoricalQ.getCategoricalOptions().iterator(); Hibernate.initialize(categoricalOption); + //reset the privious entries + resetCategoricalOptions(categoricalQ); CategoricalQuestion categoricalInfo = (CategoricalQuestion)questionInfo; getLogger().debug("Question from client is: " + categoricalInfo.getQuestion()); List<CategoricalOption> options = categoricalInfo.getCategoricalOptions(); - + for(int i = 0; i< options.size(); i++) { CategoricalOption test1 = new CategoricalOption(); test1 = (CategoricalOption)options.get(i); - + getLogger().debug("Option: " + i + test1.getOptionKey()); } - - + + //List<CategoricalOption> options = categoricalInfo.getCategoricalOptions(); categoricalQ.setCategoricalOptions(options); - + categoricalQ.setQuestion(categoricalInfo.getQuestion()); categoricalQ.setSequenceNo(categoricalInfo.getSequenceNo()); categoricalQ.setType(categoricalInfo.getType().toLowerCase()); categoricalQ.setCommunicationQ(categoricalInfo.isCommunicationQ()); - - + + questionGroup = questionGroupDao.findByProperty("id",questionGroupId); Hibernate.initialize(questionGroup); block = questionGroup.getBlock(); Hibernate.initialize(block); module = block.getModule(); Hibernate.initialize(module); - + initializeModule(module); categoricalQ.setQuestionGroup(questionGroup); - + save(categoricalQ); - + returnQuestion = categoricalQ; - getLogger().debug("Question is created with Id: " + categoricalQ.getId() + "and type is: " + categoricalQ.getType()); - + getLogger().debug("Question is updated with Id: " + categoricalQ.getId() + "and type is: " + categoricalQ.getType()); + } else if(questionInfo.getClass().getName().equalsIgnoreCase("edu.asu.commons.mme.entity.Question")) { @@ -664,36 +685,36 @@ module = block.getModule(); Hibernate.initialize(module); initializeModule(module); - + Question otherTypeQuestionInfo = (Question)questionInfo; getLogger().debug("Question from client is: " + otherTypeQuestionInfo.getQuestion()); question.setQuestion(otherTypeQuestionInfo.getQuestion()); question.setSequenceNo(otherTypeQuestionInfo.getSequenceNo()); question.setType(otherTypeQuestionInfo.getType().toLowerCase()); question.setCommunicationQ(otherTypeQuestionInfo.isCommunicationQ()); - - + + questionGroup = questionGroupDao.findByProperty("id",questionGroupId); Hibernate.initialize(questionGroup); block = questionGroup.getBlock(); Hibernate.initialize(block); module = block.getModule(); Hibernate.initialize(module); - + initializeModule(module); question.setQuestionGroup(questionGroup); - + save(question); - + returnQuestion = question; - + } - - + + return returnQuestion; } - - + + public void createQuestions() { // check if we need to recreate these questions. block = blockDao.find(3L); @@ -704,9 +725,9 @@ return; } }*/ - // createSubjectGoalQuestionGroup(); + // createSubjectGoalQuestionGroup(); } - + /*private void createSubjectGoalQuestionGroup() { QuestionGroup subjectGoalQuestionGroup = new QuestionGroup(); subjectGoalQuestionGroup.setHeader("<b>What goals did you follow when designing your strategy?</b>"); @@ -716,7 +737,7 @@ subjectGoalQuestionGroup.setDuration(30); subjectGoalQuestionGroup.setBlock(blockDao.find(3L)); subjectGoalQuestionGroup.setSequenceNo(3); - + List<CategoricalOption> categoricalOptions = new ArrayList<CategoricalOption>(); // focus on own earnings option CategoricalOption ownEarningsOption = new CategoricalOption(); @@ -746,15 +767,15 @@ "Act against rules I expect the others to know" )); categoricalOptions.add(othersOption); - + CategoricalQuestion mostImportantGoal = new CategoricalQuestion(); mostImportantGoal.setCategoricalOptions(categoricalOptions); mostImportantGoal.setQuestion("Most important goal:"); mostImportantGoal.setSequenceNo(1); mostImportantGoal.setType("categorical"); subjectGoalQuestionGroup.add(mostImportantGoal); - - + + CategoricalQuestion secondMostImportantGoal = new CategoricalQuestion(); secondMostImportantGoal.setCategoricalOptions(categoricalOptions); secondMostImportantGoal.setQuestion("Second most important goal:"); @@ -762,8 +783,8 @@ secondMostImportantGoal.setType("categorical"); subjectGoalQuestionGroup.add(secondMostImportantGoal); // secondMostImportantGoal.setQuestionGroup(subjectGoalQuestionGroup); - + CategoricalQuestion thirdMostImportantGoal = new CategoricalQuestion(); thirdMostImportantGoal.setCategoricalOptions(categoricalOptions); thirdMostImportantGoal.setQuestion("Third most important goal:"); @@ -773,14 +794,14 @@ // thirdMostImportantGoal.setQuestionGroup(subjectGoalQuestionGroup); // save(thirdMostImportantGoal); //save(subjectGoalQuestionGroup); - - - + + + /*** - * - * create sample psychometric question - */ - /*PsychometricQuestion psychometricQ = new PsychometricQuestion(); + * + * create sample psychometric question + */ + /*PsychometricQuestion psychometricQ = new PsychometricQuestion(); psychometricQ.setScale("Unipolar".toLowerCase()); psychometricQ.setMaxSliderValue(21); List<String> choices = new ArrayList<String>(); @@ -791,46 +812,46 @@ psychometricQ.setQuestion("Compared to the most important goal, this goal is"); psychometricQ.setType("psychometric"); subjectGoalQuestionGroup.add(psychometricQ); - - + + /** - * Create test Sample categorical Simple quesiton - * - - + * Create test Sample categorical Simple quesiton + * + + CategoricalQuestion testSimple = new CategoricalQuestion(); CategoricalOption simple1 = new CategoricalOption(); List<CategoricalOption> OptionsList = new ArrayList<CategoricalOption>(); - + simple1.setOptionKey("choice1"); simple1.setChoices(null); - + CategoricalOption simple2 = new CategoricalOption(); simple2.setOptionKey("choice2"); simple2.setChoices(null); - + CategoricalOption simple3 = new CategoricalOption(); simple3.setOptionKey("choice3"); simple3.setChoices(null); - + OptionsList.add(simple1); OptionsList.add(simple2); OptionsList.add(simple3); - + testSimple.setCategoricalOptions(OptionsList); testSimple.setQuestion("Test Categrical Simple"); testSimple.setSequenceNo(5); testSimple.setType("categorical"); - + subjectGoalQuestionGroup.add(testSimple);*/ - - /*questionGroupDao.save(subjectGoalQuestionGroup); + + /*questionGroupDao.save(subjectGoalQuestionGroup); }*/ - + public void setBlockDao(HibernateBlockDao blockDao) { this.blockDao = blockDao; } - + public void setModuleDao(HibernateModuleDao moduleDao) { this.moduleDao = moduleDao; } @@ -838,12 +859,22 @@ public void setQuestionGroupDao(HibernateQuestionGroupDao questionGroupDao) { this.questionGroupDao = questionGroupDao; } - + public void setPsychometricQuestionDao(HibernatePsychometricQuestionDao psychometricQuestionDao) { this.psychometricQuestionDao = psychometricQuestionDao; } public void setCategoricalQuestionDao(HibernateCategoricalQuestionDao categoricalQuestionDao) { this.categoricalQuestionDao = categoricalQuestionDao; } - + + + public void setCategoricalOptionDao(HibernateCategoricalOptionDao categoricalOptionDao) { + this.categoricalOptionDao = categoricalOptionDao; + } + + + public HibernateCategoricalOptionDao getCategoricalOptionDao() { + return categoricalOptionDao; + } + } Modified: mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-08-12 22:35:58 UTC (rev 248) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-08-13 20:53:14 UTC (rev 249) @@ -60,6 +60,10 @@ </bean> + <bean id='categoricalOptionDao' class='edu.asu.commons.mme.dao.HibernateCategoricalOptionDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> + <bean id='questionGroupDao' class='edu.asu.commons.mme.dao.HibernateQuestionGroupDao'> <property name='sessionFactory' ref='sessionFactory'/> </bean> @@ -119,6 +123,7 @@ <property name='questionGroupDao' ref='questionGroupDao'/> <property name='psychometricQuestionDao' ref='psychometricQuestionDao'/> <property name='categoricalQuestionDao' ref='categoricalQuestionDao'/> + <property name='categoricalOptionDao' ref='categoricalOptionDao'/> </bean> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-08-18 23:19:44
|
Revision: 262 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=262&view=rev Author: kjonas Date: 2009-08-18 23:19:35 +0000 (Tue, 18 Aug 2009) Log Message: ----------- StartGame.mxml should be working to start the game. FisheryExperimentCore.mxml does not work with the database properly - createStudent needs to be changed I do not know if it will all work - I do not understand what "Merged" implies, exactly, so something may or may not have been lost. Modified Paths: -------------- mentalmodels/trunk/flex/src/StartGame.mxml mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf mentalmodels/trunk/src/main/webapp/StartGame.swf Added Paths: ----------- mentalmodels/trunk/flex/src/test.mxml mentalmodels/trunk/src/main/webapp/playerProductInstall.swf mentalmodels/trunk/src/main/webapp/test.html mentalmodels/trunk/src/main/webapp/test.swf Modified: mentalmodels/trunk/flex/src/StartGame.mxml =================================================================== --- mentalmodels/trunk/flex/src/StartGame.mxml 2009-08-18 22:43:42 UTC (rev 261) +++ mentalmodels/trunk/flex/src/StartGame.mxml 2009-08-18 23:19:35 UTC (rev 262) @@ -4,14 +4,14 @@ <mx:VBox visible="{pageNum==0}" horizontalAlign="center"> <mx:HBox horizontalAlign="right" width="330" id="firstBox"> <mx:Label text="$USD per lb of fish:"/> - <mx:TextInput id="txtMoney"/> + <mx:NumericStepper id="stpMoney" stepSize="0.01" minimum="0.01" maximum="9999"/> </mx:HBox> <mx:HBox horizontalAlign="right" width="{firstBox.width}"> - <mx:Label text="Brief description of game:"/> - <mx:TextArea id="txtDescription"/> + <mx:Label text="Very brief description of game:"/> + <mx:TextInput id="txtDescription" maxChars="5"/> </mx:HBox> - <mx:Button label="Create Game" id="btnCreateGame" click="false"/> + <mx:Button label="Create Game" id="btnCreateGame" click="create()"/> <mx:HBox horizontalAlign="right" width="{firstBox.width}"> <mx:Label text="Game ID:"/> <mx:TextInput id="txtGameID" enabled="false"/> @@ -20,7 +20,7 @@ <mx:Spacer height="30"/> <mx:Text text="Click the Start Game button only after all students have connected using the above ID." width="300"/> - <mx:Button label="Start Game" id="btnStartGame" click="feed.start()"/> + <mx:Button label="Start Game" id="btnStartGame" click="start()" enabled="false"/> </mx:VBox> <mx:VBox visible="{pageNum==1}"> @@ -28,10 +28,14 @@ <mx:VBox id="responsesContent"/> </mx:VBox> - <mx:RemoteObject id="feed" destination="feed" fault="{faultHandler(event)}" /> + <mx:RemoteObject id="startupService" destination="startupService" fault="faultHandler(event)"> + <mx:method name="createGame" result="gameObjectResultHandler(event)"/> + <mx:method name="startGame" result="noResultHandler(event)"/> + </mx:RemoteObject> <mx:Script> <![CDATA[ + import actionscript.Game; import actionscript.Block; import mx.rpc.events.ResultEvent; import mx.rpc.events.FaultEvent; @@ -39,16 +43,52 @@ [Bindable]private var pageNum:int = 0; + // Universal Fault Handler public function faultHandler(event:FaultEvent):void { Alert.show(event.fault.getStackTrace()); } + // Button Click Events + public function create():void + { + stpMoney.enabled = txtDescription.enabled = btnCreateGame.enabled = false; + + var gameObject:Game = new Game(); + gameObject.money = stpMoney.value; + gameObject.description = txtDescription.text; + } + public function start():void + { + btnStartGame.enabled = false; + + startupService.startGame(); + } public function getResponses():void { } + + // Server Response Events + public function gameObjectResultHandler(event:ResultEvent):void + { + if(event.result != null) + { + txtGameID.text = (event.result as Game).description; + btnStartGame.enabled = true; + } + else + { + stpMoney.enabled = txtDescription.enabled = btnCreateGame.enabled = true; + } + } + public function noResultHandler(event:ResultEvent):void + { + + } + ]]> </mx:Script> </mx:Application> + Added: mentalmodels/trunk/flex/src/test.mxml =================================================================== --- mentalmodels/trunk/flex/src/test.mxml (rev 0) +++ mentalmodels/trunk/flex/src/test.mxml 2009-08-18 23:19:35 UTC (rev 262) @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="utf-8"?> +<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> + + <mx:HBox> + <mx:Button label="roundService.getBlock()" click="roundService.getBlock()"/> + <mx:Button label="roundService.getCurrentRound()" click="roundService.getCurrentRound()"/> + <mx:Button label="startupService.createStudent()" click="startupService.createStudent()"/> + <mx:Button label="answeringService.saveStrategy()" click="answeringService.saveStrategy()"/> + <mx:Button label="locationService.getAllLocations()" click="locationService.getAllLocations()"/> + </mx:HBox> + + <mx:RemoteObject id="roundService" destination="roundService" fault="faultHandler(event)"> + <mx:method name="getBlock" result="resultHandler(event)"/> + <mx:method name="getCurrentRound" result="resultHandler(event)"/> + </mx:RemoteObject> + <mx:RemoteObject id="startupService" destination="startupService" fault="faultHandler(event)"> + <mx:method name="createStudent" result="resultHandler(event)"/> + </mx:RemoteObject> + <mx:RemoteObject id="answeringService" destination="answeringService" fault="faultHandler(event)"> + <mx:method name="saveStrategy" result="resultHandler(event)"/> + </mx:RemoteObject> + <mx:RemoteObject id="locationService" destination="locationService" fault="faultHandler(event)"> + <mx:method name="getAllLocations" result="resultHandler(event)"/> + </mx:RemoteObject> + + <mx:Script> + <![CDATA[ + import mx.core.UIComponent; + import mx.controls.Alert; + import mx.rpc.events.FaultEvent; + import mx.rpc.events.ResultEvent; + + public function resultHandler(event:ResultEvent):void + { + var str:String = ""; + str += "event == null : " + (event == null) + "\n"; + str += "event.result == null : " + (event.result == null) + "\n"; + + Alert.show(str, "resultHandler()"); + } + + public function faultHandler(event:FaultEvent):void + { + var str:String = ""; + str += "event.fault.message:\n" + (event.fault.message) + "\n\n"; + str += "event.fault.getStackTrace():\n*START*\n" + (event.fault.getStackTrace()) + "\n*END*"; + + Alert.show(str, "faultHandler()"); + } + + ]]> + </mx:Script> + +</mx:Application> Modified: mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/StartGame.swf =================================================================== (Binary files differ) Added: mentalmodels/trunk/src/main/webapp/playerProductInstall.swf =================================================================== (Binary files differ) Property changes on: mentalmodels/trunk/src/main/webapp/playerProductInstall.swf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: mentalmodels/trunk/src/main/webapp/test.html =================================================================== --- mentalmodels/trunk/src/main/webapp/test.html (rev 0) +++ mentalmodels/trunk/src/main/webapp/test.html 2009-08-18 23:19:35 UTC (rev 262) @@ -0,0 +1,137 @@ +<!-- saved from url=(0014)about:internet --> +<html lang="en"> + +<!-- +Smart developers always View Source. + +This application was built using Adobe Flex, an open source framework +for building rich Internet applications that get delivered via the +Flash Player or to desktops via Adobe AIR. + +Learn more about Flex at http://flex.org +// --> + +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + +<!-- BEGIN Browser History required section --> +<link rel="stylesheet" type="text/css" href="history/history.css" /> +<!-- END Browser History required section --> + +<title></title> +<script src="AC_OETags.js" language="javascript"></script> + +<!-- BEGIN Browser History required section --> +<script src="history/history.js" language="javascript"></script> +<!-- END Browser History required section --> + +<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"> +<!-- +// ----------------------------------------------------------------------------- +// Globals +// Major version of Flash required +var requiredMajorVersion = 9; +// Minor version of Flash required +var requiredMinorVersion = 0; +// Minor version of Flash required +var requiredRevision = 124; +// ----------------------------------------------------------------------------- +// --> +</script> +</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); + +// Version check based upon the values defined in globals +var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision); + +if ( hasProductInstall && !hasRequestedVersion ) { + // DO NOT MODIFY THE FOLLOWING FOUR LINES + // 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; + + AC_FL_RunContent( + "src", "playerProductInstall", + "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+'&ip=test'+clientIP+"", + "width", "100%", + "height", "100%", + "align", "middle", + "id", "test", + "quality", "high", + "bgcolor", "#869ca7", + "name", "test", + "allowScriptAccess","sameDomain", + "type", "application/x-shockwave-flash", + "pluginspage", "http://www.adobe.com/go/getflashplayer" + ); +} else if (hasRequestedVersion) { + // if we've detected an acceptable version + // embed the Flash Content SWF when all tests are passed + AC_FL_RunContent( + "src", "test", + "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+"" + ); +} 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" + 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" /> + <embed src="test.swf" quality="high" bgcolor="#869ca7" + width="100%" height="100%" name="test" align="middle" + play="true" + loop="false" + quality="high" + allowScriptAccess="sameDomain" + type="application/x-shockwave-flash" + pluginspage="http://www.adobe.com/go/getflashplayer"> + </embed> + </object> +</noscript> +</body> +</html> Added: mentalmodels/trunk/src/main/webapp/test.swf =================================================================== (Binary files differ) Property changes on: mentalmodels/trunk/src/main/webapp/test.swf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-08-19 01:26:19
|
Revision: 263 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=263&view=rev Author: seematalele Date: 2009-08-19 01:26:13 +0000 (Wed, 19 Aug 2009) Log Message: ----------- Written code for executing Day by day decision but it is not complete. Modified Paths: -------------- mentalmodels/trunk/flex/src/actionscript/StudentStrategy.as 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/StartupService.java Modified: mentalmodels/trunk/flex/src/actionscript/StudentStrategy.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/StudentStrategy.as 2009-08-18 23:19:35 UTC (rev 262) +++ mentalmodels/trunk/flex/src/actionscript/StudentStrategy.as 2009-08-19 01:26:13 UTC (rev 263) @@ -14,7 +14,8 @@ public var threshold:Number; public var location:Location; public var repeatedDecisions:Boolean; - public var dayOutput:ArrayCollection; + public var student:Student; + public var round:Round; public var roundConfig:actionscript.Round; } } \ No newline at end of file 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-18 23:19:35 UTC (rev 262) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java 2009-08-19 01:26:13 UTC (rev 263) @@ -6,13 +6,17 @@ 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.Question; -import edu.asu.commons.mme.entity.Student; +import edu.asu.commons.mme.entity.Location; @Transactional public class DayByDayDecisionsService extends Service.Base<DayByDayDecisions, HibernateDayByDayDecisionsDao> { + LocationService locationService; + + + private List<DayByDayDecisions> studentDecisions = new ArrayList<DayByDayDecisions>(); public void setStudentDecisions(List<DayByDayDecisions> studentDecisions) { @@ -43,12 +47,53 @@ } } - public void executeStrategy() + public void allocateStudentForEachBay() { + DayByDayDecisions studentDecision = new DayByDayDecisions(); + List<DayByDayDecisions> bay1 = new ArrayList<DayByDayDecisions>(); + List<DayByDayDecisions> bay2 = new ArrayList<DayByDayDecisions>(); + List<DayByDayDecisions> bay3 = new ArrayList<DayByDayDecisions>(); + List<DayByDayDecisions> harbor = new ArrayList<DayByDayDecisions>(); + + for(int i = 0; i < studentDecisions.size(); i++) + { + studentDecision = studentDecisions.get(i); + if(studentDecision.getLocation().getLocationName().equalsIgnoreCase("Bay1")) + { + bay1.add(studentDecision); + } + else if(studentDecision.getLocation().getLocationName().equalsIgnoreCase("Bay2")) + { + bay2.add(studentDecision); + } + else if(studentDecision.getLocation().getLocationName().equalsIgnoreCase("Bay3")) + { + bay3.add(studentDecision); + } + else if(studentDecision.getLocation().getLocationName().equalsIgnoreCase("Harbor")) + { + harbor.add(studentDecision); + } + } + executeStrategy(bay1,"Bay1"); + executeStrategy(bay2,"Bay2"); + executeStrategy(bay3,"Bay3"); + executeStrategy(harbor,"Harbor"); } + public void executeStrategy(List<DayByDayDecisions> bay,String locationName) + { + Location location = locationService.getLocation(locationName); + + } + public LocationService getLocationService() { + return locationService; + } + + public void setLocationService(LocationService locationService) { + this.locationService = locationService; + } - } 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-18 23:19:35 UTC (rev 262) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 2009-08-19 01:26:13 UTC (rev 263) @@ -51,5 +51,21 @@ } return locations; } + + public Location getLocation(String locationName) + { + // TODO Auto-generated method stub + List<Location>locations = getAllLocations(); + Location location =new Location(); + + for(int i=0; i<locations.size(); i++) + { + if(locations.get(i).getLocationName().equalsIgnoreCase(locationName)) + { + location = locations.get(i); + } + } + return location; + } } 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-18 23:19:35 UTC (rev 262) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java 2009-08-19 01:26:13 UTC (rev 263) @@ -60,18 +60,26 @@ currentGame = new Game(); currentGame = game; getGameDao().save(currentGame); - currentGame.setDescription(currentGame.getDescription()+currentGame.getId()); - getGameDao().save(currentGame); - setCurrentGame(currentGame); - initializeCurrentGame(); + String str = currentGame.getDescription()+currentGame.getId(); + if(getGameDao().findAllByProperty("description", str) !=null) + { + setCurrentGame(null); + } + else + { + currentGame.setDescription(str); + getGameDao().save(currentGame); + setCurrentGame(currentGame); + initializeGame(currentGame); + } return getCurrentGame(); } - private void initializeCurrentGame() { + private void initializeGame(Game game) { // TODO Auto-generated method stub - Hibernate.initialize(currentGame); - Hibernate.initialize(currentGame.getCurrentBlock()); - Hibernate.initialize(currentGame.getCurrentRound()); - Iterator<Round> rounds = currentGame.getRounds().iterator(); + Hibernate.initialize(game); + Hibernate.initialize(game.getCurrentBlock()); + Hibernate.initialize(game.getCurrentRound()); + Iterator<Round> rounds = game.getRounds().iterator(); while(rounds.hasNext()) { initializeRound(rounds.next()); @@ -83,7 +91,6 @@ return getModule(sequenceNo); } - public void test() { getLogger().debug("test to check if module service is working...." ); @@ -267,10 +274,6 @@ return false; } - - - - public HibernateModuleDao getModuleDao() { return moduleDao; } @@ -373,11 +376,11 @@ private int getCurrentRoundNo() { // TODO Auto-generated method stub //FIXME: Game id 1 is hard coded but needs to make it dynamic - Game game = gameDao.find(1L); - if(game.getCurrentRound() == null) + //Game game = gameDao.find(1L); + if(getCurrentGame().getCurrentRound() == null) return 0; else - return game.getCurrentRound().getRoundNo(); + return getCurrentGame().getCurrentRound().getRoundNo(); } @@ -418,7 +421,6 @@ 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); @@ -426,14 +428,12 @@ gameDao.save(game); } - public Integer getTimerforBlock(Block block) { return block.getDuration(); } - private void initializeModule(Module module) { // TODO Auto-generated method stub @@ -514,8 +514,9 @@ Iterator <Game> games = currentRound.getGame().iterator(); while(games.hasNext()) { - Hibernate.initialize(games.next()); + initializeGame(games.next()); + } List<Location> roundlocations = currentRound.getLocations(); 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-18 23:19:35 UTC (rev 262) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java 2009-08-19 01:26:13 UTC (rev 263) @@ -38,7 +38,6 @@ public void assignGroups() { - MessageBroker msgBroker = MessageBroker.getMessageBroker(null); String clientID = UUIDUtils.createUUID(); AsyncMessage msg = new AsyncMessage(); @@ -52,7 +51,7 @@ msg.setBody(students); System.out.println("Message broker is: "+ msgBroker); System.out.println("Students size is: " + students.size()); - + msgBroker.routeMessageToService(msg, null); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-08-25 00:22:17
|
Revision: 269 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=269&view=rev Author: seematalele Date: 2009-08-25 00:20:46 +0000 (Tue, 25 Aug 2009) Log Message: ----------- Changed the pom.xml so that it will point to spring-flex 1.0.0.RC2 version. Configured the project using new version of BlazeDS(spring-flex-1.0.0.RC2) Modified Paths: -------------- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml mentalmodels/trunk/pom.xml 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/applicationContext.xml mentalmodels/trunk/src/main/webapp/WEB-INF/flex/messaging-config.xml mentalmodels/trunk/src/main/webapp/WEB-INF/flex/services-config.xml Modified: mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-08-21 23:37:51 UTC (rev 268) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-08-25 00:20:46 UTC (rev 269) @@ -430,7 +430,7 @@ currentState = "wait"; btnBack.enabled = btnForward.enabled = btnReset.enabled = true; - getNextBlock(); + //getNextBlock(); returnValue = true; } } Modified: mentalmodels/trunk/pom.xml =================================================================== --- mentalmodels/trunk/pom.xml 2009-08-21 23:37:51 UTC (rev 268) +++ mentalmodels/trunk/pom.xml 2009-08-25 00:20:46 UTC (rev 269) @@ -1,220 +1,230 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- + <!-- vim:sts=2:sw=2 --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <organization> - <name>The Virtual Commons</name> - <url>http://dev.commons.asu.edu</url> - </organization> - <modelVersion>4.0.0</modelVersion> - <groupId>edu.asu.commons</groupId> - <artifactId>mme</artifactId> - <version>0.1-SNAPSHOT</version> - <name>Mental Models Application</name> - <packaging>war</packaging> - <repositories> - <repository> - <id>dev.commons.asu.edu</id> - <url>http://dev.commons.asu.edu/archiva/repository/internal/</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>false</enabled> - </snapshots> - </repository> - </repositories> - <dependencies> - <!-- mysql jdbc --> - <dependency> - <groupId>mysql</groupId> - <artifactId>mysql-connector-java</artifactId> - <version>5.1.6</version> - </dependency> - <!-- spring dependencies --> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring</artifactId> - <version>2.5.6</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-webmvc</artifactId> - <version>2.5.6</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-flex</artifactId> - <version>1.0.0.M2</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-hibernate3</artifactId> - <version>2.0-m3</version> - </dependency> - <dependency> - <groupId>cglib</groupId> - <artifactId>cglib-nodep</artifactId> - <version>2.2</version> - </dependency> - <!-- hibernate and JPA persistence --> - <dependency> - <groupId>javax.persistence</groupId> - <artifactId>persistence-api</artifactId> - <version>1.0</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-annotations</artifactId> - <version>3.4.0.GA</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-ehcache</artifactId> - <version>3.3.1.GA</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-tools</artifactId> - <version>3.2.3.GA</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.5.2</version> - </dependency> - <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> - <version>3.1</version> - </dependency> - <dependency> - <groupId>commons-dbcp</groupId> - <artifactId>commons-dbcp</artifactId> - <version>1.2.2</version> - </dependency> - <dependency> - <groupId>javassist</groupId> - <artifactId>javassist</artifactId> - <version>3.8.0.GA</version> - </dependency> - <!-- - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>4.0-beta2</version> - </dependency> - --> - <dependency> - <groupId>com.adobe.blazeds</groupId> - <artifactId>blazeds-core</artifactId> - <version>3.2.0.3978</version> - </dependency> - <dependency> - <groupId>com.adobe.blazeds</groupId> - <artifactId>blazeds-remoting</artifactId> - <version>3.2.0.3978</version> - </dependency> - <dependency> - <groupId>com.adobe.blazeds</groupId> - <artifactId>blazeds-common</artifactId> - <version>3.2.0.3978</version> - </dependency> - <dependency> - <groupId>com.adobe.blazeds</groupId> - <artifactId>blazeds-proxy</artifactId> - <version>3.2.0.3978</version> - </dependency> - <dependency> - <groupId>com.adobe.blazeds</groupId> - <artifactId>blazeds-opt</artifactId> - <version>3.2.0.3978</version> - </dependency> - <dependency> - <groupId>xalan</groupId> - <artifactId>xalan</artifactId> - <version>2.7.1</version> - </dependency> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <organization> + <name>The Virtual Commons</name> + <url>http://dev.commons.asu.edu</url> + </organization> + <modelVersion>4.0.0</modelVersion> + <groupId>edu.asu.commons</groupId> + <artifactId>mme</artifactId> + <version>0.1-SNAPSHOT</version> + <name>Mental Models Application</name> + <packaging>war</packaging> + <repositories> + <repository> + <id>dev.commons.asu.edu</id> + <url>http://dev.commons.asu.edu/archiva/repository/internal/</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + <repository> + <id>spring-milestone</id> + <name>Spring Portfolio Milestone Repository</name> + <url>http://maven.springframework.org/milestone</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + </repositories> + <dependencies> + <!-- mysql jdbc --> + <dependency> + <groupId>mysql</groupId> + <artifactId>mysql-connector-java</artifactId> + <version>5.1.6</version> + </dependency> + <!-- spring dependencies --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring</artifactId> + <version>2.5.6</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-webmvc</artifactId> + <version>2.5.6</version> + </dependency> + <dependency> +<groupId>org.springframework.flex</groupId> +<artifactId>spring-flex</artifactId> +<version>1.0.0.RC2</version> +</dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-hibernate3</artifactId> + <version>2.0-m3</version> + </dependency> + <dependency> + <groupId>cglib</groupId> + <artifactId>cglib-nodep</artifactId> + <version>2.2</version> + </dependency> + <!-- hibernate and JPA persistence --> + <dependency> + <groupId>javax.persistence</groupId> + <artifactId>persistence-api</artifactId> + <version>1.0</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-annotations</artifactId> + <version>3.4.0.GA</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-ehcache</artifactId> + <version>3.3.1.GA</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-tools</artifactId> + <version>3.2.3.GA</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.5.2</version> + </dependency> + <dependency> + <groupId>commons-httpclient</groupId> + <artifactId>commons-httpclient</artifactId> + <version>3.1</version> + </dependency> + <dependency> + <groupId>commons-dbcp</groupId> + <artifactId>commons-dbcp</artifactId> + <version>1.2.2</version> + </dependency> + <dependency> + <groupId>javassist</groupId> + <artifactId>javassist</artifactId> + <version>3.8.0.GA</version> + </dependency> + <!-- + <dependency> <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> <version>4.0-beta2</version> + </dependency> + --> + <dependency> + <groupId>com.adobe.blazeds</groupId> + <artifactId>blazeds-core</artifactId> + <version>3.2.0.3978</version> + </dependency> + <dependency> + <groupId>com.adobe.blazeds</groupId> + <artifactId>blazeds-remoting</artifactId> + <version>3.2.0.3978</version> + </dependency> + <dependency> + <groupId>com.adobe.blazeds</groupId> + <artifactId>blazeds-common</artifactId> + <version>3.2.0.3978</version> + </dependency> + <dependency> + <groupId>com.adobe.blazeds</groupId> + <artifactId>blazeds-proxy</artifactId> + <version>3.2.0.3978</version> + </dependency> + <dependency> + <groupId>com.adobe.blazeds</groupId> + <artifactId>blazeds-opt</artifactId> + <version>3.2.0.3978</version> + </dependency> + <dependency> + <groupId>xalan</groupId> + <artifactId>xalan</artifactId> + <version>2.7.1</version> + </dependency> - </dependencies> - <build> - <finalName>mme</finalName> - <testResources> - <testResource> - <directory>src/main/webapp</directory> - </testResource> - </testResources> - <plugins> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.6</source> - <target>1.6</target> - </configuration> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>tomcat-maven-plugin</artifactId> - <configuration> - <server>myserver</server> - </configuration> + </dependencies> + <build> + <finalName>mme</finalName> + <testResources> + <testResource> + <directory>src/main/webapp</directory> + </testResource> + </testResources> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.6</source> + <target>1.6</target> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>tomcat-maven-plugin</artifactId> + <configuration> + <server>myserver</server> + </configuration> - </plugin> - <plugin> - <groupId>org.mortbay.jetty</groupId> - <artifactId>maven-jetty-plugin</artifactId> - <configuration> - <connectors> - <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> - <port>8080</port> - <maxIdleTime>60000</maxIdleTime> - </connector> - </connectors> - <scanIntervalSeconds>10</scanIntervalSeconds> - <stopKey>tdar</stopKey> - <stopPort>12919</stopPort> - </configuration> - </plugin> - </plugins> - </build> - <profiles> - <profile> - <id>ant</id> - <build> - <defaultGoal>antrun:run</defaultGoal> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <goals> - <goal>load</goal> - </goals> - <configuration> - <tasks> - <!-- - can be invoked via - mvn -P ant -D target=initialize-data - --> - <property name="compile.classpath" refid="maven.compile.classpath"/> - <property name="runtime.classpath" refid="maven.runtime.classpath"/> - <property name="test.classpath" refid="maven.test.classpath"/> - <property name="plugin.classpath" refid="maven.plugin.classpath"/> - <ant antfile="${basedir}/init-db.ant.xml" inheritRefs="true" inheritAll="true"> - <target name="${target}"/> - </ant> - </tasks> - </configuration> - </plugin> - </plugins> - </build> - <dependencies> - <dependency> - <groupId>ant-contrib</groupId> - <artifactId>ant-contrib</artifactId> - <version>1.0b2</version> - </dependency> - </dependencies> - </profile> - </profiles> + </plugin> + <plugin> + <groupId>org.mortbay.jetty</groupId> + <artifactId>maven-jetty-plugin</artifactId> + <configuration> + <connectors> + <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> + <port>8080</port> + <maxIdleTime>60000</maxIdleTime> + </connector> + </connectors> + <scanIntervalSeconds>10</scanIntervalSeconds> + <stopKey>tdar</stopKey> + <stopPort>12919</stopPort> + </configuration> + </plugin> + </plugins> + </build> + <profiles> + <profile> + <id>ant</id> + <build> + <defaultGoal>antrun:run</defaultGoal> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <goals> + <goal>load</goal> + </goals> + <configuration> + <tasks> + <!-- + can be invoked via mvn -P ant -D target=initialize-data + --> + <property name="compile.classpath" refid="maven.compile.classpath" /> + <property name="runtime.classpath" refid="maven.runtime.classpath" /> + <property name="test.classpath" refid="maven.test.classpath" /> + <property name="plugin.classpath" refid="maven.plugin.classpath" /> + <ant antfile="${basedir}/init-db.ant.xml" inheritRefs="true" + inheritAll="true"> + <target name="${target}" /> + </ant> + </tasks> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>ant-contrib</groupId> + <artifactId>ant-contrib</artifactId> + <version>1.0b2</version> + </dependency> + </dependencies> + </profile> + </profiles> </project> 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 23:37:51 UTC (rev 268) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java 2009-08-25 00:20:46 UTC (rev 269) @@ -70,12 +70,13 @@ //roundService.test(); - MessageBroker msgBroker = MessageBroker.getMessageBroker(null); + MessageBroker msgBroker = MessageBroker.getMessageBroker("_messageBroker"); String clientID = UUIDUtils.createUUID(); int i=0; - while (running) { + while (i<3) { i++; + String msgDestination = roundService.getCurrentGame().getDescription(); /*if(getCurrentModuleRoundConfig() == null) { setCurrentModuleRoundConfig(new ModuleRoundConfig()); @@ -84,19 +85,21 @@ //Push the first block to the clients AsyncMessage msg = new AsyncMessage(); - msg.setDestination("DataPush"); + msg.setDestination("mme"); //msg.setHeader("DSSubtopic", "hello"); msg.setClientId(clientID); msg.setMessageId(UUIDUtils.createUUID()); msg.setTimestamp(System.currentTimeMillis()); - System.out.println("in while loop: "); + +// System.out.println("in while loop: "); block = roundService.getBlock(); - System.out.println("after block "); - msg.setBody("Here is a block!!!" + block); + // System.out.println("after block "); + msg.setBody(block); + msgBroker.routeMessageToService(msg, null); System.out.println("Message broker is: "+ msgBroker); System.out.println("Message is: "+ block.getDescription()); - msgBroker.routeMessageToService(msg, null); - if(block.getDescription().equalsIgnoreCase("Day-by-day decisions game")) + + /* if(block.getDescription().equalsIgnoreCase("Day-by-day decisions game")) { //start day by day decision //getDayBydayDecisionService(). @@ -106,13 +109,13 @@ { //start communication round - } + }*/ //get the timer for the block Integer timer = roundService.getTimerforBlock(block); //start the timer for the block sent try { //for testing purpose 5000 is given as an argument - Thread.sleep(5000); + Thread.sleep(10000); if(block == null) { running = false; 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 23:37:51 UTC (rev 268) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java 2009-08-25 00:20:46 UTC (rev 269) @@ -62,7 +62,7 @@ public void startGame() { //push assign groups to all the students - assignGroups(); + //assignGroups(); //start the game this.startGame.run(); Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-08-21 23:37:51 UTC (rev 268) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-08-25 00:20:46 UTC (rev 269) @@ -26,7 +26,11 @@ <!-- Flex related information started --> - <flex:message-broker /> + <flex:message-broker> +<flex:message-service + default-channels="my-streaming-amf,my-longpolling-amf,my-polling-amf" /> + +</flex:message-broker> <!-- XXX: Split these out into separate XML files and import them if this file gets too large --> <!-- spring managed daos --> @@ -109,7 +113,7 @@ <property name='moduleDao' ref='moduleDao'/> <property name='gameDao' ref='gameDao' /> <property name='moduleRoundDao' ref='moduleRoundDao' /> - <property name='blockDao' ref='blockDao'/> + <!-- <property name='blockDao' ref='blockDao'/> --> </bean> @@ -168,14 +172,17 @@ <!-- Expose services for Flex/BlazeDS remoting --> - <flex:remote-service ref="studentService" /> - <flex:remote-service ref="moduleService" /> - <flex:remote-service ref="questionCreatorService" /> - <flex:remote-service ref="roundService" /> - <flex:remote-service ref="startupService" /> - <flex:remote-service ref="answeringService" /> - <flex:remote-service ref="locationService" /> - <flex:remote-service ref="feed" /> + <flex:remoting-destination ref="studentService" /> + <flex:remoting-destination ref="moduleService" /> + <flex:remoting-destination ref="questionCreatorService" /> + <flex:remoting-destination ref="roundService" /> + <flex:remoting-destination ref="startupService" /> + <flex:remoting-destination ref="answeringService" /> + <flex:remoting-destination ref="locationService" /> + <flex:remoting-destination ref="feed" /> + + <!-- Expose services for Flex/BlazeDS messaging --> + <flex:message-destination id="mme" allow-subtopics="true" subtopic-separator="." /> <!-- Flex related information ended--> Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/flex/messaging-config.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/flex/messaging-config.xml 2009-08-21 23:37:51 UTC (rev 268) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/flex/messaging-config.xml 2009-08-25 00:20:46 UTC (rev 269) @@ -1,28 +1,34 @@ <?xml version="1.0" encoding="UTF-8"?> -<service id="message-service" - class="flex.messaging.services.MessageService" - messageTypes="flex.messaging.messages.AsyncMessage" > +<service id="message-service" class="flex.messaging.services.MessageService" + messageTypes="flex.messaging.messages.AsyncMessage"> - <adapters> - <adapter-definition id="actionscript" class="flex.messaging.services.messaging.adapters.ActionScriptAdapter" default ="true"/> - <!-- <adapter-definition id="jms" class="flex.messaging.services.messaging.adapters.JMSAdapter"/> --> - <adapter-definition id="DataPushAdapter" class="Feed"/> - </adapters> + <adapters> + <adapter-definition id="actionscript" + class="flex.messaging.services.messaging.adapters.ActionScriptAdapter" + default="true" /> + <!-- + <adapter-definition id="jms" + class="flex.messaging.services.messaging.adapters.JMSAdapter"/> + --> + <adapter-definition id="DataPushAdapter" class="StartupService" /> + </adapters> - <default-channels> - <channel ref="my-polling-amf"/> - <channel ref="my-streaming-amf"/> - </default-channels> - - <destination id="DataPush"> -<channels> -<channel ref="my-polling-amf"/> -</channels> -<!--<adapter ref="DataPushAdapter"/> - ---></destination> - + <default-channels> + <channel ref="my-polling-amf" /> + <channel ref="my-streaming-amf" /> + </default-channels> - + <!--<destination id="mme"> + <properties> + <server> + <allow-subtopics>true</allow-subtopics> + <subtopic-separator>.</subtopic-separator> + </server> + </properties> + <channels> + <channel ref="my-streaming-amf" /> + </channels> + <adapter ref="DataPushAdapter"/> -</service> + </destination> --> + </service> Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/flex/services-config.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/flex/services-config.xml 2009-08-21 23:37:51 UTC (rev 268) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/flex/services-config.xml 2009-08-25 00:20:46 UTC (rev 269) @@ -39,6 +39,7 @@ <user-agent match-on="MSIE" kickstart-bytes="2048" max-streaming-connections-per-session="3"/> <user-agent match-on="Firefox" kickstart-bytes="2048" max-streaming-connections-per-session="3"/> </user-agent-settings> + </properties> </channel-definition> <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-09-04 00:52:49
|
Revision: 275 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=275&view=rev Author: kjonas Date: 2009-09-04 00:52:31 +0000 (Fri, 04 Sep 2009) Log Message: ----------- Adjusted to use server pushing Trying to get round via strategy design only Fixing errors with pushing and initializing components/information windows Modified Paths: -------------- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml mentalmodels/trunk/flex/src/actionscript/InformationWindowCreator.as mentalmodels/trunk/flex/src/actionscript/PageDisplay.as mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml mentalmodels/trunk/flex/src/custom/InstructionPage.mxml mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingFishQuestionC.mxml mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingPeopleQuestionC.mxml mentalmodels/trunk/flex/src/custom/questions/psychometric/PsychometricQuestionC.mxml mentalmodels/trunk/flex/src/custom/questions/strategyDesign/Planner.mxml mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml mentalmodels/trunk/flex/src/test.mxml mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf mentalmodels/trunk/src/main/webapp/StartGame.swf mentalmodels/trunk/src/main/webapp/WEB-INF/classes/log4j.properties mentalmodels/trunk/src/main/webapp/test.swf Modified: mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml =================================================================== --- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-08-31 22:30:50 UTC (rev 274) +++ mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-09-04 00:52:31 UTC (rev 275) @@ -57,12 +57,6 @@ <mx:VBox id="vbxContent" horizontalAlign="center" verticalAlign="middle"> <mx:VBox id="progressBars" x="0" y="0" verticalGap="0"> - <!--<mx:HBox> - <mx:Label text="Time for Module:" width="130" textAlign="right"/> - <mx:HBox width="{progressBarWidth+2}" borderStyle="solid"> - <mx:HBox id="progressBarModule" height="10" backgroundColor="#00FF00"/> - </mx:HBox> - </mx:HBox>--> <mx:HBox> <mx:Label text="Time for Block:" width="130" textAlign="right"/> <mx:HBox width="{progressBarWidth+2}" borderStyle="solid"> @@ -83,7 +77,6 @@ import mx.controls.Alert; import mx.controls.Label; import actionscript.Block; - import actionscript.Module; import actionscript.InformationWindowCreator; import mx.collections.ArrayCollection; import custom.InformationWindowPopup; @@ -103,8 +96,7 @@ public var currInfoWindowsB:ArrayCollection = null; public var currInfoWindowsDescriptions:ArrayCollection = null; - public var currModule:Module = null; - public var currBlock:Block = null; + public var currentBlock:Block = null; public function faultMsgHandler(msgevent:MessageFaultEvent):void { @@ -275,25 +267,29 @@ } } - public function loadBlock(block:Block, module:Module=null):void + public function loadBlock(block:Block):void { if(block != null) { - currBlock = block; + currentBlock = block; + var i:int = 0; + + var str:String = currentBlock.informationWindows.length + " of them.\n"; + for(i = 0; i < currentBlock.informationWindows.length; i++) + { + str += "["+(currentBlock.informationWindows.getItemAt(i) as InformationWindow).id+"]"; + } + Alert.show(str,"Information Windows:"); + var tempArray:ArrayCollection = new ArrayCollection(); - for(var i:int = 0; i<currBlock.informationWindows.length; i++) + for(i = 0; i<currentBlock.informationWindows.length; i++) { - var temp:InformationWindow = (currBlock.informationWindows.getItemAt(i) as InformationWindow); - tempArray.addItem(temp.id); + var temp:InformationWindow = (currentBlock.informationWindows.getItemAt(i) as InformationWindow); + tempArray.addItem(temp.id - 1); } selectCurrentWindows( tempArray ); } - - if(module != null) - { - currModule = module; - } } ]]> Modified: mentalmodels/trunk/flex/src/actionscript/InformationWindowCreator.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/InformationWindowCreator.as 2009-08-31 22:30:50 UTC (rev 274) +++ mentalmodels/trunk/flex/src/actionscript/InformationWindowCreator.as 2009-09-04 00:52:31 UTC (rev 275) @@ -105,7 +105,7 @@ tempWindow.addItem(temp); allInfoWindows.addItem(tempWindow); - allInfoWindowsDescriptions.addItem("Help"); + allInfoWindowsDescriptions.addItem("How to Navigate the Program (Help)"); //// // Window 1 @@ -123,7 +123,7 @@ tempWindow.addItem(temp); allInfoWindows.addItem(tempWindow); - allInfoWindowsDescriptions.addItem("Dummy Window"); + allInfoWindowsDescriptions.addItem("This is an Information Window"); //// // Window 2 @@ -329,7 +329,7 @@ tempWindow = new ArrayCollection(); temp = new Label(); - (temp as Label).text = "The 30-Day Strategy you Designed"; + (temp as Label).text = "Own Strategy"; (temp as Label).setStyle("fontSize",14); (temp as Label).setStyle("fontWeight","bold"); tempWindow.addItem(temp); @@ -341,14 +341,14 @@ updateObject.strategy = temp as StrategyDesignQuestionC; allInfoWindows.addItem(tempWindow); - allInfoWindowsDescriptions.addItem("Your Strategy"); + allInfoWindowsDescriptions.addItem("Own Strategy"); //// // Window 6 tempWindow = new ArrayCollection(); temp = new Label(); - (temp as Label).text = "The Goals You Specified"; + (temp as Label).text = "Own Goals"; (temp as Label).setStyle("fontSize",14); (temp as Label).setStyle("fontWeight","bold"); tempWindow.addItem(temp); @@ -383,7 +383,7 @@ updateObject.goals.addItem(temp as CategoricalQuestionC); allInfoWindows.addItem(tempWindow); - allInfoWindowsDescriptions.addItem("Your Goals"); + allInfoWindowsDescriptions.addItem("Own Goals"); //// // Window 7 @@ -401,7 +401,7 @@ updateObject.forecasting = temp as ForecastingFishQuestionC; allInfoWindows.addItem(tempWindow); - allInfoWindowsDescriptions.addItem("Your Forecast"); + allInfoWindowsDescriptions.addItem("Forecast"); //// // Window 8 @@ -419,14 +419,14 @@ updateObject.dayByDayResults = temp as DayByDayDecisionsQuestionC; allInfoWindows.addItem(tempWindow); - allInfoWindowsDescriptions.addItem("Day-by-Day Results"); + allInfoWindowsDescriptions.addItem("Results of Day-by-Day Decisions"); //// // Window 9 tempWindow = new ArrayCollection(); temp = new Label(); - (temp as Label).text = "Results of Your 30-Day Strategy"; + (temp as Label).text = "Results of Strategy"; (temp as Label).setStyle("fontSize",14); (temp as Label).setStyle("fontWeight","bold"); tempWindow.addItem(temp); @@ -437,7 +437,7 @@ updateObject.strategyResults = temp as DayByDayDecisionsQuestionC; allInfoWindows.addItem(tempWindow); - allInfoWindowsDescriptions.addItem("Strategy Results"); + allInfoWindowsDescriptions.addItem("Results of Strategy"); //// // Window 10 @@ -474,7 +474,7 @@ updateObject.learned.addItem(temp as TextQuestionC); allInfoWindows.addItem(tempWindow); - allInfoWindowsDescriptions.addItem("Notes - Yourself"); + allInfoWindowsDescriptions.addItem("Planned Changes to Strategy"); //// // Window 11 @@ -519,7 +519,7 @@ updateObject.learnedComm.addItem(temp as TextQuestionC); allInfoWindows.addItem(tempWindow); - allInfoWindowsDescriptions.addItem("Notes - With Group"); + allInfoWindowsDescriptions.addItem("Conclusions from Communication"); /* Modified: mentalmodels/trunk/flex/src/actionscript/PageDisplay.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-08-31 22:30:50 UTC (rev 274) +++ mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-09-04 00:52:31 UTC (rev 275) @@ -112,6 +112,7 @@ { var sdq:StrategyDesignQuestionC = new StrategyDesignQuestionC(); sdq.locations = locations; + sdq.roundService.getCurrentRound(); sdq.loadFromQuestion(Question(tempQuestion)); sdq.id = "q"+question; @@ -176,7 +177,7 @@ } - public function componentsNotFinished():Boolean + public function componentsNotFinished(force:Boolean=false):Boolean { var returnValue:Boolean = false; var curr:VBox; @@ -214,10 +215,10 @@ } // Alert.show(messages + returnValue); } - return returnValue; + return returnValue && !force; } - public function finished():Boolean - { return highestPageReached >= minPagesRead - 1; } + public function finished(force:Boolean=false):Boolean + { return highestPageReached >= minPagesRead - 1 || force; } public function get length():int { return pages.length; } Modified: mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-08-31 22:30:50 UTC (rev 274) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-09-04 00:52:31 UTC (rev 275) @@ -57,10 +57,6 @@ </mx:HBox> - <mx:RemoteObject id="roundService" destination="roundService" fault="faultHandler(event)"> - <mx:method name="getBlock" result="blockResultHandler(event)"/> - <mx:method name="getCurrentRound" result="roundResultHandler(event)"/> - </mx:RemoteObject> <mx:RemoteObject id="startupService" destination="startupService" fault="faultHandler(event)"> <mx:method name="createStudent" result="studentResultHandler(event)"/> </mx:RemoteObject> @@ -112,8 +108,6 @@ public var currentModuleNumber:int = 0; public var currentBlock:Block = null; public var currentBlockNumber:int = 0; - public var currentRound:Round = null; - public var currentRoundNumber:int = 0; [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0)]); public var shell:FisheryExperimentShell = null; @@ -133,8 +127,15 @@ private function messageHandler(event:MessageEvent):void { - Alert.show("Block from server came.."); - + setBlock(event.message.body as actionscript.Block); + } + private function blockResultHandler(event:ResultEvent):void + { + setBlock(event.result as actionscript.Block); + } + private function setBlock(block:Block):void + { + Alert.show(currentState); if(currentState == "none") { Alert.show("Block received in End of Game state.","Unexpected Block"); @@ -142,12 +143,13 @@ } else if(currentState == "wait") { - loadNextBlock(event.message.body as actionscript.Block); + loadNextBlock(block); } else if(currentState == "instructions") { - finishBlockEarly(); - loadNextBlock(event.message.body as actionscript.Block); + Alert.show("FORCING"); + accept(true); + loadNextBlock(block); } else if(currentState == "socioDemographic") { @@ -159,7 +161,6 @@ currentState = "none"; Alert.show("Block received in Instructions (load) state.","Unexpected Block"); } - } private function newLocation(maxCapacity:Number,growth:Number):Location @@ -281,6 +282,8 @@ var strategy:StrategyDesignQuestionC = StrategyDesignQuestionC(curr.getChildAt(j)); var tempDBObjects:ArrayCollection = strategy.toDatabaseObject(); + roundObject = strategy.notRepeated.round; + for(var k:int=0;k<tempDBObjects.length;k++) { (tempDBObjects.getItemAt(k) as StudentStrategy).student = studentObject; @@ -304,47 +307,7 @@ { locationService.getAllLocations(); } - private function getNextBlock():void - { - currentBlock = null; - currentBlockNumber++; - - //server request - //roundService.getBlock(); - } - private function blockResultHandler(event:ResultEvent):void - { - if(currentState == "none") - { - Alert.show("Block received in End of Game state.","Unexpected Block"); - return; - } - else if(currentState == "wait") - { - loadNextBlock(event.result as actionscript.Block); - } - else if(currentState == "instructions") - { - finishBlockEarly(); - loadNextBlock(event.result as actionscript.Block); - } - else if(currentState == "socioDemographic") - { - currentState = "none"; - Alert.show("Block received in Socio Demographic state.","Unexpected Block"); - } - else if(currentState == "instructionsLoad") - { - currentState = "none"; - Alert.show("Block received in Instructions (load) state.","Unexpected Block"); - } - } - private function finishBlockEarly():void - { - - } - private function saveDataToShell():void { shell.updateObjectA.updateDayByDayDecisions(instructions.savedDayByDayDecisions); @@ -387,9 +350,6 @@ // start timer to alert students to hurry shell.setProgressBarTime(0,0,currentBlock.duration); shell.progressBarInit(); - - // get the present round; hopefully the strategy design has been finished by now - roundService.getCurrentRound(); } private function moduleResultHandler(event:ResultEvent):void { @@ -415,11 +375,6 @@ gotoInstructions(); } } - private function roundResultHandler(event:ResultEvent):void - { - currentRound = event.result as Round; - currentRoundNumber = currentRound.id; - } public function getLocation():void { @@ -491,7 +446,7 @@ return false; } - public function accept():Boolean + public function accept(force:Boolean=false):Boolean { if(content.numChildren == 0) { return false; } @@ -526,7 +481,7 @@ { try { - var instructionPageAcceptValue:Boolean = (InstructionPage)(obj).accept(); + var instructionPageAcceptValue:Boolean = (InstructionPage)(obj).accept(force); if( instructionPageAcceptValue ) { obj.visible = false; Modified: mentalmodels/trunk/flex/src/custom/InstructionPage.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/InstructionPage.mxml 2009-08-31 22:30:50 UTC (rev 274) +++ mentalmodels/trunk/flex/src/custom/InstructionPage.mxml 2009-09-04 00:52:31 UTC (rev 275) @@ -147,15 +147,15 @@ } - public function accept():Boolean + public function accept(force:Boolean=false):Boolean { try { - if(pageDisplay.componentsNotFinished()) + if(pageDisplay.componentsNotFinished(force)) { Alert.show("You must complete all required sections of the Block.","Cannot Advance"); } - else if(pageDisplay.finished()) + else if(pageDisplay.finished(force)) { return true; } Modified: mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml 2009-08-31 22:30:50 UTC (rev 274) +++ mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml 2009-09-04 00:52:31 UTC (rev 275) @@ -172,6 +172,7 @@ public function load(loadArray:ArrayCollection):void { + if(dayByDayContent == null) return; dayByDayContent.removeAllChildren(); cumTotal = 0; @@ -227,6 +228,7 @@ public function loadFromStrategy(saved:ArrayCollection):void { + if(dayByDayContent == null) return; dayByDayContent.removeAllChildren(); cumTotal = 0; Modified: mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingFishQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingFishQuestionC.mxml 2009-08-31 22:30:50 UTC (rev 274) +++ mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingFishQuestionC.mxml 2009-09-04 00:52:31 UTC (rev 275) @@ -51,6 +51,7 @@ public function init():void { + if(fishEntry == null || peopleDisplay == null || calculated == null) return; fishEntry.initialize(); fishEntry.init(); peopleDisplay.initialize(); peopleDisplay.init(); calculated.initialize(); calculated.init(); Modified: mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingPeopleQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingPeopleQuestionC.mxml 2009-08-31 22:30:50 UTC (rev 274) +++ mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingPeopleQuestionC.mxml 2009-09-04 00:52:31 UTC (rev 275) @@ -46,6 +46,7 @@ public function init():void { + if(peopleEntry == null) return; peopleEntry.initialize(); peopleEntry.init(); if(loadPeople != null) Modified: mentalmodels/trunk/flex/src/custom/questions/psychometric/PsychometricQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/psychometric/PsychometricQuestionC.mxml 2009-08-31 22:30:50 UTC (rev 274) +++ mentalmodels/trunk/flex/src/custom/questions/psychometric/PsychometricQuestionC.mxml 2009-09-04 00:52:31 UTC (rev 275) @@ -87,6 +87,7 @@ public function load(loadArray:ArrayCollection):void { + if(slider1 == null || slider1.sliderButton == null) return; slider1.sliderButton.visible = loadArray.getItemAt(0) as Boolean; slider1.sliderButton.move(loadArray.getItemAt(1) as Number, 0); } Modified: mentalmodels/trunk/flex/src/custom/questions/strategyDesign/Planner.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/strategyDesign/Planner.mxml 2009-08-31 22:30:50 UTC (rev 274) +++ mentalmodels/trunk/flex/src/custom/questions/strategyDesign/Planner.mxml 2009-09-04 00:52:31 UTC (rev 275) @@ -5,6 +5,7 @@ <mx:Script> <![CDATA[ + import actionscript.Round; import actionscript.Location; import mx.collections.ArrayCollection; import mx.controls.Label; @@ -12,6 +13,7 @@ public var valueRequired:Boolean = false; public var hasBeenChanged:Boolean = false; [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0)]); + public var round:Round = null; private function newLocation(maxCapacity:Number,growth:Number):Location { Modified: mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml 2009-08-31 22:30:50 UTC (rev 274) +++ mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml 2009-09-04 00:52:31 UTC (rev 275) @@ -33,8 +33,15 @@ <mx:Label text="days before starting the next repetition."/> </mx:HBox> + <mx:RemoteObject id="roundService" destination="roundService" fault="faultHandler(event)"> + <mx:method name="getCurrentRound" result="roundResultHandler(event)"/> + </mx:RemoteObject> + <mx:Script> <![CDATA[ + import mx.controls.Alert; + import mx.rpc.events.FaultEvent; + import mx.rpc.events.ResultEvent; import actionscript.Round; import actionscript.Location; import actionscript.StudentStrategy; @@ -56,6 +63,17 @@ { } + public function roundResultHandler(event:ResultEvent):void + { + repeated.round = notRepeated.round = event.result as Round; + Alert.show("Round received in StrategyDesign"); + } + public function faultHandler(event:FaultEvent):void + { + Alert.show("Error finding round for Strategy Design!"); + repeated.round = notRepeated.round = null; + } + public function getNotRepeated():ArrayCollection { return notRepeated.save(); } @@ -79,6 +97,7 @@ public function load(loadArray:ArrayCollection):void { + if(notRepeated == null || repeated == null || loadArray == null) return; notRepeated.load(loadArray.getItemAt(0) as ArrayCollection); repeated.load(loadArray.getItemAt(1) as ArrayCollection); suspendWeight.value = loadArray.getItemAt(2) as Number; @@ -116,6 +135,7 @@ tempObject.location = strToLocation(tempArray.getItemAt(0) as String); tempObject.days = int(tempArray.getItemAt(1) as Number); tempObject.threshold = (tempArray.getItemAt(2) as Number); + tempObject.round = notRepeated.round; tempObject.allocationSeqNo = i; tempObject.repeatedDecisions = false; @@ -129,6 +149,7 @@ tempObject.location = strToLocation(tempArray.getItemAt(0) as String); tempObject.days = int(tempArray.getItemAt(1) as Number); tempObject.threshold = (tempArray.getItemAt(2) as Number); + tempObject.round = repeated.round; tempObject.allocationSeqNo = i+notRepeatedArray.length; tempObject.repeatedDecisions = true; Modified: mentalmodels/trunk/flex/src/test.mxml =================================================================== --- mentalmodels/trunk/flex/src/test.mxml 2009-08-31 22:30:50 UTC (rev 274) +++ mentalmodels/trunk/flex/src/test.mxml 2009-09-04 00:52:31 UTC (rev 275) @@ -1,16 +1,35 @@ <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:actionscript="actionscript.*"> - <actionscript:Student id="stu" gameCode="test1" birthYear="1991" gender="M" major="cse"/> + <actionscript:Student id="stu" birthYear="1991" gender="M" major="cse" gameCode="{gc.text}"/> + <mx:TextInput id="gc" text="test3"/> + <mx:ArrayCollection id="strat"> + <actionscript:StudentStrategy days="1" repeatedDecisions="true" location="{locs.getItemAt(0) as Location}"/> + </mx:ArrayCollection> + + <mx:ArrayCollection id="locs"> + </mx:ArrayCollection> + <mx:HBox> <mx:Button label="roundService.getBlock()" click="roundService.getBlock()"/> <mx:Button label="roundService.getCurrentRound()" click="roundService.getCurrentRound()"/> <mx:Button label="startupService.createStudent()" click="startupService.createStudent(stu)"/> - <mx:Button label="answeringService.saveStrategy()" click="answeringService.saveStrategy()"/> + <mx:Button label="answeringService.saveStrategy()" click="answeringService.saveStrategy(strat)"/> <mx:Button label="locationService.getAllLocations()" click="locationService.getAllLocations()"/> </mx:HBox> + <mx:HBox> + <mx:VBox> + <mx:Label text="location"/> + <mx:NumericStepper stepSize="1" value="0" enabled="{locs.length != 0}"/> + </mx:VBox> + <mx:VBox> + <mx:Label text="???"/> + <mx:NumericStepper stepSize="1" value="0"/> + </mx:VBox> + </mx:HBox> + <mx:RemoteObject id="roundService" destination="roundService" fault="faultHandler(event)"> <mx:method name="getBlock" result="resultHandler(event)"/> <mx:method name="getCurrentRound" result="resultHandler(event)"/> @@ -27,6 +46,7 @@ <mx:Script> <![CDATA[ + import actionscript.Location; import actionscript.Round; import mx.core.UIComponent; import mx.controls.Alert; @@ -40,8 +60,21 @@ 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); + + var array:ArrayCollection = (event.result as ArrayCollection); + if(array != null) + { + Alert.show("ArrayCollection"); + var first:Object = array.getItemAt(0); + if((first as Location) != null) + { + Alert.show("ArrayCollection of Locations"); + locs = array; + } + } + +// var round:actionscript.Round = event.result as actionscript.Round; +// Alert.show("round no is : " + round.roundNo + " " + round.id); //Alert.show } Modified: mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/StartGame.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/classes/log4j.properties =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/classes/log4j.properties 2009-08-31 22:30:50 UTC (rev 274) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/classes/log4j.properties 2009-09-04 00:52:31 UTC (rev 275) @@ -1,15 +1,16 @@ -# Set root category priority to ERROR and its only appender to A1. -log4j.rootCategory=ERROR, A1 - -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%-4r [%t] (%F:%L) %-5p %c %x - %m%n - -# Add packages to log -log4j.logger.edu.asu.commons=DEBUG - -log4j.logger.org.springframework=DEBUG -log4j.logger.org.hibernate=ERROR +# Set root category priority to ERROR and its only appender to A1. +log4j.rootCategory=ERROR, A1 + +# A1 is set to be a ConsoleAppender. +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%-4r [%t] (%F:%L) %-5p %c %x - %m%n + +# Add packages to log +log4j.logger.edu.asu.commons=DEBUG + +#log4j.logger.org.springframework=DEBUG +log4j.logger.org.springframework=ERROR +log4j.logger.org.hibernate=ERROR 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. |
From: <see...@us...> - 2009-09-28 22:57:37
|
Revision: 283 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=283&view=rev Author: seematalele Date: 2009-09-28 22:57:24 +0000 (Mon, 28 Sep 2009) Log Message: ----------- Created GameConfig.java entity which is a meta data for game configuration. Game.java will use one of the GameConfig.java configuration for conducting the game. Changed the FisheryExperimentCore.mxml so that each participant will receive blocks for that particular game. I have manually added entries in the database in GameConfig and gameroundConfig table. Created the GameConfig.as and change the actionscript classes according to the schema (entities in the java side). Modified Paths: -------------- mentalmodels/trunk/flex/src/StartGame.mxml mentalmodels/trunk/flex/src/actionscript/Game.as mentalmodels/trunk/flex/src/actionscript/Location.as mentalmodels/trunk/flex/src/actionscript/Student.as mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml mentalmodels/trunk/src/main/db/init-mme.sql mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Game.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameRound.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Round.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.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/applicationContext.xml mentalmodels/trunk/src/main/webapp/WEB-INF/classes/log4j.properties mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml Added Paths: ----------- mentalmodels/trunk/flex/src/actionscript/GameConfig.as mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGameConfigDao.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Instructor.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameConfigService.java Removed Paths: ------------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundLocation.java Modified: mentalmodels/trunk/flex/src/StartGame.mxml =================================================================== --- mentalmodels/trunk/flex/src/StartGame.mxml 2009-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/flex/src/StartGame.mxml 2009-09-28 22:57:24 UTC (rev 283) @@ -109,13 +109,9 @@ var gameObject:Game = new Game(); gameObject.money = stpMoney.value; - gameObject.description = txtDescription.text; - gameObject.numberOfRounds = 2; - gameObject.maxDays = 30; - gameObject.maxFishHarvest = 100; + gameObject.gameCode = txtDescription.text; gameObject.timestamp = new Date(); - gameObject.title = "test Game Title"; - + startupService.createGame(gameObject); /* var message:AsyncMessage = new AsyncMessage(); message.body = "got gameObject" + gameObject.description; @@ -146,7 +142,7 @@ if(event.result != null) { - var description:String = (event.result as Game).description; + var description:String = (event.result as Game).gameCode; btnStartGame.enabled = true; game = event.result as Game; txtGameID.text = description; Modified: mentalmodels/trunk/flex/src/actionscript/Game.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Game.as 2009-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/flex/src/actionscript/Game.as 2009-09-28 22:57:24 UTC (rev 283) @@ -1,21 +1,15 @@ package actionscript { - import mx.collections.ArrayCollection; - [Bindable] [RemoteClass(alias="edu.asu.commons.mme.entity.Game")] public class Game { public var id:Number; - public var numberOfRounds:int; - public var numberOfLocations:int; - public var maxDays:int; - public var maxFishHarvest:int; - public var timestamp:Date; - public var title:String; - public var description:String; + public var gameConfig:GameConfig; + public var timestamp:Date; + public var gameCode:String; public var money:Number; - public var imageLocation:String; - public var rounds:ArrayCollection; + public var currentRound:Round; + public var currentBlock:Block; } } \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/GameConfig.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/GameConfig.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/GameConfig.as 2009-09-28 22:57:24 UTC (rev 283) @@ -0,0 +1,19 @@ +package actionscript +{ + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.GameConfig")] + public class GameConfig + { + public var id:Number; + public var numberOfRounds:int; + public var numberOfLocations:int; + public var maxDays:int; + public var maxFishHarvest:int; + public var timestamp:Date; + public var title:String; + public var description:String; + public var money:Number; + public var imageLocation:String; + + } +} \ No newline at end of file Modified: mentalmodels/trunk/flex/src/actionscript/Location.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Location.as 2009-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/flex/src/actionscript/Location.as 2009-09-28 22:57:24 UTC (rev 283) @@ -1,6 +1,5 @@ package actionscript { - import mx.collections.ArrayCollection; [Bindable] [RemoteClass(alias="edu.asu.commons.mme.entity.Location")] @@ -11,6 +10,9 @@ public var maxCapacity:int; public var growthRate:Number; public var initialPopulation:int; - public var roundLocations:ArrayCollection; + public var currentPopulation:Number; + public var fishLeaving:Number; + public var fishReturned:Number; + public var gameConfig:GameConfig; } } \ No newline at end of file Modified: mentalmodels/trunk/flex/src/actionscript/Student.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Student.as 2009-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/flex/src/actionscript/Student.as 2009-09-28 22:57:24 UTC (rev 283) @@ -16,6 +16,7 @@ public var timestamp:Date; public var gender:String; public var gameCode:String; + public var game:Game; /** * input: Modified: mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-09-28 22:57:24 UTC (rev 283) @@ -68,7 +68,7 @@ </mx:RemoteObject> - <mx:Consumer id="consumer" destination="chat" message="messageHandler(event)" fault="faultMsgHandler(event)" channelSet="{cs}" /> + <mx:Consumer id="consumer" destination="mme" message="messageHandler(event)" fault="faultMsgHandler(event)" channelSet="{cs}" /> <mx:ChannelSet id="cs"> <!-- <mx:StreamingAMFChannel url="http://localhost:8080/messagebroker/streamingamf"/> --> @@ -405,6 +405,7 @@ } else { + consumer.subtopic = studentObject.gameCode; consumer.subscribe(); //Alert.show("GameCode is '" + studentObject.gameCode + "'"); //Alert.show("subscribed to destination: " + consumer.destination); Modified: mentalmodels/trunk/src/main/db/init-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/init-mme.sql 2009-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2009-09-28 22:57:24 UTC (rev 283) @@ -292,6 +292,26 @@ -- Table structure for table `game` -- +DROP TABLE IF EXISTS `game`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `gameCode` varchar(255) NOT NULL, + `money` double DEFAULT NULL, + `timestamp` datetime NOT NULL, + `current_block_id` bigint(20) DEFAULT NULL, + `current_round_id` bigint(20) DEFAULT NULL, + `gameConfig_id` bigint(20) NOT NULL, + PRIMARY KEY (`id`), + KEY `FK304BF2F1265AC7` (`current_block_id`), + KEY `FK304BF219A3AF27` (`current_round_id`), + KEY `FK304BF25E134D93` (`gameConfig_id`), + CONSTRAINT `FK304BF25E134D93` FOREIGN KEY (`gameConfig_id`) REFERENCES `game_config` (`id`), + CONSTRAINT `FK304BF219A3AF27` FOREIGN KEY (`current_round_id`) REFERENCES `round_config` (`id`), + CONSTRAINT `FK304BF2F1265AC7` FOREIGN KEY (`current_block_id`) REFERENCES `block` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `game` @@ -299,16 +319,69 @@ 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),(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; -- +-- Table structure for table `game_config` +-- + +DROP TABLE IF EXISTS `game_config`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_config` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `description` longtext NOT NULL, + `image_location` varchar(255) DEFAULT NULL, + `max_days` int(11) NOT NULL, + `max_fish_harvest` int(11) NOT NULL, + `no_of_locations` int(11) NOT NULL, + `timestamp` datetime NOT NULL, + `title` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_config` +-- + +LOCK TABLES `game_config` WRITE; +/*!40000 ALTER TABLE `game_config` DISABLE KEYS */; +INSERT INTO `game_config` VALUES (1,'Mental Model Experiment',NULL,30,5,4,'2009-09-28 11:26:14','E-Fishery'); +/*!40000 ALTER TABLE `game_config` ENABLE KEYS */; +UNLOCK TABLES; + +-- -- Table structure for table `game_round_config` -- +DROP TABLE IF EXISTS `game_round_config`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_round_config` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `sequence_no` int(11) NOT NULL, + `gameConfig_id` bigint(20) NOT NULL, + `round_id` bigint(20) NOT NULL, + PRIMARY KEY (`id`), + KEY `FKA0C2A405E134D93` (`gameConfig_id`), + KEY `FKA0C2A4047CF2321` (`round_id`), + CONSTRAINT `FKA0C2A4047CF2321` FOREIGN KEY (`round_id`) REFERENCES `round_config` (`id`), + CONSTRAINT `FKA0C2A405E134D93` FOREIGN KEY (`gameConfig_id`) REFERENCES `game_config` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Dumping data for table `game_round_config` +-- +LOCK TABLES `game_round_config` WRITE; +/*!40000 ALTER TABLE `game_round_config` DISABLE KEYS */; +INSERT INTO `game_round_config` VALUES (1,1,1,1),(2,2,1,2),(3,3,1,3),(4,4,1,4); +/*!40000 ALTER TABLE `game_round_config` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `grp` -- @@ -361,8 +434,35 @@ -- Table structure for table `location` -- +DROP TABLE IF EXISTS `location`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `location` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `current_population` double DEFAULT NULL, + `fish_leaving` double DEFAULT NULL, + `fish_return` double DEFAULT NULL, + `growth_rate` double NOT NULL, + `initial_population` double NOT NULL, + `location_name` varchar(255) NOT NULL, + `max_capacity` double NOT NULL, + `gameConfig_id` bigint(20) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `FK714F9FB55E134D93` (`gameConfig_id`), + CONSTRAINT `FK714F9FB55E134D93` FOREIGN KEY (`gameConfig_id`) REFERENCES `game_config` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; -- +-- Dumping data for table `location` +-- + +LOCK TABLES `location` WRITE; +/*!40000 ALTER TABLE `location` DISABLE KEYS */; +/*!40000 ALTER TABLE `location` ENABLE KEYS */; +UNLOCK TABLES; + +-- -- Table structure for table `module` -- @@ -534,6 +634,15 @@ -- Table structure for table `round_config` -- +DROP TABLE IF EXISTS `round_config`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `round_config` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `communication_flag` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `round_config` @@ -541,16 +650,14 @@ LOCK TABLES `round_config` WRITE; /*!40000 ALTER TABLE `round_config` DISABLE KEYS */; -INSERT INTO `round_config` VALUES (1,0,1),(2,0,2),(3,1,3),(4,0,4); +INSERT INTO `round_config` VALUES (1,0),(2,0),(3,1),(4,0); /*!40000 ALTER TABLE `round_config` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `round_config_location` +-- Table structure for table `student` -- - - DROP TABLE IF EXISTS `student`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -742,4 +849,4 @@ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2009-09-04 0:47:19 +-- Dump completed on 2009-09-28 18:29:10 Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGameConfigDao.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGameConfigDao.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGameConfigDao.java 2009-09-28 22:57:24 UTC (rev 283) @@ -0,0 +1,12 @@ +package edu.asu.commons.mme.dao; + +import edu.asu.commons.mme.entity.GameConfig; + +public class HibernateGameConfigDao extends HibernateDao<GameConfig> { + + public HibernateGameConfigDao() + { + super(GameConfig.class); + } + +} 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-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Game.java 2009-09-28 22:57:24 UTC (rev 283) @@ -2,17 +2,13 @@ import java.io.Serializable; import java.sql.Timestamp; -import java.util.List; 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.Lob; import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; import javax.persistence.Table; @Entity @@ -25,37 +21,19 @@ @GeneratedValue private Long id; - @Column(name="no_of_rounds",nullable = false) - private Integer numberOfRounds; + @ManyToOne + @JoinColumn(nullable = false) + private GameConfig gameConfig; - @Column(name="no_of_locations",nullable = false) - private Integer numberOfLocations; - - @Column(name="max_days",nullable = false) - private Integer maxDays; - - @Column(name="max_fish_harvest",nullable = false) - private Integer maxFishHarvest; - @Column(nullable=false) private Timestamp timestamp; @Column(nullable=false) - private String title; + private String gameCode; - @Lob - private String description; - @Column(scale=2) private Double money; - @Column(name="image_location") - private String imageLocation; - - // FIXME: should this be many-to-many instead? - @OneToMany(mappedBy = "game") - private List<GameRound> gameRounds; - @ManyToOne @JoinColumn(name="current_round_id", nullable=true) private Round currentRound; @@ -64,10 +42,6 @@ @JoinColumn(name="current_block_id", nullable=true) private Block currentBlock; - @OneToMany(mappedBy = "game") - private List<Location> locations; - - public void setId(Long id) { this.id = id; } @@ -75,18 +49,6 @@ return id; } - public void setTitle(String title) { - this.title = title; - } - public String getTitle() { - return title; - } - public void setDescription(String description) { - this.description = description; - } - public String getDescription() { - return description; - } public void setMoney(Double money) { this.money = money; } @@ -94,49 +56,12 @@ return money; } - /*public void setRoundconfig(List<Round> roundconfig) { - this.rounds = roundconfig; - } - public List<Round> getRoundconfig() { - return rounds; - }*/ public void setTimestamp(Timestamp timestamp) { this.timestamp = timestamp; } public Timestamp getTimestamp() { return timestamp; } - public Integer getNumberOfRounds() { - return numberOfRounds; - } - public void setNumberOfRounds(Integer numberOfRounds) { - this.numberOfRounds = numberOfRounds; - } - public Integer getNumberOfLocations() { - return numberOfLocations; - } - public void setNumberOfLocations(Integer numberOfLocations) { - this.numberOfLocations = numberOfLocations; - } - public Integer getMaxDays() { - return maxDays; - } - public void setMaxDays(Integer maxDays) { - this.maxDays = maxDays; - } - public Integer getMaxFishHarvest() { - return maxFishHarvest; - } - public void setMaxFishHarvest(Integer maxFishHarvest) { - this.maxFishHarvest = maxFishHarvest; - } - public String getImageLocation() { - return imageLocation; - } - public void setImageLocation(String imageLocation) { - this.imageLocation = imageLocation; - } - public void setCurrentRound(Round currentRound) { this.currentRound = currentRound; } @@ -149,17 +74,17 @@ public Block getCurrentBlock() { return currentBlock; } - public void setLocations(List<Location> locations) { - this.locations = locations; + public void setGameConfig(GameConfig gameConfig) { + this.gameConfig = gameConfig; } - public List<Location> getLocations() { - return locations; + public GameConfig getGameConfig() { + return gameConfig; } - public void setGameRounds(List<GameRound> gameRounds) { - this.gameRounds = gameRounds; + public void setGameCode(String gameCode) { + this.gameCode = gameCode; } - public List<GameRound> getGameRounds() { - return gameRounds; + public String getGameCode() { + return gameCode; } } Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java 2009-09-28 22:57:24 UTC (rev 283) @@ -0,0 +1,120 @@ +package edu.asu.commons.mme.entity; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name="game_config") +public class GameConfig implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = -5758994275900963337L; + + @Id + @GeneratedValue + private Long id; + + @Column(nullable=false) + private String title; + + @Lob + @Column(nullable=false) + private String description; + + @Column(name="no_of_locations",nullable = false) + private Integer numberOfLocations; + + @Column(name="max_days",nullable = false) + private Integer maxDays; + + @Column(name="max_fish_harvest",nullable = false) + private Integer maxFishHarvest; + + @Column(nullable=false) + private Timestamp timestamp; + + @Column(name="image_location") + private String imageLocation; + + // FIXME: should this be many-to-many instead? +/* @OneToMany(mappedBy = "gameConfig") + private List<GameRound> gameRounds;*/ + + @OneToMany(mappedBy = "gameConfig") + private List<Location> locations; + + + public void setId(Long id) { + this.id = id; + } + public Long getId() { + return id; + } + + public void setTimestamp(Timestamp timestamp) { + this.timestamp = timestamp; + } + public Timestamp getTimestamp() { + return timestamp; + } + public Integer getNumberOfLocations() { + return numberOfLocations; + } + public void setNumberOfLocations(Integer numberOfLocations) { + this.numberOfLocations = numberOfLocations; + } + public Integer getMaxDays() { + return maxDays; + } + public void setMaxDays(Integer maxDays) { + this.maxDays = maxDays; + } + public Integer getMaxFishHarvest() { + return maxFishHarvest; + } + public void setMaxFishHarvest(Integer maxFishHarvest) { + this.maxFishHarvest = maxFishHarvest; + } + public String getImageLocation() { + return imageLocation; + } + public void setImageLocation(String imageLocation) { + this.imageLocation = imageLocation; + } + public void setLocations(List<Location> locations) { + this.locations = locations; + } + public List<Location> getLocations() { + return locations; + } + /*public void setGameRounds(List<GameRound> gameRounds) { + this.gameRounds = gameRounds; + } + public List<GameRound> getGameRounds() { + return gameRounds; + }*/ + public void setTitle(String title) { + this.title = title; + } + public String getTitle() { + return title; + } + public void setDescription(String description) { + this.description = description; + } + public String getDescription() { + return description; + } +} Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameRound.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameRound.java 2009-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameRound.java 2009-09-28 22:57:24 UTC (rev 283) @@ -2,11 +2,13 @@ import java.io.Serializable; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; +import javax.persistence.OrderBy; import javax.persistence.Table; @Entity @@ -24,11 +26,15 @@ @ManyToOne @JoinColumn(nullable=false) + @OrderBy("seqNo") private Round round; @ManyToOne @JoinColumn(nullable=false) - private Game game; + private GameConfig gameConfig; + + @Column(name="sequence_no",nullable=false) + private Integer seqNo; public void setId(Long id) { this.id = id; @@ -46,12 +52,20 @@ return round; } - public void setGame(Game game) { - this.game = game; + public void setGameConfig(GameConfig gameConfig) { + this.gameConfig = gameConfig; } - public Game getGame() { - return game; + public GameConfig getGameConfig() { + return gameConfig; } + public void setSeqNo(Integer seqNo) { + this.seqNo = seqNo; + } + + public Integer getSeqNo() { + return seqNo; + } + } Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Instructor.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Instructor.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Instructor.java 2009-09-28 22:57:24 UTC (rev 283) @@ -0,0 +1,55 @@ +package edu.asu.commons.mme.entity; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "instructor") +public class Instructor implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 612372011522490955L; + + @Id + @GeneratedValue + private Long id; + + @Column + private String fname; + + @Column + private String lname; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setFname(String fname) { + this.fname = fname; + } + + public String getFname() { + return fname; + } + + public void setLname(String lname) { + this.lname = lname; + } + + public String getLname() { + return lname; + } + + +} 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-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java 2009-09-28 22:57:24 UTC (rev 283) @@ -1,14 +1,12 @@ package edu.asu.commons.mme.entity; import java.io.Serializable; -import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; import javax.persistence.Table; @Entity @@ -21,32 +19,29 @@ @GeneratedValue private Long id; -/* @OneToMany(mappedBy = "location") - private List<RoundLocation> roundLocations;*/ - @Column(nullable=false,name="location_name") private String locationName; - @Column(nullable=false,name="max_capacity") + @Column(nullable=false,name="max_capacity", scale=2) private Double maxCapacity; @Column(nullable=false,name="growth_rate", scale=2) private Double growthRate; - @Column(nullable=false,name="initial_population") + @Column(nullable=false,name="initial_population", scale=2) private Double initialPopulation; - @Column(name="current_population") + @Column(name="current_population", scale=2) private Double currentPopulation; - @Column(name="fish_leaving") + @Column(name="fish_leaving", scale=2) private Double fishLeaving; - @Column(name="fish_return") + @Column(name="fish_return", scale=2) private Double fishReturned; @ManyToOne - private Game game; + private GameConfig gameConfig; public void setId(Long id) { this.id = id; @@ -87,13 +82,6 @@ public Double getCurrentPopulation() { return currentPopulation; } - /*public void setRoundLocations(List<RoundLocation> roundLocations) { - this.roundLocations = roundLocations; - } - public List<RoundLocation> getRoundLocations() { - return roundLocations; - }*/ - public void setFishLeaving(Double fishLeaving) { this.fishLeaving = fishLeaving; } @@ -110,12 +98,12 @@ return fishReturned; } - public void setGame(Game game) { - this.game = game; + public void setGameConfig(GameConfig gameConfig) { + this.gameConfig = gameConfig; } - public Game getGame() { - return game; + public GameConfig getGameConfig() { + return gameConfig; } } 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-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Round.java 2009-09-28 22:57:24 UTC (rev 283) @@ -21,35 +21,20 @@ @GeneratedValue private Long id; - @Column(name="round_no",nullable=false) - private Integer roundNo; - - @OneToMany(mappedBy = "round") - private List<GameRound> gameRounds; + /*@OneToMany(mappedBy = "round") + private List<GameRound> gameRounds;*/ @Column(name="communication_flag",nullable=false,columnDefinition="Boolean default false") private boolean communicationFlag; - /*@ManyToOne - private ModuleRoundConfig round_config;*/ - - - /*@OneToMany(mappedBy = "round") - private List<RoundLocation> roundLocations; - */ public void setId(Long id) { this.id = id; } public Long getId() { return id; } - public void setRoundNo(Integer roundNo) { - this.roundNo = roundNo; - } - public Integer getRoundNo() { - return roundNo; - } + public void setCommunicationFlag(boolean communication_flag) { this.communicationFlag = communication_flag; } @@ -62,14 +47,14 @@ public List<RoundLocation> getRoundLocations() { return roundLocations; }*/ - public void setGameRounds(List<GameRound> gameRounds) { + /*public void setGameRounds(List<GameRound> gameRounds) { this.gameRounds = gameRounds; } public List<GameRound> getGameRounds() { return gameRounds; } + */ - /*public void setRound_config(ModuleRoundConfig round_config) { this.round_config = round_config; } Deleted: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundLocation.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundLocation.java 2009-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundLocation.java 2009-09-28 22:57:24 UTC (rev 283) @@ -1,57 +0,0 @@ -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; - } - -} Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameConfigService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameConfigService.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameConfigService.java 2009-09-28 22:57:24 UTC (rev 283) @@ -0,0 +1,11 @@ +package edu.asu.commons.mme.service; + +import edu.asu.commons.mme.dao.HibernateGameConfigDao; +import edu.asu.commons.mme.entity.GameConfig; + +public class GameConfigService extends Service.Base<GameConfig, HibernateGameConfigDao>{ + + + + +} 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-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 2009-09-28 22:57:24 UTC (rev 283) @@ -8,6 +8,7 @@ import edu.asu.commons.mme.dao.HibernateLocationDao; import edu.asu.commons.mme.entity.Game; +import edu.asu.commons.mme.entity.GameConfig; import edu.asu.commons.mme.entity.Location; import edu.asu.commons.mme.entity.Round; @@ -27,26 +28,27 @@ initLocation = locations.get(i); initializeLocation(initLocation); } + return locations; } public void initializeLocation(Location location) { // TODO Auto-generated method stub Hibernate.initialize(location); - //Hibernate.initialize(location.getRoundLocations()); - Game game = location.getGame(); - Hibernate.initialize(game); - Hibernate.initialize(game); - Hibernate.initialize(game.getCurrentBlock()); - Hibernate.initialize(game.getCurrentRound()); - Hibernate.initialize(game.getGameRounds()); - Hibernate.initialize(game.getLocations()); + Hibernate.initialize(location.getGameConfig()); + for(Location loc:location.getGameConfig().getLocations()) + { + Hibernate.initialize(loc); + + } + //getLogger().debug("the game rounds for round objects are : " + game.getCurrentRound().getGameRounds().get(0)); } public Location getLocation(String locationName) { // TODO Auto-generated method stub List<Location>locations = getAllLocations(); + Location location =new Location(); for(int i=0; i<locations.size(); i++) @@ -59,51 +61,58 @@ return location; } //FIXME: For the pilot experiment locations are set manually but in future might want to take inputs from user - public void setAllLocations(Game game) + public List<Location> setAllLocations(GameConfig gameConfig) { - Location harbor = new Location(); - harbor.setLocationName("Harbor"); - harbor.setCurrentPopulation(0.0); - harbor.setGrowthRate(0.0); - harbor.setInitialPopulation(0.0); - harbor.setMaxCapacity(0.0); - harbor.setGame(game); - getDao().save(harbor); + List<Location> locations = new ArrayList<Location>(); + try{ + Location harbor = new Location(); + harbor.setLocationName("Harbor"); + harbor.setCurrentPopulation(0.0); + harbor.setGrowthRate(0.0); + harbor.setInitialPopulation(0.0); + harbor.setMaxCapacity(0.0); + harbor.setGameConfig(gameConfig); + getDao().save(harbor); + getLogger().info("Saved Location "+harbor.getLocationName()+" with id " + harbor.getId()); + locations.add(harbor); + + Location bay1 = new Location(); + bay1.setLocationName("Bay1"); + bay1.setCurrentPopulation(5.0); + bay1.setInitialPopulation(5.0); + bay1.setGrowthRate(0.5); + bay1.setMaxCapacity(10.0); + bay1.setGameConfig(gameConfig); + getDao().save(bay1); + getLogger().info("Saved Location " + bay1.getLocationName() +" with id "+ bay1.getId()); + locations.add(bay1); + + Location bay2 = new Location(); + bay2.setLocationName("Bay2"); + bay2.setCurrentPopulation(10.0); + bay2.setInitialPopulation(10.0); + bay2.setGrowthRate(0.15); + bay2.setMaxCapacity(20.0); + bay2.setGameConfig(gameConfig); + getDao().save(bay2); + getLogger().info("Saved Location " + bay2.getLocationName() +" with id "+ bay2.getId()); + locations.add(bay2); + + Location bay3 = new Location(); + bay3.setLocationName("Bay3"); + bay3.setCurrentPopulation(15.0); + bay3.setInitialPopulation(15.0); + bay3.setGrowthRate(0.05); + bay3.setMaxCapacity(30.0); + bay3.setGameConfig(gameConfig); + getDao().save(bay3); + getLogger().info("Saved Location " + bay3.getLocationName() +" with id "+ bay3.getId()); + locations.add(bay3); + }catch(Exception e) + { + e.printStackTrace(); + } - getLogger().info("Saved Location "+harbor.getLocationName()+" with id " + harbor.getId()); - - Location bay1 = new Location(); - bay1.setLocationName("Bay1"); - bay1.setCurrentPopulation(5.0); - bay1.setInitialPopulation(5.0); - bay1.setGrowthRate(0.5); - bay1.setMaxCapacity(10.0); - bay1.setGame(game); - getDao().save(bay1); - - getLogger().info("Saved Location " + bay1.getLocationName() +" with id "+ bay1.getId()); - - Location bay2 = new Location(); - bay2.setLocationName("Bay2"); - bay2.setCurrentPopulation(10.0); - bay2.setInitialPopulation(10.0); - bay2.setGrowthRate(0.15); - bay2.setMaxCapacity(20.0); - bay2.setGame(game); - getDao().save(bay2); - - getLogger().info("Saved Location " + bay2.getLocationName() +" with id "+ bay2.getId()); - - Location bay3 = new Location(); - bay3.setLocationName("Bay3"); - bay3.setCurrentPopulation(15.0); - bay3.setInitialPopulation(15.0); - bay3.setGrowthRate(0.05); - bay3.setMaxCapacity(30.0); - bay3.setGame(game); - getDao().save(bay3); - - getLogger().info("Saved Location " + bay3.getLocationName() +" with id "+ bay3.getId()); - + return locations; } } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java 2009-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java 2009-09-28 22:57:24 UTC (rev 283) @@ -29,9 +29,7 @@ private boolean startGame = true; private Round currentRound; private int blockSeqNo; - private Block currentBlock; - public void test() { getLogger().debug("test to check if module service is working...." ); @@ -120,7 +118,7 @@ return null; } - private int getCurrentRoundNo() { + /*private int getCurrentRoundNo() { // TODO Auto-generated method stub //FIXME: Game id 1 is hard coded but needs to make it dynamic Game game = gameDao.find(1L); @@ -129,7 +127,7 @@ else return game.getCurrentRound().getRoundNo(); - } + }*/ private boolean isModuleFinished(Module module) { // TODO Auto-generated method stub @@ -219,9 +217,6 @@ } - - - public void setCurrentModule(Module currentModule) { this.currentModule = currentModule; } 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-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java 2009-09-28 22:57:24 UTC (rev 283) @@ -10,6 +10,7 @@ import org.springframework.transaction.annotation.Transactional; import edu.asu.commons.mme.dao.HibernateBlockDao; +import edu.asu.commons.mme.dao.HibernateGameConfigDao; import edu.asu.commons.mme.dao.HibernateGameDao; import edu.asu.commons.mme.dao.HibernateGameRoundDao; import edu.asu.commons.mme.dao.HibernateModuleDao; @@ -20,15 +21,14 @@ import edu.asu.commons.mme.entity.CategoricalOption; import edu.asu.commons.mme.entity.CategoricalQuestion; import edu.asu.commons.mme.entity.Game; +import edu.asu.commons.mme.entity.GameConfig; import edu.asu.commons.mme.entity.GameRound; -import edu.asu.commons.mme.entity.InformationWindow; 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.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> { @@ -38,110 +38,131 @@ private HibernateGameDao gameDao; private HibernateModuleRoundConfigDao moduleRoundDao; private HibernateGameRoundDao gameRoundDao; + private HibernateGameConfigDao gameConfigDao; private LocationService locationService; - //private Module currentModule; - //private boolean startGame = true; - //private Round currentRound; - //private Block currentBlock; - private int blockSeqNo; - private boolean gameFinished; public RoundService() { - /*setCurrentGame(null); - setCurrentBlock(null); - setCurrentModule(null); - setCurrentModuleRoundConfig(null); - setCurrentRound(null);*/ setBlockSeqNo(0); setGameFinished(false); } + public GameConfig createGameConfig(GameConfig gameConfig) + { + GameConfig newGameConfig = null; + try{ + newGameConfig = new GameConfig(); + newGameConfig.setImageLocation(null); + newGameConfig.setTimestamp(gameConfig.getTimestamp()); + newGameConfig.setMaxDays(gameConfig.getMaxDays()); + newGameConfig.setMaxFishHarvest(gameConfig.getMaxFishHarvest()); + newGameConfig.setNumberOfLocations(gameConfig.getNumberOfLocations()); + getGameConfigDao().save(newGameConfig); + initializeGameRounds(newGameConfig); + initializeLocations(newGameConfig); + + }catch(Exception e) + { + e.printStackTrace(); + } + return newGameConfig; + } + + public Game createGame(Game game) { - getLogger().debug("game came from flex is : " + game.getDescription()); + getLogger().debug("game came from flex is : " + game.getGameCode()); Game newGame = new Game(); //currentGame = game; try { - newGame.setDescription(game.getDescription()); - newGame.setMaxDays(game.getMaxDays()); - newGame.setMaxFishHarvest(game.getMaxFishHarvest()); + newGame.setGameCode(game.getGameCode()); newGame.setMoney(game.getMoney()); - newGame.setNumberOfRounds(game.getNumberOfRounds()); - newGame.setNumberOfLocations(game.getNumberOfLocations()); newGame.setTimestamp(game.getTimestamp()); - newGame.setTitle(game.getTitle()); - newGame.setImageLocation("null"); + + //FIXME: Currently using default GameConfiguration whose id is 1 + GameConfig gameConfig = gameConfigDao.find(1L); + newGame.setGameConfig(gameConfig); getGameDao().save(newGame); - String str = newGame.getDescription()+newGame.getId(); + String str = newGame.getGameCode()+newGame.getId(); - if(getGameDao().findAllByProperty("description", str).size() != 0) + if(getGameDao().findAllByProperty("gameCode", str).size() != 0) { //getLogger().debug("in if loop "); newGame = null; } else { - newGame.setDescription(str); + newGame.setGameCode(str); getGameDao().save(newGame); getLogger().info("Created the game: " + newGame.getId()); - initializeGameRounds(newGame); - initializeLocations(newGame); + initializeLocations(gameConfig); initializeGame(newGame); } }catch(Exception e) { e.printStackTrace(); } - getLogger().debug("current game from flex is: " + newGame.getDescription()); + getLogger().debug("current game from flex is: " + newGame.getId()); return newGame; } - private void initializeGameRounds(Game newGame) { + private void initializeGameRounds(GameConfig gameConfig) { // TODO Auto-generated method stub List<GameRound> gameRounds = new ArrayList<GameRound>(); - for(Round round:getDao().findAll()) { GameRound gameRound = new GameRound(); - gameRound.setGame(newGame); + gameRound.setGameConfig(gameConfig); gameRound.setRound(round); gameRoundDao.save(gameRound); gameRounds.add(gameRound); } - newGame.setGameRounds(gameRounds); - getGameDao().save(newGame); + getGameConfigDao().save(gameConfig); } - private void initializeLocations(Game newGame) + private void initializeLocations(GameConfig gameConfig) { - locationService.setAllLocations(newGame); - newGame.setLocations(locationService.getAllLocations()); - getGameDao().save(newGame); + gameConfig.setLocations(locationService.setAllLocations(gameConfig)); + getGameConfigDao().save(gameConfig); } public void initializeGame(Game game) { // TODO Auto-generated method stub - Hibernate.initialize(game); - Hibernate.initialize(game.getCurrentBlock()); - Hibernate.initialize(game.getCurrentRound()); - // Hibernate.initialize(game.getLocations()); + try{ + Hibernate.initialize(game); + Hibernate.initialize(game.getCurrentBlock()); + + + GameConfig gameconfig = game.getGameConfig(); + Hibernate.initialize(gameconfig); + + for(Location location:gameconfig.getLocations()) + { + Hibernate.initialize(location); - for(GameRound gameRound :game.getGameRounds()){ - Hibernate.initialize(gameRound); - //Hibernate.initialize(gameRound.getGame()); - initializeRound(gameRound.getRound()); + } + + Round round = game.getCurrentRound(); + Hibernate.initialize(round); + /*for(GameRound gameRound:round.getGameRounds()) + { + getLogger().debug("gameround in initializing round is " + gameRound.getId()); + Hibernate.initialize(gameRound); + }*/ + + }catch(Exception e ) + { + e.printStackTrace(); } - for(Location location :game.getLocations()){ - locationService.initializeLocation(location); - } + //Hibernate.initialize(gameconfig.getGameRounds()); + + } - public Module getNextModule(int sequenceNo) { return getModule(sequenceNo); @@ -171,13 +192,18 @@ //check if it is a start of the game if(game.getCurrentRound() == null && game.getCurrentBlock() == null ) { - getLogger().debug("Current Round is null... "); - getLogger().debug("Current block is null... "); + getLogger().info("Current Round is null... "); + getLogger().info("Current block is null... "); + getLogger().info("Starting of the game...." + game.getGameCode()); - getLogger().debug("Starting of the game...." + game.getDescription()); - currentRound = getNextRound(null); + currentRound = getNextRound(game); + getLogger().info("Next Round object is "+ currentRound.getId()); + currentModuleRoundConfig = getModuleRoundConfig(0, currentRound); + getLogger().info("Next ModuleRound Config object is "+ currentModuleRoundConfig.getId()); + Module currentModule = getModuleForCurrentRound(currentModuleRoundConfig); + getLogger().info("Next Module object is "+ currentModule.getId()); currentBlock = getBlock(currentModule,1); } else @@ -202,9 +228,15 @@ else { //set the next round - currentRound = getNextRound(game.getCurrentRound()); + currentRound = getNextRound(game); + getLogger().info("Next Round object is "+ currentRound.getId()); + currentModuleRoundConfig = getModuleRoundConfig(0, currentRound); + getLogger().info("Next ModuleRound Config object is "+ currentModuleRoundConfig.getId()); + Module currentModule = getModuleForCurrentRound(currentModuleRoundConfig); + getLogger().info("Next Module object is "+ currentModule.getId()); + currentBlock = getBlock(currentModule,1); } } @@ -214,7 +246,11 @@ //currentRound = getNextRound(game.getCurrentRound()); currentModuleRoundConfig = getModuleRoundConfig(getPreviousModuleConfigSequenceNo(game), currentRound); + getLogger().info("Next ModuleRound Config object is "+ currentModuleRoundConfig.getId()); + Module currentModule = getModuleForCurrentRound(currentModuleRoundConfig); + getLogger().info("Next Module object is "+ currentModule.getId()); + currentBlock = getBlock(currentModule,1); } @@ -292,32 +328,52 @@ } - private Round getNextRound(Round currentRound) { + private Round getNextRound(Game game) { // TODO Auto-generated method stub Round returnRound = null; + Round currentRound = game.getCurrentRound(); + GameConfig gameConfig = game.getGameConfig(); + List<GameRound> gameRounds = new ArrayList<GameRound>(); if(currentRound == null) { - returnRound = getDao().findByProperty("roundNo", 1); - //returnRound = currentRound; - //initializeRound(returnRound); + //get the first round + Map<String, Object> variables = new HashMap<String, Object>(); + variables.put("gameConfig",gameConfig); + variables.put("seqNo", 1); + getGameRoundDao().findByEqCriteria(variables); + gameRounds = gameRoundDao.findByEqCriteria(variables); + if(gameRounds.size() == 1) + { + returnRound = gameRounds.get(0).getRound(); + gameRounds.clear(); + } } else { - getLogger().debug("current round no is: " + currentRound.getRoundNo()); - List<Round> rounds = getDao().findAll(); - for(int i = 0; i < rounds.size(); i++) + Map<String, Object> variables = new HashMap<String, Object>(); + variables.put("gameConfig",gameConfig); + variables.put("round", currentRound); + gameRounds = getGameRoundDao().findByEqCriteria(variables); + if(gameRounds.size() == 1) { - getLogger().debug("in for loop round no is: " + rounds.get(i).getRoundNo()); - if(currentRound.getRoundNo() < rounds.get(i).getRoundNo()) + int currentSeqNo = gameRounds.get(0).getSeqNo(); + gameRounds = getGameRoundDao().findAll(); + for(int i = 0; i < gameRounds.size(); i++) { - returnRound = rounds.get(i); - break; - //getLogger().debug("currentround object is "+ rounds.get(i).getId()); + if(currentSeqNo < gameRounds.get(i).getSeqNo()) + { + returnRound = gameRounds.get(i).getRound(); + break; + //getLogger().debug("currentround object is "+ rounds.get(i).getId()); + } } } + else + { + getLogger().error("Error Occured.. Game Config is associated with multiple Rounds "); + } } - getLogger().debug("currentround object is "+ returnRound.getId()); return returnRound; } @@ -332,6 +388,7 @@ } + @SuppressWarnings("unused") private void initializeCurrentBlock(Block block) { Hibernate.initialize(block); @@ -432,23 +489,35 @@ }*/ public boolean isGameFinished(Game game) { - List<GameRound> gameRounds = game.getGameRounds(); + GameConfig gameConfig = game.getGameConfig(); + List<GameRound> gameRounds = getGameRoundDao().findAllByProperty("gameConfig",game.getGameConfig()); boolean flag = false; - if(game.getCurrentRound().getRoundNo() == gameRounds.get(gameRounds.size() - 1).getRound().getRoundNo()) + Map<String, Object> variables = new HashMap<String, Object>(); + variables.put("gameConfig",gameConfig); + variables.put("round", game.getCurrentRound()); + gameRounds = getGameRoundDao().findByEqCriteria(variables); + if(gameRounds.size() == 1) { - flag = true; - } - else - { - for(GameRound gameRound:gameRounds) + int currentSeqNo = gameRounds.get(0).getSeqNo(); + gameRounds.clear(); + gameRounds = getGameRoundDao().findAllByProperty("gameConfig", gameConfig); + + if(currentSeqNo == gameRounds.get(gameRounds.size() - 1).getSeqNo()) { - if(game.getCurrentRound().getRoundNo() < game.getCurrentRound().getRoundNo()) + flag = true; + } + else + { + for(GameRound gameRound:gameRounds) { - flag = false; + if(currentSeqNo < gameRound.getSeqNo()) + { + flag = false; + } } + } - } return flag; } @@ -626,25 +695,6 @@ return currentRound; }*/ - private void initializeRound(Round round) { - // TODO Auto-generated method stub - Hibernate.initialize(round); - - //Hibernate.initialize(round.getRoundLocations()); - - /*for (RoundLocation roundLocation: round.getRoundLocations()) { - Hibernate.initialize(roundLocation); - //hibernateroundLocation.getLocation(); - }*/ - for (GameRound gameRound: round.getGameRounds()) { - Hibernate.initialize(gameRound); - //hibernateroundLocation.getLocation(); - } - - - //Hibernate.initialize(currentRound.getLocations()); - } - public void setGameDao(HibernateGameDao gameDao) { this.gameDao = gameDao; } @@ -673,7 +723,6 @@ return blockDao; } public void setGameFinished(boolean gameFinished) { - this.gameFinished = gameFinished; } @@ -686,9 +735,9 @@ return locationService; } - public String getDescription(Game game) { + public String getGameCode(Game game) { // TODO Auto-generated method stub - return game.getDescription(); + return game.getGameCode(); } public void setGameRoundDao(HibernateGameRoundDao gameRoundDao) { @@ -698,4 +747,12 @@ public HibernateGameRoundDao getGameRoundDao() { return gameRoundDao; } + + public void setGameConfigDao(HibernateGameConfigDao gameConfigDao) { + this.gameConfigDao = gameConfigDao; + } + + public HibernateGameConfigDao getGameConfigDao() { + return gameConfigDao; + } } 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-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java 2009-09-28 22:57:24 UTC (rev 283) @@ -36,18 +36,7 @@ public Student createStudent(Student student) { - // Game game = new Game(); - Game game = student.getGame(); - Student studentReturn = null; - //System.out.println("game description: " + game.getDescription() + " student game code is: " + student.getGameCode()); - if(game.getDescription().equals(student.getGameCode())) - { - student.setGame(game); - studentReturn = new Student(); - studentReturn = studentService.createStudent(student); - //System.out.println("student Return info: " + studentReturn.getGameCode()); - } - return studentReturn; + return studentService.createStudent(student); } public Game createGame(Game game) @@ -91,7 +80,7 @@ while (i<17) { i++; - String msgDestination = roundService.getDescription(game); + String msgDestination = roundService.getGameCode(newGameState); //Push the first block to the clients AsyncMessage msg = new AsyncMessage(); 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-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java 2009-09-28 22:57:24 UTC (rev 283) @@ -29,7 +29,18 @@ public Student createStudent(Student student) { - return getStartGame().createStudent(student); + //Game game = student.getGame(); + Student studentReturn = null; + //System.out.println("game description: " + game.getDescription() + " student game code is: " + student.getGameCode()); + for(StartGame startGame:currentGames) + { + if(startGame.getGame().getGameCode().equals(student.getGameCode())) + { + student.setGame(startGame.getGame()); + studentReturn = startGame.createStudent(student); + } + } + return studentReturn; } public Game createGame(Game game) @@ -54,6 +65,7 @@ { e.printStackTrace(); } + getStartGame().getRoundService().initializeGame(newGame); return newGame; } Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-09-28 22:57:24 UTC (rev 283) @@ -97,6 +97,10 @@ <property name='sessionFactory' ref='sessionFactory'/> </bean> + <bean id='gameConfigDao' class='edu.asu.commons.mme.dao.HibernateGameConfigDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> + <bean id='moduleRoundDao' class='edu.asu.commons.mme.dao.HibernateModuleRoundConfigDao'> <property name='sessionFactory' ref='sessionFactory'/> </bean> @@ -116,6 +120,7 @@ <property name='dao' ref='roundConfigDao'/> <property name='moduleDao' ref='moduleDao'/> <property name='gameDao' ref='gameDao' /> + <property name='gameConfigDao' ref='gameConfigDao' /> <property name='moduleRoundDao' ref='moduleRoundDao' /> <property name='locationService' ref='locationService'/> <property name='gameRoundDao' ref='gameRoundDao'/> Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/classes/log4j.properties =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/classes/log4j.properties 2009-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/classes/log4j.properties 2009-09-28 22:57:24 UTC (rev 283) @@ -12,5 +12,5 @@ log4j.logger.edu.asu.commons=DEBUG #log4j.logger.org.springframework=DEBUG -log4j.logger.org.springframework=ERROR +log4j.logger.org.springframework=DEBUG log4j.logger.org.hibernate=ERROR Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-09-28 22:53:16 UTC (rev 282) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-09-28 22:57:24 UTC (rev 283) @@ -7,8 +7,10 @@ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> + <mapping class='edu.asu.commons.mme.entity.GameConfig'/> <mapping class='edu.asu.commons.mme.entity.Game'/> - <mapping class='edu.asu.commons.mme.entity.Round'/> + <mapping class='edu.asu.commons.mme.entity.Round'/> + <mapping class='edu.asu.commons.mme.entity.GameRound'/> <mapping class='edu.asu.commons.mme.entity.Location'/> <!-- <mapping class='edu.asu.commons.mme.entity.RoundLocation'/> @@ -17,8 +19,8 @@ <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.GameRound'/> + <mapping class='edu.asu.commons.mme.entity.StudentRoundConfig'/> <mapping class='edu.asu.commons.mme.entity.StudentStrategy'/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-10-28 21:13:58
|
Revision: 344 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=344&view=rev Author: kjonas Date: 2009-10-28 21:13:44 +0000 (Wed, 28 Oct 2009) Log Message: ----------- Corrected BlockInformationWindow.as and InformationWindow.as to have the right data members. InformationWindowCreator.as calls .invalidateDisplayList() when it updates. appropriate changes in FisheryExperimentShell.mxml to reflect the above. new swf files. Modified Paths: -------------- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml mentalmodels/trunk/flex/src/actionscript/BlockInformationWindow.as mentalmodels/trunk/flex/src/actionscript/InformationWindow.as mentalmodels/trunk/flex/src/actionscript/InformationWindowCreator.as mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf mentalmodels/trunk/src/main/webapp/StartGame.swf mentalmodels/trunk/src/main/webapp/test.swf Modified: mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml =================================================================== --- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-10-28 21:10:12 UTC (rev 343) +++ mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-10-28 21:13:44 UTC (rev 344) @@ -290,7 +290,7 @@ } else { - var windowID:int = (temp as BlockInformationWindow).infoWindowID; + var windowID:int = (temp as BlockInformationWindow).infoWindow.indexID; tempArray.addItem(windowID); str += "(id:" + windowID + ")"; } Modified: mentalmodels/trunk/flex/src/actionscript/BlockInformationWindow.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/BlockInformationWindow.as 2009-10-28 21:10:12 UTC (rev 343) +++ mentalmodels/trunk/flex/src/actionscript/BlockInformationWindow.as 2009-10-28 21:13:44 UTC (rev 344) @@ -5,11 +5,8 @@ [RemoteClass(alias="edu.asu.commons.mme.entity.BlockInformationWindow")] public class BlockInformationWindow { - public var id:Number; public var sequenceNo:int; - public var infoWindowID:int; public var infoWindow:InformationWindow; - } } \ No newline at end of file Modified: mentalmodels/trunk/flex/src/actionscript/InformationWindow.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/InformationWindow.as 2009-10-28 21:10:12 UTC (rev 343) +++ mentalmodels/trunk/flex/src/actionscript/InformationWindow.as 2009-10-28 21:13:44 UTC (rev 344) @@ -5,13 +5,7 @@ public class InformationWindow { public var id:int; - - public var sequenceNo:int; - + public var indexID:int; public var title:String; - - public var block:Block; - - } } \ No newline at end of file Modified: mentalmodels/trunk/flex/src/actionscript/InformationWindowCreator.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/InformationWindowCreator.as 2009-10-28 21:10:12 UTC (rev 343) +++ mentalmodels/trunk/flex/src/actionscript/InformationWindowCreator.as 2009-10-28 21:13:44 UTC (rev 344) @@ -38,40 +38,50 @@ public function updateGoals(saved:ArrayCollection):void { - (goals.getItemAt(0) as CategoricalQuestionC).load(saved.getItemAt(0) as ArrayCollection); - (goals.getItemAt(1) as CategoricalQuestionC).load(saved.getItemAt(1) as ArrayCollection); - (goals.getItemAt(2) as CategoricalQuestionC).load(saved.getItemAt(2) as ArrayCollection); + for(var i:int=0; i<3; i++) + { + (goals.getItemAt(i) as CategoricalQuestionC).load(saved.getItemAt(i) as ArrayCollection); + (goals.getItemAt(i) as CategoricalQuestionC).invalidateDisplayList(); + } } public function updateLearned(saved:ArrayCollection):void { - (learned.getItemAt(0) as TextQuestionC).load(saved.getItemAt(0) as ArrayCollection); - (learned.getItemAt(1) as TextQuestionC).load(saved.getItemAt(1) as ArrayCollection); - (learned.getItemAt(2) as TextQuestionC).load(saved.getItemAt(2) as ArrayCollection); + for(var i:int=0; i<3; i++) + { + (learned.getItemAt(i) as TextQuestionC).load(saved.getItemAt(i) as ArrayCollection); + (learned.getItemAt(i) as TextQuestionC).invalidateDisplayList(); + } } public function updateLearnedWithCommunication(saved:ArrayCollection):void { - (learnedComm.getItemAt(0) as TextQuestionC).load(saved.getItemAt(0) as ArrayCollection); - (learnedComm.getItemAt(1) as TextQuestionC).load(saved.getItemAt(1) as ArrayCollection); - (learnedComm.getItemAt(2) as TextQuestionC).load(saved.getItemAt(2) as ArrayCollection); - (learnedComm.getItemAt(3) as TextQuestionC).load(saved.getItemAt(3) as ArrayCollection); + for(var i:int=0; i<4; i++) + { + (learnedComm.getItemAt(i) as TextQuestionC).load(saved.getItemAt(i) as ArrayCollection); + (learnedComm.getItemAt(i) as TextQuestionC).invalidateDisplayList(); + } } public function updateStrategyDesign(saved:ArrayCollection):void { strategy.load(saved); strategyResults.loadFromStrategy(saved); + + strategy.invalidateDisplayList(); + strategyResults.invalidateDisplayList(); } public function updateForecasting(savedFish:ArrayCollection, savedPeople:ArrayCollection):void { forecasting.load(savedFish, savedPeople); + forecasting.invalidateDisplayList(); } public function updateDayByDayDecisions(saved:ArrayCollection):void { dayByDayResults.load(saved); + dayByDayResults.invalidateDisplayList(); } //// Modified: mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/StartGame.swf =================================================================== (Binary files differ) 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. |
From: <see...@us...> - 2009-10-28 21:50:41
|
Revision: 342 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=342&view=rev Author: seematalele Date: 2009-10-28 21:01:17 +0000 (Wed, 28 Oct 2009) Log Message: ----------- 1) Changed the DayByDayDecisions class. Made changes in the DayByDayDecisions.as also. 2) Tested following functions in DayByDayDecisionsService class - saveStudentDecision - allocateStudentForEachBay - Getting NULL pointer exception error in calculateHarvest. Need to solve that. - Other functions related to strategy execution need to be tested. 3) Revised the location entity and its relationship with other entities. Created new relationship between location and group. So for that created new entity named as GroupLocation.java. Created HibernateGroupLocationDao.java and corresponding GroupLocation.as class also. Made changes accordingly in Location.as also. Modified Paths: -------------- mentalmodels/trunk/flex/src/actionscript/DayByDayDecisions.as mentalmodels/trunk/flex/src/actionscript/Location.as mentalmodels/trunk/src/main/db/init-mme.sql mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateDao.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayByDayDecisions.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.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/SuspendRepetition.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/GameService.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/StudentService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml Added Paths: ----------- mentalmodels/trunk/flex/src/actionscript/GroupLocation.as mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGroupLocationDao.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GroupLocation.java Modified: mentalmodels/trunk/flex/src/actionscript/DayByDayDecisions.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/DayByDayDecisions.as 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/flex/src/actionscript/DayByDayDecisions.as 2009-10-28 21:01:17 UTC (rev 342) @@ -1,4 +1,4 @@ -package actionscript.questions +package actionscript { import mx.collections.ArrayCollection; @@ -11,7 +11,7 @@ public var location:Location; public var earnings:Number; public var money:Number; - public var student:Student; + public var student:actionscript.Student; public var otherStudents:ArrayCollection; } } \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/GroupLocation.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/GroupLocation.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/GroupLocation.as 2009-10-28 21:01:17 UTC (rev 342) @@ -0,0 +1,24 @@ +package actionscript +{ + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.GroupLocation")] + public class GroupLocation + { + public var id:Number; + + public var location:Location; + + public var currentPopulation:Number; + + public var fishLeaving:Number; + + public var fishReturned:Number; + + public var group:Group; + + public var maxCapacity:Number; + + public var initialPopulation:Number; + + } +} \ No newline at end of file Modified: mentalmodels/trunk/flex/src/actionscript/Location.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Location.as 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/flex/src/actionscript/Location.as 2009-10-28 21:01:17 UTC (rev 342) @@ -7,12 +7,7 @@ { public var id:Number; public var locationName:String; - public var maxCapacity:int; public var growthRate:Number; - public var initialPopulation:int; - public var currentPopulation:Number; - public var fishLeaving:Number; - public var fishReturned:Number; - public var gameConfig:GameConfig; + } } \ No newline at end of file Modified: mentalmodels/trunk/src/main/db/init-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/init-mme.sql 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2009-10-28 21:01:17 UTC (rev 342) @@ -209,23 +209,6 @@ -- Table structure for table `day_by_day_decision` -- -DROP TABLE IF EXISTS `day_by_day_decision`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `day_by_day_decision` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `dayNumber` int(11) NOT NULL, - `earnings` double NOT NULL, - `money` double NOT NULL, - `location_id` bigint(20) NOT NULL, - `student_id` bigint(20) NOT NULL, - PRIMARY KEY (`id`), - KEY `FK5B92B164224FD013` (`location_id`), - KEY `FK5B92B164992B5A41` (`student_id`), - CONSTRAINT `FK5B92B164992B5A41` FOREIGN KEY (`student_id`) REFERENCES `student` (`id`), - CONSTRAINT `FK5B92B164224FD013` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `day_by_day_decision` @@ -383,6 +366,39 @@ UNLOCK TABLES; -- +-- Table structure for table `group_location` +-- + +DROP TABLE IF EXISTS `group_location`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `group_location` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `current_population` double DEFAULT NULL, + `fish_leaving` double DEFAULT NULL, + `fish_return` double DEFAULT NULL, + `initial_population` double NOT NULL, + `max_capacity` double NOT NULL, + `group_id` bigint(20) NOT NULL, + `location_id` bigint(20) NOT NULL, + PRIMARY KEY (`id`), + KEY `FKCFF7B975224FD013` (`location_id`), + KEY `FKCFF7B97565663181` (`group_id`), + CONSTRAINT `FKCFF7B97565663181` FOREIGN KEY (`group_id`) REFERENCES `grp` (`id`), + CONSTRAINT `FKCFF7B975224FD013` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `group_location` +-- + +LOCK TABLES `group_location` WRITE; +/*!40000 ALTER TABLE `group_location` DISABLE KEYS */; +/*!40000 ALTER TABLE `group_location` ENABLE KEYS */; +UNLOCK TABLES; + +-- -- Table structure for table `grp` -- @@ -439,18 +455,10 @@ /*!40101 SET character_set_client = utf8 */; CREATE TABLE `location` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, - `current_population` double DEFAULT NULL, - `fish_leaving` double DEFAULT NULL, - `fish_return` double DEFAULT NULL, `growth_rate` double NOT NULL, - `initial_population` double NOT NULL, `location_name` varchar(255) NOT NULL, - `max_capacity` double NOT NULL, - `gameConfig_id` bigint(20) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `FK714F9FB55E134D93` (`gameConfig_id`), - CONSTRAINT `FK714F9FB55E134D93` FOREIGN KEY (`gameConfig_id`) REFERENCES `game_config` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -459,6 +467,7 @@ LOCK TABLES `location` WRITE; /*!40000 ALTER TABLE `location` DISABLE KEYS */; +INSERT INTO `location` VALUES (1,0,'Harbor'),(2,0.5,'Bay1'),(3,0.15,'Bay2'),(4,0.05,'Bay3'); /*!40000 ALTER TABLE `location` ENABLE KEYS */; UNLOCK TABLES; @@ -849,4 +858,4 @@ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2009-09-28 18:29:10 +-- Dump completed on 2009-10-19 22:05:41 Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateDao.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateDao.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateDao.java 2009-10-28 21:01:17 UTC (rev 342) @@ -6,6 +6,7 @@ import org.apache.log4j.Logger; import org.hibernate.Criteria; +import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.criterion.DetachedCriteria; @@ -170,7 +171,7 @@ return logger; } - protected Session getCurrentSession() { + public Session getCurrentSession() { return getSessionFactory().getCurrentSession(); } @@ -209,4 +210,5 @@ Criteria criteria = getCriteria().add(example); return (List<E>) criteria.list(); } + } \ No newline at end of file Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGroupLocationDao.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGroupLocationDao.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGroupLocationDao.java 2009-10-28 21:01:17 UTC (rev 342) @@ -0,0 +1,13 @@ +package edu.asu.commons.mme.dao; + +import edu.asu.commons.mme.entity.GroupLocation; + +public class HibernateGroupLocationDao extends HibernateDao<GroupLocation>{ + + public HibernateGroupLocationDao() + { + super(GroupLocation.class); + } + + +} Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayByDayDecisions.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayByDayDecisions.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayByDayDecisions.java 2009-10-28 21:01:17 UTC (rev 342) @@ -33,10 +33,10 @@ private Location location; //earning will be in pound - @Column(nullable=false) + @Column private Double earnings; - @Column(nullable=false) + @Column private Double money; @ManyToOne @@ -69,7 +69,6 @@ return earnings; } - public void setMoney(Double money) { this.money = money; } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java 2009-10-28 21:01:17 UTC (rev 342) @@ -52,8 +52,8 @@ /* @OneToMany(mappedBy = "gameConfig") private List<GameRound> gameRounds;*/ - @OneToMany(mappedBy = "gameConfig") - private List<Location> locations; +// @OneToMany(mappedBy = "gameConfig") +// private List<Location> locations; public void setId(Long id) { @@ -93,12 +93,12 @@ public void setImageLocation(String imageLocation) { this.imageLocation = imageLocation; } - public void setLocations(List<Location> locations) { + /*public void setLocations(List<Location> locations) { this.locations = locations; } public List<Location> getLocations() { return locations; - } + }*/ /*public void setGameRounds(List<GameRound> gameRounds) { this.gameRounds = gameRounds; } 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-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java 2009-10-28 21:01:17 UTC (rev 342) @@ -2,11 +2,13 @@ import java.io.Serializable; +import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; +import javax.persistence.OneToMany; import javax.persistence.OrderBy; import javax.persistence.Table; @@ -34,6 +36,9 @@ @JoinColumn(nullable = false) private Game game;*/ + /*@OneToMany(mappedBy="group") + private List<Location> locations;*/ + public Long getId() { return id; } @@ -49,6 +54,14 @@ public void setNumber(Integer no) { this.number = no; } + +/* public void setLocations(List<Location> locations) { + this.locations = locations; + } + + public List<Location> getLocations() { + return locations; + }*/ /*public void setGame(Game game) { this.game = game; Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GroupLocation.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GroupLocation.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GroupLocation.java 2009-10-28 21:01:17 UTC (rev 342) @@ -0,0 +1,113 @@ +package edu.asu.commons.mme.entity; + +import java.io.Serializable; + +import javax.persistence.Column; +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 = "group_location") +public class GroupLocation implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = -9153306249781210088L; + + @Id + @GeneratedValue + private Long id; + + @ManyToOne + @JoinColumn(nullable=false) + private Location location; + + @Column(name="current_population", scale=2) + private Double currentPopulation; + + @Column(name="fish_leaving", scale=2) + private Double fishLeaving; + + @Column(name="fish_return", scale=2) + private Double fishReturned; + + @ManyToOne + @JoinColumn(nullable=false) + private Group group; + + @Column(nullable=false,name="max_capacity", scale=2) + private Double maxCapacity; + + @Column(nullable=false,name="initial_population", scale=2) + private Double initialPopulation; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setCurrentPopulation(Double currentPopulation) { + this.currentPopulation = currentPopulation; + } + + public Double getCurrentPopulation() { + return currentPopulation; + } + + public void setFishLeaving(Double fishLeaving) { + this.fishLeaving = fishLeaving; + } + + public Double getFishLeaving() { + return fishLeaving; + } + + public void setFishReturned(Double fishReturned) { + this.fishReturned = fishReturned; + } + + public Double getFishReturned() { + return fishReturned; + } + + public void setGroup(Group group) { + this.group = group; + } + + public Group getGroup() { + return group; + } + + public void setLocation(Location location) { + this.location = location; + } + + public Location getLocation() { + return location; + } + + public void setMaxCapacity(Double maxCapacity) { + this.maxCapacity = maxCapacity; + } + + public Double getMaxCapacity() { + return maxCapacity; + } + + public void setInitialPopulation(Double initialPopulation) { + this.initialPopulation = initialPopulation; + } + + public Double getInitialPopulation() { + return initialPopulation; + } + +} 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-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java 2009-10-28 21:01:17 UTC (rev 342) @@ -6,6 +6,7 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; +import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; @@ -22,13 +23,13 @@ @Column(nullable=false,name="location_name") private String locationName; - @Column(nullable=false,name="max_capacity", scale=2) - private Double maxCapacity; + /*@Column(nullable=false,name="max_capacity", scale=2) + private Double maxCapacity;*/ @Column(nullable=false,name="growth_rate", scale=2) private Double growthRate; - @Column(nullable=false,name="initial_population", scale=2) + /*@Column(nullable=false,name="initial_population", scale=2) private Double initialPopulation; @Column(name="current_population", scale=2) @@ -38,11 +39,15 @@ private Double fishLeaving; @Column(name="fish_return", scale=2) - private Double fishReturned; + private Double fishReturned;*/ - @ManyToOne + /*@ManyToOne private GameConfig gameConfig; + @ManyToOne + @JoinColumn(nullable=false) + private Group group;*/ + public void setId(Long id) { this.id = id; } @@ -63,7 +68,7 @@ public void setLocationName(String locationName) { this.locationName = locationName; } - public Double getMaxCapacity() { + /*public Double getMaxCapacity() { return maxCapacity; } public void setMaxCapacity(Double maxCapacity) { @@ -97,8 +102,8 @@ public Double getFishReturned() { return fishReturned; } - - public void setGameConfig(GameConfig gameConfig) { +*/ + /*public void setGameConfig(GameConfig gameConfig) { this.gameConfig = gameConfig; } @@ -106,4 +111,11 @@ return gameConfig; } + public void setGroup(Group group) { + this.group = group; + } + + public Group getGroup() { + return group; + }*/ } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/SuspendRepetition.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/SuspendRepetition.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/SuspendRepetition.java 2009-10-28 21:01:17 UTC (rev 342) @@ -24,7 +24,7 @@ @ManyToOne @JoinColumn(nullable=false) - private Round roundConfig; + private Round round; @ManyToOne @JoinColumn(nullable=false) @@ -61,11 +61,11 @@ } public void setRoundConfig(Round roundconfig) { - this.roundConfig = roundconfig; + this.round = roundconfig; } public Round getRoundConfig() { - return roundConfig; + return round; } public void setStudent(Student student) { @@ -75,7 +75,5 @@ public Student getStudent() { return student; } - - - + } 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-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java 2009-10-28 21:01:17 UTC (rev 342) @@ -4,6 +4,7 @@ import org.springframework.transaction.annotation.Transactional; +import edu.asu.commons.mme.dao.HibernateDayByDayDecisionsDao; import edu.asu.commons.mme.dao.HibernateStudentResponseDao; import edu.asu.commons.mme.dao.HibernateStudentStrategyDao; import edu.asu.commons.mme.entity.DayByDayDecisions; @@ -18,14 +19,18 @@ //private HibernateStudentDao studentDao; private HibernateStudentStrategyDao studentStrategyDao; //private HibernateDayByDayDecisionsDao dayByDayDecisionsDao; - private DayByDayDecisionsService dayByDayDecisionsService; +// private DayByDayDecisionsService dayByDayDecisionsService; private ModuleService moduleService; + private HibernateDayByDayDecisionsDao dayByDayDecisionsDao; - StudentResponse studentResponse; StudentStrategy studentStrategy; Student student; + /** + * This method is for Psychometric, Categorical and text question types. + * @param studentResponses + */ public void saveQuestion(List<StudentResponse> studentResponses) { StudentResponse clientStudentResponse = new StudentResponse(); @@ -45,6 +50,11 @@ } + /** + * this method is for saving strategies of students. + * @param studentStrategies + */ + public void saveStrategy(List<StudentStrategy> studentStrategies) { StudentStrategy clientStudentStrategy = new StudentStrategy(); @@ -63,23 +73,20 @@ } } - public void daybydayOutput(DayByDayDecisions studentDecision) - { - dayByDayDecisionsService.saveStudentDecision(studentDecision); - } + /*public void setDayByDayDecisionsDao(HibernateDayByDayDecisionsDao dayByDayDecisionsDao) { this.dayByDayDecisionsDao = dayByDayDecisionsDao; }*/ - public void setDayByDayDecisionsService(DayByDayDecisionsService dayByDayDecisionsService) { + /*public void setDayByDayDecisionsService(DayByDayDecisionsService dayByDayDecisionsService) { this.dayByDayDecisionsService = dayByDayDecisionsService; } public DayByDayDecisionsService getDayByDayDecisionsService() { return dayByDayDecisionsService; - } + }*/ public void setModuleService(ModuleService moduleService) { this.moduleService = moduleService; @@ -96,4 +103,13 @@ public HibernateStudentStrategyDao getStudentStrategyDao() { return studentStrategyDao; } + + public void setDayByDayDecisionsDao(HibernateDayByDayDecisionsDao dayByDayDecisionsDao) { + this.dayByDayDecisionsDao = dayByDayDecisionsDao; + } + + public HibernateDayByDayDecisionsDao getDayByDayDecisionsDao() { + return dayByDayDecisionsDao; + } + } 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-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java 2009-10-28 21:01:17 UTC (rev 342) @@ -2,15 +2,25 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; +import org.hibernate.Query; import org.springframework.transaction.annotation.Transactional; import edu.asu.commons.mme.dao.HibernateDayByDayDecisionsDao; +import edu.asu.commons.mme.dao.HibernateGameDao; +import edu.asu.commons.mme.dao.HibernateGroupDao; +import edu.asu.commons.mme.dao.HibernateGroupLocationDao; +import edu.asu.commons.mme.dao.HibernateLocationDao; +import edu.asu.commons.mme.dao.HibernateStudentDao; import edu.asu.commons.mme.entity.DayByDayDecisions; +import edu.asu.commons.mme.entity.Game; import edu.asu.commons.mme.entity.Group; +import edu.asu.commons.mme.entity.GroupLocation; import edu.asu.commons.mme.entity.Location; +import edu.asu.commons.mme.entity.Student; /*** 1) Harvesting - Find out the amount of fish per agent and calculate the current population after harvesting @@ -35,7 +45,7 @@ 6) Loss: Some fish are lost in the process (e.g. eaten by predatory fish or died in the open ocean). These losses also model reduction of the growth/reproduction rate of overcrowded locations according to a tradi-tional concept of the logistic growth. However, for the pilot experiments the losses are set to 0. For the pilot experiments the losses will be set to 0. To simulate the one-location condition, this parameter can be set to 1. - + totalLeaving = leaving_1 + leaving_2 + leaving_3 totalLoss = totalLeaving \xD7 lossRate totalReturn = totalLeaving \x96 totalLoss @@ -58,25 +68,41 @@ 8) New population: The new fish population, with which the next simulation day starts, is calculated as actualPopulation_i = actualPopulation_i + returning_i -*/ + */ @Transactional public class DayByDayDecisionsService extends Service.Base<DayByDayDecisions, HibernateDayByDayDecisionsDao> { - LocationService locationService; - StudentService studentService; - private List<DayByDayDecisions> studentDecisions = new ArrayList<DayByDayDecisions>(); - private double totalFishLeaving; + HibernateGameDao gameDao; - public void setStudentDecisions(List<DayByDayDecisions> studentDecisions) { - this.studentDecisions = studentDecisions; + public void setGameDao(HibernateGameDao gameDao) { + this.gameDao = gameDao; } - public List<DayByDayDecisions> getStudentDecisions() { - return studentDecisions; + HibernateLocationDao locationDao; + public void setLocationDao(HibernateLocationDao locationDao) { + this.locationDao = locationDao; } + HibernateStudentDao studentDao; + public void setStudentDao(HibernateStudentDao studentDao) { + this.studentDao = studentDao; + } + + HibernateGroupLocationDao groupLocationDao; + public void setGroupLocationDao(HibernateGroupLocationDao groupLocationDao) { + this.groupLocationDao = groupLocationDao; + } + + HibernateGroupDao groupDao; + + public void setGroupDao(HibernateGroupDao groupDao) { + this.groupDao = groupDao; + } + + private double totalFishLeaving; + public double getTotalFishLeaving() { return totalFishLeaving; } @@ -84,17 +110,18 @@ public void setTotalFishLeaving(double totalFishLeaving) { this.totalFishLeaving = totalFishLeaving; } - - public StudentService getStudentService() { - return studentService; - } - public void setStudentService(StudentService studentService) { - this.studentService = studentService; - } + static final String groupsWithinGame = "select distinct student.group from Student student where student.game =:current_game_id "; + static final String studentDecisionsForGame = "SELECT d FROM DayByDayDecisions d, Student s where s.game =:game and s=d.student"; + static final String groupLocation = "SELECT * FROM mme.group_location g where g.group =:group and g.location =:location;"; - public void saveStudentDecision(DayByDayDecisions studentDecision) + public List<DayByDayDecisions> saveStudentDecision(DayByDayDecisions studentDecision,Game game) { + getLogger().debug("Student Id: " + studentDecision.getStudent().getId() + + "Decision is: " + studentDecision.getLocation().getLocationName()); + + List<DayByDayDecisions> studentDecisions = new ArrayList<DayByDayDecisions>(); + if (studentDecisions == null) { studentDecisions = new ArrayList<DayByDayDecisions>(); @@ -102,43 +129,125 @@ } else { - if(!this.studentDecisions.contains(studentDecision)) + if(!studentDecisions.contains(studentDecision)) { studentDecisions.add(studentDecision); + DayByDayDecisions studentDayDecision = new DayByDayDecisions(); + studentDayDecision.setDayNumber(studentDecision.getDayNumber()); + studentDayDecision.setLocation(studentDecision.getLocation()); + studentDayDecision.setStudent(studentDecision.getStudent()); + getDao().save(studentDayDecision); + getLogger().debug("Student Id: " + studentDecision.getStudent().getId() + + "Decision is: " + studentDecision.getLocation().getLocationName() + + "is saved with Id..." + studentDayDecision.getId()); } else { System.out.println("Student Decision already exists!!"); } } + return studentDecisions; + //allocateStudentForEachBay(game,studentDecisions); } - public void allocateStudentForEachBay() + public void allocateStudentForEachBay(Game game) { + + List<DayByDayDecisions> studentDecisions = new ArrayList<DayByDayDecisions>(); + //studentDao.find(gameDao.find(game.getId()); + //studentDecisions = getDao(). + + Query query = getDao().getCurrentSession().createQuery(studentDecisionsForGame); + + query.setEntity("game", game); + + Iterator studentDecisionsIterator = query.list().iterator(); + + //getLogger().debug("student Decision Iterator is " + studentDecisionIterator.hasNext()); + while(studentDecisionsIterator.hasNext()) + { + studentDecisions.add((DayByDayDecisions)studentDecisionsIterator.next()); + // getLogger().info("decision is: " + decision.getId() + "location number: " + decision.getLocation().getLocationName()); + } + DayByDayDecisions studentDecision = new DayByDayDecisions(); + List<DayByDayDecisions> bay1Students = new ArrayList<DayByDayDecisions>(); - List<DayByDayDecisions> bay2Students = new ArrayList<DayByDayDecisions>(); - List<DayByDayDecisions> bay3Students = new ArrayList<DayByDayDecisions>(); - List<DayByDayDecisions> harborStudents = new ArrayList<DayByDayDecisions>(); + //Bay1Service bay1 = new Bay1Service(); + // List<DayByDayDecisions> bay2Students = new ArrayList<DayByDayDecisions>(); + // List<DayByDayDecisions> bay3Students = new ArrayList<DayByDayDecisions>(); + // List<DayByDayDecisions> harborStudents = new ArrayList<DayByDayDecisions>(); + + Map<Long,List<DayByDayDecisions>> bay1StudentMap = new HashMap<Long,List<DayByDayDecisions>>(); + Map<Long,List<DayByDayDecisions>> bay2StudentMap = new HashMap<Long,List<DayByDayDecisions>>(); + Map<Long,List<DayByDayDecisions>> bay3StudentMap = new HashMap<Long,List<DayByDayDecisions>>(); + Map<Long,List<DayByDayDecisions>> harborStudentMap = new HashMap<Long,List<DayByDayDecisions>>(); + for(int i = 0; i < studentDecisions.size(); i++) { studentDecision = studentDecisions.get(i); if(studentDecision.getLocation().getLocationName().equalsIgnoreCase("Bay1")) { - bay1Students.add(studentDecision); + if(!bay1StudentMap.containsKey(studentDecision.getStudent().getGroup().getId() )) + { + //group = decision.getStudent().getGroup(); + List<DayByDayDecisions> decisions = new ArrayList<DayByDayDecisions>(); + decisions.add(studentDecision); + bay1StudentMap.put(studentDecision.getStudent().getGroup().getId(),decisions); + } + else + { + List<DayByDayDecisions> decisions = bay1StudentMap.get(studentDecision.getStudent().getGroup().getId()); + decisions.add(studentDecision); + } + } else if(studentDecision.getLocation().getLocationName().equalsIgnoreCase("Bay2")) { - bay2Students.add(studentDecision); + if(!bay2StudentMap.containsKey(studentDecision.getStudent().getGroup().getId() )) + { + //group = decision.getStudent().getGroup(); + List<DayByDayDecisions> decisions = new ArrayList<DayByDayDecisions>(); + decisions.add(studentDecision); + bay2StudentMap.put(studentDecision.getStudent().getGroup().getId(),decisions); + } + else + { + List<DayByDayDecisions> decisions = bay1StudentMap.get(studentDecision.getStudent().getGroup().getId()); + decisions.add(studentDecision); + } + } else if(studentDecision.getLocation().getLocationName().equalsIgnoreCase("Bay3")) { - bay3Students.add(studentDecision); + if(!bay3StudentMap.containsKey(studentDecision.getStudent().getGroup().getId() )) + { + //group = decision.getStudent().getGroup(); + List<DayByDayDecisions> decisions = new ArrayList<DayByDayDecisions>(); + decisions.add(studentDecision); + bay3StudentMap.put(studentDecision.getStudent().getGroup().getId(),decisions); + } + else + { + List<DayByDayDecisions> decisions = bay1StudentMap.get(studentDecision.getStudent().getGroup().getId()); + decisions.add(studentDecision); + } } else if(studentDecision.getLocation().getLocationName().equalsIgnoreCase("Harbor")) { - harborStudents.add(studentDecision); + if(!harborStudentMap.containsKey(studentDecision.getStudent().getGroup().getId() )) + { + //group = decision.getStudent().getGroup(); + List<DayByDayDecisions> decisions = new ArrayList<DayByDayDecisions>(); + decisions.add(studentDecision); + harborStudentMap.put(studentDecision.getStudent().getGroup().getId(),decisions); + } + else + { + List<DayByDayDecisions> decisions = bay1StudentMap.get(studentDecision.getStudent().getGroup().getId()); + decisions.add(studentDecision); + } } } @@ -153,110 +262,220 @@ */ - calculateHarvest(bay1Students,"Bay1"); - calculateHarvest(bay2Students,"Bay2"); - calculateHarvest(bay3Students,"Bay3"); - calculateHarvest(harborStudents,"Harbor"); + // bay1.executeStrategy(); + + //print bay1 map for testing - calculateTotalFishLeaving(); + - calculateFishReturned(); + /*Iterator<Long> keys = bay1StudentMap.keySet().iterator(); + while(keys.hasNext()) + { + Long groupId = keys.next(); + getLogger().info("key is: " + groupId + "values are : " ); + List<DayByDayDecisions> decisions = bay1StudentMap.get(groupId); + for(DayByDayDecisions decision:decisions) + { + getLogger().info("decision is: " + decision.getDayNumber() + "location number: " + decision.getLocation().getLocationName()); + } + + }*/ + - calculateNewPopulation(); + calculateHarvest(bay1StudentMap,"Bay1"); + /**calculateHarvest(bay2StudentMap,"Bay2"); + calculateHarvest(bay3StudentMap,"Bay3"); + calculateHarvest(harborStudentMap,"Harbor"); + calculateTotalFishLeaving(game); + + calculateFishReturned(); + + calculateNewPopulation(); **/ + } //FIXME: max_fish_capacity is hard coded to 5 but actually this value should get from game object - - - public void calculateHarvest(List<DayByDayDecisions> bayStudents,String locationName) + + + public void calculateHarvest(Map<Long, List<DayByDayDecisions>> bay1StudentMap,String locationName) { + // TODO Auto-generated method stub double maxFishCapacity = 5.0; double amountPerAgent = 0.0; double actualPopulation = 0.0; double growth = 0.0; double fishLeaving = 0.0; + Long groupId; + List<DayByDayDecisions> groupStudentDecisions = new ArrayList<DayByDayDecisions>(); + getLogger().debug("bay1StudentMap size is : " + bay1StudentMap.size() + "location name is : " + locationName); + Iterator<Long> keys1 = bay1StudentMap.keySet().iterator(); + while(keys1.hasNext()) + { + Long groupId1 = keys1.next(); + getLogger().info("key is: " + groupId1 + "values are : " ); + List<DayByDayDecisions> decisions = bay1StudentMap.get(groupId1); + for(DayByDayDecisions decision:decisions) + { + getLogger().info("decision is: " + decision.getDayNumber() + "location number: " + decision.getLocation().getLocationName()); + } + + } try { - Location location = locationService.getLocation(locationName); + Iterator<Long> keys = bay1StudentMap.keySet().iterator(); + while(keys.hasNext()) + { + Location location = locationDao.findByProperty("locationName","Bay1"); + groupId = keys.next(); + getLogger().debug("group id is : " + groupId + "location id is: " + location.getId()); + groupStudentDecisions = bay1StudentMap.get(groupId); + Group group = groupDao.find(groupId); - actualPopulation = location.getCurrentPopulation(); + GroupLocation groupLocation = new GroupLocation(); + groupLocation.setLocation(location); + groupLocation.setGroup(group); - //1)Harvesting - //Find out the amount of fish per agent + + List<GroupLocation> groupLocations = groupLocationDao.findByExample(groupLocation); + + getLogger().debug("groupLocations size is: " + groupLocations.size()); - amountPerAgent = maxFishCapacity * location.getCurrentPopulation() / location.getMaxCapacity(); + if(groupLocations.size()== 1) + { + groupLocation = groupLocations.get(0); + } + else + { + //Error, should result only one result + } - if((bayStudents.size() * amountPerAgent) > actualPopulation) - { - amountPerAgent = actualPopulation / bayStudents.size(); - } - //FIXME: allocate this amountPerAgent to each student + //get current population + actualPopulation = groupLocation.getCurrentPopulation(); - //calculate the current population after harvesting - actualPopulation = actualPopulation - bayStudents.size() * amountPerAgent; + //1)Harvesting + //Find out the amount of fish per agent - location.setCurrentPopulation(actualPopulation); + amountPerAgent = maxFishCapacity * groupLocation.getCurrentPopulation() / groupLocation.getMaxCapacity(); - //2)Growth - growth = actualPopulation * location.getGrowthRate(); - getLogger().info("Fish growth at " + locationName + " is: " + growth); + if((groupStudentDecisions.size() * amountPerAgent) > actualPopulation) + { + amountPerAgent = actualPopulation / groupStudentDecisions.size(); + } + //FIXME: allocate this amountPerAgent to each student - //3) Fish leaving location - fishLeaving = actualPopulation * growth / location.getMaxCapacity(); - getLogger().info("Fish leaving at " + locationName + " is: " + fishLeaving); - - location.setFishLeaving(fishLeaving); + //calculate the current population after harvesting + actualPopulation = actualPopulation - groupStudentDecisions.size() * amountPerAgent; - //4) Population after diffusion - actualPopulation = actualPopulation + growth - fishLeaving; - getLogger().info("Fish population at " + locationName + " after diffusion is: " + actualPopulation); - locationService.save(location); - - for(DayByDayDecisions dayByDayDecisions : bayStudents) - { - dayByDayDecisions.setEarnings(amountPerAgent); - Group group = dayByDayDecisions.getStudent().getGroup(); - + groupLocation.setCurrentPopulation(actualPopulation); + + //2)Growth + growth = actualPopulation * location.getGrowthRate(); + getLogger().info("Fish growth at " + locationName + " is: " + growth); + + //3) Fish leaving location + fishLeaving = actualPopulation * growth / groupLocation.getMaxCapacity(); + getLogger().info("Fish leaving at " + locationName + " is: " + fishLeaving); + + groupLocation.setFishLeaving(fishLeaving); + + + //4) Population after diffusion + actualPopulation = actualPopulation + growth - fishLeaving; + getLogger().info("Fish population at " + locationName + " after diffusion is: " + actualPopulation); + groupLocationDao.save(groupLocation); + + for(DayByDayDecisions dayByDayDecision : groupStudentDecisions) + { + + //set earning + dayByDayDecision.setEarnings(amountPerAgent); + + //set money + dayByDayDecision.setMoney(0.0); + + //set other students + + List<Student> otherStudents = new ArrayList<Student>(); + Long currentStudentId = dayByDayDecision.getStudent().getId(); + for(DayByDayDecisions students:groupStudentDecisions) + { + if(students.getStudent().getId() != currentStudentId) + { + otherStudents.add(students.getStudent()); + } + } + + dayByDayDecision.setOtherStudents(otherStudents); + + //Group group = dayByDayDecisions.getStudent().getGroup(); + getDao().save(dayByDayDecision); + } + } - }catch(Exception e) { - getLogger().error(e.fillInStackTrace()); + e.printStackTrace(); } + } - private void calculateTotalFishLeaving() { - + private void calculateTotalFishLeaving(Game game) { + double totalFishLeaving = 0; - - for(Location location : locationService.getAllLocations()) + + + Query query = studentDao.getCurrentSession().createQuery(groupsWithinGame); + + query.setLong("current_game_id", game.getId()); + Iterator groups = query.list().iterator(); + while(groups.hasNext()) { + getLogger().debug("group id is: " + groups.next()); + } + /*List<Student> students = studentDao.findAllByProperty("game", game); + List<Long> groups = null; + for(Student student:students) + { + if(groups == null) + { + groups = new ArrayList<Long>(); + groups.add(student.getGroup().getId()); + } + else if(!groups.contains(student.getGroup().getId())) + { + groups.add(student.getGroup().getId()); + } + } + */ + + /* for(Group group : groups) + { totalFishLeaving = totalFishLeaving + location.getFishLeaving(); } - setTotalFishLeaving(totalFishLeaving); - + setTotalFishLeaving(totalFishLeaving);*/ + } -/**INFO: loss rate is 0 - according to the Dr Tobias' document, loss rate for the pilot experiment is 0 + /**INFO: loss rate is 0 - according to the Dr Tobias' document, loss rate for the pilot experiment is 0 but for single location it will be 1 */ private void calculateFishReturned() { - - double totalLoss = 0.0; + + /*double totalLoss = 0.0; double lossRate = 0.0; double totalReturn = 0.0; double maxFishCapacity = 5.0; double totalReceptivity = 0.0; double receptivity = 0.0; - - + + Map<String,Double> bayReceptivity = new HashMap<String, Double>(); try { - + //calculate loss totalLoss = getTotalFishLeaving() * lossRate; totalReturn = getTotalFishLeaving() - totalLoss; @@ -274,12 +493,12 @@ getLogger().info("Total receptivity is: " + totalReceptivity); //calculte the returning for each bay - /**FOR i = 1 TO 3 + *//**FOR i = 1 TO 3 IF receptivity_total = 0 returning_i = 0 ELSE returning_i = receptivity_i \xD7 totalReturn \xD7 receptivity_i / receptivity_total - END FOR */ + END FOR *//* receptivity = 0.0; for(Location location : locationService.getAllLocations()) { @@ -298,25 +517,18 @@ }catch(Exception e) { e.printStackTrace(); - } + }*/ } - + private void calculateNewPopulation() { - - for(Location location:locationService.getAllLocations()) + + /*for(Location location:locationService.getAllLocations()) { location.setCurrentPopulation(location.getCurrentPopulation() + location.getFishReturned()); getLogger().debug("New population at " + location.getLocationName() + " is: " + location.getCurrentPopulation()); } - + */ } - public LocationService getLocationService() { - return locationService; - } - public void setLocationService(LocationService locationService) { - this.locationService = locationService; - } - } 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 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java 2009-10-28 21:01:17 UTC (rev 342) @@ -14,6 +14,7 @@ import edu.asu.commons.mme.dao.HibernateGameDao; import edu.asu.commons.mme.dao.HibernateGameRoundDao; import edu.asu.commons.mme.dao.HibernateGroupDao; +import edu.asu.commons.mme.dao.HibernateGroupLocationDao; import edu.asu.commons.mme.dao.HibernateLocationDao; import edu.asu.commons.mme.dao.HibernateModuleDao; import edu.asu.commons.mme.dao.HibernateModuleRoundConfigDao; @@ -27,6 +28,7 @@ import edu.asu.commons.mme.entity.GameConfig; import edu.asu.commons.mme.entity.GameRound; import edu.asu.commons.mme.entity.Group; +import edu.asu.commons.mme.entity.GroupLocation; import edu.asu.commons.mme.entity.Location; import edu.asu.commons.mme.entity.Module; import edu.asu.commons.mme.entity.ModuleRoundConfig; @@ -50,6 +52,7 @@ private HibernateGroupDao groupDao; private HibernateStudentDao studentDao; private HibernateLocationDao locationDao; + private HibernateGroupLocationDao groupLocationDao; private int blockSeqNo; @@ -73,7 +76,7 @@ newGameConfig.setNumberOfLocations(gameConfig.getNumberOfLocations()); getGameConfigDao().save(newGameConfig); initializeGameRounds(newGameConfig); - setAllLocations(newGameConfig); + //setAllLocations(newGameConfig); }catch(Exception e) { @@ -111,7 +114,7 @@ newGame.setGameCode(str); getDao().save(newGame); getLogger().info("Created the game: " + newGame.getId()); - setAllLocations(gameConfig); + //setAllLocations(gameConfig); initializeGame(newGame); } }catch(Exception e) @@ -132,18 +135,39 @@ * 4)Once the timer is over, push the next block * */ - public void startGame(Game game) { + public boolean startGame(Game game) { - assignGroups(game); - getLogger().debug("system has assigned groups. "); - pushBlock(game); + boolean flag = false; + + if(isSufficientStudents(game)) + { + assignGroups(game); + getLogger().debug("system has assigned groups. "); + //pushBlock(game); + flag = true; + } + else + { + flag = false; + } + + return flag; } + private boolean isSufficientStudents(Game game) { + // TODO Auto-generated method stub + boolean flag = false; + Game currentGame = getDao().find(game.getId()); + if(getStudentDao().findAllByProperty("game", currentGame).size() > 0) + flag = true; + + return flag; + } + private void pushBlock(Game game) { Game newGameState = null; Block block = null; - boolean running = false; getLogger().info("game start is: " + game.getId()); newGameState = getDao().find(game.getId()); //FIXME: Do not know if this is a right way, I do not think because it will create refrecne to message handler for every block @@ -191,15 +215,7 @@ pushBlock(game); } - private int getNumberOfBlock(Game game) { - // TODO Auto-generated method stub - - //game.getGameConfig() - - return 0; - } - - + public void assignGroups(Game currentGame) { @@ -220,23 +236,14 @@ int noOfGroupsWithSize5=0; int x; - //no of groups noOfGroupsWithSize5=((int)(totalStudents/5)); - - x= totalStudents%5; - /* if(x==0) - { - totalGroups=groupSize5; - } - else*/ if(x==1) { noOfGroupsWithSize5=noOfGroupsWithSize5 - 1; noOfGroupsWithSize3=2; - // totalGroups=groupSize5 + groupSize3; } else if(x==2) @@ -244,18 +251,15 @@ noOfGroupsWithSize5=noOfGroupsWithSize5-1; noOfGroupsWithSize4=1; noOfGroupsWithSize3=1; - // totalGroups=groupSize5 + groupSize3 + groupSize4; } else if(x==3) { noOfGroupsWithSize3=1; - // totalGroups=groupSize3 + groupSize5; } else if(x==4) { noOfGroupsWithSize4=1; - // totalGroups=groupSize4 + groupSize5; } @@ -305,32 +309,9 @@ if(students != null) { - /*MessageBroker msgBroker = MessageBroker.getMessageBroker("_messageBroker"); - - String clientID = UUIDUtils.createUUID(); - AsyncMessage msg = new AsyncMessage(); - msg.setDestination("mme"); - String msgDestination = game.getGameCode(); - msg.setHeader("DSSubtopic", msgDestination); - msg.setClientId(clientID); - msg.setMessageId(UUIDUtils.createUUID()); - msg.setTimestamp(System.currentTimeMillis()); - for(Student student: studentWithGroupsAssigned) - { - initializeStudent(student); - } - msg.setBody(studentWithGroupsAssigned); - System.out.println("Message broker is: "+ msgBroker); - System.out.println("Students size is: " + studentWithGroupsAssigned.size()); - - msgBroker.routeMessageToService(msg, null);*/ msgHandler = new MessageHandler(null); msgHandler.setDestination("mme"); msgHandler.setSubtopic(game.getGameCode()); - /*for(Student student: studentWithGroupsAssigned) - { - initializeStudent(student); - }*/ msgHandler.send(studentWithGroupsAssigned); } } @@ -346,11 +327,13 @@ { //create group Group grp = new Group(); - grp.setNumber(++groupNo); groupDao.save(grp); - getLogger().info("Group is created with id: " + grp.getId()); + + //set all location for the group + setAllLocations(grp,groupSize); + int studentNo = 1; int j = 0; for(int i = 0; i <= groupSize-1 ; i++) @@ -376,11 +359,87 @@ return studentWithGroupsAssigned; } + private void setAllLocations(Group grp, int groupSize) { + // TODO Auto-generated method stub + getLogger().info("in setAllLocations...group size is: " + groupSize); + double maxCapacity = 0.0; + double initCapacity = 0.0; + + + List<Location> locations = new ArrayList<Location>(); + locations = locationDao.findAll(); + for(Location location:locations) + { + getLogger().info("Locations is: " + location.getLocationName()); + GroupLocation groupLocation = new GroupLocation(); + groupLocation.setGroup(groupDao.find(grp.getId())); + if(location.getLocationName().equalsIgnoreCase("bay1")) + { + + groupLocation.setLocation(location); + maxCapacity = 3.0*groupSize; + + groupLocation.setMaxCapacity(maxCapacity); + initCapacity = maxCapacity/2; + + groupLocation.setInitialPopulation(initCapacity); + groupLocation.setCurrentPopulation(initCapacity); + getLogger().info("initiali population set is: " + initCapacity); + groupLocationDao.save(groupLocation); + getLogger().info("group location is created and id is: " + groupLocation.getId()); + } + if(location.getLocationName().equalsIgnoreCase("bay2")) + { + groupLocation.setLocation(location); + maxCapacity = 5.0*groupSize; + + groupLocation.setMaxCapacity(maxCapacity); + initCapacity = maxCapacity/2; + + groupLocation.setInitialPopulation(initCapacity); + groupLocation.setCurrentPopulation(initCapacity); + getLogger().info("initiali population set is: " + initCapacity); + groupLocationDao.save(groupLocation); + getLogger().info("group location is created and id is: " + groupLocation.getId()); + } + if(location.getLocationName().equalsIgnoreCase("bay3")) + { + groupLocation.setLocation(location); + maxCapacity = 10.0*groupSize; + + groupLocation.setMaxCapacity(maxCapacity); + initCapacity = maxCapacity/2; + + groupLocation.setInitialPopulation(initCapacity); + groupLocation.setCurrentPopulation(initCapacity); + getLogger().info("initiali population set is: " + initCapacity); + groupLocationDao.save(groupLocation); + getLogger().info("group location is created and id is: " + groupLocation.getId()); + } + if(location.getLocationName().equalsIgnoreCase("harbor")) + { + groupLocation.setLocation(location); + maxCapacity = 0.0*groupSize; + + groupLocation.setMaxCapacity(maxCapacity); + initCapacity = maxCapacity/2; + + groupLocation.setInitialPopulation(initCapacity); + groupLocation.setCurrentPopulation(initCapacity); + getLogger().info("initiali population set is: " + initCapacity); + groupLocationDao.save(groupLocation); + getLogger().info("group location is created and id is: " + groupLocation.getId()); + } + + } + } + + private void initializeStudent(Student student) { Hibernate.initialize(student); Hibernate.initialize(student.getGame()); Hibernate.initialize(student.getGame().getGameConfig()); - Hibernate.initialize(student.getGame().getGameConfig().getLocations()); + //Hibernate.initialize(student.getGame().getGameConfig().getLocations()); Hibernate.initialize(student.getGroup()); } @@ -407,18 +466,18 @@ getGameConfigDao().save(gameConfig); } - private List<Location> setAllLocations(GameConfig gameConfig) + /*private List<Location> setAllLocations(GameConfig gameConfig) { //FIXME: For the pilot experiment locations are set manually but in future might want to take inputs from user List<Location> locations = new ArrayList<Location>(); try{ Location harbor = new Location(); harbor.setLocationName("Harbor"); - harbor.setCurrentPopulation(0.0); + // harbor.setCurrentPopulation(0.0); harbor.setGrowthRate(0.0); harbor.setInitialPopulation(0.0); harbor.setMaxCapacity(0.0); - harbor.setGameConfig(gameConfig); + //harbor.setGameConfig(gameConfig); getLocationDao().save(harbor); getLogger().info("Saved Location "+harbor.getLocationName()+" with id " + harbor.getId()); locations.add(harbor); @@ -428,8 +487,8 @@ bay1.setCurrentPopulation(5.0); bay1.setInitialPopulation(5.0); bay1.setGrowthRate(0.5); - bay1.setMaxCapacity(10.0); - bay1.setGameConfig(gameConfig); + //bay1.setMaxCapacity(10.0); + //bay1.setGameConfig(gameConfig); getLocationDao().save(bay1); getLogger().info("Saved Location " + bay1.getLocationName() +" with id "+ bay1.getId()); locations.add(bay1); @@ -439,8 +498,8 @@ bay2.setCurrentPopulation(10.0); bay2.setInitialPopulation(10.0); bay2.setGrowthRate(0.15); - bay2.setMaxCapacity(20.0); - bay2.setGameConfig(gameConfig); + //bay2.setMaxCapacity(20.0); + //bay2.setGameConfig(gameConfig); getLocationDao().save(bay2); getLogger().info("Saved Location " + bay2.getLocationName() +" with id "+ bay2.getId()); locations.add(bay2); @@ -450,8 +509,8 @@ bay3.setCurrentPopulation(15.0); bay3.setInitialPopulation(15.0); bay3.setGrowthRate(0.05); - bay3.setMaxCapacity(30.0); - bay3.setGameConfig(gameConfig); + //bay3.setMaxCapacity(30.0); + //bay3.setGameConfig(gameConfig); getLocationDao().save(bay3); getLogger().info("Saved Location " + bay3.getLocationName() +" with id "+ bay3.getId()); locations.add(bay3); @@ -462,7 +521,7 @@ return locations; } - +*/ public Module getNextModule(int sequenceNo) { return getModule(sequenceNo); @@ -688,11 +747,11 @@ GameConfig gameconfig = game.getGameConfig(); Hibernate.initialize(gameconfig); - for(Location location:gameconfig.getLocations()) + /*for(Location location:gameconfig.getLocations()) { Hibernate.initialize(location); - } + }*/ Round round = game.getCurrentRound(); Hibernate.initialize(round); @@ -750,6 +809,7 @@ } } + @SuppressWarnings("unused") private void initializeCurrentBlock(Block block) { Hibernate.initialize(block); @@ -1119,8 +1179,9 @@ return roundService; } + public void setGroupLocationDao(HibernateGroupLocationDao groupLocationDao) { + this.groupLocationDao = groupLocationDao; + } - - } 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-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 2009-10-28 21:01:17 UTC (rev 342) @@ -35,13 +35,13 @@ public void initializeLocation(Location location) { // TODO Auto-generated method stub Hibernate.initialize(location); - Hibernate.initialize(location.getGameConfig()); + /*Hibernate.initialize(location.getGameConfig()); for(Location loc:location.getGameConfig().getLocations()) { Hibernate.initialize(loc); } - //getLogger().debug("the game rounds for round objects are : " + game.getCurrentRound().getGameRounds().get(0)); +*/ //getLogger().debug("the game rounds for round objects are : " + game.getCurrentRound().getGameRounds().get(0)); } public Location getLocation(String locationName) @@ -61,17 +61,17 @@ return location; } //FIXME: For the pilot experiment locations are set manually but in future might want to take inputs from user - public List<Location> setAllLocations(GameConfig gameConfig) +/* public List<Location> setAllLocations(GameConfig gameConfig) { List<Location> locations = new ArrayList<Location>(); try{ Location harbor = new Location(); harbor.setLocationName("Harbor"); - harbor.setCurrentPopulation(0.0); + //harbor.setCurrentPopulation(0.0); harbor.setGrowthRate(0.0); - harbor.setInitialPopulation(0.0); - harbor.setMaxCapacity(0.0); - harbor.setGameConfig(gameConfig); + //harbor.setInitialPopulation(0.0); + //harbor.setMaxCapacity(0.0); + //harbor.setGameConfig(gameConfig); getDao().save(harbor); getLogger().info("Saved Location "+harbor.getLocationName()+" with id " + harbor.getId()); locations.add(harbor); @@ -81,19 +81,19 @@ bay1.setCurrentPopulation(5.0); bay1.setInitialPopulation(5.0); bay1.setGrowthRate(0.5); - bay1.setMaxCapacity(10.0); - bay1.setGameConfig(gameConfig); + //bay1.setMaxCapacity(10.0); + //bay1.setGameConfig(gameConfig); getDao().save(bay1); getLogger().info("Saved Location " + bay1.getLocationName() +" with id "+ bay1.getId()); locations.add(bay1); Location bay2 = new Location(); bay2.setLocationName("Bay2"); - bay2.setCurrentPopulation(10.0); - bay2.setInitialPopulation(10.0); +// bay2.setCurrentPopulation(10.0); +// bay2.setInitialPopulation(10.0); bay2.setGrowthRate(0.15); - bay2.setMaxCapacity(20.0); - bay2.setGameConfig(gameConfig); + //bay2.setMaxCapacity(20.0); + //bay2.setGameConfig(gameConfig); getDao().save(bay2); getLogger().info("Saved Location " + bay2.getLocationName() +" with id "+ bay2.getId()); locations.add(bay2); @@ -104,7 +104,7 @@ bay3.setInitialPopulation(15.0); bay3.setGrowthRate(0.05); bay3.setMaxCapacity(30.0); - bay3.setGameConfig(gameConfig); + //bay3.setGameConfig(gameConfig); getDao().save(bay3); getLogger().info("Saved Location " + bay3.getLocationName() +" with id "+ bay3.getId()); locations.add(bay3); @@ -114,5 +114,5 @@ } 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-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java 2009-10-28 21:01:17 UTC (rev 342) @@ -138,7 +138,7 @@ private void initializeLocations(GameConfig gameConfig) { - gameConfig.setLocations(locationService.setAllLocations(gameConfig)); + //gameConfig.setLocations(locationService.setAllLocations(gameConfig)); getGameConfigDao().save(gameConfig); } @@ -152,11 +152,11 @@ GameConfig gameconfig = game.getGameConfig(); Hibernate.initialize(gameconfig); - for(Location location:gameconfig.getLocations()) + /*for(Location location:gameconfig.getLocations()) { Hibernate.initialize(location); - } + }*/ Round round = game.getCurrentRound(); Hibernate.initialize(round); Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java 2009-10-28 21:01:17 UTC (rev 342) @@ -61,7 +61,7 @@ Game game = student.getGame(); Hibernate.initialize(game); Hibernate.initialize(game.getGameConfig()); - Hibernate.initialize(game.getGameConfig().getLocations()); + //Hibernate.initialize(game.getGameConfig().getLocations()); Hibernate.initialize(student.getGroup()); } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java 2009-10-28 21:01:17 UTC (rev 342) @@ -1,9 +1,9 @@ package edu.asu.commons.mme.utility; import org.apache.log4j.Logger; + import edu.asu.commons.mme.entity.Block; import edu.asu.commons.mme.entity.Game; -import edu.asu.commons.mme.service.GameService; import edu.asu.commons.mme.service.StartGame; import flex.messaging.MessageBroker; import flex.messaging.messages.AcknowledgeMessage; Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-10-28 19:01:39 UTC (rev 341) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-10-28 21:01:17 UTC (rev 342) @@ -89,6 +89,10 @@ <property name='sessionFactory' ref='sessionFactory'/> </bean> + <bean id='groupLocationDao' class='edu.asu.commons.mme.dao.HibernateGroupLocationDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> + <bean id='locationDao' class='edu.asu.commons.mme.dao.HibernateLocationDao'> <property name='sessionFactory' ref='sessionFactory'/> </bean> @@ -118,16 +122,24 @@ <property name='gameConfigDao' ref='gameConfigDao' /> <property name='moduleRoundDao' ref='moduleRoundDao' /> <property name='locationDao' ref='locationD... [truncated message content] |
From: <see...@us...> - 2009-12-02 00:32:52
|
Revision: 389 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=389&view=rev Author: seematalele Date: 2009-12-02 00:32:41 +0000 (Wed, 02 Dec 2009) Log Message: ----------- 1)Created CommunicationService.java 2)Expose this as a remoting service in applicationContext file 3)Re factored the entire database. Removed the forecasting, editing strategy. Kept Strategy design as it is. Needs to convert strategy design into day by day decision. 4)Changed the communication component so that it will invoke CommunicationService. Some of the things are hard coded. for example, student and subtopic, because do not know how to find student object. Bugs- 1) Communication component is not displaying at all for the communication round. Next Tasks - 1) Test 10 sec timer, written code in MessageHandler. 2) Test communication once component is available. Modified Paths: -------------- mentalmodels/trunk/flex/src/custom/Communication.mxml mentalmodels/trunk/src/main/db/init-mme.sql mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml Added Paths: ----------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateCommunicationDao.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/CommunicationService.java Modified: mentalmodels/trunk/flex/src/custom/Communication.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/Communication.mxml 2009-12-01 23:22:11 UTC (rev 388) +++ mentalmodels/trunk/flex/src/custom/Communication.mxml 2009-12-02 00:32:41 UTC (rev 389) @@ -1,38 +1,82 @@ <?xml version="1.0" encoding="utf-8"?> -<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" defaultButton="{btnSend}"> +<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" defaultButton="{btnSelfComm}" creationComplete="init()"> + + <mx:Consumer id="consumer" destination="mme" message="messageHandler(event.message)" fault="faultMsgHandler(event)" channelSet="{cs}" /> + <mx:ChannelSet id="cs"> + <!-- <mx:StreamingAMFChannel url="http://localhost:8080/messagebroker/streamingamf"/> --> + <mx:AMFChannel url="http://localhost:8080/mme/messagebroker/amflongpolling"/> + <mx:AMFChannel url="http://localhost:8080/mme/messagebroker/amfpolling"/> + </mx:ChannelSet> + <mx:Producer id="producer" destination="mme" channelSet="{cs}"/> + <mx:RemoteObject id="comunication" destination="communicationService" fault="faultHandler(event)"> + <mx:method name="saveCommunication"/> + </mx:RemoteObject> <mx:Script> <![CDATA[ - import mx.rpc.events.ResultEvent; - import mx.rpc.events.FaultEvent; + import actionscript.Group; import actionscript.Communication; import actionscript.Student; import mx.controls.Label; import mx.controls.Text; - - public var student:Student = null; - - public function faultHandler(event:FaultEvent):void + import mx.messaging.messages.IMessage; + import mx.messaging.events.MessageAckEvent; + import mx.messaging.events.MessageFaultEvent; + import mx.messaging.events.MessageEvent; + import mx.messaging.events.MessageFaultEvent; + import mx.messaging.events.MessageFaultEvent; + import mx.controls.Alert; + import mx.messaging.messages.AsyncMessage; + + import mx.messaging.Producer; + import mx.messaging.Consumer; + + import mx.rpc.events.FaultEvent; + + public var student:actionscript.Student; + public var testDBD:TestDayByDayDecisions = new TestDayByDayDecisions(); + public function init():void { - // Silent Failure + /* var testDBD:TestDayByDayDecisions = new TestDayByDayDecisions(); + student = testDBD.studentObject; + var group:actionscript.Group = testDBD.getGroup(); + var subTopic:String = student.gameCode + group.id.toString() + student.id.toString();*/ + + consumer.subtopic = "test1.1"; + consumer.subscribe(); + + producer.subtopic = "test1.1"; + } - public function messageHandler(event:ResultEvent):void + public function faultMsgHandler(msgevent:MessageFaultEvent):void { - if(event.message.body is actionscript.Communication) - { - commReceived(event.message.body as actionscript.Communication); - } + Alert.show("Error in getting message: " + msgevent.faultString); } + private function faultHandler(event:FaultEvent):void + { + Alert.show("Fault:\n"+event.fault.message + "\n" + event.fault.getStackTrace()); + } public function btnSend_click():void { - var tempCommunication:actionscript.Communication = new actionscript.Communication(); - tempCommunication.date = new Date(); - tempCommunication.message = txtMessage.text; - tempCommunication.student = this.student; + var message:IMessage = new AsyncMessage(); + var comm:actionscript.Communication = new actionscript.Communication(); + comm.message = txtMessage.text; + comm.date = new Date(); + comm.student = new actionscript.Student(); + comm.student.birthYear = 1982; + comm.student.gender = "F"; + comm.student.major = "CSE" + comm.student.semester = "1"; + comm.student.gameCode = "test1" + comm.student.id = 1; + + message.body = comm; + //producer.send(message); + txtMessage.text = ""; - - //<service>.<method>(tempCommunication); + //<service>.<method>(txtMessage.text); + comunication.saveCommunication(comm); } public function btnSelfComm_click():void { @@ -41,7 +85,6 @@ comm.date = new Date(); comm.student = new actionscript.Student(); comm.student.id = 1; txtMessage.text = ""; - commReceived(comm); } @@ -51,7 +94,11 @@ vbxMessages.addChild(commToText(comm)); vbxMessages.verticalScrollPosition = vbxMessages.maxVerticalScrollPosition; } - + + private function messageHandler(message:IMessage):void + { + commReceived(message.body as actionscript.Communication); + } private function strToText(str:String):Text { var newText:Text = new Text(); @@ -68,10 +115,7 @@ ]]> </mx:Script> - <mx:RemoteObject id="communicationService" destination="communicationService" fault="faultHandler(event)"> - <mx:method name="sendCommunication" result="resultHandler(event)"/> - </mx:RemoteObject> - + <mx:VBox id="vbxMessages" width="500" height="300" verticalScrollPolicy="on"/> <mx:HBox> <mx:TextInput id="txtMessage" width="500"/> @@ -79,4 +123,5 @@ <mx:Button id="btnSelfComm" label="SelfComm" click="btnSelfComm_click()" visible="false"/> </mx:HBox> + </mx:VBox> Modified: mentalmodels/trunk/src/main/db/init-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/init-mme.sql 2009-12-01 23:22:11 UTC (rev 388) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2009-12-02 00:32:41 UTC (rev 389) @@ -4,6 +4,10 @@ -- ------------------------------------------------------ -- Server version 5.1.33-community +-- This file contains the refactored MME database. Foolowing records have been removed : + -- Forecasting questions + -- Blocks with "Editing strategy" description and their corresponding question groups, infromation windows and questions + /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; @@ -40,7 +44,7 @@ LOCK TABLES `block` WRITE; /*!40000 ALTER TABLE `block` DISABLE KEYS */; -INSERT INTO `block` VALUES (1,'Introduction',1080,1,1),(2,'Design Strategy',1080,1,2),(3,'Characterizing own strategy',1020,2,2),(4,'Editing strategy',300,3,2),(5,'Day-by-day decisions game',360,4,2),(6,'Evaluation of Outcomes',660,5,2),(7,'Communication',360,1,3),(8,'Design Strategy',300,1,4),(9,'Characterizing own strategy',540,2,4),(10,'Editing strategy',180,3,4),(11,'Day-by-day decisions game',360,4,4),(12,'Evaluation of Outcomes',360,5,4),(13,'Final data gathering',120,1,5),(14,'Debriefing',120,2,5),(15,'Communication - Questions',480,2,3),(16,'Day-by-day decisions game',345,2,1); +INSERT INTO `block` VALUES (1,'Introduction',1080,1,1),(2,'Design Strategy',1080,1,2),(3,'Characterizing own strategy',1020,2,2),(5,'Day-by-day decisions game',360,4,2),(6,'Evaluation of Outcomes',660,5,2),(7,'Communication',360,1,3),(8,'Design Strategy',300,1,4),(9,'Characterizing own strategy',540,2,4),(11,'Day-by-day decisions game',360,4,4),(12,'Evaluation of Outcomes',360,5,4),(13,'Final data gathering',120,1,5),(14,'Debriefing',120,2,5),(15,'Communication - Questions',480,2,3),(16,'Day-by-day decisions game',345,2,1); /*!40000 ALTER TABLE `block` ENABLE KEYS */; UNLOCK TABLES; @@ -70,7 +74,7 @@ LOCK TABLES `block_information_window` WRITE; /*!40000 ALTER TABLE `block_information_window` DISABLE KEYS */; -INSERT INTO `block_information_window` VALUES (4,1,1,1),(5,2,1,2),(6,3,1,3),(7,4,1,4),(8,1,2,1),(9,2,2,3),(10,3,2,4),(11,4,2,5),(12,1,3,1),(13,2,3,3),(14,3,3,4),(15,4,3,6),(16,1,4,1),(17,2,4,3),(18,3,4,4),(19,4,4,6),(20,5,4,5),(21,6,4,7),(22,7,4,8),(23,1,5,1),(24,2,5,3),(25,3,5,4),(26,4,5,6),(27,1,6,1),(28,2,6,3),(29,3,6,4),(30,4,6,6),(31,5,6,7),(32,6,6,8),(33,7,6,9),(34,8,6,10),(35,1,7,1),(36,2,7,3),(37,3,7,4),(38,4,7,6),(39,1,8,1),(40,2,8,3),(41,3,8,4),(42,4,8,6),(43,5,8,5),(44,6,8,8),(45,7,8,9),(46,8,8,10),(47,9,8,11),(48,10,8,12),(49,1,9,1),(50,2,9,3),(51,3,9,4),(52,4,9,6),(53,5,9,8),(54,6,9,9),(55,7,9,10),(56,8,9,11),(57,9,9,12),(58,1,10,1),(59,2,10,3),(60,3,10,4),(61,4,10,5),(62,5,10,6),(63,6,10,7),(64,7,10,8),(65,8,10,9),(66,9,10,10),(67,10,10,11),(68,11,10,12),(69,1,12,1),(70,2,12,3),(71,3,12,4),(72,4,12,5),(73,5,12,6),(74,6,12,7),(75,7,12,8),(76,8,12,9),(77,9,12,10),(78,10,12,11),(79,11,12,12),(80,1,13,1),(81,2,13,3),(82,3,13,4),(83,4,13,6),(84,5,13,9),(85,6,13,10),(86,1,14,1),(87,2,14,3),(88,3,14,4),(89,4,14,6),(90,5,14,9),(91,6,14,10); +INSERT INTO `block_information_window` VALUES (4,1,1,1),(5,2,1,2),(6,3,1,3),(7,4,1,4),(8,1,2,1),(9,2,2,3),(10,3,2,4),(12,1,3,1),(13,2,3,3),(14,3,3,4),(23,1,5,1),(24,2,5,3),(25,3,5,4),(27,1,6,1),(28,2,6,3),(29,3,6,4),(31,5,6,7),(33,7,6,9),(34,8,6,10),(35,1,7,1),(36,2,7,3),(37,3,7,4),(39,1,8,1),(40,2,8,3),(41,3,8,4),(45,7,8,9),(46,8,8,10),(47,9,8,11),(48,10,8,12),(49,1,9,1),(50,2,9,3),(51,3,9,4),(54,6,9,9),(55,7,9,10),(56,8,9,11),(57,9,9,12),(69,1,12,1),(70,2,12,3),(71,3,12,4),(74,6,12,7),(76,8,12,9),(77,9,12,10),(78,10,12,11),(79,11,12,12),(80,1,13,1),(81,2,13,3),(82,3,13,4),(84,5,13,9),(85,6,13,10),(86,1,14,1),(87,2,14,3),(88,3,14,4),(90,5,14,9),(91,6,14,10); /*!40000 ALTER TABLE `block_information_window` ENABLE KEYS */; UNLOCK TABLES; @@ -267,6 +271,35 @@ UNLOCK TABLES; -- +-- Table structure for table `day_group_location` +-- + +DROP TABLE IF EXISTS `day_group_location`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `day_group_location` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `current_population` double DEFAULT NULL, + `dayNumber` int(11) DEFAULT NULL, + `fish_leaving` double DEFAULT NULL, + `fish_return` double DEFAULT NULL, + `groupLocation_id` bigint(20) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `FK1FAF7878A77DC681` (`groupLocation_id`), + CONSTRAINT `FK1FAF7878A77DC681` FOREIGN KEY (`groupLocation_id`) REFERENCES `group_location` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `day_group_location` +-- + +LOCK TABLES `day_group_location` WRITE; +/*!40000 ALTER TABLE `day_group_location` DISABLE KEYS */; +/*!40000 ALTER TABLE `day_group_location` ENABLE KEYS */; +UNLOCK TABLES; + +-- -- Table structure for table `forecasting_question` -- @@ -389,8 +422,33 @@ -- Table structure for table `group_location` -- +DROP TABLE IF EXISTS `group_location`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `group_location` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `initial_population` double NOT NULL, + `max_capacity` double NOT NULL, + `group_id` bigint(20) NOT NULL, + `location_id` bigint(20) NOT NULL, + PRIMARY KEY (`id`), + KEY `FKCFF7B975224FD013` (`location_id`), + KEY `FKCFF7B97565663181` (`group_id`), + CONSTRAINT `FKCFF7B97565663181` FOREIGN KEY (`group_id`) REFERENCES `grp` (`id`), + CONSTRAINT `FKCFF7B975224FD013` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; -- +-- Dumping data for table `group_location` +-- + +LOCK TABLES `group_location` WRITE; +/*!40000 ALTER TABLE `group_location` DISABLE KEYS */; +/*!40000 ALTER TABLE `group_location` ENABLE KEYS */; +UNLOCK TABLES; + +-- -- Table structure for table `grp` -- @@ -597,7 +655,7 @@ LOCK TABLES `question` WRITE; /*!40000 ALTER TABLE `question` DISABLE KEYS */; -INSERT INTO `question` VALUES (1,0,'Most important goal:',1,'categorical',10),(2,0,'Second most important goal:',2,'categorical',10),(3,0,'Third most important goal:',4,'categorical',10),(4,0,'Compared to the most important goal, this goal is',3,'psychometric',10),(7,0,'An example of a scale would be',1,'psychometric',11),(8,0,'<ul>\r<li>Why did you design the strategy the way you did? What did you consider and why do you think your strategy is an adequate solution?</li>\r<li>What actions do you expect from the other fishermen in your group? Why do you think, they might act this way?</li>\r<li>How do you think your strategy will work? Will the fish population grow or shrink in the different bays? What earnings do you expect?</li>\r</ul>\r',1,'text',12),(9,0,'Compared to the most important goal, this goal is',5,'psychometric',10),(10,0,'<b>Most important goal:</b>',1,'categorical',13),(11,0,'<b>Second most important goal:</b>',2,'categorical',13),(12,0,'Compared to the most important goal, this goal is',3,'psychometric',13),(13,0,'<b>Third most important goal:</b>',4,'categorical',13),(14,0,'Compared to the most important goal, this goal is',5,'psychometric',13),(15,0,'Over all, how much do like your group (i.e. the other players)?',1,'psychometric',14),(16,0,'How important is it for you what the others think about you and your behavior (i.e. your reputation in the group)?',2,'psychometric',14),(17,0,'How important is it for you that the others can reach their goals (i.e. the outcomes are fair)?',3,'psychometric',14),(18,0,'What do you think, how important is it for the others that you can reach your goals (i.e. the outcomes are fair)?',4,'psychometric',14),(19,0,'Do you perceive the group as a team or as competing players?',5,'psychometric',14),(20,0,'How much do you trust the others in your group?',1,'psychometric',15),(21,0,'How important is it for you that the others in your group can and do trust you?',2,'psychometric',15),(22,0,'How much do you think your group trying to coordinate their actions to reach better outcomes for all?',3,'psychometric',15),(23,1,'How much are you trying to follow rules or agreements that emerged from the communication?',4,'psychometric',15),(24,1,'How much do you think <i>the others</i> are trying to follow rules or agreements that emerged from the communica-tion?',5,'psychometric',15),(25,0,'Do you feel a sense of ‘commitment’ to act in the way you specified in your strategy?',1,'psychometric',16),(26,0,'Would you feel any discomfort or tension if you would act differently than you specified in your strategy?',2,'psychometric',16),(27,0,'Do you feel any sort of ‘social pressure’ to act in the way you specified in your strategy?',3,'psychometric',16),(28,0,'Would you feel guilt or shame if you had acted differently than you specified in your strategy?',4,'psychometric',16),(29,0,'Are you afraid of some sort of ‘punishment’ if you had acted differently as specified in your strategy?',5,'psychometric',16),(30,0,'How well did you understand the dynamics of the fish population?',1,'psychometric',17),(31,0,'Did the others in your group understand the dynamics better or worse than you?',2,'psychometric',17),(32,0,'How confident are you in having developed a strategy that leads to ‘good’ outcomes regarding your goals?',3,'psychometric',17),(33,0,'How much does your strategy depend on how the others in the group will act to reach the desired outcomes?',4,'psychometric',17),(34,0,'Would you classify your strategy as ‘safe’ in the sense of having acceptable but suboptimal results for sure, or rather as ‘risky’ in the sense of having the optimal results if everything runs like expected or very poor results otherwise?',5,'psychometric',17),(35,0,'',1,'forecastingfishermen',18),(36,0,'',1,'forecastingfish',19),(37,0,'',1,'strategydesign',9),(38,0,'',1,'strategydesign',22),(39,0,'',1,'daybydaydecisions',24),(40,0,'',1,'psychometric',27),(41,0,'… better understand the dynamics of the fish population.',1,'psychometric',29),(42,0,'… better understand the other fishermen in my group.',2,'psychometric',29),(43,0,'… better understand how to design the strategy.',3,'psychometric',29),(44,0,'… feel a ‘team spirit’ in the group.',4,'psychometric',29),(45,0,'… appraise the other fishermen in my group differently. Now I think about the others…',5,'psychometric',29),(46,0,'… better understand the dynamics of the fish population.',1,'psychometric',30),(47,0,'… better understand the other fishermen.',2,'psychometric',30),(48,0,'… better understand how to design the strategy.',3,'psychometric',30),(49,0,'… feel a ‘team spirit’ in the group.',4,'psychometric',30),(50,0,'… appraise the other fishermen in my group differently. Now I think about the others …',5,'psychometric',30),(51,0,'Did the communication have any form of reference to how to fish or design the strategy?',1,'categorical',31),(54,0,'',1,'psychometric',32),(55,0,'',2,'psychometric',32),(56,0,'',3,'psychometric',32),(57,0,'',4,'psychometric',32),(58,0,'',5,'psychometric',32),(59,0,'How clear is it to you, that you have to fish conforming to this rule, agreement or coordination attempt?',1,'psychometric',33),(60,0,'Do you think the other fishermen understood how they have to act according to this rule?<br>I think the others… ',2,'psychometric',33),(61,0,'Will you follow the rule, agreement, or coordination attempt that emerged from communication?<br>I will follow the rule…',3,'psychometric',33),(62,0,'Do you think, the other fishermen in you group will follow the rule, agreement, or coordination attempt?<br>\rI think, the others will… ',4,'psychometric',33),(63,0,'Considering the effects you expect for following the rule and your expectations of how the group will follow the rule, do you think the group will do better or worse due to the rule?',5,'psychometric',33),(64,0,'New understanding of fish dynamics',1,'text',34),(65,0,'New Expectations on how the others of the group will act',2,'text',34),(66,0,'Ideas for improving your strategy',3,'text',34),(67,0,'How interesting was the experiment for you?',1,'psychometric',35),(68,0,'How would you rate the effort you invested to design your strategy?',2,'psychometric',35),(69,0,'How difficult was it to understand the problem?',3,'psychometric',35),(70,0,'How difficult was it to find a good strategy?',4,'psychometric',35),(71,0,'How clear was it what you had to do?',5,'psychometric',35),(72,0,'How many times have you participated in problem solving experiments similar to this one?',1,'text',36),(73,0,'If you already participated in such experiments, when was the last time?',2,'categorical',36),(74,0,'Comments and Feedback',1,'text',37),(75,0,'',1,'strategydesign',40),(76,0,'',1,'strategydesign',53),(77,0,'',1,'daybydaydecisions',55),(78,0,'',1,'psychometric',58),(79,0,'',2,'psychometric',27),(80,0,'I feel the outcomes are:',3,'psychometric',27),(81,0,'',1,'psychometric',59),(82,0,'',2,'psychometric',59),(83,0,'',3,'psychometric',59),(84,0,'',4,'psychometric',59),(85,0,'',5,'psychometric',59),(86,0,'I did not understand the dynamics of the fish population well enough.',1,'psychometric',60),(87,0,'Some of the other fishermen did not understand the dynamics of the fish population well enough.',2,'psychometric',60),(88,0,'The actions of the others in my group did not help my strategy work well.',3,'psychometric',60),(89,0,'Some of the other fishermen acted too reluctantly (harvested too few).',4,'psychometric',60),(90,0,'Some of the other fishermen acted too aggressively (harvested too much).',5,'psychometric',60),(91,0,'The group was too uncoordinated',6,'psychometric',60),(92,0,'The group did not follow the rules or agreements that emerged from the communication enough.',7,'psychometric',60),(93,0,'The rules or agreements that emerged from the communication did not work out well.',8,'psychometric',60),(94,0,'What were the most important reasons for you to deviate from your strategy during the day-by-day decisions?<br>\rIf you did not deviate from your strategy then please write something like \"No difference\" in the text field.',1,'text',61),(95,0,'New understanding of fish dynamics',1,'text',62),(96,0,'New expectations on how the others of the group will act',2,'text',62),(97,0,'Ideas for improving your strategy',3,'text',62),(98,0,'',2,'psychometric',58),(99,0,'I feel the outcomes are:',3,'psychometric',58),(100,0,'',1,'psychometric',63),(101,0,'',2,'psychometric',63),(102,0,'',3,'psychometric',63),(103,0,'',4,'psychometric',63),(104,0,'',5,'psychometric',63),(105,0,'I did not understand the dynamics of the fish population well enough.',1,'psychometric',64),(106,0,'Some of the other fishermen did not understand the dynamics of the fish population well enough',2,'psychometric',64),(107,0,'The actions of the others in my group did not help my strategy work well.',3,'psychometric',64),(108,0,'Some of the other fishermen acted too reluctantly (harvested too few).',4,'psychometric',64),(109,0,'Some of the other fishermen acted too aggressively (harvested too much).',5,'psychometric',64),(110,0,'The group was too uncoordinated',6,'psychometric',64),(111,0,'The group did not follow the rules or agreements that emerged from the communication enough.',7,'psychometric',64),(112,0,'The rules or agreements that emerged from the communication did not work out well.',8,'psychometric',64),(113,0,'What were the most important reasons for you to deviate from your strategy during the day-by-day decisions?<br>\rIf you did not deviate from your strategy then please write something like \"No difference\" in the text field.',1,'text',65),(114,0,'New understanding of fish dynamics',1,'text',66),(115,0,'New expectations on how the others of the group will act',2,'text',66),(116,0,'Ideas for improving your strategy',3,'text',66),(117,0,'Describe in your own words what the rule, agreement, or other coordination attempt states. Describe how you and the others should act and what would happen if one does not act in this way.<br>\rIf you cannot identify any sort of coordination attempt in the communication, write \"no coordination\" in the field below.<br>\r(The information you write in this field will be available the next time you edit your strategy.)',2,'text',31),(118,0,'How often do you play strategy games (i.e. any games where you have to anticipate the moves of other players and plan your own moves ahead, like computer games, card games, board games, etc)?',3,'categorical',36),(120,0,'<ul>\r<li>Why did you design the strategy the way you did? What did you consider and why do you think your strategy is an adequate solution?</li>\r<li>What actions do you expect from the other fishermen in your group? Why do you think, they might act this way?</li>\r<li>How do you think your strategy will work? Will the fish population grow or shrink in the different bays? What earnings do you expect?</li>\r</ul>\r',1,'text',42),(121,0,'Most important goal:',1,'categorical',43),(122,0,'Second most important goal:',2,'categorical',43),(123,0,'Compared to the most important goal, this goal is',3,'psychometric',43),(124,0,'Third most important goal:',4,'categorical',43),(125,0,'Compared to the most important goal, this goal is',5,'psychometric',43),(126,0,'<b>Most important goal:</b>',1,'categorical',44),(127,0,'<b>Second most important goal:</b>',2,'categorical',44),(128,0,'Compared to the most important goal, this goal is',3,'psychometric',44),(129,0,'<b>Third most important goal:</b>',4,'categorical',44),(130,0,'Compared to the most important goal, this goal is',5,'psychometric',44),(131,0,'Over all, how much do like your group (i.e. the other players)?',1,'psychometric',45),(132,0,'How important is it for you what the others think about you and your behavior (i.e. your reputation in the group)?',2,'psychometric',45),(133,0,'How important is it for you that the others can reach their goals (i.e. the outcomes are fair)?',3,'psychometric',45),(134,0,'What do you think, how important is it for the others that you can reach your goals (i.e. the outcomes are fair)?',4,'psychometric',45),(135,0,'Do you perceive the group as a team or as competing players?',5,'psychometric',45),(136,0,'How much do you trust the others in your group?',1,'psychometric',46),(137,0,'How important is it for you that the others in your group can and do trust you?',2,'psychometric',46),(138,0,'How much do you think your group trying to coordinate their actions to reach better outcomes for all?',3,'psychometric',46),(139,0,'How much are you trying to follow rules or agreements that emerged from the communication?',4,'psychometric',46),(140,0,'How much do you think <i>the others</i> are trying to follow rules or agreements that emerged from the communica-tion?',5,'psychometric',46),(141,0,'Do you feel a sense of ‘commitment’ to act in the way you specified in your strategy?',1,'psychometric',47),(142,0,'Would you feel any discomfort or tension if you would act differently than you specified in your strategy?',2,'psychometric',47),(143,0,'Do you feel any sort of ‘social pressure’ to act in the way you specified in your strategy?',3,'psychometric',47),(144,0,'Would you feel guilt or shame if you had acted differently than you specified in your strategy?',4,'psychometric',47),(145,0,'Are you afraid of some sort of ‘punishment’ if you had acted differently as specified in your strategy?',5,'psychometric',47),(146,0,'How well did you understand the dynamics of the fish population?',1,'psychometric',48),(147,0,'Did the others in your group understand the dynamics better or worse than you?',2,'psychometric',48),(148,0,'How confident are you in having developed a strategy that leads to ‘good’ outcomes regarding your goals?',3,'psychometric',48),(149,0,'How much does your strategy depend on how the others in the group will act to reach the desired outcomes?',4,'psychometric',48),(150,0,'Would you classify your strategy as ‘safe’ in the sense of having acceptable but suboptimal results for sure, or rather as ‘risky’ in the sense of having the optimal results if everything runs like expected or very poor results otherwise?',5,'psychometric',48),(151,0,'',1,'forecastingfishermen',49),(152,0,'',1,'forecastingfish',50),(153,0,'',1,'daybydaydecisions',67); +INSERT INTO `question` VALUES (1,0,'Most important goal:',1,'categorical',10),(2,0,'Second most important goal:',2,'categorical',10),(3,0,'Third most important goal:',4,'categorical',10),(4,0,'Compared to the most important goal, this goal is',3,'psychometric',10),(7,0,'An example of a scale would be',1,'psychometric',11),(8,0,'<ul>\r<li>Why did you design the strategy the way you did? What did you consider and why do you think your strategy is an adequate solution?</li>\r<li>What actions do you expect from the other fishermen in your group? Why do you think, they might act this way?</li>\r<li>How do you think your strategy will work? Will the fish population grow or shrink in the different bays? What earnings do you expect?</li>\r</ul>\r',1,'text',12),(9,0,'Compared to the most important goal, this goal is',5,'psychometric',10),(10,0,'<b>Most important goal:</b>',1,'categorical',13),(11,0,'<b>Second most important goal:</b>',2,'categorical',13),(12,0,'Compared to the most important goal, this goal is',3,'psychometric',13),(13,0,'<b>Third most important goal:</b>',4,'categorical',13),(14,0,'Compared to the most important goal, this goal is',5,'psychometric',13),(15,0,'Over all, how much do like your group (i.e. the other players)?',1,'psychometric',14),(16,0,'How important is it for you what the others think about you and your behavior (i.e. your reputation in the group)?',2,'psychometric',14),(17,0,'How important is it for you that the others can reach their goals (i.e. the outcomes are fair)?',3,'psychometric',14),(18,0,'What do you think, how important is it for the others that you can reach your goals (i.e. the outcomes are fair)?',4,'psychometric',14),(19,0,'Do you perceive the group as a team or as competing players?',5,'psychometric',14),(20,0,'How much do you trust the others in your group?',1,'psychometric',15),(21,0,'How important is it for you that the others in your group can and do trust you?',2,'psychometric',15),(22,0,'How much do you think your group trying to coordinate their actions to reach better outcomes for all?',3,'psychometric',15),(23,1,'How much are you trying to follow rules or agreements that emerged from the communication?',4,'psychometric',15),(24,1,'How much do you think <i>the others</i> are trying to follow rules or agreements that emerged from the communica-tion?',5,'psychometric',15),(25,0,'Do you feel a sense of ‘commitment’ to act in the way you specified in your strategy?',1,'psychometric',16),(26,0,'Would you feel any discomfort or tension if you would act differently than you specified in your strategy?',2,'psychometric',16),(27,0,'Do you feel any sort of ‘social pressure’ to act in the way you specified in your strategy?',3,'psychometric',16),(28,0,'Would you feel guilt or shame if you had acted differently than you specified in your strategy?',4,'psychometric',16),(29,0,'Are you afraid of some sort of ‘punishment’ if you had acted differently as specified in your strategy?',5,'psychometric',16),(30,0,'How well did you understand the dynamics of the fish population?',1,'psychometric',17),(31,0,'Did the others in your group understand the dynamics better or worse than you?',2,'psychometric',17),(32,0,'How confident are you in having developed a strategy that leads to ‘good’ outcomes regarding your goals?',3,'psychometric',17),(33,0,'How much does your strategy depend on how the others in the group will act to reach the desired outcomes?',4,'psychometric',17),(34,0,'Would you classify your strategy as ‘safe’ in the sense of having acceptable but suboptimal results for sure, or rather as ‘risky’ in the sense of having the optimal results if everything runs like expected or very poor results otherwise?',5,'psychometric',17),(37,0,'',1,'strategydesign',9),(39,0,'',1,'daybydaydecisions',24),(40,0,'',1,'psychometric',27),(41,0,'… better understand the dynamics of the fish population.',1,'psychometric',29),(42,0,'… better understand the other fishermen in my group.',2,'psychometric',29),(43,0,'… better understand how to design the strategy.',3,'psychometric',29),(44,0,'… feel a ‘team spirit’ in the group.',4,'psychometric',29),(45,0,'… appraise the other fishermen in my group differently. Now I think about the others…',5,'psychometric',29),(46,0,'… better understand the dynamics of the fish population.',1,'psychometric',30),(47,0,'… better understand the other fishermen.',2,'psychometric',30),(48,0,'… better understand how to design the strategy.',3,'psychometric',30),(49,0,'… feel a ‘team spirit’ in the group.',4,'psychometric',30),(50,0,'… appraise the other fishermen in my group differently. Now I think about the others …',5,'psychometric',30),(51,0,'Did the communication have any form of reference to how to fish or design the strategy?',1,'categorical',31),(54,0,'',1,'psychometric',32),(55,0,'',2,'psychometric',32),(56,0,'',3,'psychometric',32),(57,0,'',4,'psychometric',32),(58,0,'',5,'psychometric',32),(59,0,'How clear is it to you, that you have to fish conforming to this rule, agreement or coordination attempt?',1,'psychometric',33),(60,0,'Do you think the other fishermen understood how they have to act according to this rule?<br>I think the others… ',2,'psychometric',33),(61,0,'Will you follow the rule, agreement, or coordination attempt that emerged from communication?<br>I will follow the rule…',3,'psychometric',33),(62,0,'Do you think, the other fishermen in you group will follow the rule, agreement, or coordination attempt?<br>\rI think, the others will… ',4,'psychometric',33),(63,0,'Considering the effects you expect for following the rule and your expectations of how the group will follow the rule, do you think the group will do better or worse due to the rule?',5,'psychometric',33),(64,0,'New understanding of fish dynamics',1,'text',34),(65,0,'New Expectations on how the others of the group will act',2,'text',34),(66,0,'Ideas for improving your strategy',3,'text',34),(67,0,'How interesting was the experiment for you?',1,'psychometric',35),(68,0,'How would you rate the effort you invested to design your strategy?',2,'psychometric',35),(69,0,'How difficult was it to understand the problem?',3,'psychometric',35),(70,0,'How difficult was it to find a good strategy?',4,'psychometric',35),(71,0,'How clear was it what you had to do?',5,'psychometric',35),(72,0,'How many times have you participated in problem solving experiments similar to this one?',1,'text',36),(73,0,'If you already participated in such experiments, when was the last time?',2,'categorical',36),(74,0,'Comments and Feedback',1,'text',37),(75,0,'',1,'strategydesign',40),(77,0,'',1,'daybydaydecisions',55),(78,0,'',1,'psychometric',58),(79,0,'',2,'psychometric',27),(80,0,'I feel the outcomes are:',3,'psychometric',27),(81,0,'',1,'psychometric',59),(82,0,'',2,'psychometric',59),(83,0,'',3,'psychometric',59),(84,0,'',4,'psychometric',59),(85,0,'',5,'psychometric',59),(86,0,'I did not understand the dynamics of the fish population well enough.',1,'psychometric',60),(87,0,'Some of the other fishermen did not understand the dynamics of the fish population well enough.',2,'psychometric',60),(88,0,'The actions of the others in my group did not help my strategy work well.',3,'psychometric',60),(89,0,'Some of the other fishermen acted too reluctantly (harvested too few).',4,'psychometric',60),(90,0,'Some of the other fishermen acted too aggressively (harvested too much).',5,'psychometric',60),(91,0,'The group was too uncoordinated',6,'psychometric',60),(92,0,'The group did not follow the rules or agreements that emerged from the communication enough.',7,'psychometric',60),(93,0,'The rules or agreements that emerged from the communication did not work out well.',8,'psychometric',60),(94,0,'What were the most important reasons for you to deviate from your strategy during the day-by-day decisions?<br>\rIf you did not deviate from your strategy then please write something like \"No difference\" in the text field.',1,'text',61),(95,0,'New understanding of fish dynamics',1,'text',62),(96,0,'New expectations on how the others of the group will act',2,'text',62),(97,0,'Ideas for improving your strategy',3,'text',62),(98,0,'',2,'psychometric',58),(99,0,'I feel the outcomes are:',3,'psychometric',58),(100,0,'',1,'psychometric',63),(101,0,'',2,'psychometric',63),(102,0,'',3,'psychometric',63),(103,0,'',4,'psychometric',63),(104,0,'',5,'psychometric',63),(105,0,'I did not understand the dynamics of the fish population well enough.',1,'psychometric',64),(106,0,'Some of the other fishermen did not understand the dynamics of the fish population well enough',2,'psychometric',64),(107,0,'The actions of the others in my group did not help my strategy work well.',3,'psychometric',64),(108,0,'Some of the other fishermen acted too reluctantly (harvested too few).',4,'psychometric',64),(109,0,'Some of the other fishermen acted too aggressively (harvested too much).',5,'psychometric',64),(110,0,'The group was too uncoordinated',6,'psychometric',64),(111,0,'The group did not follow the rules or agreements that emerged from the communication enough.',7,'psychometric',64),(112,0,'The rules or agreements that emerged from the communication did not work out well.',8,'psychometric',64),(113,0,'What were the most important reasons for you to deviate from your strategy during the day-by-day decisions?<br>\rIf you did not deviate from your strategy then please write something like \"No difference\" in the text field.',1,'text',65),(114,0,'New understanding of fish dynamics',1,'text',66),(115,0,'New expectations on how the others of the group will act',2,'text',66),(116,0,'Ideas for improving your strategy',3,'text',66),(117,0,'Describe in your own words what the rule, agreement, or other coordination attempt states. Describe how you and the others should act and what would happen if one does not act in this way.<br>\rIf you cannot identify any sort of coordination attempt in the communication, write \"no coordination\" in the field below.<br>\r(The information you write in this field will be available the next time you edit your strategy.)',2,'text',31),(118,0,'How often do you play strategy games (i.e. any games where you have to anticipate the moves of other players and plan your own moves ahead, like computer games, card games, board games, etc)?',3,'categorical',36),(120,0,'<ul>\r<li>Why did you design the strategy the way you did? What did you consider and why do you think your strategy is an adequate solution?</li>\r<li>What actions do you expect from the other fishermen in your group? Why do you think, they might act this way?</li>\r<li>How do you think your strategy will work? Will the fish population grow or shrink in the different bays? What earnings do you expect?</li>\r</ul>\r',1,'text',42),(121,0,'Most important goal:',1,'categorical',43),(122,0,'Second most important goal:',2,'categorical',43),(123,0,'Compared to the most important goal, this goal is',3,'psychometric',43),(124,0,'Third most important goal:',4,'categorical',43),(125,0,'Compared to the most important goal, this goal is',5,'psychometric',43),(126,0,'<b>Most important goal:</b>',1,'categorical',44),(127,0,'<b>Second most important goal:</b>',2,'categorical',44),(128,0,'Compared to the most important goal, this goal is',3,'psychometric',44),(129,0,'<b>Third most important goal:</b>',4,'categorical',44),(130,0,'Compared to the most important goal, this goal is',5,'psychometric',44),(131,0,'Over all, how much do like your group (i.e. the other players)?',1,'psychometric',45),(132,0,'How important is it for you what the others think about you and your behavior (i.e. your reputation in the group)?',2,'psychometric',45),(133,0,'How important is it for you that the others can reach their goals (i.e. the outcomes are fair)?',3,'psychometric',45),(134,0,'What do you think, how important is it for the others that you can reach your goals (i.e. the outcomes are fair)?',4,'psychometric',45),(135,0,'Do you perceive the group as a team or as competing players?',5,'psychometric',45),(136,0,'How much do you trust the others in your group?',1,'psychometric',46),(137,0,'How important is it for you that the others in your group can and do trust you?',2,'psychometric',46),(138,0,'How much do you think your group trying to coordinate their actions to reach better outcomes for all?',3,'psychometric',46),(139,0,'How much are you trying to follow rules or agreements that emerged from the communication?',4,'psychometric',46),(140,0,'How much do you think <i>the others</i> are trying to follow rules or agreements that emerged from the communica-tion?',5,'psychometric',46),(141,0,'Do you feel a sense of ‘commitment’ to act in the way you specified in your strategy?',1,'psychometric',47),(142,0,'Would you feel any discomfort or tension if you would act differently than you specified in your strategy?',2,'psychometric',47),(143,0,'Do you feel any sort of ‘social pressure’ to act in the way you specified in your strategy?',3,'psychometric',47),(144,0,'Would you feel guilt or shame if you had acted differently than you specified in your strategy?',4,'psychometric',47),(145,0,'Are you afraid of some sort of ‘punishment’ if you had acted differently as specified in your strategy?',5,'psychometric',47),(146,0,'How well did you understand the dynamics of the fish population?',1,'psychometric',48),(147,0,'Did the others in your group understand the dynamics better or worse than you?',2,'psychometric',48),(148,0,'How confident are you in having developed a strategy that leads to ‘good’ outcomes regarding your goals?',3,'psychometric',48),(149,0,'How much does your strategy depend on how the others in the group will act to reach the desired outcomes?',4,'psychometric',48),(150,0,'Would you classify your strategy as ‘safe’ in the sense of having acceptable but suboptimal results for sure, or rather as ‘risky’ in the sense of having the optimal results if everything runs like expected or very poor results otherwise?',5,'psychometric',48),(153,0,'',1,'daybydaydecisions',67); /*!40000 ALTER TABLE `question` ENABLE KEYS */; UNLOCK TABLES; @@ -627,7 +685,7 @@ LOCK TABLES `question_group` WRITE; /*!40000 ALTER TABLE `question_group` DISABLE KEYS */; -INSERT INTO `question_group` VALUES (1,'In this experiment you will design a strategy to fish in an abstract fishing ground together with three other persons. As we are mainly interested in the reasons <i>why</i> you choose a certain strategy, we will ask you a number of questions. For the same reason, there are no correct or wrong strategies and no correct or wrong answers. However, since for each pound of fish you get during the experiment you will receive $1.00 US, you might be interested in finding a strategy that fits your goals well. For this, you will need to understand the dynamics of the (simulated) fish population and anticipate well the behavior of the other persons of your group.',30,'<b>Welcome to the E-Fishery Experiment</b>',1,1),(2,'<p>The experiment will run as follows:</p> <ul> <li><b>Introduction</b>: We will explain the interface and how the dynamics of the fish population are modeled. We will also ask you some questions about you and you will have the opportunity to make your decisions on how to fish on a (simulated) day-by-day basis to get a feeling for the dynamics of the fish population. </li> <li><b>Strategy design 1</b>: You will design a fishing strategy that will be simulated together with the strategies of the other persons in your group, and we ask you a larger amount of questions to understand your decisions and to help you reflect on those decisions. </li> <li><b>Fishing and evaluation 1</b>: Besides simulating the strategies you will decide on how to fish on a (simulated) day-by-day basis. Then, we will ask you some questions on your evaluation of the results. </li> <li><b>Communication</b>:You will have the opportunity to chat with the other persons in your group. After the chat we will ask some questions to asses your evaluation of the communication. </li> <li><b>Strategy design, fishing and evaluation 2</b>: The strategy design, fishing and evaluation are repeated as described above. </li> <li><b>Finishing the experiment</b>: The experiment closes with some final questions and more information on the experiment, and you will have the opportunity to give a feedback if you wish to do so. </li> </ul> <p> In the <b>information bar above the main window</b> you can see which part of the experiment you are in, your progress and how you are doing with the time. </p>',30,'<b>Experimental procedure</b>',2,1),(3,'<p>The <b>information window "Fishing Ground"</b> gives you an overview that will be explained here.</p> <p> Imagine you are living on an island and your only income is from a species of fish that only survives in the shallow bays formed by the island. The fish can leave crowed bays and move to less crowded bays, but they cannot survive in the ocean. Nor can new fish arrive from the ocean. </p> <p> The fish population grows at a constant rate. Thus, the more fish are in a bay the faster the population grows. However, the population a bay can sustain is limited and fish leave crowed bays to find less crowded bays. The more crowded a bay, the more fish leave and the less fish enter the bay (the movement is directly proportional to the percentage to which a bay is filled up). The number of fish leaving the bay is proportional to the rate of growth, and the number of fish entering the bay is also proportional to the amount of fish leaving the three bays (i.e. fish in the ocean). </p> <p> The equations of these dynamics are given in the information windows. It is, however, not necessary to know them for designing a strategy. For this, you only have to <b>understand the following five principles</b>: </p> <ul> <li>If all bays are <b>filled up</b> with fish, then the total growth is highest, but all additional lbs of fish are lost to the ocean and the amount of fish in the bays stops growing.</li> <li>If the bays are <b>half filled</b>, then the amount of fish in the bays grows fastest.</li> <li>If the bays are <b>nearly empty</b>, the population grows very slowly.</li> <li>If there is <b>no fish</b> in any of the bays, there will be never any fish again.</li> <li>If there are both <b>crowded and empty</b> bays, a lot of fish move from the crowded to the empty bays.</li> </ul> ',120,'<b>How the dynamics of the fish population are modeled</b>',3,1),(4,'<p>The three bays are different in size and characteristics leading to different growth rates and capacities (i.e. the maximal amount of fish the bay can sustain). At the start of the simulation each bay is half filled.</p> <table> <thead> <th></th><th>Bay 1</th><th>Bay 2</th><th>Bay 3</th> </thead> <tbody> <tr> <td>Capacity:</td><td>10 lb</td><td>20 lb</td><td>30 lb</td> </tr> <tr> <td>Starts with:</td><td>5 lb</td><td>10 lb</td><td>15 lb</td> </tr> <tr> <td>Growth rate:</td><td>50% per day</td><td>15% per day</td><td>5% per day</td> </tr> </tbody> </table> <p> <b>How much fish</b> you take out in a day is <b>directly proportional with the extent that the bay is filled up with fish</b>. Your fishing gear allows you to harvest a maximum of 5 lbs. Thus, if the bay is completely filled up you get 5 lb of fish. If the bay is half filled, you get 2.5 lb of fish. If the bay is filled up only to 20 % you will get 1 lb, etc. The fish population is diminished by the same amount. If several persons fish the same bay and together would get more fish than the bay holds, then all the fish in the bay are distributed equally among these fishermen. </p> <p>However, you can <b>stay in the harbor</b> instead of fishing. This way, you do not get anything and the fish population is not diminished. </p> <p> Your task is to design a strategy of how to fish this fishing ground for 30 days together with three other persons (thus, with you the group compromises 4 persons). You will define the number of days that you stay in each bay or in the harbor. Please note that this is not an exam! We do not expect you to find the mathematically optimal solution to this problem. We want to know how you come up with a solution that sufficiently fulfills your goals. As long as we can understand why you choose a certain strategy you can come up with whatever you like. </p> ',120,'<b>Differences of bays and effects of fishing</b>',4,1),(5,'<p>Before designing the strategy, you have the opportunity to make your decisions on a day-by-day basis for the simulation. You will interact with the actual model of the fishing ground together with the other persons of your group. Thus, the problems and possibilities you will experience in this warm-up are relevant for the design of your strategy. </p> <p> The <b>interface</b> you will encounter on the next page has the following elements: <ul> <li>Information on the day of the simulation</li> <li>Buttons for your decision. If you want to fish in Bay 1, for example, click on Button "Bay 1". </li> <li>Time remaining. You have 10 seconds for each decision. If you do not press any button within these 10 seconds then you will stay in the harbor for this day. However, you can change your decision within these 10 seconds (i.e. if you clicked on "Bay 1" after 4 seconds and after another 4 seconds on "Bay 3", you will go to Bay 3). </li> <li>Table of past results. Your previous locations from past days are highlighted. The table shows you how much you fished and who else was in the same location as you. You do not have any information of locations where you not have been. </li> ',60,'<b>A warm-up</b>',5,1),(7,'<p>In what we refer to as a \'strategy\' you predefine your decisions of where to go each day of the simulation.\r Al-though only 30 days will be simulated, your strategy should represent your decisions for an indefinite period. Therefore you define a <b>set of decisions that will be repeated</b> until the end of the simulation. The set can contain as many decisions as you want but try to use as few as possible. Remember: Often simple strategies are more effective!</p> <p>It might be that you want to base your set of repeated decisions on another state of the fish population. In this case you can define a set of not repeated decisions that are applied at the beginning of the simulation. For example, you might first stay in the harbor to let the fish population increase or first fish all the bays to reduce the fish population before you start the repeated sequence of decisions.</p> <p>In this strategy you define how many days you stay at a certain location and to which other location you will move on.\r If, for example, you define to repeat the sequence \"2 days in harbor - 3 days in Bay 1 - 2 days in Bay 2\" you will not fish for two days, then fish in Bay 1 for three days, then fish in Bay 2 for two days, then not fish for two days, then fish in Bay 1 for three days, etc.</p> ',480,'<b>Designing your Strategy</b>',1,2),(8,'<p>Your strategy is mainly based on the number of days you stay at a certain location. However, things might run differently than you expected and you might wish to leave a bay earlier than the days you specified because you get too few fish out of that bay. For doing so you can specify a threshold of income. If you fish less then this threshold, the next day you will not fish this bay anymore but move on to the next location specified in your strategy.</p> <p>Note: Thresholds refer to the quantity of fish you get during one day fishing in a bay and not, for example, to the quantity of fish in the bay, fish fished by others, sum of fish already fished, etc.</p> <p>The final option you have is to stop repeating your strategy and stay in the harbor for some days. This op-tion can be used to prevent the total destruction of the fish population. For this you define a threshold and a number of days. If during one repetition of your decision set you never fished the amount defined by the threshold, then you stay in the harbor for the specified number of days before you start the next repetition.</p> <p>Note: Intentionally we do not allow designing \'intelligent\' strategies that search for solutions during the game. You have to think about what would be the best solution for you and express it with the options explained above.</p> ',90,'<b>Some special features of the strategy design</b>',2,2),(9,'<p>Design your strategy by clicking on <b>\'New\'</b> and <b>\'Delete\'</b>. You have to specify at least one repeated decision! If you are not sure about the meaning of the concepts used, refer to the information window \'Help for strategy design\'. </br>\rWhen you are done, click on <b>\'Next\'</b> </p>',480,'<b>Design your strategy</b>',3,2),(10,'<p>Please specify three goals that most influenced the design of your strategy. You can select from 18 different goals grouped in three categories (foci). </p><p>First select the focus of the goal (earnings, fish population or the other fishermen). Based on this selection, the list on the right hand sight will be filled and you can select one of these goals. For the second and third most important goal, also state, how much less important they are in relation to the most important goal.</p><p> The information you write into these fields will be available the next time you edit your strategy.</p>',30,'<b>What goals did you follow when designing your strategy?</b>',3,3),(11,'<p>We will ask you a number of questions on the strategy you just designed. This will help us to better understand how you came up with your strategy and it might help you reflect on certain aspects to improve your strategy.</p>\r<p>Besides <b>large fields</b> to write text and <b>small fields</b> to write numbers, you will encounter drop-down lists for selecting predefined values and scales. </p>\r<p>To give an answer on a scale, click on the location between the labels that comes closest to your opinion. By clicking on the scale, a slider appears that marks the value you selected. You can change the value by clicking on another position on the scale. By clicking on the reset button, the sliders of all scales on a page are removed and you can start selecting values again.</p>\r<p>Please try to answer all questions even if you are not sure. We are not testing your abilities but rather want to understand how you came up with your strategy.</p>\r',30,'<b>Introduction to questionnaire</b>',1,3),(12,'<p>Please explain your strategy with a few sentences. Particularly consider the following aspects:</p>',300,'<b>Explain the strategy in your own words</b>',2,3),(13,'<p>Specify the three goals that you think most influenced the design of the strategy of the other fishermen in your group. You can select from 18 different goals grouped in three categories (foci).</p>\r<p>First select the focus of the goal (earnings, fish population or the other fishermen). Based on this selection, the list on the right hand sight will be filled and you can select one of these goals. For the second and third most important goal, also state, how much less important they are in relation to the most important goal</p>\r',30,'<b>What goals do you think the others follow?</b>',4,3),(14,'',30,'<b>How do you perceive your group?</b>',5,3),(15,'',30,'<b>How much do you count on others and how much can they count on you?</b>',6,3),(16,'',30,'<b>What else influenced your strategy design?</b>',7,3),(17,'',60,'<b>How confident are you in reaching the outcomes you are expecting?</b>',8,3),(18,'<p>Fill in the following table your expectations of the others’ actions (i.e. the number of fishermen in each bay) for the first 15 days. Please note that we ask only for the expectations of where the others will go. </p>',180,'<b>What are you expecting the others will do?</b>',9,3),(19,'<p>Please enter in the table below your expectations of how the fish population develops within the first six days. Note that by clicking on “Update” the earnings and fish remaining in the bays is calculated, using your expecta-tions of the other’s actions and your strategy. Thus, you only have to think about how the fish population changes from one day to the next due to growth and movement of the fish. These estimations can be really rough. We do not expect you do perform detailed calculations.</p>\r<b>Note: You can only change the entries of one day at a time. To calculate the values and activate the next day for entries click on “Update”. You cannot return to previous days!</b>\r',180,'<b>What are you expecting how the fish population will develop?</b>',10,3),(20,'By clicking on “Accept” you will leave this part of the questionnaire and return to the strategy design. <b>You can-not return to this or previous pages!</b> However, important information for the design of your strategy will be available in information windows.',30,'<b>Leaving questionnaire on your strategy</b>',11,3),(21,'<p>The previous questions may have lead to some reflections on your strategy and you may wish to change some elements of it. Among the information windows you will find your previous strategy, your goals and your fore-cast.</p>\r<p>The time for editing your strategy depends on how fast you finished the questionnaire. For the next simulation we have to synchronize the group again. If you have been rather fast, you can think now more deeply about your strategy. If you are rather behind the time suggestion, you have to make your changes quickly.</p>\r<p>The interface for designing your strategy will not be explained again. If you are not sure about some elements, please refer to the information window “Help on strategy design”.</p>\r',30,'<b>Edit your strategy</b>',1,4),(22,'<p>Design your strategy by clicking on <b>\'New\'</b> and <b>\'Delete\'</b>. You have to specify at least one repeated decision! If you are not sure about the meaning of the concepts used, refer to the information window \'Help for strategy design\'. </br>\rWhen you are done, click on <b>\'Next\'</b> </p>',240,'<b>Design your strategy</b>',2,4),(23,'<p>Before we present the results of your strategy, we would like to see again how you make your decisions day-by-day. On the next page you will find the same interface as you already used to decide on how to fish the modeled fishing grounds.</p>',15,'<b>Applying your strategy in day-by-day decisions</b>',1,5),(24,'',345,'<b>Day-by-day-decisions</b>',2,5),(25,'<p>We will now present you the results of your strategy. By clicking on “Accept” you cannot return to this or any previous page, but the results of your day-by-day decisions (and also of your strategy) will be available in an information window.</p>',15,'<b>Leaving day-bay-day decisions</b>',3,5),(26,'',60,'<b>Your strategy resulted in the following actions</b>',1,6),(27,'<p>First we want to know your emotional reactions to the results:</p>',30,'<b>What are your emotional reactions to the outcome?</b>',2,6),(28,'You can now chat for 5 minutes with the other fishermen in your group. You can talk about whatever you want as long as you…\r<ul><li>…do not reveal your identity.</li>\r<li>…do not threaten others with any consequence after the experiment is finished.</li>\r<li>…do not promise others side-payments after the experiment is completed.</li></ul>\rThe interface works like a text messenger. In the text box at the bottom you write your text and by clicking on “Send” you send this text to all other group members. In the large box in the center of the window you see all messages that have been sent during the communication.<br>\rAfter five minutes the “Send” button will be deactivated and the “Next” button activated. Please click then on “Next” to answer some questions about the communication. You can return to this page to see the communication protocol again.\r',360,'<b>Chat with the other fishermen in your group</b>',1,7),(29,'Due to the conversation, I now…',30,'<b>Did the communication have any effect on you?</b>',1,15),(30,'Due to the conversation, the other fishermen in my group…',30,'<b>What do you think were the effects of the communication on the others?</b>',2,15),(31,'',60,'<b>Did the communication lead to some sort of coordination of the fishing?</b>',3,15),(32,'The rule, agreement, or coordination attempt is… ',30,'<b>What is your opinion about the rule(s) that emerged from communication?</b>',4,15),(33,'',30,'<b>What will be the effects of the rule?</b>',5,15),(34,'In the fields below note what you have learned from the communication to improve your strategy.<br>\rThink about your understanding of the dynamics of the fish population, your expectations about the behavior of the other fishermen in your group and possibilities to improve your strategy. For each of these aspects a separate field is offered. This information will be available in the next round of designing your strategy.<br>\rIf you have no entry for one of the fields below, write “none” in the respective field.<br>\rThe information you write into these fields will be available the next time you edit your strategy.',300,'<b>Lessons learned<b>',6,15),(35,'Congratulations! You finished the actual experiment. We wan... [truncated message content] |
From: <see...@us...> - 2010-01-12 21:42:54
|
Revision: 427 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=427&view=rev Author: seematalele Date: 2010-01-12 21:42:47 +0000 (Tue, 12 Jan 2010) Log Message: ----------- 1) Added communication question with question type = "communication"for communication round in init-mme.sql so that flex can use it for displaying communication component. 2) Error was coming while creating game, resolved that error. Now it is working fine. 3)Conflict resolution of CommunicationC.mxml. Bugs - 1) MessageHanlder is trying run timer for communication round. But getting error - "(JDBCExceptionReporter.java:101) ERROR org.hibernate.util.JDBCExceptionReporter - Lock wait timeout exceeded; try restarting transaction." Modified Paths: -------------- mentalmodels/trunk/flex/src/custom/CommunicationC.mxml mentalmodels/trunk/src/main/db/init-mme.sql mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java Modified: mentalmodels/trunk/flex/src/custom/CommunicationC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/CommunicationC.mxml 2010-01-07 05:17:04 UTC (rev 426) +++ mentalmodels/trunk/flex/src/custom/CommunicationC.mxml 2010-01-12 21:42:47 UTC (rev 427) @@ -72,6 +72,8 @@ <mx:method name="sendCommunication" result="messageHandler(event)"/> </mx:RemoteObject> + + <mx:VBox id="vbxMessages" width="500" height="300" verticalScrollPolicy="on"/> <mx:HBox> <mx:TextInput id="txtMessage" width="500"/> Modified: mentalmodels/trunk/src/main/db/init-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/init-mme.sql 2010-01-07 05:17:04 UTC (rev 426) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2010-01-12 21:42:47 UTC (rev 427) @@ -4,10 +4,6 @@ -- ------------------------------------------------------ -- Server version 5.1.33-community --- This file contains the refactored MME database. Foolowing records have been removed : - -- Forecasting questions - -- Blocks with "Editing strategy" description and their corresponding question groups, infromation windows and questions - /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; @@ -646,7 +642,7 @@ PRIMARY KEY (`id`), KEY `FKBA823BE6CA626674` (`question_group_id`), CONSTRAINT `FKBA823BE6CA626674` FOREIGN KEY (`question_group_id`) REFERENCES `question_group` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=154 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=156 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -655,7 +651,7 @@ LOCK TABLES `question` WRITE; /*!40000 ALTER TABLE `question` DISABLE KEYS */; -INSERT INTO `question` VALUES (1,0,'Most important goal:',1,'categorical',10),(2,0,'Second most important goal:',2,'categorical',10),(3,0,'Third most important goal:',4,'categorical',10),(4,0,'Compared to the most important goal, this goal is',3,'psychometric',10),(7,0,'An example of a scale would be',1,'psychometric',11),(8,0,'<ul>\r<li>Why did you design the strategy the way you did? What did you consider and why do you think your strategy is an adequate solution?</li>\r<li>What actions do you expect from the other fishermen in your group? Why do you think, they might act this way?</li>\r<li>How do you think your strategy will work? Will the fish population grow or shrink in the different bays? What earnings do you expect?</li>\r</ul>\r',1,'text',12),(9,0,'Compared to the most important goal, this goal is',5,'psychometric',10),(10,0,'<b>Most important goal:</b>',1,'categorical',13),(11,0,'<b>Second most important goal:</b>',2,'categorical',13),(12,0,'Compared to the most important goal, this goal is',3,'psychometric',13),(13,0,'<b>Third most important goal:</b>',4,'categorical',13),(14,0,'Compared to the most important goal, this goal is',5,'psychometric',13),(15,0,'Over all, how much do like your group (i.e. the other players)?',1,'psychometric',14),(16,0,'How important is it for you what the others think about you and your behavior (i.e. your reputation in the group)?',2,'psychometric',14),(17,0,'How important is it for you that the others can reach their goals (i.e. the outcomes are fair)?',3,'psychometric',14),(18,0,'What do you think, how important is it for the others that you can reach your goals (i.e. the outcomes are fair)?',4,'psychometric',14),(19,0,'Do you perceive the group as a team or as competing players?',5,'psychometric',14),(20,0,'How much do you trust the others in your group?',1,'psychometric',15),(21,0,'How important is it for you that the others in your group can and do trust you?',2,'psychometric',15),(22,0,'How much do you think your group trying to coordinate their actions to reach better outcomes for all?',3,'psychometric',15),(23,1,'How much are you trying to follow rules or agreements that emerged from the communication?',4,'psychometric',15),(24,1,'How much do you think <i>the others</i> are trying to follow rules or agreements that emerged from the communica-tion?',5,'psychometric',15),(25,0,'Do you feel a sense of ‘commitment’ to act in the way you specified in your strategy?',1,'psychometric',16),(26,0,'Would you feel any discomfort or tension if you would act differently than you specified in your strategy?',2,'psychometric',16),(27,0,'Do you feel any sort of ‘social pressure’ to act in the way you specified in your strategy?',3,'psychometric',16),(28,0,'Would you feel guilt or shame if you had acted differently than you specified in your strategy?',4,'psychometric',16),(29,0,'Are you afraid of some sort of ‘punishment’ if you had acted differently as specified in your strategy?',5,'psychometric',16),(30,0,'How well did you understand the dynamics of the fish population?',1,'psychometric',17),(31,0,'Did the others in your group understand the dynamics better or worse than you?',2,'psychometric',17),(32,0,'How confident are you in having developed a strategy that leads to ‘good’ outcomes regarding your goals?',3,'psychometric',17),(33,0,'How much does your strategy depend on how the others in the group will act to reach the desired outcomes?',4,'psychometric',17),(34,0,'Would you classify your strategy as ‘safe’ in the sense of having acceptable but suboptimal results for sure, or rather as ‘risky’ in the sense of having the optimal results if everything runs like expected or very poor results otherwise?',5,'psychometric',17),(37,0,'',1,'strategydesign',9),(39,0,'',1,'daybydaydecisions',24),(40,0,'',1,'psychometric',27),(41,0,'… better understand the dynamics of the fish population.',1,'psychometric',29),(42,0,'… better understand the other fishermen in my group.',2,'psychometric',29),(43,0,'… better understand how to design the strategy.',3,'psychometric',29),(44,0,'… feel a ‘team spirit’ in the group.',4,'psychometric',29),(45,0,'… appraise the other fishermen in my group differently. Now I think about the others…',5,'psychometric',29),(46,0,'… better understand the dynamics of the fish population.',1,'psychometric',30),(47,0,'… better understand the other fishermen.',2,'psychometric',30),(48,0,'… better understand how to design the strategy.',3,'psychometric',30),(49,0,'… feel a ‘team spirit’ in the group.',4,'psychometric',30),(50,0,'… appraise the other fishermen in my group differently. Now I think about the others …',5,'psychometric',30),(51,0,'Did the communication have any form of reference to how to fish or design the strategy?',1,'categorical',31),(54,0,'',1,'psychometric',32),(55,0,'',2,'psychometric',32),(56,0,'',3,'psychometric',32),(57,0,'',4,'psychometric',32),(58,0,'',5,'psychometric',32),(59,0,'How clear is it to you, that you have to fish conforming to this rule, agreement or coordination attempt?',1,'psychometric',33),(60,0,'Do you think the other fishermen understood how they have to act according to this rule?<br>I think the others… ',2,'psychometric',33),(61,0,'Will you follow the rule, agreement, or coordination attempt that emerged from communication?<br>I will follow the rule…',3,'psychometric',33),(62,0,'Do you think, the other fishermen in you group will follow the rule, agreement, or coordination attempt?<br>\rI think, the others will… ',4,'psychometric',33),(63,0,'Considering the effects you expect for following the rule and your expectations of how the group will follow the rule, do you think the group will do better or worse due to the rule?',5,'psychometric',33),(64,0,'New understanding of fish dynamics',1,'text',34),(65,0,'New Expectations on how the others of the group will act',2,'text',34),(66,0,'Ideas for improving your strategy',3,'text',34),(67,0,'How interesting was the experiment for you?',1,'psychometric',35),(68,0,'How would you rate the effort you invested to design your strategy?',2,'psychometric',35),(69,0,'How difficult was it to understand the problem?',3,'psychometric',35),(70,0,'How difficult was it to find a good strategy?',4,'psychometric',35),(71,0,'How clear was it what you had to do?',5,'psychometric',35),(72,0,'How many times have you participated in problem solving experiments similar to this one?',1,'text',36),(73,0,'If you already participated in such experiments, when was the last time?',2,'categorical',36),(74,0,'Comments and Feedback',1,'text',37),(75,0,'',1,'strategydesign',40),(77,0,'',1,'daybydaydecisions',55),(78,0,'',1,'psychometric',58),(79,0,'',2,'psychometric',27),(80,0,'I feel the outcomes are:',3,'psychometric',27),(81,0,'',1,'psychometric',59),(82,0,'',2,'psychometric',59),(83,0,'',3,'psychometric',59),(84,0,'',4,'psychometric',59),(85,0,'',5,'psychometric',59),(86,0,'I did not understand the dynamics of the fish population well enough.',1,'psychometric',60),(87,0,'Some of the other fishermen did not understand the dynamics of the fish population well enough.',2,'psychometric',60),(88,0,'The actions of the others in my group did not help my strategy work well.',3,'psychometric',60),(89,0,'Some of the other fishermen acted too reluctantly (harvested too few).',4,'psychometric',60),(90,0,'Some of the other fishermen acted too aggressively (harvested too much).',5,'psychometric',60),(91,0,'The group was too uncoordinated',6,'psychometric',60),(92,0,'The group did not follow the rules or agreements that emerged from the communication enough.',7,'psychometric',60),(93,0,'The rules or agreements that emerged from the communication did not work out well.',8,'psychometric',60),(94,0,'What were the most important reasons for you to deviate from your strategy during the day-by-day decisions?<br>\rIf you did not deviate from your strategy then please write something like \"No difference\" in the text field.',1,'text',61),(95,0,'New understanding of fish dynamics',1,'text',62),(96,0,'New expectations on how the others of the group will act',2,'text',62),(97,0,'Ideas for improving your strategy',3,'text',62),(98,0,'',2,'psychometric',58),(99,0,'I feel the outcomes are:',3,'psychometric',58),(100,0,'',1,'psychometric',63),(101,0,'',2,'psychometric',63),(102,0,'',3,'psychometric',63),(103,0,'',4,'psychometric',63),(104,0,'',5,'psychometric',63),(105,0,'I did not understand the dynamics of the fish population well enough.',1,'psychometric',64),(106,0,'Some of the other fishermen did not understand the dynamics of the fish population well enough',2,'psychometric',64),(107,0,'The actions of the others in my group did not help my strategy work well.',3,'psychometric',64),(108,0,'Some of the other fishermen acted too reluctantly (harvested too few).',4,'psychometric',64),(109,0,'Some of the other fishermen acted too aggressively (harvested too much).',5,'psychometric',64),(110,0,'The group was too uncoordinated',6,'psychometric',64),(111,0,'The group did not follow the rules or agreements that emerged from the communication enough.',7,'psychometric',64),(112,0,'The rules or agreements that emerged from the communication did not work out well.',8,'psychometric',64),(113,0,'What were the most important reasons for you to deviate from your strategy during the day-by-day decisions?<br>\rIf you did not deviate from your strategy then please write something like \"No difference\" in the text field.',1,'text',65),(114,0,'New understanding of fish dynamics',1,'text',66),(115,0,'New expectations on how the others of the group will act',2,'text',66),(116,0,'Ideas for improving your strategy',3,'text',66),(117,0,'Describe in your own words what the rule, agreement, or other coordination attempt states. Describe how you and the others should act and what would happen if one does not act in this way.<br>\rIf you cannot identify any sort of coordination attempt in the communication, write \"no coordination\" in the field below.<br>\r(The information you write in this field will be available the next time you edit your strategy.)',2,'text',31),(118,0,'How often do you play strategy games (i.e. any games where you have to anticipate the moves of other players and plan your own moves ahead, like computer games, card games, board games, etc)?',3,'categorical',36),(120,0,'<ul>\r<li>Why did you design the strategy the way you did? What did you consider and why do you think your strategy is an adequate solution?</li>\r<li>What actions do you expect from the other fishermen in your group? Why do you think, they might act this way?</li>\r<li>How do you think your strategy will work? Will the fish population grow or shrink in the different bays? What earnings do you expect?</li>\r</ul>\r',1,'text',42),(121,0,'Most important goal:',1,'categorical',43),(122,0,'Second most important goal:',2,'categorical',43),(123,0,'Compared to the most important goal, this goal is',3,'psychometric',43),(124,0,'Third most important goal:',4,'categorical',43),(125,0,'Compared to the most important goal, this goal is',5,'psychometric',43),(126,0,'<b>Most important goal:</b>',1,'categorical',44),(127,0,'<b>Second most important goal:</b>',2,'categorical',44),(128,0,'Compared to the most important goal, this goal is',3,'psychometric',44),(129,0,'<b>Third most important goal:</b>',4,'categorical',44),(130,0,'Compared to the most important goal, this goal is',5,'psychometric',44),(131,0,'Over all, how much do like your group (i.e. the other players)?',1,'psychometric',45),(132,0,'How important is it for you what the others think about you and your behavior (i.e. your reputation in the group)?',2,'psychometric',45),(133,0,'How important is it for you that the others can reach their goals (i.e. the outcomes are fair)?',3,'psychometric',45),(134,0,'What do you think, how important is it for the others that you can reach your goals (i.e. the outcomes are fair)?',4,'psychometric',45),(135,0,'Do you perceive the group as a team or as competing players?',5,'psychometric',45),(136,0,'How much do you trust the others in your group?',1,'psychometric',46),(137,0,'How important is it for you that the others in your group can and do trust you?',2,'psychometric',46),(138,0,'How much do you think your group trying to coordinate their actions to reach better outcomes for all?',3,'psychometric',46),(139,0,'How much are you trying to follow rules or agreements that emerged from the communication?',4,'psychometric',46),(140,0,'How much do you think <i>the others</i> are trying to follow rules or agreements that emerged from the communica-tion?',5,'psychometric',46),(141,0,'Do you feel a sense of ‘commitment’ to act in the way you specified in your strategy?',1,'psychometric',47),(142,0,'Would you feel any discomfort or tension if you would act differently than you specified in your strategy?',2,'psychometric',47),(143,0,'Do you feel any sort of ‘social pressure’ to act in the way you specified in your strategy?',3,'psychometric',47),(144,0,'Would you feel guilt or shame if you had acted differently than you specified in your strategy?',4,'psychometric',47),(145,0,'Are you afraid of some sort of ‘punishment’ if you had acted differently as specified in your strategy?',5,'psychometric',47),(146,0,'How well did you understand the dynamics of the fish population?',1,'psychometric',48),(147,0,'Did the others in your group understand the dynamics better or worse than you?',2,'psychometric',48),(148,0,'How confident are you in having developed a strategy that leads to ‘good’ outcomes regarding your goals?',3,'psychometric',48),(149,0,'How much does your strategy depend on how the others in the group will act to reach the desired outcomes?',4,'psychometric',48),(150,0,'Would you classify your strategy as ‘safe’ in the sense of having acceptable but suboptimal results for sure, or rather as ‘risky’ in the sense of having the optimal results if everything runs like expected or very poor results otherwise?',5,'psychometric',48),(153,0,'',1,'daybydaydecisions',67); +INSERT INTO `question` VALUES (1,0,'Most important goal:',1,'categorical',10),(2,0,'Second most important goal:',2,'categorical',10),(3,0,'Third most important goal:',4,'categorical',10),(4,0,'Compared to the most important goal, this goal is',3,'psychometric',10),(7,0,'An example of a scale would be',1,'psychometric',11),(8,0,'<ul>\r<li>Why did you design the strategy the way you did? What did you consider and why do you think your strategy is an adequate solution?</li>\r<li>What actions do you expect from the other fishermen in your group? Why do you think, they might act this way?</li>\r<li>How do you think your strategy will work? Will the fish population grow or shrink in the different bays? What earnings do you expect?</li>\r</ul>\r',1,'text',12),(9,0,'Compared to the most important goal, this goal is',5,'psychometric',10),(10,0,'<b>Most important goal:</b>',1,'categorical',13),(11,0,'<b>Second most important goal:</b>',2,'categorical',13),(12,0,'Compared to the most important goal, this goal is',3,'psychometric',13),(13,0,'<b>Third most important goal:</b>',4,'categorical',13),(14,0,'Compared to the most important goal, this goal is',5,'psychometric',13),(15,0,'Over all, how much do like your group (i.e. the other players)?',1,'psychometric',14),(16,0,'How important is it for you what the others think about you and your behavior (i.e. your reputation in the group)?',2,'psychometric',14),(17,0,'How important is it for you that the others can reach their goals (i.e. the outcomes are fair)?',3,'psychometric',14),(18,0,'What do you think, how important is it for the others that you can reach your goals (i.e. the outcomes are fair)?',4,'psychometric',14),(19,0,'Do you perceive the group as a team or as competing players?',5,'psychometric',14),(20,0,'How much do you trust the others in your group?',1,'psychometric',15),(21,0,'How important is it for you that the others in your group can and do trust you?',2,'psychometric',15),(22,0,'How much do you think your group trying to coordinate their actions to reach better outcomes for all?',3,'psychometric',15),(23,1,'How much are you trying to follow rules or agreements that emerged from the communication?',4,'psychometric',15),(24,1,'How much do you think <i>the others</i> are trying to follow rules or agreements that emerged from the communica-tion?',5,'psychometric',15),(25,0,'Do you feel a sense of ‘commitment’ to act in the way you specified in your strategy?',1,'psychometric',16),(26,0,'Would you feel any discomfort or tension if you would act differently than you specified in your strategy?',2,'psychometric',16),(27,0,'Do you feel any sort of ‘social pressure’ to act in the way you specified in your strategy?',3,'psychometric',16),(28,0,'Would you feel guilt or shame if you had acted differently than you specified in your strategy?',4,'psychometric',16),(29,0,'Are you afraid of some sort of ‘punishment’ if you had acted differently as specified in your strategy?',5,'psychometric',16),(30,0,'How well did you understand the dynamics of the fish population?',1,'psychometric',17),(31,0,'Did the others in your group understand the dynamics better or worse than you?',2,'psychometric',17),(32,0,'How confident are you in having developed a strategy that leads to ‘good’ outcomes regarding your goals?',3,'psychometric',17),(33,0,'How much does your strategy depend on how the others in the group will act to reach the desired outcomes?',4,'psychometric',17),(34,0,'Would you classify your strategy as ‘safe’ in the sense of having acceptable but suboptimal results for sure, or rather as ‘risky’ in the sense of having the optimal results if everything runs like expected or very poor results otherwise?',5,'psychometric',17),(37,0,'',1,'daybydaydecisions',9),(39,0,'',1,'daybydaydecisions',24),(40,0,'',1,'psychometric',27),(41,0,'… better understand the dynamics of the fish population.',1,'psychometric',29),(42,0,'… better understand the other fishermen in my group.',2,'psychometric',29),(43,0,'… better understand how to design the strategy.',3,'psychometric',29),(44,0,'… feel a ‘team spirit’ in the group.',4,'psychometric',29),(45,0,'… appraise the other fishermen in my group differently. Now I think about the others…',5,'psychometric',29),(46,0,'… better understand the dynamics of the fish population.',1,'psychometric',30),(47,0,'… better understand the other fishermen.',2,'psychometric',30),(48,0,'… better understand how to design the strategy.',3,'psychometric',30),(49,0,'… feel a ‘team spirit’ in the group.',4,'psychometric',30),(50,0,'… appraise the other fishermen in my group differently. Now I think about the others …',5,'psychometric',30),(51,0,'Did the communication have any form of reference to how to fish or design the strategy?',1,'categorical',31),(54,0,'',1,'psychometric',32),(55,0,'',2,'psychometric',32),(56,0,'',3,'psychometric',32),(57,0,'',4,'psychometric',32),(58,0,'',5,'psychometric',32),(59,0,'How clear is it to you, that you have to fish conforming to this rule, agreement or coordination attempt?',1,'psychometric',33),(60,0,'Do you think the other fishermen understood how they have to act according to this rule?<br>I think the others… ',2,'psychometric',33),(61,0,'Will you follow the rule, agreement, or coordination attempt that emerged from communication?<br>I will follow the rule…',3,'psychometric',33),(62,0,'Do you think, the other fishermen in you group will follow the rule, agreement, or coordination attempt?<br>\rI think, the others will… ',4,'psychometric',33),(63,0,'Considering the effects you expect for following the rule and your expectations of how the group will follow the rule, do you think the group will do better or worse due to the rule?',5,'psychometric',33),(64,0,'New understanding of fish dynamics',1,'text',34),(65,0,'New Expectations on how the others of the group will act',2,'text',34),(66,0,'Ideas for improving your strategy',3,'text',34),(67,0,'How interesting was the experiment for you?',1,'psychometric',35),(68,0,'How would you rate the effort you invested to design your strategy?',2,'psychometric',35),(69,0,'How difficult was it to understand the problem?',3,'psychometric',35),(70,0,'How difficult was it to find a good strategy?',4,'psychometric',35),(71,0,'How clear was it what you had to do?',5,'psychometric',35),(72,0,'How many times have you participated in problem solving experiments similar to this one?',1,'text',36),(73,0,'If you already participated in such experiments, when was the last time?',2,'categorical',36),(74,0,'Comments and Feedback',1,'text',37),(75,0,'',1,'daybydaydecisions',40),(77,0,'',1,'daybydaydecisions',55),(78,0,'',1,'psychometric',58),(79,0,'',2,'psychometric',27),(80,0,'I feel the outcomes are:',3,'psychometric',27),(81,0,'',1,'psychometric',59),(82,0,'',2,'psychometric',59),(83,0,'',3,'psychometric',59),(84,0,'',4,'psychometric',59),(85,0,'',5,'psychometric',59),(86,0,'I did not understand the dynamics of the fish population well enough.',1,'psychometric',60),(87,0,'Some of the other fishermen did not understand the dynamics of the fish population well enough.',2,'psychometric',60),(88,0,'The actions of the others in my group did not help my strategy work well.',3,'psychometric',60),(89,0,'Some of the other fishermen acted too reluctantly (harvested too few).',4,'psychometric',60),(90,0,'Some of the other fishermen acted too aggressively (harvested too much).',5,'psychometric',60),(91,0,'The group was too uncoordinated',6,'psychometric',60),(92,0,'The group did not follow the rules or agreements that emerged from the communication enough.',7,'psychometric',60),(93,0,'The rules or agreements that emerged from the communication did not work out well.',8,'psychometric',60),(94,0,'What were the most important reasons for you to deviate from your strategy during the day-by-day decisions?<br>\rIf you did not deviate from your strategy then please write something like \"No difference\" in the text field.',1,'text',61),(95,0,'New understanding of fish dynamics',1,'text',62),(96,0,'New expectations on how the others of the group will act',2,'text',62),(97,0,'Ideas for improving your strategy',3,'text',62),(98,0,'',2,'psychometric',58),(99,0,'I feel the outcomes are:',3,'psychometric',58),(100,0,'',1,'psychometric',63),(101,0,'',2,'psychometric',63),(102,0,'',3,'psychometric',63),(103,0,'',4,'psychometric',63),(104,0,'',5,'psychometric',63),(105,0,'I did not understand the dynamics of the fish population well enough.',1,'psychometric',64),(106,0,'Some of the other fishermen did not understand the dynamics of the fish population well enough',2,'psychometric',64),(107,0,'The actions of the others in my group did not help my strategy work well.',3,'psychometric',64),(108,0,'Some of the other fishermen acted too reluctantly (harvested too few).',4,'psychometric',64),(109,0,'Some of the other fishermen acted too aggressively (harvested too much).',5,'psychometric',64),(110,0,'The group was too uncoordinated',6,'psychometric',64),(111,0,'The group did not follow the rules or agreements that emerged from the communication enough.',7,'psychometric',64),(112,0,'The rules or agreements that emerged from the communication did not work out well.',8,'psychometric',64),(113,0,'What were the most important reasons for you to deviate from your strategy during the day-by-day decisions?<br>\rIf you did not deviate from your strategy then please write something like \"No difference\" in the text field.',1,'text',65),(114,0,'New understanding of fish dynamics',1,'text',66),(115,0,'New expectations on how the others of the group will act',2,'text',66),(116,0,'Ideas for improving your strategy',3,'text',66),(117,0,'Describe in your own words what the rule, agreement, or other coordination attempt states. Describe how you and the others should act and what would happen if one does not act in this way.<br>\rIf you cannot identify any sort of coordination attempt in the communication, write \"no coordination\" in the field below.<br>\r(The information you write in this field will be available the next time you edit your strategy.)',2,'text',31),(118,0,'How often do you play strategy games (i.e. any games where you have to anticipate the moves of other players and plan your own moves ahead, like computer games, card games, board games, etc)?',3,'categorical',36),(120,0,'<ul>\r<li>Why did you design the strategy the way you did? What did you consider and why do you think your strategy is an adequate solution?</li>\r<li>What actions do you expect from the other fishermen in your group? Why do you think, they might act this way?</li>\r<li>How do you think your strategy will work? Will the fish population grow or shrink in the different bays? What earnings do you expect?</li>\r</ul>\r',1,'text',42),(121,0,'Most important goal:',1,'categorical',43),(122,0,'Second most important goal:',2,'categorical',43),(123,0,'Compared to the most important goal, this goal is',3,'psychometric',43),(124,0,'Third most important goal:',4,'categorical',43),(125,0,'Compared to the most important goal, this goal is',5,'psychometric',43),(126,0,'<b>Most important goal:</b>',1,'categorical',44),(127,0,'<b>Second most important goal:</b>',2,'categorical',44),(128,0,'Compared to the most important goal, this goal is',3,'psychometric',44),(129,0,'<b>Third most important goal:</b>',4,'categorical',44),(130,0,'Compared to the most important goal, this goal is',5,'psychometric',44),(131,0,'Over all, how much do like your group (i.e. the other players)?',1,'psychometric',45),(132,0,'How important is it for you what the others think about you and your behavior (i.e. your reputation in the group)?',2,'psychometric',45),(133,0,'How important is it for you that the others can reach their goals (i.e. the outcomes are fair)?',3,'psychometric',45),(134,0,'What do you think, how important is it for the others that you can reach your goals (i.e. the outcomes are fair)?',4,'psychometric',45),(135,0,'Do you perceive the group as a team or as competing players?',5,'psychometric',45),(136,0,'How much do you trust the others in your group?',1,'psychometric',46),(137,0,'How important is it for you that the others in your group can and do trust you?',2,'psychometric',46),(138,0,'How much do you think your group trying to coordinate their actions to reach better outcomes for all?',3,'psychometric',46),(139,0,'How much are you trying to follow rules or agreements that emerged from the communication?',4,'psychometric',46),(140,0,'How much do you think <i>the others</i> are trying to follow rules or agreements that emerged from the communica-tion?',5,'psychometric',46),(141,0,'Do you feel a sense of ‘commitment’ to act in the way you specified in your strategy?',1,'psychometric',47),(142,0,'Would you feel any discomfort or tension if you would act differently than you specified in your strategy?',2,'psychometric',47),(143,0,'Do you feel any sort of ‘social pressure’ to act in the way you specified in your strategy?',3,'psychometric',47),(144,0,'Would you feel guilt or shame if you had acted differently than you specified in your strategy?',4,'psychometric',47),(145,0,'Are you afraid of some sort of ‘punishment’ if you had acted differently as specified in your strategy?',5,'psychometric',47),(146,0,'How well did you understand the dynamics of the fish population?',1,'psychometric',48),(147,0,'Did the others in your group understand the dynamics better or worse than you?',2,'psychometric',48),(148,0,'How confident are you in having developed a strategy that leads to ‘good’ outcomes regarding your goals?',3,'psychometric',48),(149,0,'How much does your strategy depend on how the others in the group will act to reach the desired outcomes?',4,'psychometric',48),(150,0,'Would you classify your strategy as ‘safe’ in the sense of having acceptable but suboptimal results for sure, or rather as ‘risky’ in the sense of having the optimal results if everything runs like expected or very poor results otherwise?',5,'psychometric',48),(153,0,'',1,'daybydaydecisions',67),(155,1,'',1,'communication',28); /*!40000 ALTER TABLE `question` ENABLE KEYS */; UNLOCK TABLES; @@ -910,4 +906,4 @@ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2009-11-30 19:23:38 +-- Dump completed on 2010-01-12 21:34:16 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-07 05:17:04 UTC (rev 426) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java 2010-01-12 21:42:47 UTC (rev 427) @@ -58,14 +58,14 @@ private int blockSeqNo; - + MessageHandler msgHandler; - + static final String roundNo = "SELECT gameRound.seqNo " + - "FROM GameRound gameRound, Game game " + - "where gameRound.gameConfig =:gameConfig and gameRound.round =:currentRound"; - - + "FROM GameRound gameRound, Game game " + + "where gameRound.gameConfig =:gameConfig and gameRound.round =:currentRound"; + + public GameService() { } @@ -94,41 +94,41 @@ public Game createGame(Game game) { - //getLogger().debug("game came from flex is : " + game.getGameCode()); + //getLogger().debug("game came from flex is : " + game.getGameCode()); - Game newGame = new Game(); - //currentGame = game; - try - { - newGame.setGameCode(game.getGameCode()); - newGame.setMoney(game.getMoney()); - newGame.setTimestamp(game.getTimestamp()); + Game newGame = new Game(); + //currentGame = game; + try + { + newGame.setGameCode(game.getGameCode()); + newGame.setMoney(game.getMoney()); + newGame.setTimestamp(game.getTimestamp()); - //FIXME: Currently using default GameConfiguration whose id is 1 - GameConfig gameConfig = gameConfigDao.find(1L); - newGame.setGameConfig(gameConfig); - getDao().save(newGame); - String str = newGame.getGameCode()+newGame.getId(); + //FIXME: Currently using default GameConfiguration whose id is 1 + GameConfig gameConfig = gameConfigDao.find(1L); + newGame.setGameConfig(gameConfig); + getDao().save(newGame); + String str = newGame.getGameCode()+newGame.getId(); - if(getDao().findAllByProperty("gameCode", str).size() != 0) - { - //getLogger().debug("in if loop "); - newGame = null; - } - else - { - newGame.setGameCode(str); - getDao().save(newGame); - getLogger().info("Created the game: " + newGame.getId()); - //setAllLocations(gameConfig); - initializeGame(newGame); - } - }catch(Exception e) - { - e.printStackTrace(); - } - getLogger().debug("current game from flex is: " + newGame.getId()); - return newGame; + if(getDao().findAllByProperty("gameCode", str).size() != 0) + { + //getLogger().debug("in if loop "); + newGame = null; + } + else + { + newGame.setGameCode(str); + getDao().save(newGame); + getLogger().info("Created the game: " + newGame.getId()); + //setAllLocations(gameConfig); + initializeGame(newGame); + } + }catch(Exception e) + { + e.printStackTrace(); + } + getLogger().debug("current game from flex is: " + newGame.getId()); + return newGame; } @@ -144,7 +144,7 @@ public boolean startGame(Game game) { boolean flag = false; - + if(isSufficientStudents(game)) { assignGroups(game); @@ -156,7 +156,7 @@ { flag = false; } - + return flag; } @@ -167,7 +167,7 @@ Game currentGame = getDao().find(game.getId()); if(getStudentDao().findAllByProperty("game", currentGame).size() > 0) flag = true; - + return flag; } @@ -184,32 +184,32 @@ int i=0; try { - i++; - newGameState = getBlock(game); - game = newGameState; - if(newGameState == null) - { - getLogger().debug("game state is null..."); - msgHandler.sendBlock(null); - } - else - { - getLogger().debug("game state is NOT null..."); - block = newGameState.getCurrentBlock(); - initializeGame(newGameState); - msgHandler.sendBlock(newGameState); - } - + i++; + newGameState = getBlock(game); + game = newGameState; + if(newGameState == null) + { + getLogger().debug("game state is null..."); + msgHandler.sendBlock(null); + } + else + { + getLogger().debug("game state is NOT null..."); + block = newGameState.getCurrentBlock(); + initializeGame(newGameState); + msgHandler.sendBlock(newGameState); + } + }catch (Exception e) { - getLogger().debug(e); + e.printStackTrace(); } } public void pushNextData(Game game) { // TODO Auto-generated method stub pushBlock(game); - + } - + public void assignGroups(Game currentGame) { @@ -324,10 +324,10 @@ grp.setNumber(++groupNo); groupDao.save(grp); getLogger().info("Group is created with id: " + grp.getId()); - + //set all location for the group setAllLocations(grp,groupSize); - + int studentNo = 1; int j = 0; for(int i = 0; i <= groupSize-1 ; i++) @@ -358,8 +358,8 @@ getLogger().info("in setAllLocations...group size is: " + groupSize); double maxCapacity = 0.0; double initCapacity = 0.0; - - + + List<Location> locations = new ArrayList<Location>(); locations = locationDao.findAll(); for(Location location:locations) @@ -369,13 +369,13 @@ groupLocation.setGroup(groupDao.find(grp.getId())); if(location.getLocationName().equalsIgnoreCase("bay1")) { - + groupLocation.setLocation(location); maxCapacity = 3.0*groupSize; - + groupLocation.setMaxCapacity(maxCapacity); initCapacity = maxCapacity/2; - + groupLocation.setInitialPopulation(initCapacity); //groupLocation.setCurrentPopulation(initCapacity); getLogger().info("initiali population set is: " + initCapacity); @@ -390,50 +390,50 @@ groupLocation.setMaxCapacity(maxCapacity); initCapacity = maxCapacity/2; - + groupLocation.setInitialPopulation(initCapacity); - /* groupLocation.setCurrentPopulation(initCapacity); + /* groupLocation.setCurrentPopulation(initCapacity); groupLocation.setFishLeaving(0.0); groupLocation.setFishReturned(0.0); -*/ + */ getLogger().info("initiali population set is: " + initCapacity); } if(location.getLocationName().equalsIgnoreCase("bay3")) { groupLocation.setLocation(location); maxCapacity = 10.0*groupSize; - + groupLocation.setMaxCapacity(maxCapacity); initCapacity = maxCapacity/2; - + groupLocation.setInitialPopulation(initCapacity); - + getLogger().info("initiali population set is: " + initCapacity); /*groupLocation.setCurrentPopulation(initCapacity); groupLocation.setFishLeaving(0.0); groupLocation.setFishReturned(0.0); -*/ + */ } if(location.getLocationName().equalsIgnoreCase("harbor")) { groupLocation.setLocation(location); maxCapacity = 0.0*groupSize; - + groupLocation.setMaxCapacity(maxCapacity); initCapacity = maxCapacity/2; - + groupLocation.setInitialPopulation(initCapacity); -/* groupLocation.setCurrentPopulation(initCapacity); + /* groupLocation.setCurrentPopulation(initCapacity); getLogger().info("initiali population set is: " + initCapacity); groupLocation.setFishLeaving(0.0); groupLocation.setFishReturned(0.0); -*/ + */ } //groupLocation.setDayByDayDecsion(null); groupLocationDao.save(groupLocation); getLogger().info("group location is created and id is: " + groupLocation.getId()); - + } } @@ -524,7 +524,7 @@ return locations; } -*/ + */ public Module getNextModule(int sequenceNo) { return getModule(sequenceNo); @@ -830,8 +830,8 @@ } } } - + Module module = block.getModule(); Hibernate.initialize(module); initializeModule(module); @@ -909,11 +909,11 @@ if(query.list().size() == 1) roundNo = (Integer) query.list().get(0); } - + return roundNo; } - + public boolean isGameFinished(Game game) { GameConfig gameConfig = game.getGameConfig(); List<GameRound> gameRounds = getGameRoundDao().findAllByProperty("gameConfig",game.getGameConfig()); @@ -1083,7 +1083,7 @@ private void initializeRound(Round round) { // TODO Auto-generated method stub Hibernate.initialize(round); - + } public void setBlockSeqNo(int blockSeqNo) { @@ -1183,5 +1183,5 @@ this.groupLocationDao = groupLocationDao; } - + } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java 2010-01-07 05:17:04 UTC (rev 426) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java 2010-01-12 21:42:47 UTC (rev 427) @@ -89,13 +89,13 @@ { //int duration = game.getBlock().getDuration(); - /* if(game.getCurrentBlock().getDescription().equalsIgnoreCase("Day-by-day decisions game")) + /*if(game.getCurrentBlock().getDescription().equalsIgnoreCase("Day-by-day decisions game")) { //start 10 sec timer //i = max days hardcoded for(int i =0;i<30;i++) { - int duration = 11; + duration = 11; Timer timer = new Timer(); Long startTime = System.currentTimeMillis()/1000; System.out.println("Started time is : " + System.currentTimeMillis()/1000); @@ -114,8 +114,7 @@ send(studentDecisions); } } - else */ - if(game.getCurrentBlock().getDescription().equalsIgnoreCase("Communication")){ + else*/ if(game.getCurrentBlock().getDescription().equalsIgnoreCase("Communication")){ duration = game.getCurrentBlock().getDuration(); } else @@ -136,23 +135,23 @@ pushData.pushNextData(game); } - //} - else - { - System.out.println("Game is Over..." + msg); - } + //} + else + { + System.out.println("Game is Over..." + msg); + } - /*AcknowledgeMessage ack = msgBroker.routeMessageToService(msg, null); + /*AcknowledgeMessage ack = msgBroker.routeMessageToService(msg, null); logger.info("Ack received from client for message " + msg + "is : " + ack); - */ -} + */ + } -@Override -public void setApplicationContext(ApplicationContext applicationContext) -throws BeansException { - // TODO Auto-generated method stub - this.ctx = applicationContext; + @Override + public void setApplicationContext(ApplicationContext applicationContext) + throws BeansException { + // TODO Auto-generated method stub + this.ctx = applicationContext; + } } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-04-07 02:18:40
|
Revision: 92 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=92&view=rev Author: alllee Date: 2009-04-07 02:18:30 +0000 (Tue, 07 Apr 2009) Log Message: ----------- basic test class for generating schema via hibernate tools Modified Paths: -------------- mentalmodels/trunk/init-db.ant.xml mentalmodels/trunk/pom.xml mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml Added Paths: ----------- mentalmodels/trunk/src/main/java/edu/ mentalmodels/trunk/src/main/java/edu/asu/ mentalmodels/trunk/src/main/java/edu/asu/commons/ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java Modified: mentalmodels/trunk/init-db.ant.xml =================================================================== --- mentalmodels/trunk/init-db.ant.xml 2009-04-07 01:51:17 UTC (rev 91) +++ mentalmodels/trunk/init-db.ant.xml 2009-04-07 02:18:30 UTC (rev 92) @@ -32,6 +32,8 @@ the mmedev database --> + <echo message='compile classpath: ${compile.classpath}'/> + <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpath="${compile.classpath}"/> <target name="init-db" depends="create-db-schema"/> <target name='create-db-schema'> Modified: mentalmodels/trunk/pom.xml =================================================================== --- mentalmodels/trunk/pom.xml 2009-04-07 01:51:17 UTC (rev 91) +++ mentalmodels/trunk/pom.xml 2009-04-07 02:18:30 UTC (rev 92) @@ -43,7 +43,7 @@ <dependency> <groupId>org.springframework</groupId> <artifactId>spring-hibernate3</artifactId> - <version>2.0-m4</version> + <version>2.0-m3</version> </dependency> <!-- hibernate and JPA persistence --> <dependency> @@ -53,16 +53,6 @@ </dependency> <dependency> <groupId>org.hibernate</groupId> - <artifactId>hibernate-core</artifactId> - <version>3.3.1.GA</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-entitymanager</artifactId> - <version>3.3.2.GA</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> <version>3.4.0.GA</version> </dependency> Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java 2009-04-07 02:18:30 UTC (rev 92) @@ -0,0 +1,31 @@ +package edu.asu.commons.mme.entity; + +import javax.persistence.*; + +@Entity +@Table(name="student") +public class Student { + + private String name; + + @Id @GeneratedValue + private Long id; + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + +} Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-04-07 01:51:17 UTC (rev 91) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-04-07 02:18:30 UTC (rev 92) @@ -7,10 +7,7 @@ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> -<!-- <mapping class='edu.asu.commons.mme.entity.Student'/>--> -<mapping class='game.GameConfig'/> -<mapping class='game.RoundConfig'/> - + <mapping class='edu.asu.commons.mme.entity.Student'/> </session-factory> </hibernate-configuration> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-04-09 01:27:48
|
Revision: 93 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=93&view=rev Author: seematalele Date: 2009-04-09 01:27:37 +0000 (Thu, 09 Apr 2009) Log Message: ----------- Created the POJO's. Schema can be created successfully using POJO. Modified Paths: -------------- mentalmodels/trunk/init-db.ant.xml mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml Added Paths: ----------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Categorial.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Communication.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayOutput.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Gender.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/LocationConfig.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Psychometric.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Question.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundConfig.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentRoundConfig.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/SuspendRepetition.java Removed Paths: ------------- mentalmodels/trunk/src/main/java/game/ Modified: mentalmodels/trunk/init-db.ant.xml =================================================================== --- mentalmodels/trunk/init-db.ant.xml 2009-04-07 02:18:30 UTC (rev 92) +++ mentalmodels/trunk/init-db.ant.xml 2009-04-09 01:27:37 UTC (rev 93) @@ -1,65 +1,65 @@ <?xml version="1.0"?> -<!-- -vim:sts=2:sw=2 -$Id: init-db.ant.xml 239 2009-03-20 17:49:19Z alllee $ -$Revision: 239 $ -Master build file for MME deployment. ---> -<project name="mme" default="help"> - <!-- where the applicationContext.xml and hibernate.cfg.xml are currently located, this may change --> - <property name='web.inf.dir' value='src/main/webapp/WEB-INF'/> - <property name='db.dir' value='src/main/db'/> - <property name='db.generated.dir' value='${db.dir}/generated'/> - <property name='hibernate.properties.file' value='${web.inf.dir}/hibernate.properties'/> - <!-- first load environment vars from hibernate directly--> - <property file="${hibernate.properties.file}"/> - - <!-- - define some sane default values for db connection if undefined in - build.properties - --> - <property name='db.name' value='mme'/> - - <property name='hibernate.connection.url' value='jdbc:mysql://localhost/${db.name}'/> - <property name='hibernate.connection.username' value='mme'/> - - <property name='hibernate.connection.password' value='mme.mme'/> - <property name='hibernate.connection.driver_class' value='com.mysql.jdbc.Driver'/> - <property name='hibernate.dialect' value='org.hibernate.dialect.MySQLInnoDBDialect'/> - - <!-- - this should always be available, connect to this if we need to create - the mmedev database - --> - - <echo message='compile classpath: ${compile.classpath}'/> - - <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpath="${compile.classpath}"/> - <target name="init-db" depends="create-db-schema"/> - <target name='create-db-schema'> - <mkdir dir='${db.generated.dir}'/> - <echo message="You must have valid database connection information within hibernate.properties for this task to succeed."/> - <hibernatetool destdir='${db.generated.dir}'> - <!-- annotated class/packages are specified in the hibernate.cfg.xml --> - - <annotationconfiguration propertyFile="${hibernate.properties.file}" configurationfile="${web.inf.dir}/hibernate.cfg.xml"/> - <hbm2ddl export="true" drop="true" outputfilename="mme.sql"/> - - </hibernatetool> - </target> - <target name='create-indexes'> - <sql onerror='continue' autocommit='true' driver="${hibernate.connection.driver_class}" url="${hibernate.connection.url}" userid="${hibernate.connection.username}" password="${hibernate.connection.password}" classpath="${compile.classpath}"> - <transaction src="${db.dir}/create-indexes.sql"/> - </sql> - </target> - <target name="initialize-data" depends="init-db"> - <sql driver="${hibernate.connection.driver_class}" - url="${hibernate.connection.url}" - userid="${hibernate.connection.username}" - password="${hibernate.connection.password}" - classpath="${compile.classpath}" - - src="${db.dir}/init-mme.sql"/> - - </target> -</project> + <!-- + vim:sts=2:sw=2 + $Id: init-db.ant.xml 239 2009-03-20 17:49:19Z alllee $ + $Revision: 239 $ + Master build file for MME deployment. + --> + <project name="mme" default="help"> + <!-- where the applicationContext.xml and hibernate.cfg.xml are currently located, this may change --> + <property name='web.inf.dir' value='src/main/webapp/WEB-INF'/> + <property name='db.dir' value='src/main/db'/> + <property name='db.generated.dir' value='${db.dir}/generated'/> + <property name='hibernate.properties.file' value='${web.inf.dir}/hibernate.properties'/> + <!-- first load environment vars from hibernate directly--> + <property file="${hibernate.properties.file}"/> + + <!-- + define some sane default values for db connection if undefined in + build.properties + --> + <property name='db.name' value='mme'/> + + <property name='hibernate.connection.url' value='jdbc:mysql://localhost/${db.name}'/> + <property name='hibernate.connection.username' value='mme'/> + + <property name='hibernate.connection.password' value='mme.mme'/> + <property name='hibernate.connection.driver_class' value='com.mysql.jdbc.Driver'/> + <property name='hibernate.dialect' value='org.hibernate.dialect.MySQLInnoDBDialect'/> + + <!-- + this should always be available, connect to this if we need to create + the mmedev database + --> + + <echo message='compile classpath: ${compile.classpath}'/> + + <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpath="${compile.classpath}"/> + <target name="init-db" depends="create-db-schema"/> + <target name='create-db-schema'> + <mkdir dir='${db.generated.dir}'/> + <echo message="You must have valid database connection information within hibernate.properties for this task to succeed."/> + <hibernatetool destdir='${db.generated.dir}'> + <!-- annotated class/packages are specified in the hibernate.cfg.xml --> + + <annotationconfiguration propertyFile="${hibernate.properties.file}" configurationfile="${web.inf.dir}/hibernate.cfg.xml"/> + <hbm2ddl export="true" drop="true" outputfilename="mme.sql"/> + + </hibernatetool> + </target> + <target name='create-indexes'> + <sql onerror='continue' autocommit='true' driver="${hibernate.connection.driver_class}" url="${hibernate.connection.url}" userid="${hibernate.connection.username}" password="${hibernate.connection.password}" classpath="${compile.classpath}"> + <transaction src="${db.dir}/create-indexes.sql"/> + </sql> + </target> + <target name="initialize-data" depends="init-db"> + <sql driver="${hibernate.connection.driver_class}" + url="${hibernate.connection.url}" + userid="${hibernate.connection.username}" + password="${hibernate.connection.password}" + classpath="${compile.classpath}" + + src="${db.dir}/init-mme.sql"/> + + </target> + </project> Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Categorial.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Categorial.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Categorial.java 2009-04-09 01:27:37 UTC (rev 93) @@ -0,0 +1,34 @@ +package edu.asu.commons.mme.entity; + + +import java.util.List; + +import javax.persistence.Entity; + +import javax.persistence.Table; + +import org.hibernate.annotations.CollectionOfElements; +import org.hibernate.annotations.IndexColumn; + + +@Entity +@Table(name="categorial") +public class Categorial extends Question { + + + + @CollectionOfElements + @IndexColumn(name = "choices", base=1) + private List<String> choices; + + public void setChoices(List<String> choices) { + this.choices = choices; + } + + public List<String> getChoices() { + return choices; + } + + + +} Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Communication.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Communication.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Communication.java 2009-04-09 01:27:37 UTC (rev 93) @@ -0,0 +1,74 @@ +package edu.asu.commons.mme.entity; + +import java.util.Date; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.ManyToOne; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Table; + + +@Entity +@Table(name="communication") +public class Communication { + + @Id + @GeneratedValue + private Long id; + + @Lob + private String message; + + @Temporal(TemporalType.TIMESTAMP) + private Date timestamp; + + @ManyToOne + private Student student; + + @ManyToOne + private RoundConfig roundconfig; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getMessage() { + return message; + } + + public void setTimestamp(Date timestamp) { + this.timestamp = timestamp; + } + + public Date getTimestamp() { + return timestamp; + } + + public void setRoundconfig(RoundConfig roundconfig) { + this.roundconfig = roundconfig; + } + + public RoundConfig getRoundconfig() { + return roundconfig; + } + + public void setStudent(Student student) { + this.student = student; + } + + public Student getStudent() { + return student; + } + +} Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayOutput.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayOutput.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayOutput.java 2009-04-09 01:27:37 UTC (rev 93) @@ -0,0 +1,59 @@ +package edu.asu.commons.mme.entity; + + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name="student_day_output") +public class DayOutput { + + @Id + @GeneratedValue + private Long id; + + + @ManyToOne + private StudentStrategy strategy; + + private Integer day; + + private Float earnings; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setDay(Integer day) { + this.day = day; + } + + public Integer getDay() { + return day; + } + + public void setEarnings(Float earnings) { + this.earnings = earnings; + } + + public Float getEarnings() { + return earnings; + } + + public void setStrategy(StudentStrategy strategy) { + this.strategy = strategy; + } + + public StudentStrategy getStrategy() { + return strategy; + } + +} Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java 2009-04-09 01:27:37 UTC (rev 93) @@ -0,0 +1,114 @@ +package edu.asu.commons.mme.entity; + +import java.util.ArrayList; +import java.util.List; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Column; +import javax.persistence.GeneratedValue; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import java.util.Date; + + +@Entity +@Table(name="game") +public class GameConfig { + + @Id + @GeneratedValue + private Long id; + + private Integer noOfRounds; + private Integer noOfLocation; + private Integer maxDays; + private Integer maxFishHarvest; + + @Temporal(TemporalType.DATE) + private Date timestamp; + + private String title; + + @Lob + private String description; + + @Column(scale=2) + private Float money; + private String img_address; + + @OneToMany + private List<RoundConfig> roundconfig= new ArrayList<RoundConfig>(); + + + public void setId(Long id) { + this.id = id; + } + public Long getId() { + return id; + } + public void setNo_of_rounds(Integer no_of_rounds) { + this.noOfRounds = no_of_rounds; + } + public Integer getNo_of_rounds() { + return noOfRounds; + } + public void setNo_of_location(Integer no_of_location) { + this.noOfLocation = no_of_location; + } + public Integer getNo_of_location() { + return noOfLocation; + } + public void setMax_fish_harvest(Integer max_fish_harvest) { + this.maxFishHarvest = max_fish_harvest; + } + public Integer getMax_fish_harvest() { + return maxFishHarvest; + } + public void setMax_no_of_days(Integer max_no_of_days) { + this.maxDays = max_no_of_days; + } + public Integer getMax_no_of_days() { + return maxDays; + } + public void setTimestamp(Date timestamp) { + this.timestamp = timestamp; + } + public Date getTimestamp() { + return timestamp; + } + public void setTitle(String title) { + this.title = title; + } + public String getTitle() { + return title; + } + public void setDescription(String description) { + this.description = description; + } + public String getDescription() { + return description; + } + public void setMoney(Float money) { + this.money = money; + } + public Float getMoney() { + return money; + } + public void setImg_address(String img_address) { + this.img_address = img_address; + } + public String getImg_address() { + return img_address; + } + public void setRoundconfig(List<RoundConfig> roundconfig) { + this.roundconfig = roundconfig; + } + public List<RoundConfig> getRoundconfig() { + return roundconfig; + } + +} + Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Gender.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Gender.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Gender.java 2009-04-09 01:27:37 UTC (rev 93) @@ -0,0 +1,5 @@ +package edu.asu.commons.mme.entity; + +public enum Gender { +Female, Male +} Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java 2009-04-09 01:27:37 UTC (rev 93) @@ -0,0 +1,55 @@ +package edu.asu.commons.mme.entity; + + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + + +/** + * Entity implementation class for Entity: Group + * @param <Student> + * + */ +@Entity +@Table(name="grp") +public class Group { + + @Id + @GeneratedValue + private Long id; + + @Column(name="grp_no") + private Integer no; + + @ManyToOne + private GameConfig game; + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + public Integer getNo() { + return this.no; + } + + public void setNo(Integer no) { + this.no = no; + } + + + public void setGame(GameConfig game) { + this.game = game; + } + + public GameConfig getGame() { + return game; + } + +} Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/LocationConfig.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/LocationConfig.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/LocationConfig.java 2009-04-09 01:27:37 UTC (rev 93) @@ -0,0 +1,63 @@ +package edu.asu.commons.mme.entity; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "location_config") +public class LocationConfig { + + @Id + @GeneratedValue + private Long id; + + @ManyToOne + private RoundConfig roundconfig; + + private String locationName; + private Integer maxCapacity; + private Float growthRate; + private Integer startPopulation; + + public void setId(Long id) { + this.id = id; + } + public Long getId() { + return id; + } + + public void setLocation_name(String location_name) { + this.locationName = location_name; + } + public String getLocation_name() { + return locationName; + } + public void setMax_capacity(Integer max_capacity) { + this.maxCapacity = max_capacity; + } + public Integer getMax_capacity() { + return maxCapacity; + } + public void setGrowth_rate(Float growth_rate) { + this.growthRate = growth_rate; + } + public Float getGrowth_rate() { + return growthRate; + } + public void setStart_population(Integer start_population) { + this.startPopulation = start_population; + } + public Integer getStart_population() { + return startPopulation; + } + public void setRoundconfig(RoundConfig roundconfig) { + this.roundconfig = roundconfig; + } + public RoundConfig getRoundconfig() { + return roundconfig; + } + +} Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Psychometric.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Psychometric.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Psychometric.java 2009-04-09 01:27:37 UTC (rev 93) @@ -0,0 +1,70 @@ +package edu.asu.commons.mme.entity; + + + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.DiscriminatorValue; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.Lob; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +import org.hibernate.annotations.CollectionOfElements; +import org.hibernate.annotations.IndexColumn; + +@Entity +@Table(name="psychometric") + + +public class Psychometric extends Question{ + + private String scale; + + @Column(name="no_of_intervals") + private String intervals; + + @CollectionOfElements + @IndexColumn(name = "choices", base=1) + private List<String> choices; + + public void setChoices(List<String> choices) { + this.choices = choices; + } + + public List<String> getChoices() { + return choices; + } + + public void setIntervals(String intervals) { + this.intervals = intervals; + } + + public String getIntervals() { + return intervals; + } + + public void setScale(String scale) { + this.scale = scale; + } + + public String getScale() { + return scale; + } + + /*public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + }*/ +} Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Question.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Question.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Question.java 2009-04-09 01:27:37 UTC (rev 93) @@ -0,0 +1,107 @@ +package edu.asu.commons.mme.entity; + + +import javax.persistence.Column; +import javax.persistence.DiscriminatorColumn; +import javax.persistence.DiscriminatorType; +import javax.persistence.DiscriminatorValue; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.JoinColumn; +import javax.persistence.Lob; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name="question") +@Inheritance(strategy = InheritanceType.JOINED) + + +public class Question { + @Id + @GeneratedValue + private Long id; + + @ManyToOne + @JoinColumn(name="question_group_id", insertable=false, updatable=false) + private QuestionGroup questionGroup; + + @Lob + private String question; + + @Column (name="single_location" ) + private boolean singleLocation; + + @Column (name="multi_location" ) + private boolean multiLocation; + + @Column (name="misc_location" ) + private boolean miscLocation; + + @Column(name = "sequence_no") + private Integer sequenceNo; + + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + + public void setQuestion(String question) { + this.question = question; + } + + public String getQuestion() { + return question; + } + + public void setSingleLocation(boolean singleLocation) { + this.singleLocation = singleLocation; + } + + public boolean isSingleLocation() { + return singleLocation; + } + + public void setMultiLocation(boolean multiLocation) { + this.multiLocation = multiLocation; + } + + public boolean isMultiLocation() { + return multiLocation; + } + + public void setMiscLocation(boolean miscLocation) { + this.miscLocation = miscLocation; + } + + public boolean isMiscLocation() { + return miscLocation; + } + + public void setSequenceNo(Integer sequenceNo) { + this.sequenceNo = sequenceNo; + } + + public Integer getSequenceNo() { + return sequenceNo; + } + + public void setQuestionGroup(QuestionGroup questionGroup) { + this.questionGroup = questionGroup; + } + + public QuestionGroup getQuestionGroup() { + return questionGroup; + } + + +} Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java 2009-04-09 01:27:37 UTC (rev 93) @@ -0,0 +1,47 @@ +package edu.asu.commons.mme.entity; + + +import java.util.Set; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.ManyToMany; +import javax.persistence.Table; + +@Entity +@Table(name="question_group") +public class QuestionGroup { + @Id + @GeneratedValue + private Long id; + + @ManyToMany(mappedBy = "questiongroup") + private Set<RoundConfig>roundconfig; + + @Column(name = "sequence_no") + private Integer sequenceNo; + + + public void setId(Long id) { + this.id = id; + } + public Long getId() { + return id; + } + + public void setSequenceNo(Integer sequenceNo) { + this.sequenceNo = sequenceNo; + } + public Integer getSequenceNo() { + return sequenceNo; + } + public void setRoundconfig(Set<RoundConfig> roundconfig) { + this.roundconfig = roundconfig; + } + public Set<RoundConfig> getRoundconfig() { + return roundconfig; + } + +} Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundConfig.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundConfig.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundConfig.java 2009-04-09 01:27:37 UTC (rev 93) @@ -0,0 +1,66 @@ +package edu.asu.commons.mme.entity; + + +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.ManyToMany; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name="round_config") +public class RoundConfig { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + private Integer round_no; + + @ManyToOne + private GameConfig game; + + private Boolean communication_flag; + + @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}) + private Set<QuestionGroup> questiongroup; + + public void setId(Long id) { + this.id = id; + } + public Long getId() { + return id; + } + public void setRound_no(Integer round_no) { + this.round_no = round_no; + } + public Integer getRound_no() { + return round_no; + } + + public void setCommunication_flag(Boolean communication_flag) { + this.communication_flag = communication_flag; + } + public Boolean getCommunication_flag() { + return communication_flag; + } + public void setGame(GameConfig game) { + this.game = game; + } + public GameConfig getGame() { + return game; + } + public void setQuestiongroup(Set<QuestionGroup> questiongroup) { + this.questiongroup = questiongroup; + } + public Set<QuestionGroup> getQuestiongroup() { + return questiongroup; + } + + + +} 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-04-07 02:18:30 UTC (rev 92) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java 2009-04-09 01:27:37 UTC (rev 93) @@ -1,25 +1,40 @@ package edu.asu.commons.mme.entity; -import javax.persistence.*; +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.ManyToOne; +import javax.persistence.Table; + + @Entity @Table(name="student") public class Student { - private String name; - - @Id @GeneratedValue + @Id + @GeneratedValue private Long id; - - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - + + @ManyToOne + private Group group; + + @Column(name="student_no") + private Integer studentNo; + + @Column(name="year_birth",length = 4) + private Integer birthYear; + + private String major; + + private String enthnicity; + + @Enumerated(EnumType.STRING) + private Gender gender; + public Long getId() { return id; } @@ -28,4 +43,52 @@ this.id = id; } + public void setGroup(Group group) { + this.group = group; + } + + public Group getGroup() { + return group; + } + + public void setStudentNo(Integer studentNo) { + this.studentNo = studentNo; + } + + public Integer getStudentNo() { + return studentNo; + } + + public void setBirthYear(Integer birthYear) { + this.birthYear = birthYear; + } + + public Integer getBirthYear() { + return birthYear; + } + + public void setMajor(String major) { + this.major = major; + } + + public String getMajor() { + return major; + } + + public void setEnthnicity(String enthnicity) { + this.enthnicity = enthnicity; + } + + public String getEnthnicity() { + return enthnicity; + } + + public void setGender(Gender gender) { + this.gender = gender; + } + + public Gender getGender() { + return gender; + } + } Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentRoundConfig.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentRoundConfig.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentRoundConfig.java 2009-04-09 01:27:37 UTC (rev 93) @@ -0,0 +1,74 @@ +package edu.asu.commons.mme.entity; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + + + +@Entity +@Table(name="student_round_config") + +public class StudentRoundConfig { + + + @Id + @GeneratedValue + private Long id; + + @ManyToOne + private Student student; + + @ManyToOne + private RoundConfig roundconfig; + + @Column(name="current_allocation_no") + private Integer currentAllocationNo; + + @Column(name="current_day_no") + private Integer currentDayNo; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setStudent(Student student) { + this.student = student; + } + + public Student getStudent() { + return student; + } + + public void setRoundconfig(RoundConfig roundconfig) { + this.roundconfig = roundconfig; + } + + public RoundConfig getRoundconfig() { + return roundconfig; + } + + public void setCurrentAllocationNo(Integer currentAllocationNo) { + this.currentAllocationNo = currentAllocationNo; + } + + public Integer getCurrentAllocationNo() { + return currentAllocationNo; + } + + public void setCurrentDayNo(Integer currentDayNo) { + this.currentDayNo = currentDayNo; + } + + public Integer getCurrentDayNo() { + return currentDayNo; + } + +} Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java 2009-04-09 01:27:37 UTC (rev 93) @@ -0,0 +1,113 @@ +package edu.asu.commons.mme.entity; + + +import java.util.List; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; + +import javax.persistence.Table; + + + +@Entity +@Table(name="student_strategy") + +public class StudentStrategy { + + @Id + @GeneratedValue + private Long id; + + + @ManyToOne + private RoundConfig roundconfig; + + @Column(name = "allocation_sequence_no") + private Integer allocationSeqNo; + + private Integer days; + + private Float threshold; + + @ManyToOne + private LocationConfig location; + + @Column (name="repeated_decisions") + private boolean repeatedDecisions; + + + @OneToMany + private List<DayOutput> dayOutput; + + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setAllocationSeqNo(Integer allocationSeqNo) { + this.allocationSeqNo = allocationSeqNo; + } + + public Integer getAllocationSeqNo() { + return allocationSeqNo; + } + + public void setDays(Integer days) { + this.days = days; + } + + public Integer getDays() { + return days; + } + + public void setThreshold(Float threshold) { + this.threshold = threshold; + } + + public Float getThreshold() { + return threshold; + } + + public void setRepeatedDecisions(boolean repeatedDecisions) { + this.repeatedDecisions = repeatedDecisions; + } + + public boolean isRepeatedDecisions() { + return repeatedDecisions; + } + + public void setRoundConfig(RoundConfig roundConfig) { + this.roundconfig = roundConfig; + } + + public RoundConfig getRoundConfig() { + return roundconfig; + } + + public void setLocation(LocationConfig location) { + this.location = location; + } + + public LocationConfig getLocation() { + return location; + } + + public void setDayOutput(List<DayOutput> dayOutput) { + this.dayOutput = dayOutput; + } + + public List<DayOutput> getDayOutput() { + return dayOutput; + } + + + +} Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/SuspendRepetition.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/SuspendRepetition.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/SuspendRepetition.java 2009-04-09 01:27:37 UTC (rev 93) @@ -0,0 +1,74 @@ +package edu.asu.commons.mme.entity; + + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name="suspend_repetition") +public class SuspendRepetition { + + @Id + @GeneratedValue + private Long id; + + + @ManyToOne + private RoundConfig roundconfig; + + @ManyToOne + private Student student; + + @Column(name="harbor_days") + private Integer harborDays; + + @Column(name="fishing_threshold") + private Float fishingThreshold; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setHarborDays(Integer harborDays) { + this.harborDays = harborDays; + } + + public Integer getHarborDays() { + return harborDays; + } + + public void setFishingThreshold(Float fishingThreshold) { + this.fishingThreshold = fishingThreshold; + } + + public Float getFishingThreshold() { + return fishingThreshold; + } + + public void setRoundconfig(RoundConfig roundconfig) { + this.roundconfig = roundconfig; + } + + public RoundConfig getRoundconfig() { + return roundconfig; + } + + public void setStudent(Student student) { + this.student = student; + } + + public Student getStudent() { + return student; + } + + + +} Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-04-07 02:18:30 UTC (rev 92) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-04-09 01:27:37 UTC (rev 93) @@ -7,7 +7,29 @@ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> + <mapping class='edu.asu.commons.mme.entity.GameConfig'/> + <mapping class='edu.asu.commons.mme.entity.RoundConfig'/> + <mapping class='edu.asu.commons.mme.entity.LocationConfig'/> + <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'/> + <mapping class='edu.asu.commons.mme.entity.DayOutput'/> + <mapping class='edu.asu.commons.mme.entity.SuspendRepetition'/> + + <mapping class='edu.asu.commons.mme.entity.QuestionGroup'/> + <mapping class='edu.asu.commons.mme.entity.Question'/> + <mapping class='edu.asu.commons.mme.entity.Psychometric'/> + <mapping class='edu.asu.commons.mme.entity.Categorial'/> + + + + + + + </session-factory> </hibernate-configuration> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-04-17 22:32:54
|
Revision: 102 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=102&view=rev Author: alllee Date: 2009-04-17 22:32:45 +0000 (Fri, 17 Apr 2009) Log Message: ----------- adding blazeds dependencies Modified Paths: -------------- mentalmodels/trunk/pom.xml mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml mentalmodels/trunk/src/main/webapp/WEB-INF/web.xml Modified: mentalmodels/trunk/pom.xml =================================================================== --- mentalmodels/trunk/pom.xml 2009-04-15 00:30:17 UTC (rev 101) +++ mentalmodels/trunk/pom.xml 2009-04-17 22:32:45 UTC (rev 102) @@ -71,7 +71,31 @@ <artifactId>slf4j-log4j12</artifactId> <version>1.5.2</version> </dependency> - + <dependency> + <groupId>com.adobe.blazeds</groupId> + <artifactId>blazeds-core</artifactId> + <version>3.2.0.3978</version> + </dependency> + <dependency> + <groupId>com.adobe.blazeds</groupId> + <artifactId>blazeds-remoting</artifactId> + <version>3.2.0.3978</version> + </dependency> + <dependency> + <groupId>com.adobe.blazeds</groupId> + <artifactId>blazeds-common</artifactId> + <version>3.2.0.3978</version> + </dependency> + <dependency> + <groupId>com.adobe.blazeds</groupId> + <artifactId>blazeds-proxy</artifactId> + <version>3.2.0.3978</version> + </dependency> + <dependency> + <groupId>com.adobe.blazeds</groupId> + <artifactId>blazeds-opt</artifactId> + <version>3.2.0.3978</version> + </dependency> </dependencies> <build> <finalName>mme</finalName> @@ -127,12 +151,12 @@ can be invoked via mvn -P ant -D target=initialize-data --> - <property name="compile.classpath" refid="maven.compile.classpath" /> - <property name="runtime.classpath" refid="maven.runtime.classpath" /> - <property name="test.classpath" refid="maven.test.classpath" /> - <property name="plugin.classpath" refid="maven.plugin.classpath" /> + <property name="compile.classpath" refid="maven.compile.classpath"/> + <property name="runtime.classpath" refid="maven.runtime.classpath"/> + <property name="test.classpath" refid="maven.test.classpath"/> + <property name="plugin.classpath" refid="maven.plugin.classpath"/> <ant antfile="${basedir}/init-db.ant.xml" inheritRefs="true" inheritAll="true"> - <target name="${target}" /> + <target name="${target}"/> </ant> </tasks> </configuration> @@ -148,5 +172,4 @@ </dependencies> </profile> </profiles> - </project> Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-04-15 00:30:17 UTC (rev 101) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-04-17 22:32:45 UTC (rev 102) @@ -9,22 +9,19 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" - xmlns:flex="http://www.springframework.org/schema/flex" - xmlns:security="http://www.springframework.org/schema/security" + xmlns:flex="http://www.springframework.org/schema/flex" + xmlns:security="http://www.springframework.org/schema/security" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd - http://www.springframework.org/schema/tx - http://www.springframework.org/schema/tx/spring-tx.xsd - http://www.springframework.org/schema/security/spring-security-2.0.4.xsd - http://www.springframework.org/schema/flex http://www.springframework.org/schema/flex/spring-flex-1.0.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd + http://www.springframework.org/schema/security/spring-security-2.0.4.xsd + http://www.springframework.org/schema/flex http://www.springframework.org/schema/flex/spring-flex-1.0.xsd "> <!-- Flex related information started --> -<flex:message-broker> - <flex:secured /> -</flex:message-broker> +<flex:message-broker /> /<!-- XXX: Split these out into separate XML files and import them if this file gets too large --> <!-- spring managed daos --> @@ -40,7 +37,6 @@ <!-- Expose services for BlazeDS remoting --> <flex:remote-service ref="studentService" /> - <!-- Flex related information ended--> <bean id="mmeDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> @@ -60,7 +56,6 @@ <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"/> <property name="hibernateProperties"> <props> - <prop key="hibernate.cglib.use_reflection_optimizer">false</prop> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop> <prop key="hibernate.show_sql">false</prop> </props> Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/web.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/web.xml 2009-04-15 00:30:17 UTC (rev 101) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/web.xml 2009-04-17 22:32:45 UTC (rev 102) @@ -4,13 +4,7 @@ --> <web-app> <display-name>Mental Models Experiment</display-name> - <context-param> - <param-name>contextConfigLocation</param-name> - <param-value> - /WEB-INF/applicationContext.xml - </param-value> - </context-param> - + <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> @@ -26,13 +20,13 @@ </listener> <servlet> - <servlet-name>testdrive</servlet-name> + <servlet-name>mme</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> - <servlet-name>testdrive</servlet-name> + <servlet-name>mme</servlet-name> <url-pattern>/messagebroker/*</url-pattern> </servlet-mapping> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-04-17 23:06:33
|
Revision: 104 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=104&view=rev Author: alllee Date: 2009-04-17 23:06:15 +0000 (Fri, 17 Apr 2009) Log Message: ----------- fixing application context errors and adding flex configuration, still need to add more dependencies Modified Paths: -------------- mentalmodels/trunk/pom.xml mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml Added Paths: ----------- mentalmodels/trunk/src/main/webapp/WEB-INF/flex/ mentalmodels/trunk/src/main/webapp/WEB-INF/flex/messaging-config.xml mentalmodels/trunk/src/main/webapp/WEB-INF/flex/proxy-config.xml mentalmodels/trunk/src/main/webapp/WEB-INF/flex/remoting-config.xml mentalmodels/trunk/src/main/webapp/WEB-INF/flex/services-config.xml Modified: mentalmodels/trunk/pom.xml =================================================================== --- mentalmodels/trunk/pom.xml 2009-04-17 22:40:37 UTC (rev 103) +++ mentalmodels/trunk/pom.xml 2009-04-17 23:06:15 UTC (rev 104) @@ -1,4 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- +vim:sts=2:sw=2 +--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <organization> <name>The Virtual Commons</name> @@ -33,10 +36,15 @@ <dependency> <groupId>org.springframework</groupId> <artifactId>spring</artifactId> - <version>2.5.5</version> + <version>2.5.6</version> </dependency> <dependency> <groupId>org.springframework</groupId> + <artifactId>spring-webmvc</artifactId> + <version>2.5.6</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> <artifactId>spring-flex</artifactId> <version>1.0.0.M2</version> </dependency> @@ -72,6 +80,28 @@ <version>1.5.2</version> </dependency> <dependency> + <groupId>commons-httpclient</groupId> + <artifactId>commons-httpclient</artifactId> + <version>3.1</version> + </dependency> + <dependency> + <groupId>commons-dbcp</groupId> + <artifactId>commons-dbcp</artifactId> + <version>1.2.2</version> + </dependency> + <dependency> + <groupId>javassist</groupId> + <artifactId>javassist</artifactId> + <version>3.8.0.GA</version> + </dependency> + <!-- + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>4.0-beta2</version> + </dependency> + --> + <dependency> <groupId>com.adobe.blazeds</groupId> <artifactId>blazeds-core</artifactId> <version>3.2.0.3978</version> @@ -96,6 +126,11 @@ <artifactId>blazeds-opt</artifactId> <version>3.2.0.3978</version> </dependency> + <dependency> + <groupId>xalan</groupId> + <artifactId>xalan</artifactId> + <version>2.7.1</version> + </dependency> </dependencies> <build> <finalName>mme</finalName> Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-04-17 22:40:37 UTC (rev 103) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-04-17 23:06:15 UTC (rev 104) @@ -5,37 +5,42 @@ <!-- $Id: applicationContext.xml 617 2008-03-28 17:27:23Z alllee $ --> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:flex="http://www.springframework.org/schema/flex" + xmlns:security="http://www.springframework.org/schema/security" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" - xmlns:flex="http://www.springframework.org/schema/flex" - xmlns:security="http://www.springframework.org/schema/security" + xsi:schemaLocation=" + http://www.springframework.org/schema/tx + http://www.springframework.org/schema/tx/spring-tx-2.0.xsd + http://www.springframework.org/schema/aop + http://www.springframework.org/schema/aop/spring-aop-2.0.xsd + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/flex + http://www.springframework.org/schema/flex/spring-flex-1.0.xsd + http://www.springframework.org/schema/security + http://www.springframework.org/schema/security/spring-security-2.0.4.xsd"> - xsi:schemaLocation=" - http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd - http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd - http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd - http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd - http://www.springframework.org/schema/security/spring-security-2.0.4.xsd - http://www.springframework.org/schema/flex http://www.springframework.org/schema/flex/spring-flex-1.0.xsd - "> <!-- Flex related information started --> -<flex:message-broker /> + <flex:message-broker > + <flex:secured /> + </flex:message-broker> -/<!-- XXX: Split these out into separate XML files and import them if this file gets too large --> +<!-- XXX: Split these out into separate XML files and import them if this file gets too large --> <!-- spring managed daos --> -<bean id='studentDao' class='edu.asu.commons.mme.dao.HibernateStudentDao'> - <property name='sessionFactory' ref='sessionFactory'/> -</bean> + <bean id='studentDao' class='edu.asu.commons.mme.dao.HibernateStudentDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> <!-- spring managed service layer --> -<bean id='studentService' class='edu.asu.commons.mme.service.StudentService'> - <property name='dao' ref='studentDao'/> -</bean> + <bean id='studentService' class='edu.asu.commons.mme.service.StudentService'> + <property name='dao' ref='studentDao'/> + </bean> <!-- Expose services for BlazeDS remoting --> -<flex:remote-service ref="studentService" /> + <flex:remote-service ref="studentService" /> <!-- Flex related information ended--> Added: mentalmodels/trunk/src/main/webapp/WEB-INF/flex/messaging-config.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/flex/messaging-config.xml (rev 0) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/flex/messaging-config.xml 2009-04-17 23:06:15 UTC (rev 104) @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<service id="message-service" + class="flex.messaging.services.MessageService"> + + <adapters> + <adapter-definition id="actionscript" class="flex.messaging.services.messaging.adapters.ActionScriptAdapter" default="true" /> + <!-- <adapter-definition id="jms" class="flex.messaging.services.messaging.adapters.JMSAdapter"/> --> + </adapters> + + <default-channels> + <channel ref="my-polling-amf"/> + </default-channels> + +</service> Added: mentalmodels/trunk/src/main/webapp/WEB-INF/flex/proxy-config.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/flex/proxy-config.xml (rev 0) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/flex/proxy-config.xml 2009-04-17 23:06:15 UTC (rev 104) @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<service id="proxy-service" + class="flex.messaging.services.HTTPProxyService"> + + <properties> + <connection-manager> + <max-total-connections>100</max-total-connections> + <default-max-connections-per-host>2</default-max-connections-per-host> + </connection-manager> + <allow-lax-ssl>true</allow-lax-ssl> + </properties> + + <adapters> + <adapter-definition id="http-proxy" class="flex.messaging.services.http.HTTPProxyAdapter" default="true"/> + <adapter-definition id="soap-proxy" class="flex.messaging.services.http.SOAPProxyAdapter"/> + </adapters> + + <default-channels> + <channel ref="my-amf"/> + </default-channels> + + <destination id="DefaultHTTP"> + </destination> + +</service> Added: mentalmodels/trunk/src/main/webapp/WEB-INF/flex/remoting-config.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/flex/remoting-config.xml (rev 0) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/flex/remoting-config.xml 2009-04-17 23:06:15 UTC (rev 104) @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<service id="remoting-service" + class="flex.messaging.services.RemotingService"> + + <adapters> + <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/> + </adapters> + + <default-channels> + <channel ref="my-amf"/> + </default-channels> + +</service> \ No newline at end of file Added: mentalmodels/trunk/src/main/webapp/WEB-INF/flex/services-config.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/flex/services-config.xml (rev 0) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/flex/services-config.xml 2009-04-17 23:06:15 UTC (rev 104) @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="UTF-8"?> +<services-config> + + <services> + <service-include file-path="remoting-config.xml" /> + <service-include file-path="proxy-config.xml" /> + <service-include file-path="messaging-config.xml" /> + + <default-channels> + <channel ref="my-amf"/> + </default-channels> + + </services> + + + <security> + <login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/> + <!-- Uncomment the correct app server + <login-command class="flex.messaging.security.TomcatLoginCommand" server="JBoss"> + <login-command class="flex.messaging.security.JRunLoginCommand" server="JRun"/> + <login-command class="flex.messaging.security.WeblogicLoginCommand" server="Weblogic"/> + <login-command class="flex.messaging.security.WebSphereLoginCommand" server="WebSphere"/> + --> + + <!-- + <security-constraint id="basic-read-access"> + <auth-method>Basic</auth-method> + <roles> + <role>guests</role> + <role>accountants</role> + <role>employees</role> + <role>managers</role> + </roles> + </security-constraint> + --> + </security> + + <channels> + + <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"> + <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/> + </channel-definition> + + <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel"> + <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/> + <properties> + <add-no-cache-headers>false</add-no-cache-headers> + </properties> + </channel-definition> + + <channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel"> + <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/> + <properties> + <polling-enabled>true</polling-enabled> + <polling-interval-seconds>4</polling-interval-seconds> + </properties> + </channel-definition> + + <!-- + <channel-definition id="my-http" class="mx.messaging.channels.HTTPChannel"> + <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/http" class="flex.messaging.endpoints.HTTPEndpoint"/> + </channel-definition> + + <channel-definition id="my-secure-http" class="mx.messaging.channels.SecureHTTPChannel"> + <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/httpsecure" class="flex.messaging.endpoints.SecureHTTPEndpoint"/> + <properties> + <add-no-cache-headers>false</add-no-cache-headers> + </properties> + </channel-definition> + --> + </channels> + + <logging> + <target class="flex.messaging.log.ConsoleTarget" level="Error"> + <properties> + <prefix>[BlazeDS] </prefix> + <includeDate>false</includeDate> + <includeTime>false</includeTime> + <includeLevel>false</includeLevel> + <includeCategory>false</includeCategory> + </properties> + <filters> + <pattern>Endpoint.*</pattern> + <pattern>Service.*</pattern> + <pattern>Configuration</pattern> + </filters> + </target> + </logging> + + <system> + <redeploy> + <enabled>false</enabled> + <!-- + <watch-interval>20</watch-interval> + <watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-file> + <watch-file>{context.root}/WEB-INF/flex/proxy-config.xml</watch-file> + <watch-file>{context.root}/WEB-INF/flex/remoting-config.xml</watch-file> + <watch-file>{context.root}/WEB-INF/flex/messaging-config.xml</watch-file> + <watch-file>{context.root}/WEB-INF/flex/data-management-config.xml</watch-file> + <touch-file>{context.root}/WEB-INF/web.xml</touch-file> + --> + </redeploy> + </system> + +</services-config> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-04-18 02:36:32
|
Revision: 108 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=108&view=rev Author: seematalele Date: 2009-04-18 02:36:30 +0000 (Sat, 18 Apr 2009) Log Message: ----------- written code in StudentService and HibernateStudentDao. Tested it but getting error if I make class as transactional. Otherwise it does not give any error. Modified Paths: -------------- mentalmodels/trunk/flex/src/MME.mxml mentalmodels/trunk/flex/src/Socio_Demographic_Information.mxml mentalmodels/trunk/flex/src/actionscript/RoundConfig.as mentalmodels/trunk/pom.xml mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateStudentDao.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Gender.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml Added Paths: ----------- mentalmodels/trunk/src/main/webapp/FisheryExperiment.html mentalmodels/trunk/src/main/webapp/FisheryExperiment.swf Modified: mentalmodels/trunk/flex/src/MME.mxml =================================================================== --- mentalmodels/trunk/flex/src/MME.mxml 2009-04-18 00:59:30 UTC (rev 107) +++ mentalmodels/trunk/flex/src/MME.mxml 2009-04-18 02:36:30 UTC (rev 108) @@ -9,6 +9,9 @@ <![CDATA[ import mx.collections.ArrayCollection; import actionscript.RoundConfig; + import mx.controls.Alert; + import mx.rpc.events.ResultEvent; + import mx.rpc.events.FaultEvent; // request config data from server private var rndConfig:RoundConfig = getConfig(); @@ -22,6 +25,47 @@ new ArrayCollection([5, 10, 15])); } + [Bindable] public var outputresp : Boolean; + private function resultHandler(event:ResultEvent):void + { + outputresp = event.result as Boolean; + } + + private function faultHandler(event:FaultEvent):void + { + Alert.show(event.fault.faultDetail); + } + + /*private function getData():void + { + outputresp = ss.getStudentFname(); + + }*/ + + private function save():void + { + + changeState(); + /*Alert.show("In save() function"); + Alert.show("year of birth is " + socio_demographic_information1.txtipYOB.text); + Alert.show(socio_demographic_information1.txtipMajor.text); + Alert.show(socio_demographic_information1.study.selectedValue.toString());*/ + //Alert.show(socio_demographic_information1.female.selected?'Correct Answer!':'Wrong Answer', 'Result'); + if(ss.createStudent(socio_demographic_information1.txtipYOB.text, socio_demographic_information1.txtipMajor.text,"Female",socio_demographic_information1.study.selectedValue.toString())) + { + Alert.show("Record is sucessfully added!"); + } + else + Alert.show("Record is NOT sucessfully added!"); + + } + + private function changeState():void + { + this.currentState = 'forecasting'; + } + + ]]> </mx:Script> @@ -45,7 +89,7 @@ </ns1:Socio_Demographic_Information> <mx:HBox x="42" width="100%" height="10%" verticalAlign="bottom" horizontalAlign="center" bottom="5" id="hbox1"> - <mx:Button label="Submit" id="btnSubmit_Socio_Demographic_Info" click="currentState='forecasting'" fontSize="12"/> + <mx:Button label="Submit" id="btnSubmit_Socio_Demographic_Info" click="save()" fontSize="12"/> </mx:HBox> </mx:Canvas> <mx:HBox width="100%" id="hboxfooter" horizontalAlign="center" verticalAlign="bottom"> @@ -56,4 +100,5 @@ </mx:HBox> </mx:VBox> </mx:Canvas> + <mx:RemoteObject id="ss" destination="studentservice" fault="faultHandler(event)" result="resultHandler(event)"/> </mx:Application> Modified: mentalmodels/trunk/flex/src/Socio_Demographic_Information.mxml =================================================================== --- mentalmodels/trunk/flex/src/Socio_Demographic_Information.mxml 2009-04-18 00:59:30 UTC (rev 107) +++ mentalmodels/trunk/flex/src/Socio_Demographic_Information.mxml 2009-04-18 02:36:30 UTC (rev 108) @@ -7,18 +7,21 @@ <mx:FormHeading label="Socio DemographicInformation " id="frmheadingSocioDemographicInfo" fontSize="24" textAlign="left" themeColor="#1200FF" color="#186BE8" width="5%" height="10%"/> <mx:FormItem id="frmitemStudy" horizontalAlign="left" fontSize="14" required="true"> <mx:Label text="What year are you in your study?"/> - <mx:RadioButton id="freshman" groupName="study"> + <mx:RadioButtonGroup id="study"/> + <mx:RadioButton id="freshman" groupName="{study}"> <mx:label>Freshman</mx:label> </mx:RadioButton> - <mx:RadioButton id="sophomore" groupName="study"> + <mx:RadioButton id="sophomore" groupName="{study}"> <mx:label>Sophomore</mx:label> </mx:RadioButton> - <mx:RadioButton id="junior" groupName="study"> + <mx:RadioButton id="junior" groupName="{study}"> <mx:label>Junior</mx:label> </mx:RadioButton> - <mx:RadioButton id="senior" groupName="study"> + <mx:RadioButton id="senior" groupName="{study}"> <mx:label>Senior</mx:label> </mx:RadioButton> + + </mx:FormItem> <mx:FormItem label="What is your major?" id="frmitemMajor" horizontalAlign="left" fontSize="14" required="true"> @@ -28,6 +31,7 @@ <mx:TextInput id="txtipYOB" maxChars="4"/> </mx:FormItem> <mx:FormItem label="Gender" id="frmitemGender" horizontalAlign="left" fontSize="14" required="true"> + <mx:RadioButtonGroup id="gender"/> <mx:RadioButton id="male" groupName="gender"> <mx:label>Male</mx:label> </mx:RadioButton> Modified: mentalmodels/trunk/flex/src/actionscript/RoundConfig.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/RoundConfig.as 2009-04-18 00:59:30 UTC (rev 107) +++ mentalmodels/trunk/flex/src/actionscript/RoundConfig.as 2009-04-18 02:36:30 UTC (rev 108) @@ -2,6 +2,7 @@ { import mx.collections.ArrayCollection; + public class RoundConfig { private var number:Number; // what round is it? Modified: mentalmodels/trunk/pom.xml =================================================================== --- mentalmodels/trunk/pom.xml 2009-04-18 00:59:30 UTC (rev 107) +++ mentalmodels/trunk/pom.xml 2009-04-18 02:36:30 UTC (rev 108) @@ -131,6 +131,7 @@ <artifactId>xalan</artifactId> <version>2.7.1</version> </dependency> + </dependencies> <build> <finalName>mme</finalName> @@ -150,6 +151,10 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> + <configuration> + <server>myserver</server> + </configuration> + </plugin> <plugin> <groupId>org.mortbay.jetty</groupId> Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateStudentDao.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateStudentDao.java 2009-04-18 00:59:30 UTC (rev 107) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateStudentDao.java 2009-04-18 02:36:30 UTC (rev 108) @@ -1,5 +1,13 @@ package edu.asu.commons.mme.dao; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.Transaction; +import org.springframework.transaction.annotation.Transactional; + +import edu.asu.commons.mme.entity.GameConfig; +import edu.asu.commons.mme.entity.Gender; +import edu.asu.commons.mme.entity.Group; import edu.asu.commons.mme.entity.Student; /** @@ -11,10 +19,84 @@ * @author <a href='mailto:All...@as...'>Allen Lee</a> * @version $Rev$ */ +@Transactional public class HibernateStudentDao extends HibernateDao<Student> { + + private static Integer groupNo=0; + private static Integer studentNo=0; + private SessionFactory sessionFactory; public HibernateStudentDao() { super(Student.class); } + + public SessionFactory getSessionFactory() { + return super.getSessionFactory(); + } + public void setSessionFactory(SessionFactory sessionFactory) { + this.sessionFactory = sessionFactory; + } + public static void setGroupNo(Integer groupNo) { + HibernateStudentDao.groupNo = groupNo; + } + + public static Integer getGroupNo() { + return groupNo; + } + + public static void setStudentNo(Integer studentNo) { + HibernateStudentDao.studentNo = studentNo; + } + + public static Integer getStudentNo() { + return studentNo; + } + + public Long createStudent(Integer birthyear, String ethnicity, String gender,String major) + { + Student newstudent = null; + try{ + sessionFactory = this.getSessionFactory(); + Session session = + sessionFactory.getCurrentSession(); + Transaction tx = session.beginTransaction(); + //generateGroups(); + studentNo = getStudentNo() + 1; + newstudent = new Student(); + //newstudent.setGroup(newgroup); + newstudent.setBirthYear(birthyear); + newstudent.setEthnicity(ethnicity); + if(gender.equals(Gender.F)) + newstudent.setGender(Gender.F); + else + newstudent.setGender(Gender.M); + newstudent.setMajor(major); + newstudent.setStudentNo(studentNo); + session.save(newstudent); + tx.commit(); + + } + catch(Exception e) + { + logger.error("Can not create student."); + + } + finally{ + sessionFactory.close(); + } + return newstudent.getId(); + + } + + + + + + + + + + + } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Gender.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Gender.java 2009-04-18 00:59:30 UTC (rev 107) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Gender.java 2009-04-18 02:36:30 UTC (rev 108) @@ -1,5 +1,5 @@ package edu.asu.commons.mme.entity; public enum Gender { -FEMALE, MALE +F, M } 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-04-18 00:59:30 UTC (rev 107) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java 2009-04-18 02:36:30 UTC (rev 108) @@ -21,7 +21,6 @@ private Long id; @ManyToOne - @JoinColumn(nullable=false) private Group group; @Column(name="student_no",nullable = false) Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java 2009-04-18 00:59:30 UTC (rev 107) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java 2009-04-18 02:36:30 UTC (rev 108) @@ -1,7 +1,16 @@ package edu.asu.commons.mme.service; +import org.apache.log4j.Logger; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.Transaction; +import org.springframework.transaction.annotation.Transactional; + import edu.asu.commons.mme.dao.HibernateStudentDao; +import edu.asu.commons.mme.entity.GameConfig; +import edu.asu.commons.mme.entity.Gender; import edu.asu.commons.mme.entity.Student; +import edu.asu.commons.mme.entity.Group; /** * @@ -11,6 +20,33 @@ * @author <a href='mailto:All...@as...'>Allen Lee</a> * @version $Rev$ */ + + public class StudentService extends Service.Base<Student, HibernateStudentDao> { + Student newstudent; + Group newgroup; + + + private static Integer groupNo; + private static Integer studentNo; + + public boolean createGroup() + { + return false; + } + + public Long createStudent(Integer birthYear, String ethnicity,String gender,String major) + { + //createGroup(); + System.out.println("Birthyear" + birthYear); + System.out.println("Ethnicity" + ethnicity); + System.out.println("Gender" + gender); + System.out.println("Major" + major); + + this.getDao().createStudent(birthYear, ethnicity, gender, major); + return newstudent.getId(); + + } + } Added: mentalmodels/trunk/src/main/webapp/FisheryExperiment.html =================================================================== --- mentalmodels/trunk/src/main/webapp/FisheryExperiment.html (rev 0) +++ mentalmodels/trunk/src/main/webapp/FisheryExperiment.html 2009-04-18 02:36:30 UTC (rev 108) @@ -0,0 +1,121 @@ +<!-- saved from url=(0014)about:internet --> +<html lang="en"> + +<!-- +Smart developers always View Source. + +This application was built using Adobe Flex, an open source framework +for building rich Internet applications that get delivered via the +Flash Player or to desktops via Adobe AIR. + +Learn more about Flex at http://flex.org +// --> + +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + +<!-- BEGIN Browser History required section --> +<link rel="stylesheet" type="text/css" href="history/history.css" /> +<!-- END Browser History required section --> + +<title></title> +<script src="AC_OETags.js" language="javascript"></script> + +<!-- BEGIN Browser History required section --> +<script src="history/history.js" language="javascript"></script> +<!-- END Browser History required section --> + +<style> +body { margin: 0px; overflow:hidden } +</style> +<script language="JavaScript" type="text/javascript"> +<!-- +// ----------------------------------------------------------------------------- +// Globals +// Major version of Flash required +var requiredMajorVersion = 9; +// Minor version of Flash required +var requiredMinorVersion = 0; +// Minor version of Flash required +var requiredRevision = 124; +// ----------------------------------------------------------------------------- +// --> +</script> +</head> + +<body scroll="no"> +<script language="JavaScript" type="text/javascript"> +<!-- +// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65) +var hasProductInstall = DetectFlashVer(6, 0, 65); + +// Version check based upon the values defined in globals +var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision); + +if ( hasProductInstall && !hasRequestedVersion ) { + // DO NOT MODIFY THE FOLLOWING FOUR LINES + // 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; + + AC_FL_RunContent( + "src", "playerProductInstall", + "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"", + "width", "760", + "height", "510", + "align", "middle", + "id", "FisheryExperiment", + "quality", "high", + "bgcolor", "#869ca7", + "name", "FisheryExperiment", + "allowScriptAccess","sameDomain", + "type", "application/x-shockwave-flash", + "pluginspage", "http://www.adobe.com/go/getflashplayer" + ); +} else if (hasRequestedVersion) { + // if we've detected an acceptable version + // embed the Flash Content SWF when all tests are passed + AC_FL_RunContent( + "src", "FisheryExperiment", + "width", "760", + "height", "510", + "align", "middle", + "id", "FisheryExperiment", + "quality", "high", + "bgcolor", "#869ca7", + "name", "FisheryExperiment", + "allowScriptAccess","sameDomain", + "type", "application/x-shockwave-flash", + "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 + } +// --> +</script> +<noscript> + <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" + id="FisheryExperiment" width="760" height="510" + codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"> + <param name="movie" value="FisheryExperiment.swf" /> + <param name="quality" value="high" /> + <param name="bgcolor" value="#869ca7" /> + <param name="allowScriptAccess" value="sameDomain" /> + <embed src="FisheryExperiment.swf" quality="high" bgcolor="#869ca7" + width="760" height="510" name="FisheryExperiment" align="middle" + play="true" + loop="false" + quality="high" + allowScriptAccess="sameDomain" + type="application/x-shockwave-flash" + pluginspage="http://www.adobe.com/go/getflashplayer"> + </embed> + </object> +</noscript> +</body> +</html> Added: mentalmodels/trunk/src/main/webapp/FisheryExperiment.swf =================================================================== (Binary files differ) Property changes on: mentalmodels/trunk/src/main/webapp/FisheryExperiment.swf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-04-18 00:59:30 UTC (rev 107) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-04-18 02:36:30 UTC (rev 108) @@ -12,6 +12,7 @@ xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd http://www.springframework.org/schema/aop @@ -23,7 +24,8 @@ http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd"> -<!-- Flex related information started --> + +<!-- Flex related information started --> <flex:message-broker > </flex:message-broker> @@ -71,6 +73,6 @@ <property name="sessionFactory" ref="sessionFactory"/> </bean> <!-- XXX: don't need proxy-target-class if services are interfaces instead --> - <tx:annotation-driven proxy-target-class='true'/> + <tx:annotation-driven proxy-target-class="true"/> </beans> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |