[virtualcommons-svn] SF.net SVN: virtualcommons:[182] mentalmodels/trunk/src/main/java/edu/asu/ com
Status: Beta
Brought to you by:
alllee
|
From: <kj...@us...> - 2009-07-13 23:32:25
|
Revision: 182
http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=182&view=rev
Author: kjonas
Date: 2009-07-13 23:32:20 +0000 (Mon, 13 Jul 2009)
Log Message:
-----------
Modified DayOutput.java and StudentStrategy.java to contain public variables, for use as beans.
ModuleService.java now returns sequential modules, and can be reset to the first. (this needs to be changed to get module number N)
Modified Paths:
--------------
mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayOutput.java
mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java
mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java
Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayOutput.java
===================================================================
--- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayOutput.java 2009-07-13 23:29:02 UTC (rev 181)
+++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayOutput.java 2009-07-13 23:32:20 UTC (rev 182)
@@ -19,17 +19,17 @@
@Id
@GeneratedValue
- private Long id;
+ public Long id;
@ManyToOne
@JoinColumn(nullable=false)
- private StudentStrategy strategy;
+ public StudentStrategy strategy;
@Column(nullable=false)
- private Integer day;
+ public Integer day;
@Column(nullable=false)
- private Double earnings;
+ public Double earnings;
public void setId(Long id) {
this.id = id;
Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java
===================================================================
--- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java 2009-07-13 23:29:02 UTC (rev 181)
+++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java 2009-07-13 23:32:20 UTC (rev 182)
@@ -24,7 +24,7 @@
@Id
@GeneratedValue
- private Long id;
+ public Long id;
@ManyToOne
@@ -32,25 +32,25 @@
private RoundConfig roundConfig;
@Column(name = "allocation_sequence_no",nullable=false)
- private Integer allocationSeqNo;
+ public Integer allocationSeqNo;
@Column(nullable=false)
- private Integer days;
+ public Integer days;
@Column(nullable=false)
- private Double threshold;
+ public Double threshold;
@ManyToOne
@JoinColumn(nullable=false)
- private Location location;
+ public Location location;
@Column (name="repeated_decisions",columnDefinition="Boolean", nullable=false)
- private boolean repeatedDecisions;
+ public boolean repeatedDecisions;
@OneToMany(mappedBy="strategy")
@JoinColumn(nullable=false)
- private List<DayOutput> dayOutput;
+ public List<DayOutput> dayOutput;
public void setId(Long id) {
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-13 23:29:02 UTC (rev 181)
+++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java 2009-07-13 23:32:20 UTC (rev 182)
@@ -17,10 +17,21 @@
@Transactional
public class ModuleService extends Service.Base<Module, HibernateModuleDao>{
- public Module getFirstPage()
+ public Integer currentModule = new Integer(1);
+
+ public Module setToModule(int moduleNumber)
{
+ currentModule = new Integer(moduleNumber);
+ Module tempModule = new Module();
+ tempModule.setDescription("result of setModule - ignore!");
+ return tempModule;
+ }
+
+ public Module getNextModule()
+ {
// Enter the sequence number in new Integer(Sequence number of module u want to fetch)
- Module module = getDao().findByProperty("sequenceNo", new Integer(1));
+ Module module = getDao().findByProperty("sequenceNo", currentModule);
+ setToModule(1 + currentModule.intValue());
Hibernate.initialize(module);
getLogger().debug("Module object is " + module.getDescription());
@@ -52,8 +63,47 @@
}
}
- return module;
-
+ return module;
}
-
+
+ public Module get1thModule()
+ {
+ // Enter the sequence number in new Integer(Sequence number of module u want to fetch)
+ setToModule(1);
+ Module module = getDao().findByProperty("sequenceNo", currentModule);
+ setToModule(1 + currentModule.intValue());
+
+ Hibernate.initialize(module);
+ getLogger().debug("Module object is " + module.getDescription());
+
+ Iterator<Block> iterateBlock = module.getBlocks().iterator();
+ while(iterateBlock.hasNext())
+ {
+ Block block = iterateBlock.next();
+ Hibernate.initialize(block);
+ Iterator<QuestionGroup> iteratorquestionGrp = block.getQuestionGroups().iterator();
+ {
+ while(iteratorquestionGrp.hasNext())
+ {
+ QuestionGroup questionGroup = iteratorquestionGrp.next();
+ Hibernate.initialize(questionGroup);
+ List<Question> questions = questionGroup.getQuestions();
+
+ for(int j = 0; j < questions.size(); j++)
+ {
+ Hibernate.initialize(questions.get(j));
+ if(questions.get(j).getClass().getName().equalsIgnoreCase("edu.asu.commons.mme.entity.CategoricalQuestion"))
+ {
+ CategoricalQuestion categoricalQ = (CategoricalQuestion)questions.get(j);
+ Iterator<CategoricalOption> categoricalOption = categoricalQ.getCategoricalOptions().iterator();
+ Hibernate.initialize(categoricalOption);
+ }
+ }
+ }
+ }
+
+ }
+ return module;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|