Index: lams_tool_eadventure/.classpath
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/.classpath,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/.classpath 2 Nov 2010 22:16:26 -0000 1.1
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_eadventure/.cvsignore
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/.cvsignore,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/.cvsignore 2 Nov 2010 22:16:26 -0000 1.1
@@ -0,0 +1,3 @@
+.myeclipse
+.mymetadata
+build
Index: lams_tool_eadventure/.project
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/.project,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/.project 2 Nov 2010 22:16:26 -0000 1.1
@@ -0,0 +1,43 @@
+
+
+ lams_tool_larsrc
+
+
+
+
+
+ com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator
+
+
+
+
+ com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator
+
+
+
+
+ com.ibm.etools.validation.validationbuilder
+
+
+
+
+ com.ibm.sse.model.structuredbuilder
+
+
+
+
+
+ com.genuitec.eclipse.j2eedt.core.webnature
+ org.eclipse.jdt.core.javanature
+
+
Index: lams_tool_eadventure/axisclient.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/axisclient.properties,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/axisclient.properties 2 Nov 2010 22:16:26 -0000 1.1
@@ -0,0 +1,60 @@
+###############################################################################
+# Copyright (c) 2005, 2006 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+!--ScenarioType REQUIRED. Differentiates from "service" scenario. See axisservice.properties.
+ScenarioType=client
+
+!--InitialSelection REQUIRED. Workspace relative URI to the input WSDL or Java.
+InitialSelection=/dynamicWebProjectName/WebContent/wsdl/myService.wsdl
+
+!--Utility property values - use these to list values for the following properties:
+!-- Client.RuntimeId, Client.ServerId
+ListRuntimes=true
+ListServers=true
+!-- Verbose will list informational messages as well as errors if set to true
+Verbose=true
+
+
+!--Client.RuntimeId - ID of web service runtime
+Client.RuntimeId=org.eclipse.jst.ws.axis.creation.axisWebServiceRT
+!--Client.ServerId - ID of target server
+Client.ServerId=org.eclipse.jst.server.tomcat.50
+
+!--ClientProjectName - name of Client project - this property can be used to give the client project a
+!-- different name than the project containing the initial selection
+!--ClientProjectName=clientProjectName
+
+!--ClientEarProjectName- name of Client EAR project - set only if applicable for selected server type
+!--ClientEarProjectName=clientEARProjectName
+
+!--ClientComponentType - type of Client project - the following are valid Axis templates: template.jst.web and template.jst.utility
+!--ClientComponentType=template.jst.web
+
+!-- CustomizeClientMappings - set to true to supply package-namespace mappings type: boolean
+!--CustomizeClientMappings=false
+
+!-- Mappings
+!-- Workspace relative URI to property file containing mappings
+!-- Mappings are used to override the default package names of the generated Java classes.
+!-- Need not be set if CustomizeClientMappings is false
+!-- The content of the properties file must be of the format package = namespace.
+!--Mappings=/testProj/mappings/mappings.txt
+
+!--OverwriteFilesEnabled - set to true to overwrite files that already exist. type:boolean
+!-- note for non-interactive mode it is recommended that this be set to true
+!-- OverwriteFilesEnabled=true
+
+!--CreateFoldersEnabled - set to true create folders necessary during file generation type:boolean
+!-- note for non-interactive mode it is recommended that this be set to true
+!-- CreateFoldersEnabled=true
+
+!--CheckoutFilesEnabled - set to true to check out files with no warning to the user type:boolean
+!-- note for non-interactive mode it is recommended that this be set to true
+!-- CheckoutFilesEnabled=true
Index: lams_tool_eadventure/axisservice.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/axisservice.properties,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/axisservice.properties 2 Nov 2010 22:16:26 -0000 1.1
@@ -0,0 +1,71 @@
+###############################################################################
+# Copyright (c) 2005, 2006 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+!-- ScenarioType REQUIRED. Differentiates from "client" scenario. See axisclient.properties.
+ScenarioType=service
+
+!-- InitialSelection REQUIRED. Workspace relative URI to the input WSDL or Java
+InitialSelection=/dynamicWebProjectName/WebContent/myService.wsdl
+
+!--Utility property values - use these to list valid values for the following properties:
+!-- Service.RuntimeId, Service.ServerId
+ListRuntimes=true
+ListServers=true
+!-- Verbose will list informational messages as well as errors if set to true
+Verbose=true
+
+!-- Service.RuntimeId - ID of web service runtime
+Service.RuntimeId=org.eclipse.jst.ws.axis.creation.axisWebServiceRT
+!-- Service.ServerId - ID of target server
+Service.ServerId=org.eclipse.jst.server.tomcat.50
+!-- Service.TypeId - "Top Down EJB" or "Bottom Up EJB"
+!-- Java Bean is default for both Top Down and Bottom Up
+!-- Service.TypeId=Top Down EJB
+
+!-- ServiceProjectName - !--type:String - name of Service project - this property can be used to give the service project a different name than the project containing the initial selection. type: String
+!--ServiceProjectName=serviceProjectName
+!-- ServiceEarProjectName - !--type:String - name of Service project - this property can be used to give the service EAR project a different name than the project containing the initial selection. type: String
+!--ServiceEarProjectName=serviceEarProjectName
+
+!-- Mappings
+!-- Top down or bottom up scenario. Workspace relative URI to property file containing mappings.
+!-- Top Down: Mappings are used to override the default package names of the generated Java template classes.
+!-- The content of the properties file must be of the format namespace=package
+!-- Bottom Up: Mappings are used to override the default namespace names in the generated WSDL.
+!-- The content of the properties file must be of the format package = namespace
+!--Mappings=/testProj/mappings/mappings.txt
+
+!-- JavaOutput
+!-- Top down - String: the workspace relative URI for a Java source folder for the generated Java code - must be existing workspace source folder
+!--JavaOutput=/projectName/JavaSource
+
+!-- Methods
+!-- Bottom up - space delimited string of method signatures (i.e. method1(parmType1) method2(parmType2)) to be exposed in output WSDL. If no list is provided, all methods are exposed.
+!-- Methods=
+
+!-- Style
+!-- Bottom up - String: one of: RPC, DOCUMENT, WRAPPED
+!--Style=DOCUMENT
+
+!-- Use
+!-- Bottom up - String: one of: LITERAL, ENCODED
+!--Use=LITERAL
+
+!--OverwriteFilesEnabled - set to true to overwrite files that already exist. type:boolean
+!-- note for non-interactive mode it is recommended that this be set to true
+!--OverwriteFilesEnabled=true
+
+!--CreateFoldersEnabled - set to true create folders necessary during file generation type:boolean
+!-- note for non-interactive mode it is recommended that this be set to true
+!--CreateFoldersEnabled=true
+
+!--CheckoutFilesEnabled - set to true to check out files with no warning to the user type:boolean
+!-- note for non-interactive mode it is recommended that this be set to true
+!--CheckoutFilesEnabled=true
Index: lams_tool_eadventure/build.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/build.properties,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/build.properties 2 Nov 2010 22:16:26 -0000 1.1
@@ -0,0 +1,25 @@
+########################################################################################################################
+### BUILD PROPERTIES ###
+### 1) Do *NOT* use backslashes in paths unless you are sure the ANT task treats them properly. ###
+### 2) Use only ant variables (${foo}) that You declared above or make *SURE* You derive them from the right place. ###
+### 3) Comment out boolean style build settings instead of setting false. Set to false may fail. ###
+### 4) Uncommenting the forceClean attribute *WILL* delete your sourcecode to make place for vcs controlled builds. ###
+###
+########################################################################################################################
+
+### project properties ###
+signature=eueadv10
+project.displayname = lams eadventure tool
+weblib=lib
+
+#project version
+tool.version=20071100
+
+# hide tool option
+hideTool=false
+
+# Minimum compatible version
+min.server.version.number=2.0
+
+# Language files package
+language.files.package=org.eucm.lams.tool.eadventure
Index: lams_tool_eadventure/build.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/build.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/build.xml 2 Nov 2010 22:16:26 -0000 1.1
@@ -0,0 +1,509 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +------------------------------------------+
+ | creating directory structure |
+ +------------------------------------------+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +------------------------------------------+
+ | clean |
+ +------------------------------------------+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +------------------------------------------+
+ | generating hibernate metadata |
+ +------------------------------------------+
+
+
+
+ Building hbm.xml files using XDoclet to ${conf.hibernate.mapping.dir} from ${src.java.dir}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +------------------------------------------+
+ | create jar file |
+ +------------------------------------------+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +------------------------------------------+
+ | build jar file |
+ +------------------------------------------+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +------------------------------------------+
+ | Generate the deployment package. |
+ +------------------------------------------+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Deploying the Eadventure tool
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +------------------------------------------+
+ | built war file |
+ +------------------------------------------+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_eadventure/conf/hibernate/mappings/.cvsignore
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/conf/hibernate/mappings/Attic/.cvsignore,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/conf/hibernate/mappings/.cvsignore 2 Nov 2010 22:16:32 -0000 1.1
@@ -0,0 +1 @@
+org
Index: lams_tool_eadventure/conf/hibernate/mappings/hibernate.cfg.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/conf/hibernate/mappings/hibernate.cfg.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/conf/hibernate/mappings/hibernate.cfg.xml 2 Nov 2010 22:16:32 -0000 1.1
@@ -0,0 +1,13 @@
+
+
+
+
+ lams
+ lamsdemo
+ jdbc:mysql://localhost/lams
+ com.mysql.jdbc.Driver
+ org.hibernate.dialect.MySQLDialect
+
+
+
Index: lams_tool_eadventure/conf/jar/META-INF/MANIFEST.MF
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/conf/jar/META-INF/Attic/MANIFEST.MF,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/conf/jar/META-INF/MANIFEST.MF 2 Nov 2010 22:16:36 -0000 1.1
@@ -0,0 +1,4 @@
+Implementation-Title: LAMS - Eadventure Tool
+Implementation-Version: 2.1
+Implementation-Vendor: LAMS Foundation (http://lamsfoundation.org)
+Class-Path:
\ No newline at end of file
Index: lams_tool_eadventure/conf/language/lams/ApplicationResources.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/conf/language/lams/ApplicationResources.properties,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/conf/language/lams/ApplicationResources.properties 2 Nov 2010 22:16:24 -0000 1.1
@@ -0,0 +1,198 @@
+appName = eadventure
+#language code: en
+#locale code: AU
+
+ # CVS ID: $Id: ApplicationResources.properties,v 1.1 2010/11/02 22:16:24 angel.dba Exp $ Exported from the LAMS Community by Ernie Ghiglione on Sat Jul 04 01:38:10 CST 2009
+
+#=================== labels for ShareResources =================#
+
+activity.description =eAdventure Game.
+label.authoring.basic.resource.instructions =Instructions
+label.authoring.heading.instructions =Instructions
+label.authoring.heading.instructions.desc =Please input online and offline instructions
+label.authoring.basic.instruction =Instruction
+label.authoring.basic.resource.add.instruction =Add Instruction
+label.authoring.online.instruction =Online Instructions
+label.authoring.offline.instruction =Offline Instructions
+error.resource.item.desc.blank =Comment/Instruction can not be blank
+activity.helptext =Uploading your resources to share with others.
+tool.display.name =eAdventure Tool
+tool.description =Tool for use eAdventure videogames in the learning design.
+appName =eAdventure
+errorPage.title =Error page
+errorPage.heading =Some error occurs when handling your request
+label.authoring.heading =eAdventure
+label.author.title =eAdventure Authoring
+label.authoring.heading.basic =Basic
+label.next.instruction =Next Instruction
+label.authoring.heading.basic.desc =Basic input information for eAdventure games
+msg.no.instruction =No instruction available.
+label.authoring.heading.advance.desc =Please input advance options for eAdventure game
+label.authoring.basic.title =Title
+label.learning.comment.or.instruction =Comment/Instruction
+label.authoring.basic.add.url =Add URL
+label.authoring.basic.add.file =Add Single File
+label.authoring.basic.resource.list.title =Resource List
+label.authoring.basic.resource.url =URL
+label.authoring.basic.resource.file =File
+label.authoring.basic.resource.website =Website
+label.authoring.basic.resource.verify.url =Verify URL
+label.authoring.basic.resource.preview =Preview
+label.authoring.basic.resource.edit =Edit
+label.authoring.basic.resource.delete =Delete
+monitoring.tab.instructions =Instruction
+label.authoring.advanced.reflectOnActivity =Add Notebook at end of eAdventure game with the following instructions:
+label.authoring.basic.resource.title.input =Title
+label.authoring.basic.resource.url.input =URL
+label.authoring.basic.resource.file.input =File
+label.authoring.basic.resource.description.input =Description
+label.authoring.basic.resource.zip.file.input =Zip file:
+label.authoring.online.file =Upload online file
+label.authoring.offline.file =Upload offline file
+label.authoring.choosefile.button =Choose file
+label.authoring.upload.online.button =Upload Online
+label.authoring.upload.offline.button =Upload Offline
+label.authoring.online.filelist =Online file list
+label.authoring.offline.filelist =Offline file list
+label.authoring.online.delete =Delete
+label.authoring.offline.delete =Delete
+label.authoring.advance.mini.number.resources.view =Minimum number of resources to view
+label.authoring.advance.allow.learner.add.urls =Allow learners to add URLs
+label.authoring.advance.allow.learner.add.files =Allow learners to add Files
+label.authoring.cancel.button =Cancel
+label.description =Description:
+authoring.exception =There is a problem in eAdventure authoring page, the reason is {0}
+error.resource.item.title.blank =Title can not be blank.
+error.resource.item.url.blank =URL can not be blank.
+error.resource.item.file.blank =File can not be blank.
+error.resource.item.invalid.url =Invalid URL format.
+error.upload.failed =Upload file failed: {0}
+error.msg.upload.file.not.found =Could not find upload file {0}.
+error.msg.zip.file.exception =Could not handle zip file when uploading file.
+error.msg.file.not.found =File not found exception occurs when uploading file.
+error.msg.ims.application =ImscpApplicationException occurs when uploading resource item file.
+error.msg.website.no.initial.file =Website zip can not find out initial file (index.htm/html or default.htm/html).
+error.msg.io.exception =IOException occurs when uploading file.
+error.msg.invaid.param.upload =InvalidParameterException occured while trying to upload File.
+error.msg.default.content.not.find =Could not retrieve default content record for this tool.
+authoring.msg.cancel.save =Do you want to close this window without saving?
+label.learning.title =eAdventure Learning
+label.learning.heading =eAdventure
+label.resoruce.to.review =Resources to view
+label.learning.minimum.review =You must view at least {0} of the resources.
+label.check.for.new =Check for new
+label.suggest.new =Suggest a new
+label.learning.new.file =New file details:
+label.learning.new.url =New URL details:
+monitoring.tab.summary =Summary
+monitoring.tab.statistics =Statistic
+monitoring.tab.edit.activity =Edit Activity
+monitoring.label.group =Group
+monitoring.summary.note =Note: number of learners is the number of learners who have viewed the resource.
+monitoring.label.type =Type
+monitoring.label.title =Title
+monitoring.label.suggest =Suggested By
+monitoring.label.number.learners =Number of Learners
+monitoring.label.hide =Hide
+monitoring.label.show =Show
+monitoring.label.user.report = Assessment Report
+monitoring.label.user.loginname =Login name
+monitoring.label.user.name =Name
+monitoring.label.hidden =Hidden
+monitoring.no.report = Report not received
+label.monitoring.edit.activity.cancel =Cancel
+label.monitoring.edit.activity.update =Update
+label.monitoring.edit.activity.edit =Edit
+message.monitoring.edit.activity.not.editable =This Activity is no longer editable
+export.label.resource =Resource
+export.label.no.learning.object =No offline package available
+export.title =Export portfolio of eAdventure activity
+export.init.resource =Initial Resources
+errors.header =
+errors.footer =
+error.valueReqd =Value Required
+error.inputFileTooLarge =Input File size is too large!
+error.uploading =error uploading
+error.title.empty =Title can not be blank
+message.msg.maxFileSize =Max 250K
+label.open =Open
+label.delete =Delete
+label.download =Download
+label.view =View
+label.edit =Edit
+label.completed =Completed
+button.upload =Upload
+button.add =Add
+button.cancel =Cancel
+message.monitoring.summary.no.session =No Session Available
+label.show =Show
+label.hide =Hide
+label.save =Save
+label.cancel =Cancel
+define.later.message =Please wait for the teacher to complete the contents of this activity.
+run.offline.message =This activity is not being done on the computer. Please see your instructor for details.
+message.monitoring.summary.no.resource.for.group =No resource available for this group.
+button.try.again =Try again
+open.in.new.window =Open URL in pop-up
+page.title.monitoring.view.reflection =View Notebook Entries
+button.edit =Edit
+message.no.reflection.available =No notebook available
+error.reflection.emtpy =Please input Notebook Entry
+title.reflection =Notebook Entry
+monitoring.user.reflection =Notebook Entry
+activity.title =eadventure
+label.authoring.save.button =Save
+monitoring.label.access.time =Access time
+label.authoring.advance.lock.on.finished =Lock when finished
+label.authoring.advance.define.completed = Hide "finish button" until eAdventure "completed" var is set
+label.authoring.heading.advance =Advanced
+label.authoring.basic.add.learning.object =Add IMS Content Package
+label.authoring.basic.add.website =Add Zipped Website
+label.authoring.basic.resource.learning.object =IMS CP
+error.msg.ims.package =Invalid IMS CP format.
+message.step.of =Step {0} of {1}
+label.authoring.advance.run.content.auto =Run content automatically (only available if there is exactly one resource)
+label.up =Move Up
+label.down =Move down
+label.continue =Continue
+monitoring.user.fullname =Name
+button.close =Close
+label.monitoring.heading.access =Learners list
+errors.maxfilesize =The uploaded file has exceeded the maximum file size limit of {0} bytes
+error.attachment.executable =The uploaded file is executable, please zip it before uploading.
+lable.learning.minimum.view.number.less =You must view at least another {0} of the resources.
+label.finished =Next Activity
+label.finish =Finished
+error.msg.repository =A repository error occurred while trying to upload the file.
+monitoring.label.attachments =Attachments
+message.activityLocked =The instructor has set this activity not to allow you to view or share any more resources after you have finished it.
+label.export.reflection =Notebook Entries
+message.warnLockOnFinish =Note: After you click on \u201cNext Activity\u201d, if you come back to this Share Resource, you won\u2019t be able to share new resources.
+monitoring.label.instructions =Instructions
+label.on =On
+label.off =Off
+monitor.summary.th.advancedSettings =Advanced Settings
+monitor.summary.td.addNotebook =Add Notebook at end of eAdventure game
+monitor.summary.td.notebookInstructions =Notebook instructions
+label.authoring.advanced.notify.onassigmentsubmit =Notify monitoring teachers when a learner submits a resource
+event.assigment.submit.subject =LAMS: A learner submitted an assigment in a eAdventure tool
+event.assigment.submit.body =The learner {0} submitted an assigment in a eAdventure tool.\n\nThis message was send automatically, following tool''s advanced settings.
+message.alertContentEdit =Warning: One of more learners have accessed this activity. Changing this content will result in learners getting different information.
+error.planner.no.resource.save =There has to be at least one resource to save.
+error.planner.url.blank =In resource {0} URL can not be blank.
+error.planner.file.blank =In resource {0} file can not be blank.
+
+output.desc.learner.score =score
+output.desc.learner.time.taken = time taken
+output.desc.learner.number.of.attempts = attemps
+output.desc.learner.completed = completed
+
+output.desc.learner.user.defined = User defined:
+
+output.desc.shared.items.output.definition.rsrc =Share Resources: Uploaded URLs and paths to files
+
+heading.totalLearnersInGroup = Total Number of Learners in Group:
+
+heading.totalFinishedLearnersInGroup= Number of Finished Learners:
+
+#======= End labels: Exported 172 labels for en AU =====
Index: lams_tool_eadventure/conf/language/lams/ApplicationResources_en_AU.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/conf/language/lams/ApplicationResources_en_AU.properties,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/conf/language/lams/ApplicationResources_en_AU.properties 2 Nov 2010 22:16:24 -0000 1.1
@@ -0,0 +1,215 @@
+appName = eadventure
+#language code: en
+#locale code: AU
+
+ # CVS ID: $Id: ApplicationResources_en_AU.properties,v 1.1 2010/11/02 22:16:24 angel.dba Exp $ Exported from the LAMS Community by Ernie Ghiglione on Sat Jul 04 01:38:10 CST 2009
+
+#=================== labels for ShareResources =================#
+
+activity.description = eAdventure Game.
+label.authoring.basic.resource.instructions =Instructions
+label.authoring.heading.instructions =Instructions
+label.authoring.heading.instructions.desc =Please input online and offline instructions
+label.authoring.basic.instruction =Instruction
+label.authoring.basic.resource.add.instruction =Add Instruction
+label.authoring.online.instruction =Online Instructions
+label.authoring.offline.instruction =Offline Instructions
+error.resource.item.desc.blank =Comment/Instruction can not be blank
+tool.display.name =eAdventure Tool
+tool.description =Tool for use games in a sequence.
+errorPage.title =Error page
+errorPage.heading =Some error occurs when handling your request
+label.authoring.heading =eAdventure
+label.author.title =eAdventure Authoring
+label.authoring.heading.basic =Basic
+label.next.instruction =Next Instruction
+label.authoring.heading.basic.desc =Basic input information for eAdventure
+msg.no.instruction =No instruction available.
+label.authoring.heading.advance.desc =Please input advance options for eAdventure
+label.authoring.basic.title =Title
+label.learning.comment.or.instruction =Comment/Instruction
+label.authoring.basic.add.url =Add URL
+label.authoring.basic.add.file =Add Single File
+label.authoring.basic.resource.preview =Preview
+label.authoring.basic.resource.edit =Edit
+label.authoring.basic.resource.delete =Delete
+monitoring.tab.instructions =Instruction
+label.authoring.advanced.reflectOnActivity =Add Notebook at end of eAdventure with the following instructions:
+label.authoring.basic.resource.title.input =Title
+label.authoring.basic.resource.file.input =File
+label.authoring.basic.resource.description.input =Description
+label.authoring.online.file =Upload online file
+label.authoring.offline.file =Upload offline file
+label.authoring.choosefile.button =Choose file
+label.authoring.upload.online.button =Upload Online
+label.authoring.upload.offline.button =Upload Offline
+label.authoring.online.filelist =Online file list
+label.authoring.offline.filelist =Offline file list
+label.authoring.online.delete =Delete
+label.authoring.offline.delete =Delete
+label.authoring.advance.mini.number.resources.view =Minimum number of resources to view
+label.authoring.advance.allow.learner.add.urls =Allow learners to add URLs
+label.authoring.advance.allow.learner.add.files =Allow learners to add Files
+label.authoring.cancel.button =Cancel
+label.description =Description:
+authoring.exception =There is a problem in eAdventure authoring page, the reason is {0}
+error.resource.item.title.blank =Title can not be blank.
+error.resource.item.url.blank =URL can not be blank.
+error.resource.item.file.blank =File can not be blank.
+error.resource.item.invalid.url =Invalid URL format.
+error.upload.failed =Upload file failed: {0}
+error.msg.upload.file.not.found =Could not find upload file {0}.
+error.msg.zip.file.exception =Could not handle zip file when uploading file.
+error.msg.file.not.found =File not found exception occurs when uploading file.
+error.msg.ims.application =ImscpApplicationException occurs when uploading resource item file.
+error.msg.io.exception =IOException occurs when uploading file.
+error.msg.invaid.param.upload =InvalidParameterException occured while trying to upload File.
+error.msg.default.content.not.find =Could not retrieve default content record for this tool.
+authoring.msg.cancel.save =Do you want to close this window without saving?
+label.learning.title =eAdventure Learning
+label.learning.heading =eAdventure Resources
+label.learning.new.file =New file details:
+monitoring.tab.summary =Summary
+monitoring.tab.statistics =Statistic
+monitoring.tab.edit.activity =Edit Activity
+monitoring.label.group =Group
+monitoring.summary.note =Note: number of learners is the number of learners who have viewed the resource.
+monitoring.label.type =Type
+monitoring.label.title =Title
+monitoring.label.suggest =Suggested By
+monitoring.label.number.learners =Number of Learners
+monitoring.label.hide =Hide
+monitoring.label.show =Show
+monitoring.label.user.loginname =Login name
+monitoring.label.user.report = Assessment Report
+monitoring.label.user.name =Name
+monitoring.label.hidden =Hidden
+monitoring.no.report = Report not received
+label.monitoring.edit.activity.cancel =Cancel
+label.monitoring.edit.activity.update =Update
+label.monitoring.edit.activity.edit =Edit
+message.monitoring.edit.activity.not.editable =This Activity is no longer editable
+export.label.no.learning.object =No offline package available
+export.title =Export portfolio of eAdventure activity
+export.init.resource =Initial Resources
+errors.header =
+errors.footer =
+error.valueReqd =Value Required
+error.inputFileTooLarge =Input File size is too large!
+error.uploading =error uploading
+error.title.empty =Title can not be blank
+message.msg.maxFileSize =Max 250K
+label.delete =Delete
+label.download =Download
+label.view =View
+label.edit =Edit
+label.completed =Completed
+button.upload =Upload
+button.add =Add
+button.cancel =Cancel
+message.monitoring.summary.no.session =No Session Available
+label.show =Show
+label.hide =Hide
+label.save =Save
+label.cancel =Cancel
+define.later.message =Please wait for the teacher to complete the contents of this activity.
+run.offline.message =This activity is not being done on the computer. Please see your instructor for details.
+message.monitoring.summary.no.resource.for.group =No resource available for this group.
+button.try.again =Try again
+open.in.new.window =Open URL in pop-up
+page.title.monitoring.view.reflection =View Notebook Entries
+button.edit =Edit
+message.no.reflection.available =No notebook available
+error.reflection.emtpy =Please input Notebook Entry
+title.reflection =Notebook Entry
+monitoring.user.reflection =Notebook Entry
+activity.title =eAdventure
+label.authoring.save.button =Save
+monitoring.label.access.time =Access time
+label.authoring.advance.lock.on.finished =Lock when finished
+label.authoring.advance.define.completed = Hide "finish button" until eAdventure "completed" var is set
+label.authoring.heading.advance =Advanced
+error.msg.ims.package = Invalid game format
+label.up =Move Up
+label.down =Move down
+label.continue =Continue
+monitoring.user.fullname =Name
+button.close =Close
+label.monitoring.heading.access =Learners list
+errors.maxfilesize =The uploaded file has exceeded the maximum file size limit of {0} bytes
+error.attachment.executable =The uploaded file is executable, please zip it before uploading.
+label.finished =Next Activity
+label.finish =Finished
+error.msg.repository =A repository error occurred while trying to upload the file.
+monitoring.label.attachments =Attachments
+message.activityLocked =The instructor has set this activity not to allow you to play the game after you have finished it.
+label.export.reflection =Notebook Entries
+message.warnLockOnFinish =Note: After you click on \u201cNext Activity\u201d, if you come back to this eAdventure Activity, you won\u2019t be able to execute the game again.
+monitoring.label.instructions =Instructions
+label.on =On
+label.off =Off
+monitor.summary.th.advancedSettings =Advanced Settings
+monitor.summary.td.addNotebook =Add Notebook at end of eAdventure
+monitor.summary.td.notebookInstructions =Notebook instructions
+message.alertContentEdit =Warning: One of more learners have accessed this activity. Changing this content will result in learners getting different information.
+error.resource.game.title.blank = The activity name can not be empty.
+error.condition.name.blank = The condition's name can not be empty.
+error.condition.expression.name.blank = You have to select one variable or fill with a value the second op.
+error.condition.contains.wrong.symbol = The condition's name contains invalid symbols.
+error.condition.var.same.name.vars = You can choose the same variable at both sides of the expression.
+error.condition.not.ead.added = You have to choose a eAdventure game before create conditions.
+error.eadventure.not.ead.added = You have to select one valid eAdventure game (exported specifically for LAMS).
+error.condition.var.not.eq.type = The selected variables have not the same type.
+error.condition.no.expressions = There has to be at least one expression in the condition.
+error.condition.name.duplicated = The name already exists.
+error.condition.value.introduce.not.alpha = The string value introduced in the expression is not alphanumeric.
+error.expression.not.selected.operator = There is not an operator selected.
+error.expression.not.selected.second.var = You choose to introduce a variable and there is not a variable selected.
+error.expression.not.selected.first.var = There is not a first variable selected.
+output.desc.learner.user.defined = User defined:
+heading.totalLearnersInGroup = Total Number of Learners in Group:
+heading.totalFinishedLearnersInGroup= Number of Finished Learners:
+label.authoring.basic.edit.game = Change Game
+label.authoring.basic.add.game = Add Game
+label.authoring.conditions.list.title = Conditions
+label.authoring.conditions.condition.name = Condition Name
+label.authoring.conditions.empty.condition.list = There are no conditions
+label.authoring.conditions.add.condition = Add Condition
+label.authoring.conditions.expression.list.title = Expressions for selected condition
+label.authoring.conditions.condition.var1 = First variable
+label.authoring.conditions.condition.operator = Operator
+label.authoring.conditions.condition.var2 = Second variable or value
+label.authoring.conditions.add.expression = Add new expression
+label.authoring.conditions.empty.expression.list = There are no expressions
+label.authoring.conditions.select.var = -- VARIABLE --
+label.authoring.conditions.select.operator = -- OPERATOR --
+label.authoring.conditions.change.introduce.value = Add value
+label.authoring.conditions.change.introduce.var = Select a variable
+label.authoring.conditions.introduce.value = Introduce a value
+label.authoring.conditions.select.boolean.value.true = true
+label.authoring.conditions.select.boolean.value.false = false
+label.authoring.conditions.condition.nextOp = Next Operator
+label.authoring.conditions.change.expression.advance.edition = Change to advance expression edition
+label.authoring.conditions.change.expression.simple.edition = Change to simple expression edition
+label.authoring.conditions.select.boolean.value.and = and
+label.authoring.conditions.select.boolean.value.or = or
+label.authoring.conditions.condition.number = N�
+label.authoring.conditions.can.not.add = Conditions can not be added until you upload a eAdventure game
+label.condition.branching = Match Conditions to Game Adaptation Paths
+label.condition.branching.condition = Conditions
+label.condition.branching.adaptation = Adaptation Paths
+label.condition.branching.mappings = Mappings
+label.condition.branching.path = Game Path
+label.condition.helper.values = Assigning values to variables to check the condition
+label.condition.helper.init= The selected condition will be met
+label.condition.helper.expression = if {0} is {1} {2}
+label.condition.helper.expression.and = and
+label.condition.helper.expression.or = or
+label.condition.helper.integer.equals = equals to
+label.condition.helper.integer.gt = greater than
+label.condition.helper.integer.gte = greater than or equals to
+label.condition.helper.integer.lt = less than
+label.condition.helper.integer.lte = less than or equals to
+label.condition.helper.integer.ne = not equals to
+
+#======= End labels: Exported 172 labels for en AU =====
Index: lams_tool_eadventure/conf/language/rams/ApplicationResources.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/conf/language/rams/Attic/ApplicationResources.properties,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/conf/language/rams/ApplicationResources.properties 2 Nov 2010 22:16:38 -0000 1.1
@@ -0,0 +1,171 @@
+appName = shareresources
+#language code: en
+#locale code: AU
+
+ # CVS ID: $Id: ApplicationResources.properties,v 1.1 2010/11/02 22:16:38 angel.dba Exp $ Exported from the RAMS Community by Ernie Ghiglione on Tue Aug 12 12:00:29 EST 2008
+
+#=================== labels for ShareResources =================#
+
+appName =Share Resources
+activity.title =eadventure
+activity.description =Sharing resource with others.
+activity.helptext =Uploading your resources to share with others.
+tool.display.name =Share Resources Tool
+tool.description =Tool for sharing resources.
+errorPage.title =Error page
+errorPage.heading =Some error occurs when handling your request
+label.authoring.heading =Share Resources
+label.author.title =Share Resources Authoring
+label.authoring.heading.basic =Basic
+label.authoring.heading.advance =Advanced
+label.authoring.heading.instructions =Instructions
+label.authoring.heading.basic.desc =Basic input information for shared resources
+label.authoring.heading.instructions.desc =Please input online and offline instructions
+label.authoring.heading.advance.desc =Please input advance options for shared resources
+label.authoring.basic.title =Title
+label.authoring.basic.instruction =Instruction
+label.authoring.basic.add.url =Add URL
+label.authoring.basic.add.file =Add Single File
+label.authoring.basic.add.website =Add Zipped Website
+label.authoring.basic.add.learning.object =Add IMS Content Package
+label.authoring.basic.resource.list.title =Resource List
+label.authoring.basic.resource.url =URL
+label.authoring.basic.resource.file =File
+label.authoring.basic.resource.website =Website
+label.authoring.basic.resource.learning.object =IMS CP
+label.authoring.basic.resource.verify.url =Verify URL
+label.authoring.basic.resource.preview =Preview
+label.authoring.basic.resource.edit =Edit
+label.authoring.basic.resource.delete =Delete
+label.authoring.basic.resource.add.instruction =Add Instruction
+label.authoring.basic.resource.instructions =Instructions
+label.authoring.basic.resource.title.input =Title
+label.authoring.basic.resource.url.input =URL
+label.authoring.basic.resource.file.input =File
+label.authoring.basic.resource.description.input =Description
+label.authoring.basic.resource.zip.file.input =Zip file:
+label.authoring.online.instruction =Online Instructions
+label.authoring.offline.instruction =Offline Instructions
+label.authoring.online.file =Upload online file
+label.authoring.offline.file =Upload offline file
+label.authoring.choosefile.button =Choose file
+label.authoring.upload.online.button =Upload Online
+label.authoring.upload.offline.button =Upload Offline
+label.authoring.online.filelist =Online file list
+label.authoring.offline.filelist =Offline file list
+label.authoring.online.delete =Delete
+label.authoring.offline.delete =Delete
+label.authoring.advance.lock.on.finished =Lock when finished
+label.authoring.advance.run.content.auto =Run content automatically (only available if there is exactly one resource)
+label.authoring.advance.mini.number.resources.view =Minimum number of resources to view
+label.authoring.advance.allow.learner.add.urls =Allow participants to add URLs
+label.authoring.advance.allow.learner.add.files =Allow participants to add Files
+label.next.instruction =Next Instruction
+label.authoring.save.button =Save
+label.authoring.cancel.button =Cancel
+label.description =Description:
+authoring.exception =There is a problem in shared resources authoring page, the reason is {0}
+error.resource.item.title.blank =Title can not be blank.
+error.resource.item.url.blank =URL can not be blank.
+error.resource.item.file.blank =File can not be blank.
+error.resource.item.desc.blank =Comment/Instruction can not be blank
+error.resource.item.invalid.url =Invalid URL format.
+error.upload.failed =Upload file failed: {0}
+error.msg.upload.file.not.found =Could not find upload file {0}.
+error.msg.zip.file.exception =Could not handle zip file when uploading file.
+error.msg.file.not.found =File not found exception occurs when uploading file.
+error.msg.ims.package =Invalid IMS CP format.
+error.msg.ims.application =ImscpApplicationException occurs when uploading resource item file.
+error.msg.website.no.initial.file =Website zip can not find out initial file (index.htm/html or default.htm/html).
+error.msg.io.exception =IOException occurs when uploading file.
+error.msg.invaid.param.upload =InvalidParameterException occured while trying to upload File.
+error.msg.repository =Repository occurs exception while trying to upload file.
+error.msg.default.content.not.find =Could not retrieve default content record for this tool.
+msg.no.instruction =No instruction available.
+authoring.msg.cancel.save =Do you want to close this window without saving?
+label.learning.title =Share Resource
+label.learning.heading =Share Resources
+label.resoruce.to.review =Resources to view
+label.learning.minimum.review =You must view at least {0} of the resources.
+lable.learning.minimum.view.number.less =You at least view another {0} of the resources.
+label.check.for.new =Check for new
+label.suggest.new =Suggest a new
+label.learning.new.file =New file details:
+label.learning.new.url =New URL details:
+label.learning.comment.or.instruction =Comment/Instruction
+monitoring.tab.summary =Summary
+monitoring.tab.statistics =Statistic
+monitoring.tab.instructions =Instruction
+monitoring.tab.edit.activity =Edit Activity
+monitoring.label.group =Group
+monitoring.summary.note =Note: number of participants is the number of participants who have viewed the resource.
+monitoring.label.type =Type
+monitoring.label.title =Title
+monitoring.label.suggest =Suggested By
+monitoring.label.number.learners =Number of Participants
+monitoring.label.hide =Hide
+monitoring.label.show =Show
+monitoring.label.user.loginname =Login name
+monitoring.label.user.name =Name
+monitoring.label.hidden =Hidden
+label.monitoring.edit.activity.cancel =Cancel
+label.monitoring.edit.activity.update =Update
+label.monitoring.edit.activity.edit =Edit
+message.monitoring.edit.activity.not.editable =This Activity is no longer editable
+export.label.resource =Resource
+export.label.no.learning.object =No offline package available
+export.title =Export portfolio of Share Resource
+export.init.resource =Initial Resources
+errors.header =
+errors.footer =
+error.valueReqd =Value Required
+error.inputFileTooLarge =Input File size is too large!
+error.uploading =error uploading
+error.title.empty =Title can not be blank
+message.msg.maxFileSize =Max 250K
+label.open =Open
+label.delete =Delete
+label.download =Download
+label.view =View
+label.edit =Edit
+label.finished =Finished
+label.completed =Completed
+label.finish =Finish
+button.upload =Upload
+button.add =Add
+button.cancel =Cancel
+message.monitoring.summary.no.session =No Session Available
+label.show =Show
+label.hide =Hide
+label.save =Save
+label.cancel =Cancel
+monitoring.label.access.time =Access time
+define.later.message =Please wait for the researcher to complete the contents of this activity.
+run.offline.message =This activity is not being done on the computer. Please see your instructor for details.
+message.monitoring.summary.no.resource.for.group =No resource available for this group.
+button.try.again =Try again
+open.in.new.window =Open URL in pop-up
+label.up =Move Up
+label.down =Move down
+label.authoring.advanced.reflectOnActivity =Add Notebook at end of Shared Resources with the following instructions:
+error.reflection.emtpy =Please input reflection
+title.reflection =Reflection
+label.continue =Continue
+monitoring.user.fullname =Name
+monitoring.user.reflection =Reflection
+page.title.monitoring.view.reflection =View Reflection
+button.close =Close
+message.step.of =Step {0} of {1}
+message.no.reflection.available =No notebook available
+button.edit =Edit
+errors.maxfilesize =The uploaded file has exceeded the maximum file size limit of {0} bytes
+error.attachment.executable =The uploaded file is executable, please zip it before uploading.
+label.monitoring.heading.access =Participants list
+message.alertContentEdit =Warning: One of more participants have accessed this activity. Changing this content will result in students getting different information.
+label.export.reflection =Notebook Entries
+monitoring.label.attachments =Attachments
+message.activityLocked =Note: After you click on "Next Activity" and you come back to this Share Resources, you won't be able to continue.
+message.warnLockOnFinish =This activitiy has been setup not to allow sharing and viewing of resources after it has been finished.
+
+
+#======= End labels: Exported 160 labels for en AU =====
Index: lams_tool_eadventure/conf/language/rams/ApplicationResources_en_AU.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/conf/language/rams/Attic/ApplicationResources_en_AU.properties,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/conf/language/rams/ApplicationResources_en_AU.properties 2 Nov 2010 22:16:38 -0000 1.1
@@ -0,0 +1,171 @@
+appName = eAdventure
+#language code: en
+#locale code: AU
+
+ # CVS ID: $Id: ApplicationResources_en_AU.properties,v 1.1 2010/11/02 22:16:38 angel.dba Exp $ Exported from the RAMS Community by Ernie Ghiglione on Tue Aug 12 12:00:29 EST 2008
+
+#=================== labels for ShareResources =================#
+
+appName = eAdventure
+activity.title =eadventure
+activity.description =Add eAdventure games in your sequence
+activity.helptext =Add a white-box game to increase the educational experience and to obtain detailed feedback.
+tool.display.name =eAdventure Tool
+tool.description =eAdventure game.
+errorPage.title =Error page
+errorPage.heading =Some error occurs when handling your request
+label.authoring.heading =eAdventure
+label.author.title =eAdventure Authoring
+label.authoring.heading.basic =Basic
+label.authoring.heading.advance =Advanced
+label.authoring.heading.instructions =Instructions
+label.authoring.heading.basic.desc =Basic input information for eAdventure games
+label.authoring.heading.instructions.desc =Please input online and offline instructions
+label.authoring.heading.advance.desc =Please input advance options for eAdventure
+label.authoring.basic.title =Title
+label.authoring.basic.instruction =Instruction
+label.authoring.basic.add.url =Add URL
+label.authoring.basic.add.file =Add Single File
+label.authoring.basic.add.website =Add Zipped Website
+label.authoring.basic.add.learning.object =Add IMS Content Package
+label.authoring.basic.resource.list.title =Resource List
+label.authoring.basic.resource.url =URL
+label.authoring.basic.resource.file =File
+label.authoring.basic.resource.website =Website
+label.authoring.basic.resource.learning.object =IMS CP
+label.authoring.basic.resource.verify.url =Verify URL
+label.authoring.basic.resource.preview =Preview
+label.authoring.basic.resource.edit =Edit
+label.authoring.basic.resource.delete =Delete
+label.authoring.basic.resource.add.instruction =Add Instruction
+label.authoring.basic.resource.instructions =Instructions
+label.authoring.basic.resource.title.input =Title
+label.authoring.basic.resource.url.input =URL
+label.authoring.basic.resource.file.input =File
+label.authoring.basic.resource.description.input =Description
+label.authoring.basic.resource.zip.file.input =Zip file:
+label.authoring.online.instruction =Online Instructions
+label.authoring.offline.instruction =Offline Instructions
+label.authoring.online.file =Upload online file
+label.authoring.offline.file =Upload offline file
+label.authoring.choosefile.button =Choose file
+label.authoring.upload.online.button =Upload Online
+label.authoring.upload.offline.button =Upload Offline
+label.authoring.online.filelist =Online file list
+label.authoring.offline.filelist =Offline file list
+label.authoring.online.delete =Delete
+label.authoring.offline.delete =Delete
+label.authoring.advance.lock.on.finished =Lock when finished
+label.authoring.advance.run.content.auto =Run content automatically (only available if there is exactly one resource)
+label.authoring.advance.mini.number.resources.view =Minimum number of resources to view
+label.authoring.advance.allow.learner.add.urls =Allow participants to add URLs
+label.authoring.advance.allow.learner.add.files =Allow participants to add Files
+label.next.instruction =Next Instruction
+label.authoring.save.button =Save
+label.authoring.cancel.button =Cancel
+label.description =Description:
+authoring.exception =There is a problem in eAdventure authoring page, the reason is {0}
+error.resource.item.title.blank =Title can not be blank.
+error.resource.item.url.blank =URL can not be blank.
+error.resource.item.file.blank =File can not be blank.
+error.resource.item.desc.blank =Comment/Instruction can not be blank
+error.resource.item.invalid.url =Invalid URL format.
+error.upload.failed =Upload file failed: {0}
+error.msg.upload.file.not.found =Could not find upload file {0}.
+error.msg.zip.file.exception =Could not handle zip file when uploading file.
+error.msg.file.not.found =File not found exception occurs when uploading file.
+error.msg.ims.package =Invalid IMS CP format.
+error.msg.ims.application =ImscpApplicationException occurs when uploading resource item file.
+error.msg.website.no.initial.file =Website zip can not find out initial file (index.htm/html or default.htm/html).
+error.msg.io.exception =IOException occurs when uploading file.
+error.msg.invaid.param.upload =InvalidParameterException occured while trying to upload File.
+error.msg.repository =Repository occurs exception while trying to upload file.
+error.msg.default.content.not.find =Could not retrieve default content record for this tool.
+msg.no.instruction =No instruction available.
+authoring.msg.cancel.save =Do you want to close this window without saving?
+label.learning.title =eAdventure game
+label.learning.heading =eAQdventure
+label.resoruce.to.review =Resources to view
+label.learning.minimum.review =You must view at least {0} of the resources.
+lable.learning.minimum.view.number.less =You at least view another {0} of the resources.
+label.check.for.new =Check for new
+label.suggest.new =Suggest a new
+label.learning.new.file =New file details:
+label.learning.new.url =New URL details:
+label.learning.comment.or.instruction =Comment/Instruction
+monitoring.tab.summary =Summary
+monitoring.tab.statistics =Statistic
+monitoring.tab.instructions =Instruction
+monitoring.tab.edit.activity =Edit Activity
+monitoring.label.group =Group
+monitoring.summary.note =Note: number of participants is the number of participants who have viewed the resource.
+monitoring.label.type =Type
+monitoring.label.title =Title
+monitoring.label.suggest =Suggested By
+monitoring.label.number.learners =Number of Participants
+monitoring.label.hide =Hide
+monitoring.label.show =Show
+monitoring.label.user.loginname =Login name
+monitoring.label.user.name =Name
+monitoring.label.hidden =Hidden
+label.monitoring.edit.activity.cancel =Cancel
+label.monitoring.edit.activity.update =Update
+label.monitoring.edit.activity.edit =Edit
+message.monitoring.edit.activity.not.editable =This Activity is no longer editable
+export.label.resource =Resource
+export.label.no.learning.object =No offline package available
+export.title =Export portfolio of eAdventure game
+export.init.resource =Initial Resources
+errors.header =
+errors.footer =
+error.valueReqd =Value Required
+error.inputFileTooLarge =Input File size is too large!
+error.uploading =error uploading
+error.title.empty =Title can not be blank
+message.msg.maxFileSize =Max 250K
+label.open =Open
+label.delete =Delete
+label.download =Download
+label.view =View
+label.edit =Edit
+label.finished =Finished
+label.completed =Completed
+label.finish =Finish
+button.upload =Upload
+button.add =Add
+button.cancel =Cancel
+message.monitoring.summary.no.session =No Session Available
+label.show =Show
+label.hide =Hide
+label.save =Save
+label.cancel =Cancel
+monitoring.label.access.time =Access time
+define.later.message =Please wait for the researcher to complete the contents of this activity.
+run.offline.message =This activity is not being done on the computer. Please see your instructor for details.
+message.monitoring.summary.no.resource.for.group =No resource available for this group.
+button.try.again =Try again
+open.in.new.window =Open URL in pop-up
+label.up =Move Up
+label.down =Move down
+label.authoring.advanced.reflectOnActivity =Add Notebook at end of eAdventure game with the following instructions:
+error.reflection.emtpy =Please input reflection
+title.reflection =Reflection
+label.continue =Continue
+monitoring.user.fullname =Name
+monitoring.user.reflection =Reflection
+page.title.monitoring.view.reflection =View Reflection
+button.close =Close
+message.step.of =Step {0} of {1}
+message.no.reflection.available =No notebook available
+button.edit =Edit
+errors.maxfilesize =The uploaded file has exceeded the maximum file size limit of {0} bytes
+error.attachment.executable =The uploaded file is executable, please zip it before uploading.
+label.monitoring.heading.access =Participants list
+message.alertContentEdit =Warning: One of more participants have accessed this activity. Changing this content will result in students getting different information.
+label.export.reflection =Notebook Entries
+monitoring.label.attachments =Attachments
+message.activityLocked =Note: After you click on "Next Activity" and you come back to this Share Resources, you won't be able to continue.
+message.warnLockOnFinish =This activitiy has been setup not to allow sharing and viewing of resources after it has been finished.
+
+
+#======= End labels: Exported 160 labels for en AU =====
Index: lams_tool_eadventure/conf/war/META-INF/MANIFEST.MF
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/conf/war/META-INF/Attic/MANIFEST.MF,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/conf/war/META-INF/MANIFEST.MF 2 Nov 2010 22:16:39 -0000 1.1
@@ -0,0 +1,4 @@
+Implementation-Title: LAMS - Eadventure Tool
+Implementation-Version: 2.1
+Implementation-Vendor: LAMS Foundation (http://lamsfoundation.org)
+Class-Path: ./lams.jar ./lams-tool-eueadv10.jar ./lams-contentrepository.jar
Index: lams_tool_eadventure/conf/xdoclet/global-exceptions.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/conf/xdoclet/global-exceptions.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/conf/xdoclet/global-exceptions.xml 2 Nov 2010 22:16:24 -0000 1.1
@@ -0,0 +1,8 @@
+
+
+
Index: lams_tool_eadventure/conf/xdoclet/global-forwards.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/conf/xdoclet/global-forwards.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/conf/xdoclet/global-forwards.xml 2 Nov 2010 22:16:24 -0000 1.1
@@ -0,0 +1,6 @@
+
+
+
+
+
+
Index: lams_tool_eadventure/conf/xdoclet/struts-actions.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/conf/xdoclet/struts-actions.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/conf/xdoclet/struts-actions.xml 2 Nov 2010 22:16:25 -0000 1.1
@@ -0,0 +1,339 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_eadventure/conf/xdoclet/struts-forms.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/conf/xdoclet/struts-forms.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/conf/xdoclet/struts-forms.xml 2 Nov 2010 22:16:25 -0000 1.1
@@ -0,0 +1 @@
+
Index: lams_tool_eadventure/conf/xdoclet/struts-message-resources.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/conf/xdoclet/struts-message-resources.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/conf/xdoclet/struts-message-resources.xml 2 Nov 2010 22:16:25 -0000 1.1
@@ -0,0 +1 @@
+
Index: lams_tool_eadventure/conf/xdoclet/struts-plugins.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/conf/xdoclet/struts-plugins.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/conf/xdoclet/struts-plugins.xml 2 Nov 2010 22:16:24 -0000 1.1
@@ -0,0 +1,15 @@
+
+
+
+
+
+
Index: lams_tool_eadventure/conf/xdoclet/validation-forms.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/conf/xdoclet/validation-forms.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/conf/xdoclet/validation-forms.xml 2 Nov 2010 22:16:25 -0000 1.1
@@ -0,0 +1,29 @@
+
Index: lams_tool_eadventure/conf/xdoclet/validation-global.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/conf/xdoclet/validation-global.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/conf/xdoclet/validation-global.xml 2 Nov 2010 22:16:25 -0000 1.1
@@ -0,0 +1,6 @@
+
+
+ datePattern
+ yyyy-MM-dd
+
+
Index: lams_tool_eadventure/db/model/eadventure.clay
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/db/model/eadventure.clay,v
diff -u
Binary files differ
Index: lams_tool_eadventure/db/sql/activity_insert.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/db/sql/activity_insert.sql,v
diff -u
Binary files differ
Index: lams_tool_eadventure/db/sql/create_lams_tool_eadventure.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/db/sql/create_lams_tool_eadventure.sql,v
diff -u
Binary files differ
Index: lams_tool_eadventure/db/sql/db_version_insert.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/db/sql/db_version_insert.sql,v
diff -u
Binary files differ
Index: lams_tool_eadventure/db/sql/drop_lams_tool_eadventure.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/db/sql/drop_lams_tool_eadventure.sql,v
diff -u
Binary files differ
Index: lams_tool_eadventure/db/sql/library_insert.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/db/sql/library_insert.sql,v
diff -u
Binary files differ
Index: lams_tool_eadventure/db/sql/table-schema.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/db/sql/table-schema.sql,v
diff -u
Binary files differ
Index: lams_tool_eadventure/db/sql/tool_insert.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/db/sql/tool_insert.sql,v
diff -u
Binary files differ
Index: lams_tool_eadventure/db/sql/updatescripts/updateTo20070227.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/db/sql/updatescripts/Attic/updateTo20070227.sql,v
diff -u
Binary files differ
Index: lams_tool_eadventure/db/sql/updatescripts/updateTo20080229.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/db/sql/updatescripts/Attic/updateTo20080229.sql,v
diff -u
Binary files differ
Index: lams_tool_eadventure/lib/jaxen/sax.jar
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/lib/jaxen/Attic/sax.jar,v
diff -u
Binary files differ
Index: lams_tool_eadventure/lib/jaxen/saxpath.jar
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/lib/jaxen/Attic/saxpath.jar,v
diff -u
Binary files differ
Index: lams_tool_eadventure/lib/reload_2_0_1/castor-0.9.5.3-xml.jar
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/lib/reload_2_0_1/Attic/castor-0.9.5.3-xml.jar,v
diff -u
Binary files differ
Index: lams_tool_eadventure/lib/reload_2_0_1/jdom.jar
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/lib/reload_2_0_1/Attic/jdom.jar,v
diff -u
Binary files differ
Index: lams_tool_eadventure/lib/reload_2_0_1/moonunitsrc.jar
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/lib/reload_2_0_1/Attic/moonunitsrc.jar,v
diff -u
Binary files differ
Index: lams_tool_eadventure/lib/reload_2_0_1/reload-diva.jar
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/lib/reload_2_0_1/Attic/reload-diva.jar,v
diff -u
Binary files differ
Index: lams_tool_eadventure/lib/reload_2_0_1/reload-editor.jar
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/lib/reload_2_0_1/Attic/reload-editor.jar,v
diff -u
Binary files differ
Index: lams_tool_eadventure/lib/reload_2_0_1/reload-jdom.jar
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/lib/reload_2_0_1/Attic/reload-jdom.jar,v
diff -u
Binary files differ
Index: lams_tool_eadventure/lib/reload_2_0_1/reload-moonunit.jar
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/lib/reload_2_0_1/Attic/reload-moonunit.jar,v
diff -u
Binary files differ
Index: lams_tool_eadventure/lib/reload_2_0_1/xml-apis.jar
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/lib/reload_2_0_1/Attic/xml-apis.jar,v
diff -u
Binary files differ
Index: lams_tool_eadventure/licenses/Jaxen LICENSE.txt
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/licenses/Attic/Jaxen LICENSE.txt,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/licenses/Jaxen LICENSE.txt 2 Nov 2010 22:16:29 -0000 1.1
@@ -0,0 +1,33 @@
+/*
+ $Id: Jaxen\040LICENSE.txt,v 1.1 2010/11/02 22:16:29 angel.dba Exp $
+
+ Copyright 2003-2006 The Werken Company. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the Jaxen Project nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ */
Index: lams_tool_eadventure/licenses/castor license.txt
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/licenses/Attic/castor license.txt,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/licenses/castor license.txt 2 Nov 2010 22:16:29 -0000 1.1
@@ -0,0 +1,38 @@
+Copyright 2000-2002 (C) Intalio Inc. All Rights Reserved.
+
+Redistribution and use of this software and associated documentation
+("Software"), with or without modification, are permitted provided
+that the following conditions are met:
+
+1. Redistributions of source code must retain copyright statements
+ and notices. Redistributions must also contain a copy of this
+ document.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+3. The name "ExoLab" must not be used to endorse or promote products
+ derived from this Software without prior written permission of
+ Intalio Inc. For written permission, please contact info@exolab.org.
+
+4. Products derived from this Software may not be called "Castor"
+ nor may "Castor" appear in their names without prior written
+ permission of Intalio Inc. Exolab, Castor and Intalio are
+ trademarks of Intalio Inc.
+
+5. Due credit should be given to the ExoLab Project
+ (http://www.exolab.org/).
+
+THIS SOFTWARE IS PROVIDED BY INTALIO AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTALIO OR ITS
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.
Index: lams_tool_eadventure/licenses/jdom licence.txt
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/licenses/Attic/jdom licence.txt,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/licenses/jdom licence.txt 2 Nov 2010 22:16:29 -0000 1.1
@@ -0,0 +1,54 @@
+/*--
+
+ Copyright (C) 2000-2002 Brett McLaughlin & Jason Hunter.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials
+ provided with the distribution.
+
+ 3. The name "JDOM" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact license@jdom.org.
+
+ 4. Products derived from this software may not be called "JDOM", nor
+ may "JDOM" appear in their name, without prior written permission
+ from the JDOM Project Management (pm@jdom.org).
+
+ In addition, we request (but do not require) that you include in the
+ end-user documentation provided with the redistribution and/or in the
+ software itself an acknowledgement equivalent to the following:
+ "This product includes software developed by the
+ JDOM Project (http://www.jdom.org/)."
+ Alternatively, the acknowledgment may be graphical using the logos
+ available at http://www.jdom.org/images/logos.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the JDOM Project and was originally
+ created by Brett McLaughlin and
+ Jason Hunter . For more information on the
+ JDOM Project, please see .
+
+ */
+
Index: lams_tool_eadventure/licenses/library_licenses.txt
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/licenses/Attic/library_licenses.txt,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/licenses/library_licenses.txt 2 Nov 2010 22:16:29 -0000 1.1
@@ -0,0 +1,28 @@
+Tigra Tree Javascript license description:
+There is no license fee or royalty fee to be paid at any time for using the Tigra Tree Menu v1.x
+You may include the source code or modified source code within your own projects for either personal or commercial use but excluding the restrictions outlined below. The following restrictions apply to all parts of the component, including all source code, samples and documentation.
+
+ * Header block of script file (tree.js) CAN NOT be modified or removed.
+ * The above items CAN NOT be sold as are, either individually or together.
+ * The above items CAN NOT be modified and then sold as a library component, either individually or together.
+
+
+For more detail, http://www.softcomplex.com/products/tigra_tree_menu/docs/
+
+Library/Package License
+
+Used for the IMSCP functionality (Reload Project)
+castor-0.9.5.3-xml.jar Castor License
+jdom.jar Jdom Jar License
+moonunitsrc.jar Reload License
+reload-diva.jar Reload License
+reload-editor.jar Reload License
+reload-jdom.jar Reload License
+reload-moonunit.jar Reload License
+xercesImpl.jar Apache Software License 1.1
+xml-apis.jar Apache Software License 1.1
+
+Other libraries
+jaxen-full.jar Jaxen Jar License (The Werken Company)
+sax.jar Public Domain
+saxpath.jar Jaxen Jar License (The Werken Company)
Index: lams_tool_eadventure/licenses/reload licence.txt
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/licenses/Attic/reload licence.txt,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/licenses/reload licence.txt 2 Nov 2010 22:16:30 -0000 1.1
@@ -0,0 +1,45 @@
+RELOAD Tools and Libraries
+
+Copyright (c) 2002-2004 Oleg Liber, Bill Olivier, Phillip Beauvoir
+
+This licence covers:
+
+The Reload "jdom" library
+The Reload "diva" library
+The Reload "dweezil" library
+The Reload "jdom" library
+The Reload "moonunit" library
+The Reload "xindice" library
+The Reload Editor
+The Reload SCORM Player
+The Reload Schema Viewer Eclipse Plugin
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Project Management Contact:
+
+Oleg Liber
+Bolton Institute of Higher Education
+Deane Road
+Bolton BL3 5AB
+UK
+
+e-mail: o.liber@bolton.ac.uk
+
+
+Technical Contact:
+
+Phillip Beauvoir
+Bolton Institute of Higher Education
+Deane Road
+Bolton BL3 5AB
+UK
+
+e-mail: p.beauvoir@bolton.ac.uk
+
+
+Web: http://www.reload.ac.uk
Index: lams_tool_eadventure/licenses/xerces licence.txt
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/licenses/Attic/xerces licence.txt,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/licenses/xerces licence.txt 2 Nov 2010 22:16:30 -0000 1.1
@@ -0,0 +1,56 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xerces" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 1999, International
+ * Business Machines, Inc., http://www.ibm.com. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/EadventureConstants.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/EadventureConstants.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/EadventureConstants.java 2 Nov 2010 22:16:26 -0000 1.1
@@ -0,0 +1,274 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $Id: EadventureConstants.java,v 1.1 2010/11/02 22:16:26 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure;
+
+public class EadventureConstants {
+
+ public enum ExpresionOp {
+ AND, OR, EMPTY
+ }
+
+ public enum ParamType {
+ BOOLEAN, STRING, INTEGER
+ }
+
+ public static final String[] IntergerOp = {
+ "==", "!=","<", "<=", ">", ">="
+ };
+
+ public static final String[] StringOp = {
+ "==", "!="
+ };
+
+ public static final String[] BooleanOp = {
+ "==", "!="
+ };
+
+ public static final String TOOL_SIGNATURE = "eueadv10";
+
+ public static final String RESOURCE_SERVICE = "eadventureService";
+
+ public static final String TOOL_CONTENT_HANDLER_NAME = "eadventureToolContentHandler";
+
+ public static final int COMPLETED = 1;
+
+ // eadventure type;
+ public static final short RESOURCE_TYPE_URL = 1;
+
+ public static final short RESOURCE_TYPE_FILE = 2;
+
+ public static final short RESOURCE_TYPE_WEBSITE = 3;
+
+ public static final short RESOURCE_TYPE_LEARNING_OBJECT = 4;
+
+ // for action forward name
+ public static final String SUCCESS = "success";
+
+ public static final String ERROR = "error";
+
+ public static final String DEFINE_LATER = "definelater";
+
+ // for parameters' name
+
+ public static final String PARAM_TOOL_CONTENT_ID = "toolContentID";
+
+ public static final String PARAM_TOOL_SESSION_ID = "toolSessionID";
+
+ public static final String PARAM_FILE_VERSION_ID = "fileVersionId";
+
+ public static final String PARAM_FILE_UUID = "fileUuid";
+
+ public static final String PARAM_ITEM_INDEX = "itemIndex";
+
+ public static final String PARAM_RESOURCE_ITEM_UID = "itemUid";
+
+ public static final String PARAM_CURRENT_INSTRUCTION_INDEX = "insIdx";
+
+ public static final String PARAM_RUN_OFFLINE = "runOffline";
+
+ public static final String PARAM_OPEN_URL_POPUP = "popupUrl";
+
+ public static final String PARAM_TITLE = "title";
+
+ public static final String PARAM_CONDITION_POSITION = "position";
+
+ public static final String PARAM_EXPRESSION_POSITION = "positionExpression";
+
+ public static final String PARAM_VAR_NAME = "paramName";
+
+ // for request attribute name
+ public static final String ATTR_EXPRS_INFO = "exprsInfo";
+
+ public static final String ATTR_ERROR_IN_CONDITION = "notallowDefineCondition";
+
+ public static final String ATTR_EXPR_SELECTED_TYPE = "type";
+
+ public static final String ATTR_GAME_DELETE = "gameDelete";
+
+ public static final String ATTR_OPEN_SAVED_GAME = "savedGame";
+
+ public static final String ATTR_EDIT_CONDITION = "editCondition";
+
+ public static final String ATTR_CONDITION_LIST = "conditionsList";
+
+ public static final String ATTR_EXPRESSION_LIST = "expressionList";
+
+ public static final String ATTR_PARAMS_LIST = "paramsList";
+
+ public static final String ATTR_DELETED_CONDITION_LIST = "deletedConditionsList";
+
+ public static final String ATTR_DELETED_EXPRESSION_LIST = "deletedExpressionList";
+
+ public static final String ATTR_DELETED_PARAMS_LIST = "deletedParamsList";
+
+ public static final String ATTR_CHANGE_FILE = "newFile";
+
+ public static final String ATTR_HAS_FILE = "hasFile";
+
+ public static final String ATTR_LOCAL_URL = "localURL";
+
+ public static final String ATTR_TOOL_CONTENT_ID = "toolContentID";
+
+ public static final String ATTR_TOOL_SESSION_ID = "toolSessionID";
+
+ public static final String ATTR_INSTRUCTION_LIST = "instructionList";
+
+ public static final String ATTR_RESOURCE_ITEM_LIST = "eadventureList";
+
+ public static final String ATTR_RESOURCE_PARAM_LIST = "eadventureParamList";
+
+ public static final String ATT_ATTACHMENT_LIST = "instructionAttachmentList";
+
+ public static final String ATTR_DELETED_RESOURCE_ITEM_LIST = "deleteEadventureList";
+
+ public static final String ATTR_DELETED_ATTACHMENT_LIST = "deletedAttachmmentList";
+
+ public static final String ATTR_DELETED_RESOURCE_ITEM_ATTACHMENT_LIST = "deletedItemAttachmmentList";;
+
+ public static final String ATT_LEARNING_OBJECT = "cpPackage";
+
+ public static final String ATTR_RESOURCE_REVIEW_URL = "eadventureItemReviewUrl";
+
+ public static final String ATTR_EADVENTURE = "eadventure";
+
+ public static final String ATTR_RUN_AUTO = "runAuto";
+
+ public static final String ATTR_RESOURCE_ITEM_UID = "itemUid";
+
+ public static final String ATTR_NEXT_ACTIVITY_URL = "nextActivityUrl";
+
+ public static final String ATTR_SUMMARY_LIST = "summaryList";
+
+ public static final String ATTR_USER_LIST = "userList";
+
+ public static final String ATTR_RESOURCE_INSTRUCTION = "instructions";
+
+ public static final String ATTR_FINISH_LOCK = "finishedLock";
+
+ public static final String ATTR_LOCK_ON_FINISH = "lockOnFinish";
+
+ public static final String ATTR_DEFINE_COMPLETED = "defineCompleted";
+
+ public static final String ATTR_COMPLETED = "completed";
+
+ public static final String ATTR_SESSION_MAP_ID = "sessionMapID";
+
+ public static final String ATTR_RESOURCE_FORM = "eadventureForm";
+
+ public static final String ATTR_GAME_FORM = "eadventureGameForm";
+
+ public static final String ATTR_ADD_RESOURCE_TYPE = "addType";
+
+ public static final String ATTR_FILE_TYPE_FLAG = "fileTypeFlag";
+
+ public static final String ATTR_TITLE = "title";
+
+ public static final String ATTR_INSTRUCTIONS = "instructions";
+
+ public static final String ATTR_USER_FINISHED = "userFinished";
+
+ public static final String ATTR_USER_ID = "userID";
+
+ public static final String ATTR_USER_FNAME = "userFName";
+
+ public static final String ATTR_USER_LNAME = "userLName";
+
+ // error message keys
+ public static final String ERROR__EXPRESSION_NO_FIRST_VAR = "error.expression.not.selected.first.var";
+
+ public static final String ERROR__EXPRESSION_NO_SECOND_VAR = "error.expression.not.selected.second.var";
+
+ public static final String ERROR__EXPRESSION_NO_OPERATOR = "error.expression.not.selected.operator";
+
+ public static final String ERROR_MSG_TITLE_BLANK = "error.resource.game.title.blank";
+
+ public static final String ERROR_NAME_CONDITION_BLANK = "error.condition.name.blank";
+
+ public static final String ERROR_NAME_VALUE_BLANK = "error.condition.expression.name.blank";
+
+ public static final String ERROR_MSG_NAME_CONTAINS_WRONG_SYMBOL = "error.condition.contains.wrong.symbol";
+
+ public static final String ERROR_VALUE_NOT_BOOLEAN = "error.condition.value.introduce.not.boolean";
+
+ public static final String ERROR_SAME_VARS_NAME = "error.condition.var.same.name.vars";
+
+ public static final String ERROR_NOT_EAD_ADD_COND = "error.condition.not.ead.added";
+
+ public static final String ERROR_NOT_EAD_ADD = "error.eadventure.not.ead.added";
+
+ public static final String ERROR_NOT_EQ_VARS_TYPE = "error.condition.var.not.eq.type";
+
+ public static final String ERROR_MSG_NO_EXPRESSIONS = "error.condition.no.expressions";
+
+ public static final String ERROR_MSG_NAME_DUPLICATED = "error.condition.name.duplicated";
+
+ public static final String ERROR_VALUE_NOT_ALPHA = "error.condition.value.introduce.not.alpha";
+
+ public static final String ERROR_VALUE_NOT_NUMERIC = "error.condition.value.introduce.not.numeric";
+
+ public static final String ERROR_MSG_URL_BLANK = "error.resource.item.url.blank";
+
+ public static final String ERROR_MSG_DESC_BLANK = "error.resource.item.desc.blank";
+
+ public static final String ERROR_MSG_FILE_BLANK = "error.resource.item.file.blank";
+
+ public static final String ERROR_MSG_INVALID_URL = "error.resource.item.invalid.url";
+
+ public static final String ERROR_MSG_UPLOAD_FAILED = "error.upload.failed";
+
+ public static final String PAGE_EDITABLE = "isPageEditable";
+
+ public static final String MODE_AUTHOR_SESSION = "author_session";
+
+ public static final String ATTR_REFLECTION_ON = "reflectOn";
+
+ public static final String ATTR_REFLECTION_INSTRUCTION = "reflectInstructions";
+
+ public static final String ATTR_REFLECTION_ENTRY = "reflectEntry";
+
+ public static final String ATTR_REFLECT_LIST = "reflectList";
+
+ public static final String ATTR_USER_UID = "userUid";
+
+ public static final String DEFUALT_PROTOCOL_REFIX = "http://";
+
+ public static final String ALLOW_PROTOCOL_REFIX = new String("[http://|https://|ftp://|nntp://]");
+
+ public static final String EVENT_NAME_NOTIFY_TEACHERS_ON_ASSIGMENT_SUBMIT = "notify_teachers_on_assigment_submit";
+
+ public static final String SHARED_ITEMS_DEFINITION_NAME = "shared.items.output.definition.eadventure";
+
+
+ public final static String PARAMETERS_FILE_NAME = "ead-parameters.xml";
+
+ public final static String PARAMS_TYPE_STRING = "string";
+ public final static String PARAMS_TYPE_INTEGER = "integer";
+ public final static String PARAMS_TYPE_BOOLEAN = "boolean";
+
+ public final static String VAR_NAME_SCORE = "score";
+ public final static String VAR_NAME_REPORT = "report";
+ public final static String VAR_NAME_COMPLETED = "game-completed";
+ public final static String VAR_NAME_TIME_TAKEN = "total-time";
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/eadventureApplicationContext.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/eadventureApplicationContext.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/eadventureApplicationContext.xml 2 Nov 2010 22:16:26 -0000 1.1
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+ org.eucm.lams.tool.eadventure.ApplicationResources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,+java.lang.Exception
+ PROPAGATION_REQUIRED,+java.lang.Exception
+ PROPAGATION_REQUIRED,+java.lang.Exception
+ PROPAGATION_REQUIRED,+java.lang.Exception
+
+
+
+
+
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/DAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/DAO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/DAO.java 2 Nov 2010 22:16:33 -0000 1.1
@@ -0,0 +1,70 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: DAO.java,v 1.1 2010/11/02 22:16:33 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.dao;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+/**
+ * Data Access Object (DAO) interface. This is an interface
+ * used to tag our DAO classes and to provide common methods to all DAOs.
+ *
+ * @author Dapeng.Ni
+ */
+public interface DAO {
+
+ /**
+ * Generic method used to get all objects of a particular type. This
+ * is the same as lookup up all rows in a table.
+ * @param clazz the type of objects (a.k.a. while table) to get data from
+ * @return List of populated objects
+ */
+ public List getObjects(Class clazz);
+
+ /**
+ * Generic method to get an object based on class and identifier. An
+ * ObjectRetrievalFailureException Runtime Exception is thrown if
+ * nothing is found.
+ *
+ * @param clazz model class to lookup
+ * @param id the identifier (primary key) of the class
+ * @return a populated object
+ * @see org.springframework.orm.ObjectRetrievalFailureException
+ */
+ public Object getObject(Class clazz, Serializable id);
+
+ /**
+ * Generic method to save an object - handles both update and insert.
+ * @param o the object to save
+ */
+ public void saveObject(Object o);
+
+ /**
+ * Generic method to delete an object based on class and id
+ * @param clazz model class to lookup
+ * @param id the identifier (primary key) of the class
+ */
+ public void removeObject(Class clazz, Serializable id);
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureAttachmentDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/Attic/EadventureAttachmentDAO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureAttachmentDAO.java 2 Nov 2010 22:16:33 -0000 1.1
@@ -0,0 +1,28 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: EadventureAttachmentDAO.java,v 1.1 2010/11/02 22:16:33 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.dao;
+
+public interface EadventureAttachmentDAO extends DAO {
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureConditionDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureConditionDAO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureConditionDAO.java 2 Nov 2010 22:16:33 -0000 1.1
@@ -0,0 +1,32 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureConditionDAO.java,v 1.1 2010/11/02 22:16:33 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.dao;
+
+public interface EadventureConditionDAO extends DAO{
+
+
+
+
+}
+
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureDAO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureDAO.java 2 Nov 2010 22:16:32 -0000 1.1
@@ -0,0 +1,36 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: EadventureDAO.java,v 1.1 2010/11/02 22:16:32 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.dao;
+
+import org.eucm.lams.tool.eadventure.model.Eadventure;
+
+public interface EadventureDAO extends DAO {
+
+ Eadventure getByContentId(Long contentId);
+
+ Eadventure getByUid(Long eadventureUid);
+
+ void delete(Eadventure eadventure);
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureExpressionDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureExpressionDAO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureExpressionDAO.java 2 Nov 2010 22:16:33 -0000 1.1
@@ -0,0 +1,29 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureExpressionDAO.java,v 1.1 2010/11/02 22:16:33 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.dao;
+
+public interface EadventureExpressionDAO extends DAO{
+
+}
+
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureItemVisitDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureItemVisitDAO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureItemVisitDAO.java 2 Nov 2010 22:16:33 -0000 1.1
@@ -0,0 +1,48 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: EadventureItemVisitDAO.java,v 1.1 2010/11/02 22:16:33 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eucm.lams.tool.eadventure.dto.Summary;
+import org.eucm.lams.tool.eadventure.model.EadventureItemVisitLog;
+
+public interface EadventureItemVisitDAO extends DAO {
+
+
+ public EadventureItemVisitLog getEadventureItemLog(Long itemUid,Long userId);
+
+ public int getUserViewLogCount(Long sessionId, Long userUid);
+ /**
+ * Return list which contains key pair which key is eadventure item uid, value is number view.
+ *
+ * @param contentId
+ * @return
+ */
+ public Map getSummary(Long contentId);
+
+ public List getEadventureItemLogBySession(Long sessionId,Long itemUid);
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureParamDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureParamDAO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureParamDAO.java 2 Nov 2010 22:16:33 -0000 1.1
@@ -0,0 +1,38 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureParamDAO.java,v 1.1 2010/11/02 22:16:33 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.dao;
+
+import java.util.List;
+
+import org.eucm.lams.tool.eadventure.model.EadventureParam;
+
+public interface EadventureParamDAO extends DAO {
+
+
+ public List getEadventureParamByEadContentId(Long contentId);
+
+ void delete(EadventureParam param);
+
+}
+
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureSessionDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureSessionDAO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureSessionDAO.java 2 Nov 2010 22:16:33 -0000 1.1
@@ -0,0 +1,41 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: EadventureSessionDAO.java,v 1.1 2010/11/02 22:16:33 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.dao;
+
+import java.util.List;
+
+import org.eucm.lams.tool.eadventure.model.EadventureSession;
+
+public interface EadventureSessionDAO extends DAO {
+
+ EadventureSession getSessionBySessionId(Long sessionId);
+
+ List getByContentId(Long toolContentId);
+
+ void delete(EadventureSession session);
+
+ void deleteBySessionId(Long toolSessionId);
+
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureUserDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureUserDAO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureUserDAO.java 2 Nov 2010 22:16:33 -0000 1.1
@@ -0,0 +1,37 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: EadventureUserDAO.java,v 1.1 2010/11/02 22:16:33 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.dao;
+
+import java.util.List;
+
+import org.eucm.lams.tool.eadventure.model.EadventureUser;
+
+public interface EadventureUserDAO extends DAO {
+
+ EadventureUser getUserByUserIDAndSessionID(Long userID, Long sessionId);
+
+ EadventureUser getUserByUserIDAndContentID(Long userId, Long contentId);
+
+ List getBySessionID(Long sessionId);
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureVarsDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureVarsDAO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/EadventureVarsDAO.java 2 Nov 2010 22:16:33 -0000 1.1
@@ -0,0 +1,33 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureVarsDAO.java,v 1.1 2010/11/02 22:16:33 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.dao;
+
+import org.eucm.lams.tool.eadventure.model.EadventureVars;
+
+public interface EadventureVarsDAO extends DAO {
+
+
+ public EadventureVars getEadventureVars(Long itemVisitLogID,String name);
+}
+
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/BaseDAOHibernate.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/BaseDAOHibernate.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/BaseDAOHibernate.java 2 Nov 2010 22:16:32 -0000 1.1
@@ -0,0 +1,72 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: BaseDAOHibernate.java,v 1.1 2010/11/02 22:16:32 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.dao.hibernate;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eucm.lams.tool.eadventure.dao.DAO;
+import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
+
+/**
+ * This class serves as the Base class for all other DAOs - namely to hold
+ * common methods that they might all use. Can be used for standard CRUD
+ * operations.
+ *
+ * @author Dapeng.Ni
+ */
+public class BaseDAOHibernate extends HibernateDaoSupport implements DAO {
+ protected final Log log = LogFactory.getLog(getClass());
+
+ /**
+ * @see com.edgenius.paradise.dao.DAO#saveObject(java.lang.Object)
+ */
+ public void saveObject(Object o) {
+ getHibernateTemplate().saveOrUpdate(o);
+ }
+
+ /**
+ * @see com.edgenius.paradise.dao.DAO#getObject(java.lang.Class, java.io.Serializable)
+ */
+ public Object getObject(Class clazz, Serializable id) {
+ Object o = getHibernateTemplate().get(clazz, id);
+ return o;
+ }
+
+ /**
+ * @see com.edgenius.paradise.dao.DAO#getObjects(java.lang.Class)
+ */
+ public List getObjects(Class clazz) {
+ return getHibernateTemplate().loadAll(clazz);
+ }
+
+ /**
+ * @see com.edgenius.paradise.dao.DAO#removeObject(java.lang.Class, java.io.Serializable)
+ */
+ public void removeObject(Class clazz, Serializable id) {
+ getHibernateTemplate().delete(getObject(clazz, id));
+ }
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureAttachmentDAOHibernate.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/Attic/EadventureAttachmentDAOHibernate.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureAttachmentDAOHibernate.java 2 Nov 2010 22:16:32 -0000 1.1
@@ -0,0 +1,30 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: EadventureAttachmentDAOHibernate.java,v 1.1 2010/11/02 22:16:32 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.dao.hibernate;
+
+import org.eucm.lams.tool.eadventure.dao.EadventureAttachmentDAO;
+
+public class EadventureAttachmentDAOHibernate extends BaseDAOHibernate implements EadventureAttachmentDAO{
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureConditionDAOHibernate.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureConditionDAOHibernate.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureConditionDAOHibernate.java 2 Nov 2010 22:16:32 -0000 1.1
@@ -0,0 +1,31 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureConditionDAOHibernate.java,v 1.1 2010/11/02 22:16:32 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.dao.hibernate;
+
+import org.eucm.lams.tool.eadventure.dao.EadventureConditionDAO;
+
+public class EadventureConditionDAOHibernate extends BaseDAOHibernate implements EadventureConditionDAO {
+
+}
+
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureDAOHibernate.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureDAOHibernate.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureDAOHibernate.java 2 Nov 2010 22:16:32 -0000 1.1
@@ -0,0 +1,56 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: EadventureDAOHibernate.java,v 1.1 2010/11/02 22:16:32 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.dao.hibernate;
+
+import java.util.List;
+
+import org.eucm.lams.tool.eadventure.dao.EadventureDAO;
+import org.eucm.lams.tool.eadventure.model.Eadventure;
+
+/**
+ *
+ * @author Steve.Ni
+ *
+ * @version $Revision: 1.1 $
+ */
+public class EadventureDAOHibernate extends BaseDAOHibernate implements EadventureDAO{
+ private static final String GET_RESOURCE_BY_CONTENTID = "from "+Eadventure.class.getName()+" as r where r.contentId=?";
+
+ public Eadventure getByContentId(Long contentId) {
+ List list = getHibernateTemplate().find(GET_RESOURCE_BY_CONTENTID,contentId);
+ if(list.size() > 0)
+ return (Eadventure) list.get(0);
+ else
+ return null;
+ }
+
+ public Eadventure getByUid(Long eadventureUid) {
+ return (Eadventure) getObject(Eadventure.class,eadventureUid);
+ }
+
+ public void delete(Eadventure eadventure) {
+ this.getHibernateTemplate().delete(eadventure);
+ }
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureExpressionDAOHibernate.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureExpressionDAOHibernate.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureExpressionDAOHibernate.java 2 Nov 2010 22:16:32 -0000 1.1
@@ -0,0 +1,31 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureExpressionDAOHibernate.java,v 1.1 2010/11/02 22:16:32 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.dao.hibernate;
+
+import org.eucm.lams.tool.eadventure.dao.EadventureExpressionDAO;
+
+public class EadventureExpressionDAOHibernate extends BaseDAOHibernate implements EadventureExpressionDAO {
+
+}
+
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureItemVisitDAOHibernate.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureItemVisitDAOHibernate.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureItemVisitDAOHibernate.java 2 Nov 2010 22:16:32 -0000 1.1
@@ -0,0 +1,102 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: EadventureItemVisitDAOHibernate.java,v 1.1 2010/11/02 22:16:32 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.dao.hibernate;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eucm.lams.tool.eadventure.dao.EadventureItemVisitDAO;
+import org.eucm.lams.tool.eadventure.dto.Summary;
+import org.eucm.lams.tool.eadventure.model.Eadventure;
+import org.eucm.lams.tool.eadventure.model.EadventureItemVisitLog;
+import org.eucm.lams.tool.eadventure.model.EadventureSession;
+import org.eucm.lams.tool.eadventure.model.EadventureUser;
+
+public class EadventureItemVisitDAOHibernate extends BaseDAOHibernate implements EadventureItemVisitDAO{
+
+ private static final String FIND_BY_ITEM_AND_USER = "from " + EadventureItemVisitLog.class.getName()
+ + " as r where r.user.userId = ? and r.eadventure.uid = ?";
+
+ private static final String FIND_BY_ITEM_BYSESSION = "from " + EadventureItemVisitLog.class.getName()
+ + " as r where r.sessionId = ? and r.eadventure.uid=?";
+
+ private static final String FIND_VIEW_COUNT_BY_USER = "select count(*) from " + EadventureItemVisitLog.class.getName()
+ + " as r where r.sessionId=? and r.user.userId =?";
+
+ private static final String FIND_SUMMARY = "select v.eadventure.uid, count(v.eadventure) from "
+ + EadventureItemVisitLog.class.getName() + " as v , "
+ + EadventureSession.class.getName() + " as s, "
+ + Eadventure.class.getName() + " as r "
+ +" where v.sessionId = s.sessionId "
+ +" and s.eadventure.uid = r.uid "
+ +" and r.contentId =? "
+ +" group by v.sessionId, v.eadventure.uid ";
+
+ /*private static final String FIND_SUMMARY = "select v.eadventure.uid, count(v.eadventureItem) from "
+ + EadventureItemVisitLog.class.getName() + " as v , "
+ + EadventureSession.class.getName() + " as s, "
+ + Eadventure.class.getName() + " as r "
+ +" where v.sessionId = s.sessionId "
+ +" and s.eadventure.uid = r.uid "
+ +" and r.contentId =? "
+ +" group by v.sessionId, v.eadventure.uid ";
+
+ */
+ public EadventureItemVisitLog getEadventureItemLog(Long itemUid,Long userId){
+ List list = getHibernateTemplate().find(FIND_BY_ITEM_AND_USER,new Object[]{userId,itemUid});
+ if(list == null || list.size() ==0)
+ return null;
+ return (EadventureItemVisitLog) list.get(0);
+ }
+
+ public int getUserViewLogCount(Long toolSessionId ,Long userUid) {
+ List list = getHibernateTemplate().find(FIND_VIEW_COUNT_BY_USER,new Object[]{toolSessionId, userUid});
+ if(list == null || list.size() ==0)
+ return 0;
+ return ((Number) list.get(0)).intValue();
+ }
+
+ // returns for specified Eadventure UUID the number () of eadVisitLogs asociated to this eAdventure
+ public Map getSummary(Long contentId) {
+
+ // Note: Hibernate 3.1 query.uniqueResult() returns Integer, Hibernate 3.2 query.uniqueResult() returns Long
+ List result = getHibernateTemplate().find(FIND_SUMMARY,contentId);
+ Map summaryList = new HashMap (result.size());
+ for(Object[] list : result){
+ if ( list[1] != null ) {
+ summaryList.put((Long)list[0],new Integer(((Number)list[1]).intValue()));
+ }
+ }
+ return summaryList;
+
+ }
+
+ public List getEadventureItemLogBySession(Long sessionId, Long itemUid) {
+
+ return getHibernateTemplate().find(FIND_BY_ITEM_BYSESSION,new Object[]{sessionId,itemUid});
+ }
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureParamDAOHibernate.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureParamDAOHibernate.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureParamDAOHibernate.java 2 Nov 2010 22:16:32 -0000 1.1
@@ -0,0 +1,57 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureParamDAOHibernate.java,v 1.1 2010/11/02 22:16:32 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.dao.hibernate;
+
+import java.util.List;
+
+import org.eucm.lams.tool.eadventure.dao.EadventureParamDAO;
+import org.eucm.lams.tool.eadventure.model.EadventureParam;
+import org.eucm.lams.tool.eadventure.model.EadventureVars;
+
+public class EadventureParamDAOHibernate extends BaseDAOHibernate implements EadventureParamDAO {
+
+
+ private static final String FIND_BY_ITEM_AND_NAME = "from " + EadventureParam.class.getName()
+ + " as r where r.visitLog.uid = ? and r.name =?";
+
+
+ private static final String FIND_BY_EAD = "from " + EadventureParam.class.getName()
+ + " as r where r.eadventure_uid = ?";
+
+
+ public List getEadventureParamByEadContentId(Long contentId){
+ List list = getHibernateTemplate().find(FIND_BY_EAD,contentId);
+ if(list == null || list.size() ==0)
+ return null;
+
+ return list;
+}
+
+ public void delete(EadventureParam param){
+ this.getHibernateTemplate().delete(param);
+ }
+
+
+}
+
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureSessionDAOHibernate.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureSessionDAOHibernate.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureSessionDAOHibernate.java 2 Nov 2010 22:16:32 -0000 1.1
@@ -0,0 +1,54 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: EadventureSessionDAOHibernate.java,v 1.1 2010/11/02 22:16:32 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.dao.hibernate;
+
+import java.util.List;
+
+import org.eucm.lams.tool.eadventure.dao.EadventureSessionDAO;
+import org.eucm.lams.tool.eadventure.model.EadventureSession;
+
+
+public class EadventureSessionDAOHibernate extends BaseDAOHibernate implements EadventureSessionDAO{
+
+ private static final String FIND_BY_SESSION_ID = "from " + EadventureSession.class.getName() + " as p where p.sessionId=?";
+ private static final String FIND_BY_CONTENT_ID = "from " + EadventureSession.class.getName() + " as p where p.eadventure.contentId=?";
+
+ public EadventureSession getSessionBySessionId(Long sessionId) {
+ List list = getHibernateTemplate().find(FIND_BY_SESSION_ID,sessionId);
+ if(list == null || list.size() == 0)
+ return null;
+ return (EadventureSession) list.get(0);
+ }
+ public List getByContentId(Long toolContentId) {
+ return getHibernateTemplate().find(FIND_BY_CONTENT_ID,toolContentId);
+ }
+
+ public void delete(EadventureSession session) {
+ this.getHibernateTemplate().delete(session);
+ }
+ public void deleteBySessionId(Long toolSessionId) {
+ this.removeObject(EadventureSession.class,toolSessionId);
+ }
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureUserDAOHibernate.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureUserDAOHibernate.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureUserDAOHibernate.java 2 Nov 2010 22:16:32 -0000 1.1
@@ -0,0 +1,57 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: EadventureUserDAOHibernate.java,v 1.1 2010/11/02 22:16:32 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.dao.hibernate;
+
+import java.util.List;
+
+import org.eucm.lams.tool.eadventure.dao.EadventureUserDAO;
+import org.eucm.lams.tool.eadventure.model.EadventureUser;
+
+
+public class EadventureUserDAOHibernate extends BaseDAOHibernate implements EadventureUserDAO{
+
+ private static final String FIND_BY_USER_ID_CONTENT_ID = "from " + EadventureUser.class.getName() + " as u where u.userId =? and u.eadventure.contentId=?";
+ private static final String FIND_BY_USER_ID_SESSION_ID = "from " + EadventureUser.class.getName() + " as u where u.userId =? and u.session.sessionId=?";
+ private static final String FIND_BY_SESSION_ID = "from " + EadventureUser.class.getName() + " as u where u.session.sessionId=?";
+
+ public EadventureUser getUserByUserIDAndSessionID(Long userID, Long sessionId) {
+ List list = this.getHibernateTemplate().find(FIND_BY_USER_ID_SESSION_ID,new Object[]{userID,sessionId});
+ if(list == null || list.size() == 0)
+ return null;
+ return (EadventureUser) list.get(0);
+ }
+
+ public EadventureUser getUserByUserIDAndContentID(Long userId, Long contentId) {
+ List list = this.getHibernateTemplate().find(FIND_BY_USER_ID_CONTENT_ID,new Object[]{userId,contentId});
+ if(list == null || list.size() == 0)
+ return null;
+ return (EadventureUser) list.get(0);
+ }
+
+ public List getBySessionID(Long sessionId) {
+ return this.getHibernateTemplate().find(FIND_BY_SESSION_ID,sessionId);
+ }
+
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureVarsDAOHibernate.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureVarsDAOHibernate.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dao/hibernate/EadventureVarsDAOHibernate.java 2 Nov 2010 22:16:32 -0000 1.1
@@ -0,0 +1,47 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureVarsDAOHibernate.java,v 1.1 2010/11/02 22:16:32 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.dao.hibernate;
+
+import java.util.List;
+
+import org.eucm.lams.tool.eadventure.dao.EadventureVarsDAO;
+import org.eucm.lams.tool.eadventure.model.EadventureItemVisitLog;
+import org.eucm.lams.tool.eadventure.model.EadventureVars;
+
+public class EadventureVarsDAOHibernate extends BaseDAOHibernate implements EadventureVarsDAO {
+
+
+
+ private static final String FIND_BY_ITEM_AND_NAME = "from " + EadventureVars.class.getName()
+ + " as r where r.visitLog.uid = ? and r.name =?";
+
+ public EadventureVars getEadventureVars(Long itemVisitLogID,String name){
+ List list = getHibernateTemplate().find(FIND_BY_ITEM_AND_NAME,new Object[]{itemVisitLogID,name});
+ if(list == null || list.size() ==0)
+ return null;
+
+ return (EadventureVars)list.get(0);
+ }
+}
+
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dbupdates/autopatchContext.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dbupdates/autopatchContext.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dbupdates/autopatchContext.xml 2 Nov 2010 22:16:38 -0000 1.1
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dto/ExpressionInfo.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dto/ExpressionInfo.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dto/ExpressionInfo.java 2 Nov 2010 22:16:34 -0000 1.1
@@ -0,0 +1,100 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: ExpressionInfo.java,v 1.1 2010/11/02 22:16:34 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.dto;
+
+public class ExpressionInfo {
+
+ private String name;
+
+ private String type;
+
+ private String valueInExpression;
+
+ private String operator;
+
+ private String nameSecondOp;
+
+ private String nextOp;
+
+
+ public ExpressionInfo(String name, String type, String operator, String nextOp){
+ this.name = name;
+ this.type = type;
+ this.operator = operator;
+ this.nextOp = nextOp;
+
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getValueInExpression() {
+ return valueInExpression;
+ }
+
+ public void setValueInExpression(String valueInExpression) {
+ this.valueInExpression = valueInExpression;
+ }
+
+ public String getOperator() {
+ return operator;
+ }
+
+ public void setOperator(String operator) {
+ this.operator = operator;
+ }
+
+ public String getNameSecondOp() {
+ return nameSecondOp;
+ }
+
+ public void setNameSecondOp(String nameSecondOp) {
+ this.nameSecondOp = nameSecondOp;
+ }
+
+ public String getNextOp() {
+ return nextOp;
+ }
+
+ public void setNextOp(String nextOp) {
+ this.nextOp = nextOp;
+ }
+
+
+
+}
+
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dto/InstructionNavDTO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dto/InstructionNavDTO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dto/InstructionNavDTO.java 2 Nov 2010 22:16:34 -0000 1.1
@@ -0,0 +1,54 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: InstructionNavDTO.java,v 1.1 2010/11/02 22:16:34 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.dto;
+
+import java.util.List;
+
+
+/**
+ *
+ * @author Steve.Ni
+ * @version $Revision: 1.1 $
+ */
+public class InstructionNavDTO {
+
+ private String title;
+ private String instruction;
+
+ public String getTitle() {
+ return title;
+ }
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getInstruction() {
+ return instruction;
+ }
+ public void setInstruction(String instruction) {
+ this.instruction = instruction;
+ }
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dto/ReflectDTO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dto/ReflectDTO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dto/ReflectDTO.java 2 Nov 2010 22:16:34 -0000 1.1
@@ -0,0 +1,67 @@
+package org.eucm.lams.tool.eadventure.dto;
+
+import org.eucm.lams.tool.eadventure.model.EadventureUser;
+
+/**
+ *
+ * @author Dapeng Ni
+ *
+ */
+public class ReflectDTO {
+ private Long userUid;
+ private String fullName;
+ private String loginName;
+ private boolean hasRefection;
+ private String reflectInstrctions;
+ private boolean finishReflection;
+ private String reflect;
+
+ public ReflectDTO(EadventureUser user) {
+ this.setLoginName(user.getLoginName());
+ this.setFullName(user.getFirstName()+" "+user.getLastName());
+ this.setUserUid(user.getUid());
+ }
+
+ public boolean isFinishReflection() {
+ return finishReflection;
+ }
+ public void setFinishReflection(boolean finishReflection) {
+ this.finishReflection = finishReflection;
+ }
+ public String getFullName() {
+ return fullName;
+ }
+ public void setFullName(String fullName) {
+ this.fullName = fullName;
+ }
+ public boolean isHasRefection() {
+ return hasRefection;
+ }
+ public void setHasRefection(boolean hasRefection) {
+ this.hasRefection = hasRefection;
+ }
+ public String getLoginName() {
+ return loginName;
+ }
+ public void setLoginName(String loginName) {
+ this.loginName = loginName;
+ }
+ public String getReflect() {
+ return reflect;
+ }
+ public void setReflect(String reflect) {
+ this.reflect = reflect;
+ }
+ public String getReflectInstrctions() {
+ return reflectInstrctions;
+ }
+ public void setReflectInstrctions(String reflectInstrctions) {
+ this.reflectInstrctions = reflectInstrctions;
+ }
+ public Long getUserUid() {
+ return userUid;
+ }
+ public void setUserUid(Long userUid) {
+ this.userUid = userUid;
+ }
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dto/Summary.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dto/Summary.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/dto/Summary.java 2 Nov 2010 22:16:34 -0000 1.1
@@ -0,0 +1,292 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: Summary.java,v 1.1 2010/11/02 22:16:34 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.dto;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+
+import org.eucm.lams.tool.eadventure.model.Eadventure;
+import org.eucm.lams.tool.eadventure.model.EadventureUser;
+import org.eucm.lams.tool.eadventure.util.EadventureWebUtils;
+
+/**
+ * List contains following element:
+ *
+ * session_id session_name EadventureItem.uid
+ * EadventureItem.item_type EadventureItem.create_by_author
+ * EadventureItem.is_hide EadventureItem.title User.login_name
+ * count(eadventure_item_uid)
+ *
+ * @author Steve.Ni
+ *
+ * @version $Revision: 1.1 $
+ */
+public class Summary {
+
+ private Long sessionId;
+ private String sessionName;
+ private Long eadventureUid;
+ private boolean[] existList;
+ private String[] reportList;
+ private List users;
+ private int numberOfLearners;
+ private int numberOfFinishedLearners;
+ //private short itemType;
+ //private boolean itemCreateByAuthor;
+ //TODO ver que pasa con itemHide
+ private boolean itemHide;
+ private String itemTitle;
+ //TODO ver que pasa con item instructions
+ // private List itemInstructions = new ArrayList();
+ private String username;
+ //TODO Cuidado, = viewNumber y numberOfLearners....
+ private int viewNumber;
+
+ // following is used for export portfolio programs:
+ private String url;
+ private Long fileUuid;
+ private Long fileVersionId;
+ private String fileName;
+ private String attachmentLocalUrl;
+
+ // true: initial group item, false, belong to some group.
+ private boolean isInitGroup;
+
+ public Summary() {
+ }
+
+ /**
+ * Contruction method for monitoring summary function.
+ *
+ * Don't not set isInitGroup and viewNumber fields
+ *
+ * @param sessionName
+ * @param item
+ * @param isInitGroup
+ */
+ public Summary(Long sessionId, String sessionName, Eadventure ead) {
+ this.sessionId = sessionId;
+ this.sessionName = sessionName;
+ if (ead != null) {
+ this.eadventureUid = ead.getUid();
+ //this.itemType = ead.getType();
+ // this.itemCreateByAuthor = ead.isCreatedByAuthor();
+
+ //TODO ver que pasa con hide
+ // this.itemHide = ead.isHide();
+ this.itemTitle = ead.getTitle();
+ this.username = ead.getCreatedBy() == null ? "" : ead.getCreatedBy().getLoginName();
+ // this.url = ead.protocol(ead.getUrl());
+ this.fileName = ead.getFileName();
+ this.fileUuid = ead.getFileUuid();
+ this.fileVersionId = ead.getFileVersionId();
+ } else
+ this.eadventureUid = new Long(-1);
+ }
+
+ /**
+ * Contruction method for export profolio function.
+ *
+ * Don't not set sessionId and viewNumber fields
+ *
+ * @param sessionName
+ * @param item
+ * @param isInitGroup
+ */
+ public Summary(Long sessionId, String sessionName, Eadventure ead, boolean isInitGroup) {
+ this.sessionId = sessionId;
+ this.sessionName = sessionName;
+ if (ead != null) {
+ this.eadventureUid = ead.getUid();
+ //TODO ver que pasa con HIDE
+ //this.itemHide = ead.isHide();
+ this.itemTitle = ead.getTitle();
+ this.username = ead.getCreatedBy() == null ? "" : ead.getCreatedBy().getLoginName();
+ // this.url = EadventureWebUtils.protocol(item.getUrl());
+ this.fileName = ead.getFileName();
+ this.fileUuid = ead.getFileUuid();
+ this.fileVersionId = ead.getFileVersionId();
+
+
+ } else
+ this.eadventureUid = new Long(-1);
+ //this.isInitGroup = isInitGroup;
+ }
+
+
+
+ public boolean isItemHide() {
+ return itemHide;
+ }
+
+ public void setItemHide(boolean itemHide) {
+ this.itemHide = itemHide;
+ }
+
+ public String getItemTitle() {
+ return itemTitle;
+ }
+
+ public void setItemTitle(String itemTitle) {
+ this.itemTitle = itemTitle;
+ }
+
+
+
+ public Long getItemUid() {
+ return eadventureUid;
+ }
+
+ public void setItemUid(Long itemUid) {
+ this.eadventureUid = itemUid;
+ }
+
+ public Long getSessionId() {
+ return sessionId;
+ }
+
+ public void setSessionId(Long sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ public String getSessionName() {
+ return sessionName;
+ }
+
+ public void setSessionName(String sessionName) {
+ this.sessionName = sessionName;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+
+
+ public Long getFileUuid() {
+ return fileUuid;
+ }
+
+ public void setFileUuid(Long fileUuid) {
+ this.fileUuid = fileUuid;
+ }
+
+ public Long getFileVersionId() {
+ return fileVersionId;
+ }
+
+ public void setFileVersionId(Long fileVersionId) {
+ this.fileVersionId = fileVersionId;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public boolean isInitGroup() {
+ return isInitGroup;
+ }
+
+ public void setInitGroup(boolean isInitGroup) {
+ this.isInitGroup = isInitGroup;
+ }
+
+ public String getAttachmentLocalUrl() {
+ return attachmentLocalUrl;
+ }
+
+ public void setAttachmentLocalUrl(String attachmentLocalUrl) {
+ this.attachmentLocalUrl = attachmentLocalUrl;
+ }
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+ public int getViewNumber() {
+ return viewNumber;
+ }
+
+ public void setViewNumber(int viewNumber) {
+ this.viewNumber = viewNumber;
+ }
+
+ public boolean[] getExistList() {
+ return existList;
+ }
+
+ public void setExistList(boolean[] existList) {
+ this.existList = existList;
+ }
+
+ public List getUsers() {
+ return users;
+ }
+
+ public void setUsers(List users) {
+ this.users = users;
+ }
+
+ public int getNumberOfLearners() {
+ return numberOfLearners;
+ }
+
+ public void setNumberOfLearners(int numberOfLearners) {
+ this.numberOfLearners = numberOfLearners;
+ }
+
+ public int getNumberOfFinishedLearners() {
+ return numberOfFinishedLearners;
+ }
+
+ public void setNumberOfFinishedLearners(int numberOfFinishedLearners) {
+ this.numberOfFinishedLearners = numberOfFinishedLearners;
+ }
+
+ public String[] getReportList() {
+ return reportList;
+ }
+
+ public void setReportList(String[] reportList) {
+ this.reportList = reportList;
+ }
+
+
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/ims/IContentPackageConverter.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/ims/IContentPackageConverter.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/ims/IContentPackageConverter.java 2 Nov 2010 22:16:37 -0000 1.1
@@ -0,0 +1,64 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: IContentPackageConverter.java,v 1.1 2010/11/02 22:16:37 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.ims;
+
+/**
+ * A ContentPackageConverter converts an IMS Content Package into the
+ * data needed for our tool. The only implementation initially done was
+ * SimpleContentPackageCoverter.
+ *
+ * The creation method of the converter (which is unique to each converter)
+ * will need to parse the package and have the data ready for the "get"
+ * calls.
+ *
+ * Note: Classes that implement this interface should be normal POJOS,
+ * not singletons. This allows them to have instance data.
+ */
+public interface IContentPackageConverter {
+
+ /**
+ * @return Returns the defaultItem.
+ */
+ public abstract String getDefaultItem();
+
+ /**
+ * @return Returns the description.
+ */
+ public abstract String getDescription();
+
+ /**
+ * @return Returns the organzationXML.
+ */
+ public abstract String getOrganzationXML();
+
+ /**
+ * @return Returns the schema.
+ */
+ public abstract String getSchema();
+
+ /**
+ * @return Returns the title.
+ */
+ public abstract String getTitle();
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/ims/IMSManifestException.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/ims/IMSManifestException.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/ims/IMSManifestException.java 2 Nov 2010 22:16:37 -0000 1.1
@@ -0,0 +1,64 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: IMSManifestException.java,v 1.1 2010/11/02 22:16:37 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.ims;
+
+/**
+ * This exception is thrown when an error occurs that may be related to
+ * the formatting of the IMS content package. e.g. the manifest file
+ * is missing.
+ *
+ * @author Fiona Malikoff
+ */
+public class IMSManifestException extends ImscpApplicationException {
+
+ /**
+ *
+ */
+ public IMSManifestException() {
+ super();
+ }
+
+ /**
+ * @param arg0
+ */
+ public IMSManifestException(String arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ */
+ public IMSManifestException(Throwable arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ public IMSManifestException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/ims/ImscpApplicationException.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/ims/ImscpApplicationException.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/ims/ImscpApplicationException.java 2 Nov 2010 22:16:37 -0000 1.1
@@ -0,0 +1,61 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: ImscpApplicationException.java,v 1.1 2010/11/02 22:16:37 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.ims;
+
+/**
+ * Generic exception for the imscr tool.
+ * @author Fiona Malikoff
+ */
+public class ImscpApplicationException extends Exception {
+
+ /**
+ *
+ */
+ public ImscpApplicationException() {
+ super();
+ }
+
+ /**
+ * @param arg0
+ */
+ public ImscpApplicationException(String arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ */
+ public ImscpApplicationException(Throwable arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ public ImscpApplicationException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/ims/OrganizationXMLDef.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/ims/OrganizationXMLDef.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/ims/OrganizationXMLDef.java 2 Nov 2010 22:16:37 -0000 1.1
@@ -0,0 +1,42 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: OrganizationXMLDef.java,v 1.1 2010/11/02 22:16:37 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.ims;
+
+/**
+ * This contains the "tag" of items in the organization xml. May be used
+ * by JSP pages to get the tag names right!
+ *
+ * @author Fiona Malikoff
+ */
+public final class OrganizationXMLDef {
+
+ public static final String DEFAULT = "default";
+ public static final String ITEM = "item";
+ public static final String PARAMETERS = "parameters";
+ public static final String HREF = "href";
+ public static final String IDENTIFIER = "identifier";
+ public static final String RESOURCE = "eadventure";
+ public static final String TITLE = "title";
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/ims/SimpleContentPackageConverter.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/ims/SimpleContentPackageConverter.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/ims/SimpleContentPackageConverter.java 2 Nov 2010 22:16:37 -0000 1.1
@@ -0,0 +1,492 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: SimpleContentPackageConverter.java,v 1.1 2010/11/02 22:16:37 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.ims;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.Namespace;
+
+import uk.ac.reload.jdom.XMLDocument;
+import uk.ac.reload.jdom.XMLPath;
+import uk.ac.reload.jdom.XMLUtils;
+import uk.ac.reload.moonunit.contentpackaging.CP_Core;
+
+/**
+ * SimpleContentPackageConverter contains the code required for
+ * parsing the IMS Content Package and converting the info into our
+ * own structures.
+ *
+ * Note: this class has instance data, so do not use it as a singleton.
+ *
+ * @author Fiona Malikoff
+ */
+public class SimpleContentPackageConverter implements IContentPackageConverter {
+
+ private Logger log = Logger.getLogger(SimpleContentPackageConverter.class);
+
+ // manifestDoc and cpCore are set up in the constructor. They are then used
+ // to generate the rest of the values
+ private XMLDocument manifestDoc = null;
+ private CP_Core cpCore = null;
+
+ private String schema=null;
+ private String title=null;
+ private String description=null;
+ private String defaultItem=null;
+ private String organzationXML=null;
+
+ // cachedEadventureList is used to avoid building up the list
+ // every time an item is parsed - otherwise there is a lot
+ // of processing done by the reload code time and time again.
+ private Element[] cachedEadventureList = null;
+
+ /** Set up a package converter, using the supplied directory as the package.
+ * The package should be parsed automatically and the values readied for calls
+ * to getSchema(), getTitle(), etc.
+ *
+ * @param directoryName: directory containing an expanded IMS content package.
+ * @throws IMSManifestException if there is an error in parsing the manifest file
+ * due to an error in the file or an unexpected value.
+ * @throws ImscpApplicationException if there is any other error
+ */
+ public SimpleContentPackageConverter(String directoryName)
+ throws IMSManifestException, ImscpApplicationException {
+
+ this.manifestDoc = getDocument(directoryName);
+ this.cpCore = new CP_Core(manifestDoc);
+
+ // initialise the property file required for the reload code. Needed to make
+ // the metadata call work. If we remove the metadata call, then this constructor
+ // may be removed.
+ System.setProperty("editor.properties.file", "uk.ac.reload.editor.properties.rb");
+
+ parsePackage();
+ }
+
+ /** Parse IMS content package expanded out
+ * into the supplied directory. Note: the manifest file is expected to be in the
+ * root of the supplied directory.
+ *
+ * @throws ImscpApplicationException
+ * @throws IMSManifestException
+ */
+ private void parsePackage( ) throws IMSManifestException, ImscpApplicationException {
+
+ String schemaText = getText(manifestDoc, "//metadata/schema");
+ String schemaVersion = getText(manifestDoc, "//metadata/schemaversion");
+ this.schema = ( schemaText != null ? schemaText : "unknown" )
+ + " " + ( schemaVersion != null ? schemaVersion : "unknown") ;
+
+ Document orgs = buildOrganisationList();
+ if ( orgs == null ) {
+ String error = "Unable to convert organizations from manifest file to our own structure. Reason unknown - buildOrganisationList returned null";
+ log.error(error);
+ throw new ImscpApplicationException(error);
+ }
+
+ try {
+ this.organzationXML = XMLUtils.write2XMLString(orgs);
+ } catch ( IOException ioe ) {
+ String error = "Exception thrown converting organization structure (as document) to an XML string."+ioe.getMessage();
+ log.error(error,ioe);
+ throw new ImscpApplicationException(error,ioe);
+ }
+
+ XMLPath xmlPath = new XMLPath("//metadata/*:lom/*:general/*:title/*:langstring");
+ this.title = getMetaValue(xmlPath);
+ if ( this.title == null ) {
+ // try the old root name - untested
+ xmlPath = new XMLPath("//metadata/*:record/*:general/*:title/*:langstring");
+ this.title = getMetaValue(xmlPath);
+ }
+
+ xmlPath = new XMLPath("//metadata/*:lom/*:general/*:description/*:langstring");
+ this.description = getMetaValue(xmlPath);
+ if ( this.description == null ) {
+ // try the old root name - untested
+ xmlPath = new XMLPath("//metadata/*:record/*:general/*:description/*:langstring");
+ this.description = getMetaValue(xmlPath);
+ }
+
+ }
+
+
+ /**
+ * Finds a value at the given xmlPath. If only one element, uses that value.
+ * If more than one element, tries to find an English value.
+ * @param xmlPath
+ * @return Value of the element found at xmlPath.
+ */
+ private String getMetaValue(XMLPath xmlPath) {
+ Element[] elList = manifestDoc.getElements(xmlPath);
+ String value = null;
+ if ( elList != null ) {
+ if ( elList.length == 0 ) {
+ value="Unknown";
+ } else if ( elList.length == 1 ) {
+ value=elList[0].getTextTrim();
+ } else {
+ value = null;
+ // TODO check if it is really testing for english
+ for ( int i=0; value == null && i < elList.length; i++ ) {
+ // grab the first English one
+ Element el = elList[i];
+ String attrValue = el.getAttributeValue("lang", Namespace.XML_NAMESPACE );
+ if ( attrValue != null && attrValue.startsWith("en") ) {
+ value = el.getTextTrim();
+ }
+ }
+ if ( value == null ) {
+ // can't seem to find an English one, just pick the first
+ value=elList[0].getTextTrim();
+ }
+ }
+ }
+ return value;
+ }
+
+ /* Get the text for this element - expect only 1 */
+ private String getText(XMLDocument document, String xmlPathString ) {
+ XMLPath xmlPath = new XMLPath(xmlPathString);
+ Element el = document.getElement(xmlPath);
+ return el != null ? el.getTextTrim() : null;
+ }
+
+ private String debug(XMLDocument document, String param, String xmlPathString ) {
+ XMLPath xmlPath = new XMLPath(xmlPathString);
+ Element[]elList = document.getElements(xmlPath);
+ if ( elList != null ) {
+ log.error(param+" xp: length "+elList.length+" el "+elList);
+ if ( elList.length >= 1 ) {
+ log.error("text is "+elList[0].getTextTrim());
+ return elList[0].getTextTrim();
+ }
+ } else {
+ log.error(param+" xp: el is null");
+ }
+ return null;
+ }
+
+ /**
+ * @param directoryName
+ * @return
+ * @throws JDOMException
+ * @throws IOException
+ */
+ private XMLDocument getDocument(String directoryName) throws IMSManifestException {
+ try {
+ XMLDocument doc = new XMLDocument();
+ doc.loadDocument(new File(directoryName, "imsmanifest.xml"));
+ return doc;
+ } catch (JDOMException je) {
+ String error = "Parsing error occured while loading imsmanifest.xml file. Contents of file may be invalid. "+je.getMessage();
+ log.error(error, je);
+ throw new IMSManifestException(error, je);
+ } catch (FileNotFoundException e) {
+ String error = "Unable to find imsmanifest file in the package."+e.getMessage();
+ log.error(error, e);
+ throw new IMSManifestException(error, e);
+ } catch (IOException ioe) {
+ String error = "IOException occured while loading imsmanifest file. "+ioe.getMessage();
+ log.error(error, ioe);
+ throw new IMSManifestException(error, ioe);
+ }
+ }
+
+ /** Built an XML document which is a list of organisations/eadventure.
+ */
+ private Document buildOrganisationList( ) throws IMSManifestException {
+
+ Namespace nm = cpCore.getRootManifestElement().getNamespace();
+
+ Element rootElement = cpCore.getRootManifestElement();
+ Element orgsElement = rootElement.getChild(CP_Core.ORGANIZATIONS, nm);
+
+ // set up a list of all the eadventure
+
+ // now get all the organizations and set up the new XML document, combining
+ // the organization and the eadventure.
+ Element defaultOrg = cpCore.getDefaultOrganization(orgsElement);
+ String defaultOrgIdentifier = null;
+ if ( defaultOrg != null )
+ defaultOrgIdentifier = defaultOrg.getAttributeValue("identifier");
+
+ log.debug("cpCore default org id: "+defaultOrgIdentifier);
+
+ Element newRootElement = new Element("organizations");
+ setAttribute(newRootElement, "version", "imscp1");
+ Document doc = new Document(newRootElement);
+
+ Element[] orgs = cpCore.getOrganizationsAllowed(orgsElement);
+ Element initOrganizationElement =null;
+ for ( int i=0; i
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Eadventure.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Eadventure.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Eadventure.java 2 Nov 2010 22:16:27 -0000 1.1
@@ -0,0 +1,695 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $Id: Eadventure.java,v 1.1 2010/11/02 22:16:27 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.model;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.log4j.Logger;
+import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler;
+import org.eucm.lams.tool.eadventure.util.EadventureToolContentHandler;
+
+/**
+ * Eadventure
+ * @author Dapeng Ni
+ * @author �ngel del Blanco
+ *
+ * @hibernate.class table="tl_eueadv10_eadventure"
+ *
+ */
+public class Eadventure implements Cloneable {
+
+ private static final Logger log = Logger.getLogger(Eadventure.class);
+
+ //key
+ private Long uid;
+
+ //tool contentID
+ private Long contentId;
+
+ private String title;
+
+ private String instructions;
+
+ //advance
+ private boolean runOffline;
+
+ private boolean lockWhenFinished;
+
+ private boolean defineLater;
+
+ private boolean contentInUse;
+
+ //instructions
+ private String onlineInstructions;
+
+ private String offlineInstructions;
+
+ private Set attachments;
+
+ //general infomation
+ private Date created;
+
+ private Date updated;
+
+ private EadventureUser createdBy;
+
+ //eadventure Items
+ //private Set eadventureItems;
+
+ private boolean reflectOnActivity;
+
+ private String reflectInstructions;
+
+ //Info from item
+ private String imsSchema;
+
+ private String organizationXml;
+
+ //info for file
+ private String initialItem;
+
+ private Long fileUuid;
+
+ private Long fileVersionId;
+
+ private String fileName;
+
+ private String fileType;
+
+ //If is set, the eAdventure game will completed the activity, and the user can't complete it by clicking in finish
+ private boolean defineComplete;
+
+ private Set params;
+
+ private Set conditions;
+
+ // DTO fields:
+ private boolean complete;
+
+ //*************** NON Persist Fields ********************
+ // manages the content in the repository
+ private IToolContentHandler toolContentHandler;
+
+ private List onlineFileList;
+
+ private List offlineFileList;
+
+
+ /**
+ * Default contruction method.
+ *
+ */
+ public Eadventure() {
+ attachments = new HashSet();
+ params = new HashSet();
+ conditions = new HashSet();
+
+ }
+
+ // **********************************************************
+ // Function method for Eadventure
+ // **********************************************************
+ public static Eadventure newInstance(Eadventure defaultContent, Long contentId,
+ EadventureToolContentHandler eadventureToolContentHandler) {
+ Eadventure toContent = new Eadventure();
+ defaultContent.toolContentHandler = eadventureToolContentHandler;
+ toContent = (Eadventure) defaultContent.clone();
+ toContent.setContentId(contentId);
+
+ //reset user info as well
+ if (toContent.getCreatedBy() != null) {
+ toContent.getCreatedBy().setEadventure(toContent);
+ }
+
+ return toContent;
+ }
+
+ @Override
+ public Object clone() {
+
+ Eadventure eadventure = null;
+ try {
+ eadventure = (Eadventure) super.clone();
+ eadventure.setUid(null);
+ //clone attachment
+ if (attachments != null) {
+ Iterator iter = attachments.iterator();
+ Set set = new HashSet();
+ while (iter.hasNext()) {
+ EadventureAttachment file = (EadventureAttachment) iter.next();
+ EadventureAttachment newFile = (EadventureAttachment) file.clone();
+ // just clone old file without duplicate it in repository
+
+ set.add(newFile);
+ }
+ eadventure.attachments = set;
+ }
+ //clone ReourceUser as well
+ if (createdBy != null) {
+ eadventure.setCreatedBy((EadventureUser) createdBy.clone());
+ }
+ if (params != null){
+ Iterator iter = params.iterator();
+ Set set = new HashSet();
+ while (iter.hasNext()) {
+ EadventureParam param = (EadventureParam) iter.next();
+ EadventureParam newParam = (EadventureParam) param.clone();
+
+
+ set.add(newParam);
+ }
+ eadventure.params = set;
+ }
+
+ if (conditions != null){
+ Iterator iter = conditions.iterator();
+ Set set = new HashSet();
+ while (iter.hasNext()) {
+ EadventureCondition cond = (EadventureCondition) iter.next();
+ EadventureCondition newCond = (EadventureCondition) cond.clone();
+ //TODO ver como hago esto bien
+ Iterator it2= newCond.getEadListExpression().iterator();
+ while (it2.hasNext()) {
+ EadventureExpression eadExpr = (EadventureExpression)it2.next();
+ Iterator it3 = eadventure.params.iterator();
+ while (it3.hasNext()){
+ EadventureParam eadPar = (EadventureParam)it3.next();
+ if (eadPar.getName().equals(eadExpr.getFirstOp().getName()))
+ eadExpr.setFirstOp(eadPar);
+ if (eadExpr.getVarIntroduced()!=null && eadPar.getName().equals(eadExpr.getVarIntroduced().getName())){
+ eadExpr.setVarIntroduced(eadPar);
+ }
+ }
+ }
+ set.add(newCond);
+ }
+
+ eadventure.conditions = set;
+ }
+ }
+ catch (CloneNotSupportedException e) {
+ Eadventure.log.error("When clone " + Eadventure.class + " failed");
+ }
+
+ return eadventure;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof Eadventure)) {
+ return false;
+ }
+
+ final Eadventure genericEntity = (Eadventure) o;
+
+ return new EqualsBuilder().append(uid, genericEntity.uid).append(title, genericEntity.title).append(instructions,
+ genericEntity.instructions).append(onlineInstructions, genericEntity.onlineInstructions).append(
+ offlineInstructions, genericEntity.offlineInstructions).append(created, genericEntity.created).append(updated,
+ genericEntity.updated).append(createdBy, genericEntity.createdBy).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(uid).append(title).append(instructions).append(onlineInstructions).append(
+ offlineInstructions).append(created).append(updated).append(createdBy).toHashCode();
+ }
+
+ /**
+ * Updates the modification data for this entity.
+ */
+ public void updateModificationData() {
+
+ long now = System.currentTimeMillis();
+ if (created == null) {
+ this.setCreated(new Date(now));
+ }
+ this.setUpdated(new Date(now));
+ }
+
+ public void toDTO() {
+ onlineFileList = new ArrayList();
+ offlineFileList = new ArrayList();
+ Set fileSet = this.getAttachments();
+ if (fileSet != null) {
+ for (EadventureAttachment file : fileSet) {
+ if (StringUtils.equalsIgnoreCase(file.getFileType(), IToolContentHandler.TYPE_OFFLINE)) {
+ offlineFileList.add(file);
+ }
+ else {
+ onlineFileList.add(file);
+ }
+ }
+ }
+ }
+
+ //**********************************************************
+ // get/set methods
+ //**********************************************************
+ /**
+ * Returns the object's creation date
+ *
+ * @return date
+ * @hibernate.property column="create_date"
+ */
+ public Date getCreated() {
+ return created;
+ }
+
+ /**
+ * Sets the object's creation date
+ *
+ * @param created
+ */
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ /**
+ * Returns the object's date of last update
+ *
+ * @return date updated
+ * @hibernate.property column="update_date"
+ */
+ public Date getUpdated() {
+ return updated;
+ }
+
+ /**
+ * Sets the object's date of last update
+ *
+ * @param updated
+ */
+ public void setUpdated(Date updated) {
+ this.updated = updated;
+ }
+
+ /**
+ * @return Returns the userid of the user who created the Share eadventure.
+ *
+ * @hibernate.many-to-one
+ * cascade="save-update"
+ * column="create_by"
+ *
+ */
+ public EadventureUser getCreatedBy() {
+ return createdBy;
+ }
+
+ /**
+ * @param createdBy The userid of the user who created this Share eadventure.
+ */
+ public void setCreatedBy(EadventureUser createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ /**
+ * @hibernate.id column="uid" generator-class="native"
+ */
+ public Long getUid() {
+ return uid;
+ }
+
+ public void setUid(Long uid) {
+ this.uid = uid;
+ }
+
+ /**
+ * @return Returns the title.
+ *
+ * @hibernate.property
+ * column="title"
+ *
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * @param title The title to set.
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ /**
+ * @return Returns the runOffline.
+ *
+ * @hibernate.property
+ * column="run_offline"
+ *
+ */
+ public boolean getRunOffline() {
+ return runOffline;
+ }
+
+ /**
+ * @param runOffline The forceOffLine to set.
+ *
+ *
+ */
+ public void setRunOffline(boolean forceOffline) {
+ runOffline = forceOffline;
+ }
+
+ /**
+ * @return Returns the lockWhenFinish.
+ *
+ * @hibernate.property
+ * column="lock_on_finished"
+ *
+ */
+ public boolean getLockWhenFinished() {
+ return lockWhenFinished;
+ }
+
+ /**
+ * @param lockWhenFinished Set to true to lock the eadventure for finished users.
+ */
+ public void setLockWhenFinished(boolean lockWhenFinished) {
+ this.lockWhenFinished = lockWhenFinished;
+ }
+
+ /**
+ * @return Returns the instructions set by the teacher.
+ *
+ * @hibernate.property
+ * column="instructions"
+ * type="text"
+ */
+ public String getInstructions() {
+ return instructions;
+ }
+
+ public void setInstructions(String instructions) {
+ this.instructions = instructions;
+ }
+
+ /**
+ * @return Returns the onlineInstructions set by the teacher.
+ *
+ * @hibernate.property
+ * column="online_instructions"
+ * type="text"
+ */
+ public String getOnlineInstructions() {
+ return onlineInstructions;
+ }
+
+ public void setOnlineInstructions(String onlineInstructions) {
+ this.onlineInstructions = onlineInstructions;
+ }
+
+ /**
+ * @return Returns the onlineInstructions set by the teacher.
+ *
+ * @hibernate.property
+ * column="offline_instructions"
+ * type="text"
+ */
+ public String getOfflineInstructions() {
+ return offlineInstructions;
+ }
+
+ public void setOfflineInstructions(String offlineInstructions) {
+ this.offlineInstructions = offlineInstructions;
+ }
+
+ /**
+ *
+ * @hibernate.set lazy="true"
+ * cascade="all"
+ * inverse="false"
+ * order-by="create_date desc"
+ * @hibernate.collection-key column="eadventure_uid"
+ * @hibernate.collection-one-to-many
+ * class="org.eucm.lams.tool.eadventure.model.EadventureAttachment"
+ *
+ * @return a set of Attachments to this Message.
+ */
+ public Set getAttachments() {
+ return attachments;
+ }
+
+ /*
+ * @param attachments The attachments to set.
+ */
+ public void setAttachments(Set attachments) {
+ this.attachments = attachments;
+ }
+
+ /**
+ * @hibernate.property column="content_in_use"
+ * @return
+ */
+ public boolean isContentInUse() {
+ return contentInUse;
+ }
+
+ public void setContentInUse(boolean contentInUse) {
+ this.contentInUse = contentInUse;
+ }
+
+ /**
+ * @hibernate.property column="define_later"
+ * @return
+ */
+ public boolean isDefineLater() {
+ return defineLater;
+ }
+
+ public void setDefineLater(boolean defineLater) {
+ this.defineLater = defineLater;
+ }
+
+ /**
+ * @hibernate.property column="content_id" unique="true"
+ * @return
+ */
+ public Long getContentId() {
+ return contentId;
+ }
+
+ public void setContentId(Long contentId) {
+ this.contentId = contentId;
+ }
+
+ public List getOfflineFileList() {
+ return offlineFileList;
+ }
+
+ public void setOfflineFileList(List offlineFileList) {
+ this.offlineFileList = offlineFileList;
+ }
+
+ public List getOnlineFileList() {
+ return onlineFileList;
+ }
+
+ public void setOnlineFileList(List onlineFileList) {
+ this.onlineFileList = onlineFileList;
+ }
+
+ public void setToolContentHandler(IToolContentHandler toolContentHandler) {
+ this.toolContentHandler = toolContentHandler;
+ }
+
+ /**
+ * @hibernate.property column="reflect_instructions"
+ * @return
+ */
+ public String getReflectInstructions() {
+ return reflectInstructions;
+ }
+
+ public void setReflectInstructions(String reflectInstructions) {
+ this.reflectInstructions = reflectInstructions;
+ }
+
+ /**
+ * @hibernate.property column="reflect_on_activity"
+ * @return
+ */
+ public boolean isReflectOnActivity() {
+ return reflectOnActivity;
+ }
+
+ public void setReflectOnActivity(boolean reflectOnActivity) {
+ this.reflectOnActivity = reflectOnActivity;
+ }
+
+ /**
+ * @hibernate.property column="ims_schema" type="text"
+ * @return
+ */
+ public String getImsSchema() {
+ return imsSchema;
+ }
+
+ public void setImsSchema(String imsSchema) {
+ this.imsSchema = imsSchema;
+ }
+
+ /**
+ * @hibernate.property column="organization_xml" length="65535"
+ * @return
+ */
+ public String getOrganizationXml() {
+ return organizationXml;
+ }
+
+ public void setOrganizationXml(String organizationXml) {
+ this.organizationXml = organizationXml;
+ }
+
+ /**
+ * @hibernate.property column="file_name" type="text"
+ *
+ * @return
+ */
+ public String getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(String name) {
+ this.fileName = name;
+ }
+
+ /**
+ * @hibernate.property column="file_uuid"
+ *
+ * @return
+ */
+ public Long getFileUuid() {
+ return fileUuid;
+ }
+
+ public void setFileUuid(Long crUuid) {
+ this.fileUuid = crUuid;
+ }
+
+ /**
+ * @hibernate.property column="file_version_id"
+ * @return
+ */
+ public Long getFileVersionId() {
+ return fileVersionId;
+ }
+
+ public void setFileVersionId(Long crVersionId) {
+ this.fileVersionId = crVersionId;
+ }
+
+
+
+ public void setComplete(boolean complete) {
+ this.complete = complete;
+ }
+
+ public boolean isComplete() {
+ return complete;
+ }
+
+ /**
+ * @hibernate.property column="file_type"
+ * @return
+ */
+ public String getFileType() {
+ return fileType;
+ }
+
+ public void setFileType(String fileType) {
+ this.fileType = fileType;
+ }
+
+ /**
+ * @hibernate.property column="define_complete"
+ * @return
+ */
+
+ public boolean isDefineComplete() {
+ return defineComplete;
+ }
+
+ public void setDefineComplete(boolean defineComplete) {
+ this.defineComplete = defineComplete;
+ }
+
+ /**
+ *
+ * @hibernate.set lazy="true" inverse="false" cascade="all"
+ * @hibernate.collection-key column="eadventure_uid"
+ * @hibernate.collection-one-to-many class="org.eucm.lams.tool.eadventure.model.EadventureParam"
+ *
+ * @return
+ */
+
+ public Set getParams() {
+ return params;
+ }
+
+ public void setParams(Set params) {
+ this.params = params;
+ }
+
+ /**
+ * @hibernate.property column="init_item"
+ * @return
+ */
+ public String getInitialItem() {
+ return initialItem;
+ }
+
+ public void setInitialItem(String initialItem) {
+ this.initialItem = initialItem;
+ }
+
+ /**
+ *
+ * @hibernate.set lazy="true" inverse="false" cascade="all" order-by = "sequence_id"
+ * @hibernate.collection-key column="eadventure_uid"
+ * @hibernate.collection-one-to-many class="org.eucm.lams.tool.eadventure.model.EadventureCondition"
+ *
+ * @return
+ */
+ public Set getConditions() {
+ return conditions;
+ }
+
+ public void setConditions(Set conditions) {
+ this.conditions = conditions;
+ }
+
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureAttachment.hbm.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Attic/EadventureAttachment.hbm.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureAttachment.hbm.xml 2 Nov 2010 22:16:28 -0000 1.1
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureAttachment.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Attic/EadventureAttachment.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureAttachment.java 2 Nov 2010 22:16:28 -0000 1.1
@@ -0,0 +1,163 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: EadventureAttachment.java,v 1.1 2010/11/02 22:16:28 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.model;
+
+import java.util.Date;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.log4j.Logger;
+
+/**
+ * @author Dapeng Ni
+ *
+ * A Wrapper class for uploaded files. An Attachment cannot exist independently
+ * and must belong to a Eadventure.
+ *
+ *
+ * @hibernate.class table="tl_eueadv10_attachment"
+ *
+ */
+public class EadventureAttachment implements Cloneable{
+ private static final Logger log = Logger.getLogger(EadventureAttachment.class);
+
+ private Long uid;
+ private Long fileUuid;
+ private Long fileVersionId;
+ private String fileType;
+ private String fileName;
+ private Date created;
+
+ //Default contruction method
+ public EadventureAttachment(){
+
+ }
+// **********************************************************
+ // Function method for Attachment
+// **********************************************************
+ public Object clone(){
+ Object obj = null;
+ try {
+ obj = super.clone();
+ ((EadventureAttachment)obj).setUid(null);
+ } catch (CloneNotSupportedException e) {
+ log.error("When clone " + EadventureAttachment.class + " failed");
+ }
+
+ return obj;
+ }
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (!(o instanceof EadventureAttachment))
+ return false;
+
+ final EadventureAttachment genericEntity = (EadventureAttachment) o;
+
+ return new EqualsBuilder()
+ .append(this.uid,genericEntity.uid)
+ .append(this.fileVersionId,genericEntity.fileVersionId)
+ .append(this.fileName,genericEntity.fileName)
+ .append(this.fileType,genericEntity.fileType)
+ .append(this.created,genericEntity.created)
+ .isEquals();
+ }
+
+ public int hashCode() {
+ return new HashCodeBuilder().append(uid).append(fileVersionId).append(fileName).append(fileType).append(created)
+ .toHashCode();
+ }
+
+// **********************************************************
+ // get/set methods
+// **********************************************************
+ /**
+ * @hibernate.id column="uid" generator-class="native"
+ */
+ public Long getUid() {
+ return uid;
+ }
+
+ public void setUid(Long uid) {
+ this.uid = uid;
+ }
+
+ /**
+ * @hibernate.property column="file_version_id"
+ *
+ */
+ public Long getFileVersionId() {
+ return fileVersionId;
+ }
+
+ public void setFileVersionId(Long version) {
+ this.fileVersionId = version;
+ }
+
+ /**
+ * @hibernate.property column="file_type"
+ */
+ public String getFileType() {
+ return fileType;
+ }
+
+ public void setFileType(String type) {
+ this.fileType = type;
+ }
+
+ /**
+ * @hibernate.property column="file_name"
+ */
+ public String getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(String name) {
+ this.fileName = name;
+ }
+
+
+ /**
+ * @hibernate.property column="file_uuid"
+ * @return
+ */
+ public Long getFileUuid() {
+ return fileUuid;
+ }
+
+ public void setFileUuid(Long uuid) {
+ this.fileUuid = uuid;
+ }
+ /**
+ * @hibernate.property column="create_date"
+ * @return
+ */
+ public Date getCreated() {
+ return created;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureCondition.hbm.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Attic/EadventureCondition.hbm.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureCondition.hbm.xml 2 Nov 2010 22:16:28 -0000 1.1
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureCondition.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureCondition.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureCondition.java 2 Nov 2010 22:16:28 -0000 1.1
@@ -0,0 +1,244 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureCondition.java,v 1.1 2010/11/02 22:16:28 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.model;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+
+
+/**
+ * Eadventure
+ * @author Angel del Blanco
+ *
+ * @hibernate.class table="tl_eueadv10_condition"
+ *
+ */
+public class EadventureCondition implements Cloneable{
+
+ private static final Logger log = Logger.getLogger(EadventureCondition.class);
+
+ private Long uid;
+ //unique name
+ private String name;
+ private int sequenceId;
+ private Long eadventure_uid;
+ //taskList Items
+ private Set eadListExpression;
+
+ /**
+ * Default contruction method.
+ */
+ public EadventureCondition(){
+ eadListExpression = new HashSet();
+ }
+
+ // **********************************************************
+ // Function method for TaskList
+ // **********************************************************
+
+ /**
+ * {@Override}
+ */
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + sequenceId;
+ result = prime * result + ((eadListExpression == null) ? 0 : eadListExpression.hashCode());
+ result = prime * result + ((uid == null) ? 0 : uid.hashCode());
+ result = prime * result + ((eadventure_uid == null) ? 0 : eadventure_uid.hashCode());
+ return result;
+ }
+
+ /**
+ * {@Override}
+ */
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null) return false;
+ if (getClass() != obj.getClass()) return false;
+ final EadventureCondition other = (EadventureCondition) obj;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (sequenceId != other.sequenceId)
+ return false;
+ if (eadListExpression == null) {
+ if (other.eadListExpression != null)
+ return false;
+ } else if (!eadListExpression.equals(other.eadListExpression))
+ return false;
+ if (uid == null) {
+ if (other.uid != null)
+ return false;
+ } else if (!uid.equals(other.uid))
+ return false;
+ if (eadventure_uid == null) {
+ if (other.eadventure_uid != null)
+ return false;
+ } else if (!eadventure_uid.equals(other.eadventure_uid))
+ return false;
+ return true;
+ }
+
+ /**
+ * {@Override}
+ */
+ public Object clone(){
+
+ EadventureCondition condition = null;
+ try{
+ condition = (EadventureCondition) super.clone();
+ condition.setUid(null);
+ if (eadListExpression != null){
+ Iterator iter = eadListExpression.iterator();
+ Set set = new HashSet();
+ while (iter.hasNext()) {
+ EadventureExpression expr = (EadventureExpression) iter.next();
+ EadventureExpression newExpr = (EadventureExpression) expr.clone();
+ newExpr.setCondition(condition);
+
+ set.add(newExpr);
+ }
+ condition.eadListExpression = set;
+ }
+
+
+
+ } catch (CloneNotSupportedException e) {
+ log.error("When clone " + EadventureCondition.class + " failed");
+ }
+
+ return condition;
+ }
+
+ //**********************************************************
+ // Get/set methods
+ //**********************************************************
+
+ /**
+ * Returns EadventureCondition
id.
+ *
+ * @return EadventureCondition id
+ *
+ * @hibernate.id column="uid" generator-class="native"
+ */
+ public Long getUid() {
+ return uid;
+ }
+
+ /**
+ * Sets EadventureCondition
id.
+ *
+ * @param uid EadventureCondition id
+ */
+ public void setUid(Long uid) {
+ this.uid = uid;
+ }
+
+ /**
+ * Returns condition's name.
+ *
+ * @return condition's name.
+ *
+ * @hibernate.property
+ * column="name"
+ *
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * Sets the condition's name. Should be unique for the parent EadventureCondition.
+ *
+ * @param title condition's name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Return set of EadventureExpression
+ *
+ * @return set of EadventureCondition
+ *
+ * @hibernate.set lazy="true"
+ * inverse="false"
+ * cascade="all"
+ * order-by = "sequence_id"
+ * @hibernate.collection-key column="condition_uid"
+ * @hibernate.collection-one-to-many class="org.eucm.lams.tool.eadventure.model.EadventureExpression"
+ */
+ public Set getEadListExpression() {
+ return eadListExpression;
+ }
+
+
+ public void setEadListExpression(Set eadListExpression) {
+ this.eadListExpression = eadListExpression;
+ }
+
+
+ /**
+ * Returns condition's sequence number. Order is very important for
+ * conditions as the conditions will be tested in the order shown on the
+ * screen.
+ *
+ * @return condition's sequence number
+ *
+ * @hibernate.property column="sequence_id"
+ */
+ public int getSequenceId() {
+ return sequenceId;
+ }
+ /**
+ * Sets condition's sequence number. Order is very important for
+ * conditions as the conditions will be tested in the order shown on the
+ * screen.
+ *
+ * @param sequenceId condition's sequence number
+ */
+ public void setSequenceId(int sequenceId) {
+ this.sequenceId = sequenceId;
+ }
+
+ /**
+ * @hibernate.property column="eadventure_uid"
+ * @return
+ */
+ public Long getEadventure_uid() {
+ return eadventure_uid;
+ }
+
+ public void setEadventure_uid(Long eadventure_uid) {
+ this.eadventure_uid = eadventure_uid;
+ }
+
+
+}
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureExpression.hbm.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Attic/EadventureExpression.hbm.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureExpression.hbm.xml 2 Nov 2010 22:16:27 -0000 1.1
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureExpression.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureExpression.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureExpression.java 2 Nov 2010 22:16:28 -0000 1.1
@@ -0,0 +1,303 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureExpression.java,v 1.1 2010/11/02 22:16:28 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.model;
+
+
+import java.util.HashSet;
+
+import org.apache.log4j.Logger;
+
+
+
+/**
+ * Eadventure
+ * @author Angel del Blanco
+ *
+ * @hibernate.class table="tl_eueadv10_condition_expression"
+ *
+ */
+public class EadventureExpression implements Cloneable{
+
+ private static final Logger log = Logger.getLogger(EadventureExpression.class);
+
+ private Long uid;
+ private EadventureParam firstOp;
+ // The both values allows to introduce the second operand this value shows if the
+ private String valueIntroduced;
+ private EadventureParam varIntroduced;
+ //TODO preguntar si hay problemas de eficiencia por hacer esto con objeto en vez de con id (facilita el codigo, pero cargamos objetos)
+ // private Long condition_uid;
+ private EadventureCondition condition;
+ private String expresionOp;
+ // the op (and / or) to link with the next operation
+ private String nextOp;
+ private int sequenceId;
+
+
+
+ /**
+ * Default construction method.
+ */
+ public EadventureExpression(){
+
+ }
+
+ // **********************************************************
+ // Function method for TaskList
+ // **********************************************************
+
+ /**
+ * {@Override}
+ */
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((firstOp == null) ? 0 : firstOp.hashCode());
+ result = prime * result + sequenceId;
+ result = prime * result + ((valueIntroduced == null) ? 0 : valueIntroduced.hashCode());
+ result = prime * result + ((varIntroduced == null) ? 0 : varIntroduced.hashCode());
+ result = prime * result + ((expresionOp == null) ? 0 : expresionOp.hashCode());
+ result = prime * result + ((uid == null) ? 0 : uid.hashCode());
+ //result = prime * result + ((condition_uid == null) ? 0 : condition_uid.hashCode());
+ result = prime * result + ((nextOp == null) ? 0 : nextOp.hashCode());
+ //result = prime * result + ((condition == null) ? 0 : condition.getUid().hashCode());
+ return result;
+ }
+
+ /**
+ * {@Override}
+ */
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null) return false;
+ if (getClass() != obj.getClass()) return false;
+ final EadventureExpression other = (EadventureExpression) obj;
+
+ if (!firstOp.equals(other.firstOp))
+ return false;
+
+ if (valueIntroduced == null) {
+ if (other.valueIntroduced != null)
+ return false;
+ }else if (!valueIntroduced.equals(other.valueIntroduced))
+ return false;
+
+
+ if (!varIntroduced.equals(other.varIntroduced))
+ return false;
+
+ if (expresionOp == null) {
+ if (other.expresionOp != null)
+ return false;
+ }else if (!expresionOp.equals(other.expresionOp))
+ return false;
+
+ if (nextOp == null) {
+ if (other.nextOp != null)
+ return false;
+ }else if (!nextOp.equals(other.nextOp))
+ return false;
+
+ if (sequenceId != other.sequenceId)
+ return false;
+
+ if (uid == null) {
+ if (other.uid != null)
+ return false;
+ } else if (!uid.equals(other.uid))
+ return false;
+
+ if (condition.getUid() == null) {
+ if (other.condition.getUid()!= null)
+ return false;
+ } else if (!condition.getUid().equals(condition.getUid()))
+ return false;
+ return true;
+ }
+
+ /**
+ * {@Override}
+ */
+ public Object clone(){
+
+ EadventureExpression expression = null;
+ try{
+ expression = (EadventureExpression) super.clone();
+ expression.setUid(null);
+ expression.setCondition(null);
+ if (firstOp!=null){
+ expression.firstOp = (EadventureParam) firstOp.clone();
+ }
+ if (varIntroduced!=null){
+ expression.varIntroduced = (EadventureParam) varIntroduced.clone();
+
+ }
+
+
+
+ } catch (CloneNotSupportedException e) {
+ log.error("When clone " + EadventureExpression.class + " failed");
+ }
+
+ return expression;
+
+ }
+
+
+ //**********************************************************
+ // Get/set methods
+ //**********************************************************
+
+
+ /**
+ * Returns EadventureExpression
id.
+ *
+ * @return EadventureExpression id
+ *
+ * @hibernate.id column="uid" generator-class="native"
+ */
+ public Long getUid() {
+ return uid;
+ }
+
+ /**
+ * Sets EadventureExpression
id.
+ *
+ * @param uid EadventureExpression id
+ */
+ public void setUid(Long uid) {
+ this.uid = uid;
+ }
+
+ /**
+ * @hibernate.many-to-one column="first_op"
+ * cascade="none"
+ * @return
+ */
+ public EadventureParam getFirstOp() {
+ return firstOp;
+ }
+
+ public void setFirstOp(EadventureParam firstOp) {
+ this.firstOp = firstOp;
+ }
+
+ /**
+ * Returns value introduced for the expression .
+ *
+ * @return condition's name.
+ *
+ * @hibernate.property
+ * column="value_introduced"
+ *
+ */
+ public String getValueIntroduced() {
+ return valueIntroduced;
+ }
+
+ public void setValueIntroduced(String valueIntroduced) {
+ this.valueIntroduced = valueIntroduced;
+ }
+
+ /**
+ * @hibernate.many-to-one column="var_introduced"
+ * cascade="none"
+ * @return
+ */
+ public EadventureParam getVarIntroduced() {
+ return varIntroduced;
+ }
+
+ public void setVarIntroduced(EadventureParam varIntroduced) {
+ this.varIntroduced = varIntroduced;
+ }
+
+ /**
+ * Returns condition's name.
+ *
+ * @return condition's name.
+ *
+ * @hibernate.property
+ * column="expresion_op"
+ *
+ */
+ public String getExpresionOp() {
+ return expresionOp;
+ }
+
+ public void setExpresionOp(String expresionOp) {
+ this.expresionOp = expresionOp;
+ }
+
+ /**
+ * Returns condition's sequence number. Order is very important for
+ * conditions as the conditions will be tested in the order shown on the
+ * screen.
+ *
+ * @return condition's sequence number
+ *
+ * @hibernate.property column="sequence_id"
+ */
+
+ public int getSequenceId() {
+ return sequenceId;
+ }
+
+ public void setSequenceId(int sequenceId) {
+ this.sequenceId = sequenceId;
+ }
+
+ /**
+ *
+ * @hibernate.many-to-one column="condition_uid"
+ * cascade="save-update"
+ * @return
+ */
+
+ public EadventureCondition getCondition() {
+ return condition;
+ }
+
+ public void setCondition(EadventureCondition condition) {
+ this.condition = condition;
+ }
+
+ /**
+ * Returns condition's name.
+ *
+ * @return condition's name.
+ *
+ * @hibernate.property
+ * column="next_op"
+ *
+ */
+ public String getNextOp() {
+ return nextOp;
+ }
+
+ public void setNextOp(String nextOp) {
+ this.nextOp = nextOp;
+ }
+}
+
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureItemVisitLog.hbm.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Attic/EadventureItemVisitLog.hbm.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureItemVisitLog.hbm.xml 2 Nov 2010 22:16:28 -0000 1.1
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureItemVisitLog.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureItemVisitLog.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureItemVisitLog.java 2 Nov 2010 22:16:28 -0000 1.1
@@ -0,0 +1,137 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureItemVisitLog.java,v 1.1 2010/11/02 22:16:28 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.model;
+
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+/**
+ * Eadventure
+ * @author Dapeng Ni
+ *
+ * @hibernate.class table="tl_eueadv10_item_log"
+ *
+ */
+public class EadventureItemVisitLog {
+
+ private Long uid;
+ private EadventureUser user;
+ private Eadventure eadventure;
+ private boolean complete;
+ private Date accessDate;
+ private Long sessionId;
+ private Set eadventureVars;
+
+
+ public EadventureItemVisitLog(){
+ eadventureVars = new HashSet();
+ }
+ /**
+ * @hibernate.property column="access_date"
+ * @return
+ */
+ public Date getAccessDate() {
+ return accessDate;
+ }
+ public void setAccessDate(Date accessDate) {
+ this.accessDate = accessDate;
+ }
+ /**
+ * @hibernate.many-to-one column="eadventure_item_uid"
+ * cascade="none"
+ * @return
+ */
+ public Eadventure getEadventure() {
+ return eadventure;
+ }
+ public void setEadventure(Eadventure item) {
+ this.eadventure = item;
+ }
+
+ /**
+ * @hibernate.id generator-class="native" type="java.lang.Long" column="uid"
+ * @return Returns the log Uid.
+ */
+ public Long getUid() {
+ return uid;
+ }
+ public void setUid(Long uid) {
+ this.uid = uid;
+ }
+ /**
+ * @hibernate.many-to-one column="user_uid"
+ * cascade="none"
+ * @return
+ */
+ public EadventureUser getUser() {
+ return user;
+ }
+ public void setUser(EadventureUser user) {
+ this.user = user;
+ }
+ /**
+ * @hibernate.property column="complete"
+ * @return
+ */
+ public boolean isComplete() {
+ return complete;
+ }
+ public void setComplete(boolean complete) {
+ this.complete = complete;
+ }
+ /**
+ * @hibernate.property column="session_id"
+ * @return
+ */
+ public Long getSessionId() {
+ return sessionId;
+ }
+ public void setSessionId(Long sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ /**
+ *
+ *
+ * @hibernate.set lazy="true"
+ * inverse="true"
+ * cascade="all"
+ * order-by="create_date desc"
+ * @hibernate.collection-key column="visit_log_uid"
+ * @hibernate.collection-one-to-many class="org.eucm.lams.tool.eadventure.model.EadventureVars"
+ *
+ * @return
+ */
+ public Set getEadventureVars() {
+ return eadventureVars;
+ }
+ public void setEadventureVars(Set eadventureVars) {
+ this.eadventureVars = eadventureVars;
+ }
+
+
+
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureParam.hbm.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Attic/EadventureParam.hbm.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureParam.hbm.xml 2 Nov 2010 22:16:28 -0000 1.1
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureParam.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureParam.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureParam.java 2 Nov 2010 22:16:27 -0000 1.1
@@ -0,0 +1,133 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureParam.java,v 1.1 2010/11/02 22:16:27 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.model;
+
+import org.apache.log4j.Logger;
+
+
+/**
+ * Eadventure
+ * @author Angel del Blanco
+ *
+ * @hibernate.class table="tl_eueadv10_param"
+ *
+ */
+public class EadventureParam implements Cloneable{
+ private static final Logger log = Logger.getLogger(EadventureParam.class);
+
+ private Long uid;
+ private String name;
+ private String type;
+ private boolean input;
+ private Long eadventure_uid;
+
+
+ public EadventureParam(){
+
+ }
+ public EadventureParam(String name, String type, boolean input ){
+ this.name = name;
+ this.type = type;
+ this.input = input;
+ }
+
+ public Object clone(){
+ Object obj = null;
+ try {
+ obj = super.clone();
+ ((EadventureParam)obj).setUid(null);
+ /*if (eadventure != null) {
+ ((EadventureParam)obj).setEadventure((Eadventure)eadventure.clone());
+
+ }*/
+ } catch (CloneNotSupportedException e) {
+ log.error("When clone " + EadventureParam.class + " failed");
+ }
+
+ return obj;
+}
+
+ /**
+ * @hibernate.id generator-class="native" type="java.lang.Long" column="uid"
+ * @return Returns the log Uid.
+ */
+ public Long getUid() {
+ return uid;
+ }
+ public void setUid(Long uid) {
+ this.uid = uid;
+ }
+ /**
+ * @hibernate.property column="name"
+ * @return
+ */
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @hibernate.property column="type"
+ * @return
+ */
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * @hibernate.property column="input"
+ * @return
+ */
+ public boolean isInput() {
+ return input;
+ }
+ public void setInput(boolean input) {
+ this.input = input;
+ }
+
+
+ /**
+ * @hibernate.property column="eadventure_uid"
+ * @return
+ */
+ public Long getEadventure_uid() {
+ return eadventure_uid;
+ }
+ public void setEadventure_uid(Long eadventure_uid) {
+ this.eadventure_uid = eadventure_uid;
+ }
+
+
+
+
+
+
+
+}
+
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureSession.hbm.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Attic/EadventureSession.hbm.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureSession.hbm.xml 2 Nov 2010 22:16:28 -0000 1.1
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureSession.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureSession.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureSession.java 2 Nov 2010 22:16:27 -0000 1.1
@@ -0,0 +1,140 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: EadventureSession.java,v 1.1 2010/11/02 22:16:27 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.model;
+
+import java.util.Date;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Eadventure
+ * @author Dapeng Ni
+ *
+ * @hibernate.class table="tl_eueadv10_session"
+ *
+ */
+public class EadventureSession{
+
+ private static Logger log = Logger.getLogger(EadventureSession.class);
+
+ private Long uid;
+ private Long sessionId;
+ private String sessionName;
+ private Eadventure eadventure;
+ private Date sessionStartDate;
+ private Date sessionEndDate;
+ //finish or not
+ private int status;
+ //eadventure Items
+ //private Set eadventureItems;
+
+
+// **********************************************************
+ // Get/Set methods
+// **********************************************************
+ /**
+ * @hibernate.id generator-class="native" type="java.lang.Long" column="uid"
+ * @return Returns the learnerID.
+ */
+ public Long getUid() {
+ return uid;
+ }
+ public void setUid(Long uuid) {
+ this.uid = uuid;
+ }
+
+ /**
+ * @hibernate.property column="session_end_date"
+ * @return
+ */
+ public Date getSessionEndDate() {
+ return sessionEndDate;
+ }
+ public void setSessionEndDate(Date sessionEndDate) {
+ this.sessionEndDate = sessionEndDate;
+ }
+ /**
+ * @hibernate.property column="session_start_date"
+ *
+ * @return
+ */
+ public Date getSessionStartDate() {
+ return sessionStartDate;
+ }
+ public void setSessionStartDate(Date sessionStartDate) {
+ this.sessionStartDate = sessionStartDate;
+ }
+ /**
+ * @hibernate.property
+ * @return
+ */
+ public int getStatus() {
+ return status;
+ }
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+ /**
+ * @hibernate.many-to-one column="eadventure_uid"
+ * cascade="save-update"
+ * @return
+ */
+ public Eadventure getEadventure() {
+ return eadventure;
+ }
+ public void setEadventure(Eadventure eadventure) {
+ this.eadventure = eadventure;
+ }
+ /**
+ * @hibernate.property column="session_id"
+ * @return
+ */
+ public Long getSessionId() {
+ return sessionId;
+ }
+ public void setSessionId(Long sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ /**
+ * @hibernate.property column="session_name" length="250"
+ * @return Returns the session name
+ */
+ public String getSessionName() {
+ return sessionName;
+ }
+
+ /**
+ *
+ * @param sessionName The session name to set.
+ */
+ public void setSessionName(String sessionName) {
+ this.sessionName = sessionName;
+ }
+
+
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureUser.hbm.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Attic/EadventureUser.hbm.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureUser.hbm.xml 2 Nov 2010 22:16:28 -0000 1.1
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureUser.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureUser.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureUser.java 2 Nov 2010 22:16:28 -0000 1.1
@@ -0,0 +1,220 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: EadventureUser.java,v 1.1 2010/11/02 22:16:28 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.model;
+
+import java.util.Date;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.log4j.Logger;
+import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
+/**
+ * Eadventure
+ * @author Dapeng Ni
+ *
+ * @hibernate.class table="tl_eueadv10_user"
+ *
+ */
+public class EadventureUser implements Cloneable{
+ private static final long serialVersionUID = -7043502180037866257L;
+ private static Logger log = Logger.getLogger(EadventureUser.class);
+
+ private Long uid;
+ private Long userId;
+ private String firstName;
+ private String lastName;
+ private String loginName;
+ private boolean sessionFinished;
+
+ private EadventureSession session;
+ private Eadventure eadventure;
+
+ //=============== NON Persisit value: for display use ===========
+ //the user access some reousrce item date time. Use in monitoring summary page
+ private Date accessDate;
+
+ public EadventureUser(){
+ }
+ public EadventureUser(UserDTO user, EadventureSession session){
+ this.userId = new Long(user.getUserID().intValue());
+ this.firstName = user.getFirstName();
+ this.lastName = user.getLastName();
+ this.loginName = user.getLogin();
+ this.session = session;
+ this.eadventure = null;
+ this.sessionFinished = false;
+ }
+ public EadventureUser(UserDTO user, Eadventure content){
+ this.userId = new Long(user.getUserID().intValue());
+ this.firstName = user.getFirstName();
+ this.lastName = user.getLastName();
+ this.loginName = user.getLogin();
+ this.session = null;
+ this.eadventure = content;
+ this.sessionFinished = false;
+ }
+ /**
+ * Clone method from java.lang.Object
+ */
+ public Object clone(){
+
+ EadventureUser user = null;
+ try{
+ user = (EadventureUser) super.clone();
+ user.setUid(null);
+ //never clone session
+ user.setSession(null);
+ } catch (CloneNotSupportedException e) {
+ log.error("When clone " + EadventureUser.class + " failed");
+ }
+
+ return user;
+ }
+// **********************************************************
+ // Get/Set methods
+// **********************************************************
+ /**
+ * @hibernate.id generator-class="native" type="java.lang.Long" column="uid"
+ * @return Returns the uid.
+ */
+ public Long getUid() {
+ return uid;
+ }
+ /**
+ * @param uid The uid to set.
+ */
+ public void setUid(Long userID) {
+ this.uid = userID;
+ }
+
+ /**
+ * @hibernate.property column="user_id" length="20"
+ * @return Returns the userId.
+ */
+ public Long getUserId() {
+ return userId;
+ }
+ /**
+ * @param userId
+ * The userId to set.
+ */
+ public void setUserId(Long userID) {
+ this.userId = userID;
+ }
+
+ /**
+ * @hibernate.property length="255" column="last_name"
+ * @return
+ */
+ public String getLastName() {
+ return lastName;
+ }
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+ /**
+ * @hibernate.property length="255" column="first_name"
+ * @return
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+
+ /**
+ * @hibernate.property column="login_name"
+ * @return
+ */
+ public String getLoginName() {
+ return loginName;
+ }
+
+ public void setLoginName(String loginName) {
+ this.loginName = loginName;
+ }
+ /**
+ * @hibernate.many-to-one column="session_uid"
+ * cascade="none"
+ * @return
+ */
+ public EadventureSession getSession() {
+ return session;
+ }
+
+ public void setSession(EadventureSession session) {
+ this.session = session;
+ }
+ /**
+ * @hibernate.many-to-one column="eadventure_uid"
+ * cascade="none"
+ * @return
+ */
+ public Eadventure getEadventure() {
+ return eadventure;
+ }
+ public void setEadventure(Eadventure content) {
+ this.eadventure = content;
+ }
+ /**
+ * @hibernate.property column="session_finished"
+ * @return
+ */
+ public boolean isSessionFinished() {
+ return sessionFinished;
+ }
+
+ public void setSessionFinished(boolean sessionFinished) {
+ this.sessionFinished = sessionFinished;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!(obj instanceof EadventureUser))
+ return false;
+
+ final EadventureUser user = (EadventureUser) obj;
+
+ return new EqualsBuilder().append(this.uid, user.uid).append(this.firstName, user.firstName)
+ .append(this.lastName,user.lastName).append(this.loginName, user.loginName).isEquals();
+
+ }
+
+ public int hashCode() {
+ return new HashCodeBuilder().append(uid).append(firstName)
+ .append(lastName).append(loginName)
+ .toHashCode();
+ }
+ public Date getAccessDate() {
+ return accessDate;
+ }
+ public void setAccessDate(Date accessDate) {
+ this.accessDate = accessDate;
+ }
+
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureVars.hbm.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/Attic/EadventureVars.hbm.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureVars.hbm.xml 2 Nov 2010 22:16:28 -0000 1.1
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureVars.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureVars.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/model/EadventureVars.java 2 Nov 2010 22:16:27 -0000 1.1
@@ -0,0 +1,102 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureVars.java,v 1.1 2010/11/02 22:16:27 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.model;
+
+/**
+ * Eadventure
+ * @author Angel del Blanco
+ *
+ * @hibernate.class table="tl_eueadv10_var"
+ *
+ */
+public class EadventureVars {
+
+ private Long uid;
+ private String name;
+ private String type;
+ private String value;
+ //TODO necesito tener el visitLog entero o solo el uid??�?�??
+ private EadventureItemVisitLog visitLog;
+ /**
+ * @hibernate.id generator-class="native" type="java.lang.Long" column="uid"
+ * @return Returns the log Uid.
+ */
+ public Long getUid() {
+ return uid;
+ }
+ public void setUid(Long uid) {
+ this.uid = uid;
+ }
+
+ /**
+ * @hibernate.property column="name"
+ * @return
+ */
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @hibernate.property column="type"
+ * @return
+ */
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * @hibernate.property column="value"
+ * type="text"
+ * @return
+ */
+ public String getValue() {
+ return value;
+ }
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ *
+ * @hibernate.many-to-one column="visit_log_uid"
+ * cascade="save-update"
+ * @return
+ */
+ public EadventureItemVisitLog getVisitLog() {
+ return visitLog;
+ }
+ public void setVisitLog(EadventureItemVisitLog visitLog) {
+ this.visitLog = visitLog;
+ }
+
+
+
+}
+
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureApplicationException.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureApplicationException.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureApplicationException.java 2 Nov 2010 22:16:34 -0000 1.1
@@ -0,0 +1,48 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: EadventureApplicationException.java,v 1.1 2010/11/02 22:16:34 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.service;
+
+public class EadventureApplicationException extends Exception{
+
+ public EadventureApplicationException() {
+ super();
+
+ }
+
+ public EadventureApplicationException(String message, Throwable cause) {
+ super(message, cause);
+
+ }
+
+ public EadventureApplicationException(String message) {
+ super(message);
+
+ }
+
+ public EadventureApplicationException(Throwable cause) {
+ super(cause);
+
+ }
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureOutputFactory.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureOutputFactory.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureOutputFactory.java 2 Nov 2010 22:16:34 -0000 1.1
@@ -0,0 +1,302 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureOutputFactory.java,v 1.1 2010/11/02 22:16:34 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.service;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.lamsfoundation.lams.learningdesign.BranchCondition;
+import org.lamsfoundation.lams.tool.OutputFactory;
+import org.lamsfoundation.lams.tool.OutputType;
+import org.lamsfoundation.lams.tool.ToolOutput;
+import org.lamsfoundation.lams.tool.ToolOutputDefinition;
+import org.lamsfoundation.lams.tool.exception.ToolException;
+import org.eucm.lams.tool.eadventure.EadventureConstants;
+import org.eucm.lams.tool.eadventure.model.Eadventure;
+import org.eucm.lams.tool.eadventure.model.EadventureCondition;
+import org.eucm.lams.tool.eadventure.model.EadventureItemVisitLog;
+import org.eucm.lams.tool.eadventure.model.EadventureParam;
+import org.eucm.lams.tool.eadventure.model.EadventureSession;
+import org.eucm.lams.tool.eadventure.model.EadventureUser;
+import org.eucm.lams.tool.eadventure.model.EadventureVars;
+import org.lamsfoundation.lams.util.Configuration;
+import org.lamsfoundation.lams.util.ConfigurationKeys;
+import org.lamsfoundation.lams.web.util.AttributeNames;
+
+public class EadventureOutputFactory extends OutputFactory {
+
+
+ protected final static String OUTPUT_NAME_LEARNER_TOTAL_SCORE = "learner.score";
+ protected final static String OUTPUT_NAME_LEARNER_TIME_TAKEN = "learner.time.taken";
+ protected final static String OUTPUT_NAME_LEARNER_COMPLETED = "learner.completed";
+ protected final static String OUTPUT_NAME_TOOL_CONDITION = "tool.condition";
+
+ @Override
+ public SortedMap getToolOutputDefinitions(Object toolContentObject)
+ throws ToolException {
+ TreeMap definitionMap = new TreeMap();
+
+ ToolOutputDefinition definition =null;
+ Eadventure ead = (Eadventure)toolContentObject;
+ Set eadParams = ead.getParams();
+ for (EadventureParam param : eadParams){
+ String text;
+ if (param.getType().equals("score")){
+ definition = buildRangeDefinition(param.getName(),new Long(0), null );
+ definition.setDescription(param.getName());
+ } else if (param.getType().equals("game-completed")){
+ definition = buildBooleanOutputDefinition(param.getName());
+ definition.setDescription(param.getName());
+ } else if (param.getType().equals("total-time")){
+ definition = buildRangeDefinition(param.getName(),new Long(0), null );
+ definition.setDescription(param.getName());
+ } else if (param.getType().equals("real-time")){
+ definition = buildRangeDefinition(param.getName(),new Long(0), null );
+ definition.setDescription(param.getName());
+ } else if (param.getType().equals(EadventureConstants.PARAMS_TYPE_BOOLEAN)){
+ definition = buildBooleanOutputDefinition(param.getName());
+ definition.setDescription(getI18NText("output.desc.learner.user.defined", false) + param.getName());
+ }else if (param.getType().equals(EadventureConstants.PARAMS_TYPE_INTEGER)){
+ definition = buildRangeDefinition(param.getName(), new Long(0), null);
+ definition.setDescription(getI18NText("output.desc.learner.user.defined", false) + param.getName());
+ } if (param.getType().equals(EadventureConstants.PARAMS_TYPE_STRING)){
+ definition = buildRangeDefinition(param.getName(), new Long(0), null);
+ definition.setDescription(getI18NText("output.desc.learner.user.defined", false) + param.getName());
+ }
+ definitionMap.put(param.getName(), definition);
+ }
+
+
+ //add the conditions defined at authoring
+ if (ead.getConditions()!=null&&ead.getConditions().size()>0){
+ ToolOutputDefinition definitionOthers = buildBooleanSetOutputDefinition(OUTPUT_NAME_TOOL_CONDITION);
+ if ( definitionOthers.getDefaultConditions() == null )
+ definitionOthers.setDefaultConditions(new ArrayList());
+
+ List defaultConditions = definitionOthers.getDefaultConditions();
+ String trueString = Boolean.TRUE.toString();
+
+ Iterator iter2 = ead.getConditions().iterator();
+ while ( iter2.hasNext() ) {
+ EadventureCondition condition = iter2.next();
+ String name = buildConditionName(OUTPUT_NAME_TOOL_CONDITION, condition.getName());
+ defaultConditions.add(new BranchCondition(null, null, condition.getSequenceId(), name,
+ condition.getName(),
+ OutputType.OUTPUT_BOOLEAN.toString(),
+ null,
+ null,
+ trueString));
+ }
+
+ definitionOthers.setShowConditionNameOnly(Boolean.TRUE);
+
+ definitionMap.put(OUTPUT_NAME_TOOL_CONDITION, definitionOthers);
+ }
+
+
+ return definitionMap;
+ }
+
+
+
+ /**
+ * Follows {@link EadventureServiceImp#getToolOutput(List, Long, Long)}.
+ *
+ */
+ public SortedMap getToolOutput(List names, IEadventureService eadventureService,
+ Long toolSessionId, Long learnerId) {
+
+ //TODO checkear el orden
+ TreeMap outputs = new TreeMap();
+
+ EadventureSession session = eadventureService.getEadventureSessionBySessionId(toolSessionId);
+
+ if ((session != null) && (session.getEadventure() != null)) {
+ Eadventure ead = session.getEadventure();
+
+ TreeMap output = null;
+ if ( names == null ) {
+ return output;
+ } else {
+ output = new TreeMap();
+ for ( String name: names) {
+ ToolOutput newOutput = getToolOutput(name, eadventureService, toolSessionId, learnerId);
+ if ( newOutput != null )
+ output.put(name, newOutput);
+ }
+ }
+ }
+ return outputs;
+
+ }
+
+
+
+
+ public ToolOutput getToolOutput(String name, IEadventureService eadventureService, Long toolSessionId, Long learnerId) {
+
+
+ if (name != null) {
+ EadventureSession session = eadventureService.getEadventureSessionBySessionId(toolSessionId);
+
+ EadventureUser eadU = eadventureService.getUser(learnerId);
+
+ if ((session != null) && (session.getEadventure() != null)) {
+ Eadventure ead = //session.getEadventure();
+ eadventureService.getEadventureBySessionId(toolSessionId);
+
+ if (name.equals(OUTPUT_NAME_LEARNER_TOTAL_SCORE)) {
+ return getTotalScore(eadventureService, learnerId, ead,session.getSessionId());
+ } else if (name.equals(OUTPUT_NAME_LEARNER_TIME_TAKEN)) {
+ return getTimeTaken(eadventureService, learnerId, ead,session.getSessionId());
+ } else if (name.equals(OUTPUT_NAME_LEARNER_TOTAL_SCORE)) {
+ return getCompleted(eadventureService, learnerId, ead,session.getSessionId());
+ } else if (name.startsWith(OUTPUT_NAME_TOOL_CONDITION)) {
+ boolean check;
+ String[] dcNames = splitConditionName(name);
+ if ( dcNames[1] == null || dcNames[1].length() == 0) {
+ log.error("Wrong name for tool output " + OUTPUT_NAME_TOOL_CONDITION + ". Returning false. Condition name was: " + name);
+ check = false;
+ } else {
+ check = eadventureService.checkCondition(dcNames[1], toolSessionId, learnerId);
+ }
+ return new ToolOutput(name, getI18NText(OUTPUT_NAME_TOOL_CONDITION, true), check);
+ } else {
+ Set eadParams = ead.getParams();
+ for (EadventureParam param : eadParams){
+ if (name.equals(param.getName())) {
+ return getUserDefinedParam(eadventureService, learnerId, ead, session.getSessionId(), param);
+ }
+ }
+ }
+ }
+ }
+ return null;
+
+ }
+
+ private ToolOutput getUserDefinedParam(IEadventureService eadventureService, Long learnerId, Eadventure ead, Long sessionId, EadventureParam param){
+ EadventureUser user = eadventureService.getUserByIDAndSession(learnerId, sessionId);
+ EadventureItemVisitLog log = eadventureService.getEadventureItemLog(ead.getUid(), user.getUserId());
+ if (log==null)
+ return new ToolOutput(OUTPUT_NAME_LEARNER_TOTAL_SCORE, getI18NText(
+ OUTPUT_NAME_LEARNER_TOTAL_SCORE, true), 0);
+ EadventureVars var = eadventureService.getEadventureVars(log.getUid(), param.getName());
+
+
+ if (param.getType().equals("boolean")){
+ if (var!=null)
+ return new ToolOutput(var.getName(), "description", Boolean.parseBoolean(var.getValue()));
+ else return new ToolOutput(param.getName(), "description", false);
+ } else
+
+ if (param.getType().equals("integer")){
+ if (var!=null)
+ return new ToolOutput(var.getName(), "description", Integer.parseInt(var.getValue()));
+ else
+ return new ToolOutput(param.getName(), "description", 0);
+
+ } else {
+ if (var!=null)
+ return new ToolOutput(var.getName(), "description", var.getValue());
+ else
+ return new ToolOutput(param.getName(), "description", "");
+ }
+ }
+
+
+
+ /**
+ * Get total score for a user. Will always return a ToolOutput object.
+ */
+
+ private ToolOutput getTotalScore(IEadventureService eadventureService, Long learnerId, Eadventure ead, Long sessionId){
+
+ EadventureUser user = eadventureService.getUserByIDAndSession(learnerId, sessionId);
+
+ //eadventureService.getUserByIDAndContent(learnerId, ead.getContentId());
+ EadventureItemVisitLog log = eadventureService.getEadventureItemLog(ead.getUid(), user.getUserId());
+ if (log==null)
+ return new ToolOutput(OUTPUT_NAME_LEARNER_TOTAL_SCORE, getI18NText(
+ OUTPUT_NAME_LEARNER_TOTAL_SCORE, true), 0);
+ EadventureVars var = eadventureService.getEadventureVars(log.getUid(), EadventureConstants.VAR_NAME_SCORE);
+
+ float totalScore = (var == null||var.getValue()==null) ? 0 : Integer.parseInt(var.getValue());
+
+ return new ToolOutput(OUTPUT_NAME_LEARNER_TOTAL_SCORE, getI18NText(
+ OUTPUT_NAME_LEARNER_TOTAL_SCORE, true), totalScore);
+
+ }
+
+ /**
+ * Get time taken for a user. Will always return a ToolOutput object.
+ */
+
+ private ToolOutput getTimeTaken(IEadventureService eadventureService, Long learnerId, Eadventure ead, Long sessionId){
+
+ EadventureUser user = eadventureService.getUserByIDAndSession(learnerId, sessionId);
+
+ //eadventureService.getUserByIDAndContent(learnerId, ead.getContentId());
+ EadventureItemVisitLog log = eadventureService.getEadventureItemLog(ead.getUid(), user.getUserId());
+ if (log==null)
+ return new ToolOutput(OUTPUT_NAME_LEARNER_TIME_TAKEN, getI18NText(
+ OUTPUT_NAME_LEARNER_TIME_TAKEN, true), 0);
+ EadventureVars var = eadventureService.getEadventureVars(log.getUid(), EadventureConstants.VAR_NAME_TIME_TAKEN);
+
+ float totalTime = (var == null||var.getValue()==null) ? 0 : Integer.parseInt(var.getValue());
+
+ return new ToolOutput(OUTPUT_NAME_LEARNER_TIME_TAKEN, getI18NText(
+ OUTPUT_NAME_LEARNER_TIME_TAKEN, true), totalTime);
+
+ }
+
+ /**
+ * Completed when it is required. Will always return a ToolOutput object.
+ */
+
+ private ToolOutput getCompleted(IEadventureService eadventureService, Long learnerId, Eadventure ead, Long sessionId){
+
+ EadventureUser user = eadventureService.getUserByIDAndSession(learnerId, sessionId);
+
+ //eadventureService.getUserByIDAndContent(learnerId, ead.getContentId());
+ EadventureItemVisitLog log = eadventureService.getEadventureItemLog(ead.getUid(), user.getUserId());
+ if (log==null)
+ return new ToolOutput(OUTPUT_NAME_LEARNER_COMPLETED, getI18NText(
+ OUTPUT_NAME_LEARNER_COMPLETED, true), 0);
+ EadventureVars var = eadventureService.getEadventureVars(log.getUid(), EadventureConstants.VAR_NAME_COMPLETED);
+
+ boolean totalScore = (var == null||var.getValue()==null) ? false : Boolean.parseBoolean(var.getValue());
+
+ return new ToolOutput(OUTPUT_NAME_LEARNER_COMPLETED, getI18NText(
+ OUTPUT_NAME_LEARNER_COMPLETED, true), totalScore);
+
+ }
+
+}
+
+
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureServiceImpl.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureServiceImpl.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureServiceImpl.java 2 Nov 2010 22:16:34 -0000 1.1
@@ -0,0 +1,1631 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: EadventureServiceImpl.java,v 1.1 2010/11/02 22:16:34 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.service;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.Vector;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.apache.struts.upload.FormFile;
+import org.lamsfoundation.lams.contentrepository.AccessDeniedException;
+import org.lamsfoundation.lams.contentrepository.ICredentials;
+import org.lamsfoundation.lams.contentrepository.ITicket;
+import org.lamsfoundation.lams.contentrepository.IVersionedNode;
+import org.lamsfoundation.lams.contentrepository.InvalidParameterException;
+import org.lamsfoundation.lams.contentrepository.LoginException;
+import org.lamsfoundation.lams.contentrepository.NodeKey;
+import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException;
+import org.lamsfoundation.lams.contentrepository.WorkspaceNotFoundException;
+import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler;
+import org.lamsfoundation.lams.contentrepository.service.IRepositoryService;
+import org.lamsfoundation.lams.contentrepository.service.SimpleCredentials;
+import org.lamsfoundation.lams.events.IEventNotificationService;
+import org.lamsfoundation.lams.learning.service.ILearnerService;
+import org.lamsfoundation.lams.learningdesign.service.ExportToolContentException;
+import org.lamsfoundation.lams.learningdesign.service.IExportToolContentService;
+import org.lamsfoundation.lams.learningdesign.service.ImportToolContentException;
+import org.lamsfoundation.lams.lesson.service.ILessonService;
+import org.lamsfoundation.lams.notebook.model.NotebookEntry;
+import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants;
+import org.lamsfoundation.lams.notebook.service.ICoreNotebookService;
+import org.lamsfoundation.lams.tool.ToolContentImport102Manager;
+import org.lamsfoundation.lams.tool.ToolContentManager;
+import org.lamsfoundation.lams.tool.ToolOutput;
+import org.lamsfoundation.lams.tool.ToolOutputDefinition;
+import org.lamsfoundation.lams.tool.ToolSessionExportOutputData;
+import org.lamsfoundation.lams.tool.ToolSessionManager;
+import org.lamsfoundation.lams.tool.exception.DataMissingException;
+import org.lamsfoundation.lams.tool.exception.SessionDataExistsException;
+import org.lamsfoundation.lams.tool.exception.ToolException;
+import org.eucm.lams.tool.eadventure.EadventureConstants;
+import org.eucm.lams.tool.eadventure.dao.EadventureAttachmentDAO;
+import org.eucm.lams.tool.eadventure.dao.EadventureConditionDAO;
+import org.eucm.lams.tool.eadventure.dao.EadventureDAO;
+import org.eucm.lams.tool.eadventure.dao.EadventureExpressionDAO;
+import org.eucm.lams.tool.eadventure.dao.EadventureItemVisitDAO;
+import org.eucm.lams.tool.eadventure.dao.EadventureParamDAO;
+import org.eucm.lams.tool.eadventure.dao.EadventureSessionDAO;
+import org.eucm.lams.tool.eadventure.dao.EadventureUserDAO;
+import org.eucm.lams.tool.eadventure.dao.EadventureVarsDAO;
+import org.eucm.lams.tool.eadventure.dto.ReflectDTO;
+import org.eucm.lams.tool.eadventure.dto.Summary;
+import org.eucm.lams.tool.eadventure.ims.IContentPackageConverter;
+import org.eucm.lams.tool.eadventure.ims.IMSManifestException;
+import org.eucm.lams.tool.eadventure.ims.ImscpApplicationException;
+import org.eucm.lams.tool.eadventure.ims.SimpleContentPackageConverter;
+import org.eucm.lams.tool.eadventure.model.Eadventure;
+import org.eucm.lams.tool.eadventure.model.EadventureAttachment;
+import org.eucm.lams.tool.eadventure.model.EadventureCondition;
+import org.eucm.lams.tool.eadventure.model.EadventureExpression;
+import org.eucm.lams.tool.eadventure.model.EadventureItemVisitLog;
+import org.eucm.lams.tool.eadventure.model.EadventureParam;
+import org.eucm.lams.tool.eadventure.model.EadventureSession;
+import org.eucm.lams.tool.eadventure.model.EadventureUser;
+import org.eucm.lams.tool.eadventure.model.EadventureVars;
+import org.eucm.lams.tool.eadventure.util.ReflectDTOComparator;
+import org.eucm.lams.tool.eadventure.util.EadventureToolContentHandler;
+import org.eucm.lams.tool.eadventure.util.InputOutputReader;
+import org.lamsfoundation.lams.tool.service.ILamsToolService;
+import org.lamsfoundation.lams.usermanagement.User;
+import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
+import org.lamsfoundation.lams.usermanagement.service.IUserManagementService;
+import org.lamsfoundation.lams.util.MessageService;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.util.audit.IAuditService;
+import org.lamsfoundation.lams.util.wddx.WDDXProcessor;
+import org.lamsfoundation.lams.util.wddx.WDDXProcessorConversionException;
+import org.lamsfoundation.lams.util.zipfile.ZipFileUtil;
+import org.lamsfoundation.lams.util.zipfile.ZipFileUtilException;
+
+/**
+ *
+ * @author Dapeng.Ni
+ *
+ */
+public class EadventureServiceImpl implements IEadventureService, ToolContentManager, ToolSessionManager,
+ ToolContentImport102Manager
+
+{
+ static Logger log = Logger.getLogger(EadventureServiceImpl.class.getName());
+
+ private EadventureDAO eadventureDao;
+
+ private EadventureAttachmentDAO eadventureAttachmentDao;
+
+ private EadventureUserDAO eadventureUserDao;
+
+ private EadventureSessionDAO eadventureSessionDao;
+
+ private EadventureItemVisitDAO eadventureItemVisitDao;
+
+ private EadventureVarsDAO eadventureVarsDao;
+
+ private EadventureParamDAO eadventureParamDao;
+
+ private EadventureConditionDAO eadventureConditionDao;
+
+ private EadventureExpressionDAO eadventureExpressionDao;
+
+ // tool service
+ private EadventureToolContentHandler eadventureToolContentHandler;
+
+ private MessageService messageService;
+
+ // system services
+ private IRepositoryService repositoryService;
+
+ private ILamsToolService toolService;
+
+ private ILearnerService learnerService;
+
+ private IAuditService auditService;
+
+ private IUserManagementService userManagementService;
+
+ private IExportToolContentService exportContentService;
+
+ private ICoreNotebookService coreNotebookService;
+
+ private IEventNotificationService eventNotificationService;
+
+ private ILessonService lessonService;
+
+ private EadventureOutputFactory eadventureOutputFactory;
+
+
+
+
+ public IVersionedNode getFileNode(Long itemUid, String relPathString) throws EadventureApplicationException {
+ Eadventure ead = (Eadventure) eadventureDao.getObject(Eadventure.class, itemUid);
+ if (ead == null) {
+ throw new EadventureApplicationException("Eadventure " + itemUid + " not found.");
+ }
+
+ return getFile(ead.getFileUuid(), ead.getFileVersionId(), relPathString);
+ }
+
+ // *******************************************************************************
+ // Service method
+ // *******************************************************************************
+ /**
+ * Try to get the file. If forceLogin = false and an access denied exception occurs, call this method again to get a
+ * new ticket and retry file lookup. If forceLogin = true and it then fails then throw exception.
+ *
+ * @param uuid
+ * @param versionId
+ * @param relativePath
+ * @param attemptCount
+ * @return file node
+ * @throws ImscpApplicationException
+ */
+ private IVersionedNode getFile(Long uuid, Long versionId, String relativePath) throws EadventureApplicationException {
+
+ ITicket tic = getRepositoryLoginTicket();
+
+ try {
+
+ return repositoryService.getFileItem(tic, uuid, versionId, relativePath);
+
+ } catch (AccessDeniedException e) {
+
+ String error = "Unable to access repository to get file uuid " + uuid + " version id " + versionId
+ + " path " + relativePath + ".";
+
+ error = error + "AccessDeniedException: " + e.getMessage() + " Unable to retry further.";
+ EadventureServiceImpl.log.error(error);
+ throw new EadventureApplicationException(error, e);
+
+ } catch (Exception e) {
+
+ String error = "Unable to access repository to get file uuid " + uuid + " version id " + versionId
+ + " path " + relativePath + "." + " Exception: " + e.getMessage();
+ EadventureServiceImpl.log.error(error);
+ throw new EadventureApplicationException(error, e);
+
+ }
+ }
+
+ /**
+ * This method verifies the credentials of the Eadventure Tool and gives it the Ticket
to login
+ * and access the Content Repository.
+ *
+ * A valid ticket is needed in order to access the content from the repository. This method would be called evertime
+ * the tool needs to upload/download files from the content repository.
+ *
+ * @return ITicket The ticket for repostory access
+ * @throws EadventureApplicationException
+ */
+ private ITicket getRepositoryLoginTicket() throws EadventureApplicationException {
+ ICredentials credentials = new SimpleCredentials(eadventureToolContentHandler.getRepositoryUser(),
+ eadventureToolContentHandler.getRepositoryId());
+ try {
+ ITicket ticket = repositoryService.login(credentials, eadventureToolContentHandler
+ .getRepositoryWorkspaceName());
+ return ticket;
+ } catch (AccessDeniedException ae) {
+ throw new EadventureApplicationException("Access Denied to repository." + ae.getMessage());
+ } catch (WorkspaceNotFoundException we) {
+ throw new EadventureApplicationException("Workspace not found." + we.getMessage());
+ } catch (LoginException e) {
+ throw new EadventureApplicationException("Login failed." + e.getMessage());
+ }
+ }
+
+ public Eadventure getEadventureByContentId(Long contentId) {
+ Eadventure rs = eadventureDao.getByContentId(contentId);
+ if (rs == null) {
+ EadventureServiceImpl.log.error("Could not find the content by given ID:" + contentId);
+ }
+ return rs;
+ }
+
+ public Eadventure getDefaultContent(Long contentId) throws EadventureApplicationException {
+ if (contentId == null) {
+ String error = messageService.getMessage("error.msg.default.content.not.find");
+ EadventureServiceImpl.log.error(error);
+ throw new EadventureApplicationException(error);
+ }
+
+ Eadventure defaultContent = getDefaultEadventure();
+ // save default content by given ID.
+ Eadventure content = new Eadventure();
+ content = Eadventure.newInstance(defaultContent, contentId, eadventureToolContentHandler);
+ return content;
+ }
+
+ //TODO revisar
+ /* public List getAuthoredItems(Long eadventureUid) {
+ return eadventureItemDao.getAuthoringItems(eadventureUid);
+ }*/
+
+ public EadventureAttachment uploadInstructionFile(FormFile uploadFile, String fileType)
+ throws UploadEadventureFileException {
+ if (uploadFile == null || StringUtils.isEmpty(uploadFile.getFileName())) {
+ throw new UploadEadventureFileException(messageService.getMessage("error.msg.upload.file.not.found",
+ new Object[] { uploadFile }));
+ }
+
+ // upload file to repository
+ NodeKey nodeKey = processFile(uploadFile, fileType);
+
+ // create new attachement
+ EadventureAttachment file = new EadventureAttachment();
+ file.setFileType(fileType);
+ file.setFileUuid(nodeKey.getUuid());
+ file.setFileVersionId(nodeKey.getVersion());
+ file.setFileName(uploadFile.getFileName());
+ file.setCreated(new Date());
+
+ return file;
+ }
+
+ public void createUser(EadventureUser eadventureUser) {
+ eadventureUserDao.saveObject(eadventureUser);
+ }
+
+ public EadventureUser getUserByIDAndContent(Long userId, Long contentId) {
+
+ return eadventureUserDao.getUserByUserIDAndContentID(userId, contentId);
+
+ }
+
+ public EadventureUser getUserByIDAndSession(Long userId, Long sessionId) {
+
+ return eadventureUserDao.getUserByUserIDAndSessionID(userId, sessionId);
+
+ }
+
+ public void deleteFromRepository(Long fileUuid, Long fileVersionId) throws EadventureApplicationException {
+ ITicket ticket = getRepositoryLoginTicket();
+ try {
+ repositoryService.deleteVersion(ticket, fileUuid, fileVersionId);
+ } catch (Exception e) {
+ throw new EadventureApplicationException("Exception occured while deleting files from" + " the repository "
+ + e.getMessage());
+ }
+ }
+
+ public void saveOrUpdateEadventure(Eadventure eadventure) {
+ eadventureDao.saveObject(eadventure);
+ }
+
+
+ public void saveOrUpdateEadventureExpressions(Set eadExpressions, Long condUID) {
+ Iterator it = eadExpressions.iterator();
+ while (it.hasNext()){
+ EadventureExpression expression = it.next();
+ // expression.setCondition_uid(condUID);
+ eadventureExpressionDao.saveObject(expression);
+ }
+ }
+
+ public void saveOrUpdateEadventureExpression(EadventureExpression eadExpression) {
+ eadventureExpressionDao.saveObject(eadExpression);
+ }
+
+ public void saveOrUpdateEadventureCondition(EadventureCondition eadCondition) {
+ eadventureConditionDao.saveObject(eadCondition);
+ }
+
+ public void saveOrUpdateEadventureConditions(Set eadConditions) {
+ Iterator it = eadConditions.iterator();
+ while (it.hasNext()){
+ EadventureCondition cond = it.next();
+ // Set expList = cond.getEadListExpression();
+ // cond.setEadListExpression(null);
+ eadventureConditionDao.saveObject(cond);
+ // saveOrUpdateEadventureExpressions(expList, cond.getUid());
+ // cond.setEadListExpression(expList);
+ }
+}
+
+ public void deleteEadventureAttachment(Long attachmentUid) {
+ eadventureAttachmentDao.removeObject(EadventureAttachment.class, attachmentUid);
+
+ }
+
+ public void deleteEadventureCondition(Long conditionUid) {
+ eadventureConditionDao.removeObject(EadventureCondition.class, conditionUid);
+
+ }
+
+ public void deleteEadventureExpression(Long expressionUid) {
+ eadventureExpressionDao.removeObject(EadventureExpression.class, expressionUid);
+
+ }
+
+ //TODO revisar!!!!!! Monitoring
+ public List exportBySessionId(Long sessionId, Long userId) {
+ EadventureSession session = eadventureSessionDao.getSessionBySessionId(sessionId);
+ if (session == null) {
+ EadventureServiceImpl.log.error("Failed get EadventureSession by ID [" + sessionId + "]");
+ return null;
+ }
+ // initial eadventure items list
+ List itemList = new ArrayList();
+ Eadventure ead = session.getEadventure();
+ Summary sum = new Summary(session.getSessionId(), session.getSessionName(), ead, false);
+
+
+
+ //List userList = getUserListBySessionItem(session.getSessionId(), ead.getUid());
+ boolean[] existList = new boolean[1];
+ String[] reportList = new String[1];
+
+ EadventureUser eadUser = eadventureUserDao.getUserByUserIDAndSessionID(userId,sessionId);
+ //TODO doble acceso a vistit log... (aqui y en getUserListBySessionItem)
+ EadventureItemVisitLog log = getEadventureItemLog(ead.getUid(), userId);
+ eadUser.setAccessDate(log.getAccessDate());
+ EadventureVars var = getEadventureVars(log.getUid(), EadventureConstants.VAR_NAME_REPORT);
+
+
+ if (var!=null){
+ existList[0]=true;
+ reportList[0]=var.getValue();
+ }else{
+ existList[0]=false;
+ reportList[0]=null;
+ }
+
+
+ ArrayList userList = new ArrayList();
+ userList.add(eadUser);
+ sum.setUsers(userList);
+ sum.setExistList(existList);
+ sum.setReportList(reportList);
+
+
+ //TODO ver si tiene sentido que sea una lista
+ ArrayList list = new ArrayList();
+ list.add(sum);
+
+ return list;
+ }
+ //TODO revisar!!!!!! Monitoring
+ public List exportByContentId(Long contentId) {
+ Eadventure eadventure = eadventureDao.getByContentId(contentId);
+ List groupList = new ArrayList();
+
+ // session by session
+ List sessionList = eadventureSessionDao.getByContentId(contentId);
+ for (EadventureSession session : sessionList) {
+
+ Summary sum = new Summary(session.getSessionId(), session.getSessionName(), session.getEadventure(), false);
+
+ List userList = getUserListBySessionItem(session.getSessionId(), eadventure.getUid());
+ boolean[] existList = new boolean[userList.size()];
+ String[] reportList = new String[userList.size()];
+ int numberOfFinishedLearners = 0;
+ int i=0;
+ for (EadventureUser eadUser : userList){
+ //TODO doble acceso a vistit log... (aqui y en getUserListBySessionItem)
+ EadventureItemVisitLog log = getEadventureItemLog(eadventure.getUid(), eadUser.getUserId());
+
+ EadventureVars var = getEadventureVars(log.getUid(), EadventureConstants.VAR_NAME_REPORT);
+
+ if (log.isComplete())
+ numberOfFinishedLearners++;
+
+ if (var!=null){
+ existList[i]=true;
+ reportList[i]=var.getValue();
+ }else{
+ existList[i]=false;
+ reportList[i]=null;
+ }
+ i++;
+
+ }
+ sum.setUsers(userList);
+ sum.setExistList(existList);
+ sum.setReportList(reportList);
+
+
+ groupList.add(sum);
+ }
+
+ return groupList;
+ }
+
+ public Eadventure getEadventureBySessionId(Long sessionId) {
+ EadventureSession session = eadventureSessionDao.getSessionBySessionId(sessionId);
+ // to skip CGLib problem
+ Long contentId = session.getEadventure().getContentId();
+ Eadventure res = eadventureDao.getByContentId(contentId);
+ return res;
+ }
+
+ public EadventureSession getEadventureSessionBySessionId(Long sessionId) {
+ return eadventureSessionDao.getSessionBySessionId(sessionId);
+ }
+
+ public void saveOrUpdateEadventureSession(EadventureSession resSession) {
+ eadventureSessionDao.saveObject(resSession);
+ }
+
+ /* public void retrieveComplete(SortedSet eadventureItemList, EadventureUser user) {
+ for (EadventureItem item : eadventureItemList) {
+ EadventureItemVisitLog log = eadventureItemVisitDao.getEadventureItemLog(item.getUid(), user.getUserId());
+ if (log == null) {
+ item.setComplete(false);
+ } else {
+ item.setComplete(log.isComplete());
+ }
+ }
+ }*/
+
+
+ public void setItemComplete(Long eadventureItemUid, Long userId, Long sessionId) {
+ EadventureItemVisitLog log = eadventureItemVisitDao.getEadventureItemLog(eadventureItemUid, userId);
+ if (log == null) {
+ log = new EadventureItemVisitLog();
+ Eadventure ead = eadventureDao.getByUid(eadventureItemUid);
+ log.setEadventure(ead);
+ EadventureUser user = eadventureUserDao.getUserByUserIDAndSessionID(userId, sessionId);
+ log.setUser(user);
+ log.setSessionId(sessionId);
+ log.setAccessDate(new Timestamp(new Date().getTime()));
+ }
+ log.setComplete(true);
+ eadventureItemVisitDao.saveObject(log);
+ }
+
+ public void setItemAccess(Long eadventureItemUid, Long userId, Long sessionId) {
+ EadventureItemVisitLog log = eadventureItemVisitDao.getEadventureItemLog(eadventureItemUid, userId);
+ EadventureServiceImpl.log.error("Set item acces!!!!!");
+
+ if (log == null) {
+ log = new EadventureItemVisitLog();
+ Eadventure item = eadventureDao.getByUid(eadventureItemUid);
+ log.setEadventure(item);
+ EadventureServiceImpl.log.error("El id de usuario es " + userId);
+ EadventureServiceImpl.log.error("USER ID "+userId);
+ EadventureServiceImpl.log.error("SESSION ID "+sessionId);
+ EadventureUser user = eadventureUserDao.getUserByUserIDAndSessionID(userId, sessionId);
+ if (user==null)
+ EadventureServiceImpl.log.error("NOS DA NULL!!!!!!!");
+ log.setUser(user);
+ log.setComplete(false);
+ log.setSessionId(sessionId);
+ log.setAccessDate(new Timestamp(new Date().getTime()));
+ eadventureItemVisitDao.saveObject(log);
+ } else
+ EadventureServiceImpl.log.error("NO ES NULL!!!");
+ }
+
+ public String finishToolSession(Long toolSessionId, Long userId) throws EadventureApplicationException {
+ EadventureUser user = eadventureUserDao.getUserByUserIDAndSessionID(userId, toolSessionId);
+ user.setSessionFinished(true);
+ eadventureUserDao.saveObject(user);
+
+ // EadventureSession session = eadventureSessionDao.getSessionBySessionId(toolSessionId);
+ // session.setStatus(EadventureConstants.COMPLETED);
+ // eadventureSessionDao.saveObject(session);
+
+ String nextUrl = null;
+ try {
+ nextUrl = this.leaveToolSession(toolSessionId, userId);
+ } catch (DataMissingException e) {
+ throw new EadventureApplicationException(e);
+ } catch (ToolException e) {
+ throw new EadventureApplicationException(e);
+ }
+ return nextUrl;
+ }
+
+ //TODO revisar!!!! monitoring
+ public List getSummary(Long contentId) {
+ List groupList = new ArrayList();
+
+ // get all item which is accessed by user
+ Map visitCountMap = eadventureItemVisitDao.getSummary(contentId);
+
+ Eadventure eadventure = eadventureDao.getByContentId(contentId);
+
+ List sessionList = eadventureSessionDao.getByContentId(contentId);
+ for (EadventureSession session : sessionList) {
+ // one new group for one session.
+ // so far no any ead available, so just put session name info to Summary
+ Summary sum = new Summary(session.getSessionId(), session.getSessionName(), session.getEadventure());
+ // set viewNumber according visit log
+ if (visitCountMap.containsKey(eadventure.getUid())) {
+ sum.setViewNumber(visitCountMap.get(eadventure.getUid()).intValue());
+ }
+ List userList = getUserListBySessionItem(session.getSessionId(), eadventure.getUid());
+ boolean[] existList = new boolean[userList.size()];
+ int numberOfFinishedLearners = 0;
+ int i=0;
+ for (EadventureUser eadUser : userList){
+ //TODO doble acceso a vistit log... (aqui y en getUserListBySessionItem)
+ EadventureItemVisitLog log = getEadventureItemLog(eadventure.getUid(), eadUser.getUserId());
+
+ EadventureVars var = getEadventureVars(log.getUid(), EadventureConstants.VAR_NAME_REPORT);
+
+ if (log.isComplete())
+ numberOfFinishedLearners++;
+
+ if (var!=null)
+ existList[i]=true;
+ else
+ existList[i]=false;
+
+ i++;
+
+ }
+ sum.setUsers(userList);
+ sum.setExistList(existList);
+ sum.setNumberOfLearners(userList.size());
+ sum.setNumberOfFinishedLearners(numberOfFinishedLearners);
+
+ groupList.add(sum);
+ }
+
+ return groupList;
+
+ }
+
+ public Map> getReflectList(Long contentId, boolean setEntry) {
+ Map> map = new HashMap>();
+
+ List sessionList = eadventureSessionDao.getByContentId(contentId);
+ for (EadventureSession session : sessionList) {
+ Long sessionId = session.getSessionId();
+ boolean hasRefection = session.getEadventure().isReflectOnActivity();
+ Set list = new TreeSet(new ReflectDTOComparator());
+ // get all users in this session
+ List users = eadventureUserDao.getBySessionID(sessionId);
+ for (EadventureUser user : users) {
+ ReflectDTO ref = new ReflectDTO(user);
+
+ if (setEntry) {
+ NotebookEntry entry = getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL,
+ EadventureConstants.TOOL_SIGNATURE, user.getUserId().intValue());
+ if (entry != null) {
+ ref.setReflect(entry.getEntry());
+ }
+ }
+
+ ref.setHasRefection(hasRefection);
+ list.add(ref);
+ }
+ map.put(sessionId, list);
+ }
+
+ return map;
+ }
+
+ public List getUserListBySessionItem(Long sessionId, Long itemUid) {
+ List logList = eadventureItemVisitDao.getEadventureItemLogBySession(sessionId, itemUid);
+ List userList = new ArrayList(logList.size());
+ for (EadventureItemVisitLog visit : logList) {
+ EadventureUser user = visit.getUser();
+ user.setAccessDate(visit.getAccessDate());
+ userList.add(user);
+ }
+ //List userList = null;
+ return userList;
+ }
+
+ //TODO revisar Monitoring!!!
+ public void setItemVisible(Long itemUid, boolean visible) {
+ /*EadventureItem item = eadventureItemDao.getByUid(itemUid);
+ if (item != null) {
+ // createBy should be null for system default value.
+ Long userId = 0L;
+ String loginName = "No user";
+ if (item.getCreateBy() != null) {
+ userId = item.getCreateBy().getUserId();
+ loginName = item.getCreateBy().getLoginName();
+ }
+ if (visible) {
+ auditService.logShowEntry(EadventureConstants.TOOL_SIGNATURE, userId, loginName, item.toString());
+ } else {
+ auditService.logHideEntry(EadventureConstants.TOOL_SIGNATURE, userId, loginName, item.toString());
+ }
+ item.setHide(!visible);
+ eadventureItemDao.saveObject(item);
+ }*/
+ }
+
+ public Long createNotebookEntry(Long sessionId, Integer notebookToolType, String toolSignature, Integer userId,
+ String entryText) {
+ return coreNotebookService.createNotebookEntry(sessionId, notebookToolType, toolSignature, userId, "",
+ entryText);
+ }
+
+ public NotebookEntry getEntry(Long sessionId, Integer idType, String signature, Integer userID) {
+ List list = coreNotebookService.getEntry(sessionId, idType, signature, userID);
+ if (list == null || list.isEmpty()) {
+ return null;
+ } else {
+ return list.get(0);
+ }
+ }
+
+ /**
+ * @param notebookEntry
+ */
+ public void updateEntry(NotebookEntry notebookEntry) {
+ coreNotebookService.updateEntry(notebookEntry);
+ }
+
+ public EadventureUser getUser(Long uid) {
+ return (EadventureUser) eadventureUserDao.getObject(EadventureUser.class, uid);
+ }
+
+ // *****************************************************************************
+ // private methods
+ // *****************************************************************************
+ private Eadventure getDefaultEadventure() throws EadventureApplicationException {
+ Long defaultEadventureId = getToolDefaultContentIdBySignature(EadventureConstants.TOOL_SIGNATURE);
+ Eadventure defaultEadventure = getEadventureByContentId(defaultEadventureId);
+ if (defaultEadventure == null) {
+ String error = messageService.getMessage("error.msg.default.content.not.find");
+ EadventureServiceImpl.log.error(error);
+ throw new EadventureApplicationException(error);
+ }
+
+ return defaultEadventure;
+ }
+
+ private Long getToolDefaultContentIdBySignature(String toolSignature) throws EadventureApplicationException {
+ Long contentId = null;
+ contentId = new Long(toolService.getToolDefaultContentIdBySignature(toolSignature));
+ if (contentId == null) {
+ String error = messageService.getMessage("error.msg.default.content.not.find");
+ EadventureServiceImpl.log.error(error);
+ throw new EadventureApplicationException(error);
+ }
+ return contentId;
+ }
+
+ /**
+ * Process an uploaded file.
+ *
+ * @throws EadventureApplicationException
+ * @throws FileNotFoundException
+ * @throws IOException
+ * @throws RepositoryCheckedException
+ * @throws InvalidParameterException
+ */
+ private NodeKey processFile(FormFile file, String fileType) throws UploadEadventureFileException {
+ NodeKey node = null;
+ if (file != null && !StringUtils.isEmpty(file.getFileName())) {
+ String fileName = file.getFileName();
+ try {
+ node = eadventureToolContentHandler.uploadFile(file.getInputStream(), fileName, file.getContentType(),
+ fileType);
+ } catch (InvalidParameterException e) {
+ throw new UploadEadventureFileException(messageService.getMessage("error.msg.invaid.param.upload"));
+ } catch (FileNotFoundException e) {
+ throw new UploadEadventureFileException(messageService.getMessage("error.msg.file.not.found"));
+ } catch (RepositoryCheckedException e) {
+ throw new UploadEadventureFileException(messageService.getMessage("error.msg.repository"));
+ } catch (IOException e) {
+ throw new UploadEadventureFileException(messageService.getMessage("error.msg.io.exception"));
+ }
+ }
+ return node;
+ }
+
+ private NodeKey processPackage(String packageDirectory, String initFile) throws UploadEadventureFileException {
+ NodeKey node = null;
+ try {
+ node = eadventureToolContentHandler.uploadPackage(packageDirectory, initFile);
+ } catch (InvalidParameterException e) {
+ throw new UploadEadventureFileException(messageService.getMessage("error.msg.invaid.param.upload"));
+ } catch (RepositoryCheckedException e) {
+ throw new UploadEadventureFileException(messageService.getMessage("error.msg.repository"));
+ }
+ return node;
+ }
+
+ public void saveOrUpdateEadventureParams(Set eadParams){
+ Iterator it = eadParams.iterator();
+ while (it.hasNext()){
+ EadventureParam param = it.next();
+ eadventureParamDao.saveObject(param);
+ }
+ }
+
+ public void removeParam(EadventureParam eadParams){
+ eadventureParamDao.delete(eadParams);
+ }
+
+
+ public void uploadEadventureFile(Eadventure ead, FormFile file) throws UploadEadventureFileException {
+ try {
+ InputStream is = file.getInputStream();
+ String fileName = file.getFileName();
+ String fileType = file.getContentType();
+
+ // need unzip upload, and parse learning object information from XML file.
+
+ String packageDirectory = ZipFileUtil.expandZip(is, fileName);
+ log.error("Direcci�n del zip: "+packageDirectory);
+ IContentPackageConverter cpConverter = new SimpleContentPackageConverter(packageDirectory);
+ String initFile = cpConverter.getDefaultItem();
+ ead.setImsSchema(cpConverter.getSchema());
+ ead.setOrganizationXml(cpConverter.getOrganzationXML());
+ ead.setInitialItem(initFile);
+ // upload package
+ NodeKey nodeKey = processPackage(packageDirectory, initFile);
+ ead.setFileUuid(nodeKey.getUuid());
+ ead.setFileVersionId(nodeKey.getVersion());
+
+ // create the package from the directory contents
+ ead.setFileType(fileType);
+ ead.setFileName(fileName);
+
+ // parse parameters.xml file, and create the eadParams
+ //TODO reportar bien el error cuando no se produce xk no es un e-Ad file
+ HashMap params = InputOutputReader.getOutputParameterList(packageDirectory+"//"+EadventureConstants.PARAMETERS_FILE_NAME);
+ // chek if its a real e-adventure package
+
+ if (! new File(packageDirectory+"//"+EadventureConstants.PARAMETERS_FILE_NAME).exists()){
+ EadventureServiceImpl.log.error(messageService.getMessage("error.msg.ims.package") + " : "
+ + "No eAdventure game!! ");
+ throw new UploadEadventureFileException(messageService.getMessage("error.msg.ims.package"));
+ }
+ Iterator it = params.keySet().iterator();
+ Set eadParam = new HashSet();
+ while (it.hasNext()){
+ EadventureParam param = new EadventureParam();
+ String key = it.next();
+ param.setInput(false);
+ param.setName(key);
+ param.setType(params.get(key));
+ // eadventureParamDao.saveObject(param);
+ eadParam.add(param);
+ log.error(key+" ha sido subido con exito!!!!!!");
+
+ }
+ //add default params (this are not included in the params file at eAd LAMS export due to they always have to appear)
+ eadParam.addAll(getDefaultParams());
+ ead.setParams(eadParam);
+
+ } catch (ZipFileUtilException e) {
+ EadventureServiceImpl.log.error(messageService.getMessage("error.msg.zip.file.exception") + " : "
+ + e.toString());
+ throw new UploadEadventureFileException(messageService.getMessage("error.msg.zip.file.exception"));
+ } catch (FileNotFoundException e) {
+ EadventureServiceImpl.log.error(messageService.getMessage("error.msg.file.not.found") + ":" + e.toString());
+ throw new UploadEadventureFileException(messageService.getMessage("error.msg.file.not.found"));
+ } catch (IOException e) {
+ EadventureServiceImpl.log.error(messageService.getMessage("error.msg.io.exception") + ":" + e.toString());
+ throw new UploadEadventureFileException(messageService.getMessage("error.msg.io.exception"));
+ } catch (IMSManifestException e) {
+ EadventureServiceImpl.log.error(messageService.getMessage("error.msg.ims.package") + ":" + e.toString());
+ throw new UploadEadventureFileException(messageService.getMessage("error.msg.ims.package"));
+ } catch (ImscpApplicationException e) {
+ EadventureServiceImpl.log.error(messageService.getMessage("error.msg.ims.application") + ":" + e.toString());
+ throw new UploadEadventureFileException(messageService.getMessage("error.msg.ims.application"));
+ }
+ }
+
+ private List getDefaultParams(){
+ List defaultParams = new ArrayList();
+ defaultParams.add(new EadventureParam("score","integer",false));
+ defaultParams.add(new EadventureParam("game-completed","boolean",false));
+ defaultParams.add(new EadventureParam("total-time","integer",false));
+ return defaultParams;
+ }
+
+ /**
+ * Find out default.htm/html or index.htm/html in the given directory folder
+ *
+ * @param packageDirectory
+ * @return
+ */
+
+ //TODO creo que vga a sobrar
+ private String findWebsiteInitialItem(String packageDirectory) {
+ File file = new File(packageDirectory);
+ if (!file.isDirectory()) {
+ return null;
+ }
+
+ File[] initFiles = file.listFiles(new FileFilter() {
+ public boolean accept(File pathname) {
+ if (pathname == null || pathname.getName() == null) {
+ return false;
+ }
+ String name = pathname.getName();
+ if (name.endsWith("default.html") || name.endsWith("default.htm") || name.endsWith("index.html")
+ || name.endsWith("index.htm")) {
+ return true;
+ }
+ return false;
+ }
+ });
+ if (initFiles != null && initFiles.length > 0) {
+ return initFiles[0].getName();
+ } else {
+ return null;
+ }
+ }
+
+ // *****************************************************************************
+ // set methods for Spring Bean
+ // *****************************************************************************
+ public void setAuditService(IAuditService auditService) {
+ this.auditService = auditService;
+ }
+
+ public void setLearnerService(ILearnerService learnerService) {
+ this.learnerService = learnerService;
+ }
+
+ public void setMessageService(MessageService messageService) {
+ this.messageService = messageService;
+ }
+
+ public void setRepositoryService(IRepositoryService repositoryService) {
+ this.repositoryService = repositoryService;
+ }
+
+ public void setEadventureAttachmentDao(EadventureAttachmentDAO eadventureAttachmentDao) {
+ this.eadventureAttachmentDao = eadventureAttachmentDao;
+ }
+
+ public void setEadventureDao(EadventureDAO eadventureDao) {
+ this.eadventureDao = eadventureDao;
+ }
+
+ public List getEadventureParamByContentId(Long contentId){
+ return eadventureParamDao.getEadventureParamByEadContentId(contentId);
+ }
+
+ public void setEadventureSessionDao(EadventureSessionDAO eadventureSessionDao) {
+ this.eadventureSessionDao = eadventureSessionDao;
+ }
+
+ public void setEadventureToolContentHandler(EadventureToolContentHandler eadventureToolContentHandler) {
+ this.eadventureToolContentHandler = eadventureToolContentHandler;
+ }
+
+ public void setEadventureUserDao(EadventureUserDAO eadventureUserDao) {
+ this.eadventureUserDao = eadventureUserDao;
+ }
+
+ public void setEadventureItemVisitDao(EadventureItemVisitDAO eadventureItemVisitDao) {
+ this.eadventureItemVisitDao = eadventureItemVisitDao;
+ }
+
+ public EadventureItemVisitDAO getEadventureItemVisitDao() {
+ return eadventureItemVisitDao;
+ }
+
+ public void setEadventureVarsDao(EadventureVarsDAO eadventureVarsDao) {
+ this.eadventureVarsDao = eadventureVarsDao;
+ }
+
+ public void setToolService(ILamsToolService toolService) {
+ this.toolService = toolService;
+ }
+
+
+ // *******************************************************************************
+ // ToolContentManager, ToolSessionManager methods
+ // *******************************************************************************
+
+ public void exportToolContent(Long toolContentId, String rootPath) throws DataMissingException, ToolException {
+ Eadventure toolContentObj = eadventureDao.getByContentId(toolContentId);
+ if (toolContentObj == null) {
+ try {
+ toolContentObj = getDefaultEadventure();
+ } catch (EadventureApplicationException e) {
+ throw new DataMissingException(e.getMessage());
+ }
+ }
+ if (toolContentObj == null) {
+ throw new DataMissingException("Unable to find default content for the eadventure tool");
+ }
+
+ // set EadventureToolContentHandler as null to avoid copy file node in repository again.
+ toolContentObj = Eadventure.newInstance(toolContentObj, toolContentId, null);
+ toolContentObj.setToolContentHandler(null);
+ toolContentObj.setOfflineFileList(null);
+ toolContentObj.setOnlineFileList(null);
+ try {
+ exportContentService.registerFileClassForExport(EadventureAttachment.class.getName(), "fileUuid",
+ "fileVersionId");
+ //TODO revisar!!
+ exportContentService.registerFileClassForExport(Eadventure.class.getName(), "fileUuid", "fileVersionId");
+ exportContentService.exportToolContent(toolContentId, toolContentObj, eadventureToolContentHandler, rootPath);
+ } catch (ExportToolContentException e) {
+ throw new ToolException(e);
+ }
+ }
+
+ public void importToolContent(Long toolContentId, Integer newUserUid, String toolContentPath, String fromVersion,
+ String toVersion) throws ToolException {
+
+ try {
+ exportContentService.registerFileClassForImport(EadventureAttachment.class.getName(), "fileUuid",
+ "fileVersionId", "fileName", "fileType", null, null);
+ //TODO revisar
+ exportContentService.registerFileClassForImport(Eadventure.class.getName(), "fileUuid", "fileVersionId",
+ "fileName", "fileType", null, "initialItem");
+
+ Object toolPOJO = exportContentService.importToolContent(toolContentPath, eadventureToolContentHandler,
+ fromVersion, toVersion);
+ if (!(toolPOJO instanceof Eadventure)) {
+ throw new ImportToolContentException(
+ "Import eadventure tool content failed. Deserialized object is " + toolPOJO);
+ }
+ Eadventure toolContentObj = (Eadventure) toolPOJO;
+
+ // reset it to new toolContentId
+ toolContentObj.setContentId(toolContentId);
+ EadventureUser user = eadventureUserDao.getUserByUserIDAndContentID(new Long(newUserUid.longValue()),
+ toolContentId);
+ if (user == null) {
+ user = new EadventureUser();
+ UserDTO sysUser = ((User) userManagementService.findById(User.class, newUserUid)).getUserDTO();
+ user.setFirstName(sysUser.getFirstName());
+ user.setLastName(sysUser.getLastName());
+ user.setLoginName(sysUser.getLogin());
+ user.setUserId(new Long(newUserUid.longValue()));
+ user.setEadventure(toolContentObj);
+ }
+ toolContentObj.setCreatedBy(user);
+ //TODO revisar!! que no falte nada al objeto de EAD
+ // reset all eadventureItem createBy user
+ /*Set items = toolContentObj.getEadventureItems();
+ for (EadventureItem item : items) {
+ item.setCreateBy(user);
+ }*/
+ //TODO ver si esto es correcto:
+ Set par = toolContentObj.getParams();
+ List listPar = new ArrayList(par);
+ for (Object o:listPar){
+ ((EadventureParam)o).setEadventure_uid(null);
+ this.eadventureParamDao.saveObject(o);
+ }
+ Set con = toolContentObj.getConditions();
+ List listCon = new ArrayList(con);
+ for (Object o:listCon){
+ ((EadventureCondition)o).setEadventure_uid(null);
+ this.eadventureConditionDao.saveObject(o);
+ }
+
+
+
+ eadventureDao.saveObject(toolContentObj);
+
+
+
+ } catch (ImportToolContentException e) {
+ throw new ToolException(e);
+ }
+ }
+
+ /**
+ * Get the definitions for possible output for an activity, based on the toolContentId. These may be definitions
+ * that are always available for the tool (e.g. number of marks for Multiple Choice) or a custom definition created
+ * for a particular activity such as the answer to the third question contains the word Koala and hence the need for
+ * the toolContentId
+ *
+ * @return SortedMap of ToolOutputDefinitions with the key being the name of each definition
+ * @throws EadventureApplicationException
+ */
+
+ @Override
+ public SortedMap getToolOutputDefinitions(Long toolContentId) throws ToolException {
+ Eadventure content = getEadventureByContentId(toolContentId);
+ if (content == null) {
+ try {
+ content = getDefaultContent(toolContentId);
+
+ } catch (EadventureApplicationException e) {
+ throw new ToolException(e);
+ }
+ }
+
+ SortedMap prueba = getEadventureOutputFactory().getToolOutputDefinitions(content);
+
+
+
+ return prueba;
+ }
+
+ public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException {
+ if (toContentId == null) {
+ throw new ToolException("Failed to create the EadventureFiles tool seession");
+ }
+
+ Eadventure eadventure = null;
+ if (fromContentId != null) {
+ eadventure = eadventureDao.getByContentId(fromContentId);
+ }
+ if (eadventure == null) {
+ try {
+ eadventure = getDefaultEadventure();
+ } catch (EadventureApplicationException e) {
+ throw new ToolException(e);
+ }
+ }
+
+ Eadventure toContent = Eadventure.newInstance(eadventure, toContentId, eadventureToolContentHandler);
+ eadventureDao.saveObject(toContent);
+
+ //TODO no hace nada... pero comprobar que no de problema
+ // save eadventure items as well
+ /*Set items = toContent.getEadventureItems();
+ if (items != null) {
+ Iterator iter = items.iterator();
+ while (iter.hasNext()) {
+ EadventureItem item = (EadventureItem) iter.next();
+ // createRootTopic(toContent.getUid(),null,msg);
+ }
+ }*/
+ }
+
+ public void setAsDefineLater(Long toolContentId, boolean value) throws DataMissingException, ToolException {
+ Eadventure eadventure = eadventureDao.getByContentId(toolContentId);
+ if (eadventure == null) {
+ throw new ToolException("No found tool content by given content ID:" + toolContentId);
+ }
+ eadventure.setDefineLater(value);
+ }
+
+ public void setAsRunOffline(Long toolContentId, boolean value) throws DataMissingException, ToolException {
+ Eadventure eadventure = eadventureDao.getByContentId(toolContentId);
+ if (eadventure == null) {
+ throw new ToolException("No found tool content by given content ID:" + toolContentId);
+ }
+ eadventure.setRunOffline(value);
+ }
+
+ public void removeToolContent(Long toolContentId, boolean removeSessionData) throws SessionDataExistsException,
+ ToolException {
+ Eadventure eadventure = eadventureDao.getByContentId(toolContentId);
+ if (removeSessionData) {
+ List list = eadventureSessionDao.getByContentId(toolContentId);
+ Iterator iter = list.iterator();
+ while (iter.hasNext()) {
+ EadventureSession session = (EadventureSession) iter.next();
+ eadventureSessionDao.delete(session);
+ }
+ }
+ eadventureDao.delete(eadventure);
+ }
+
+ public void removeParams(Long toolContentId){
+ List params = getEadventureParamByContentId(toolContentId);
+ if (params!=null){
+ for (EadventureParam param:params){
+ eadventureParamDao.delete(param);
+ }
+ }
+ }
+
+ public void createToolSession(Long toolSessionId, String toolSessionName, Long toolContentId) throws ToolException {
+ EadventureSession session = new EadventureSession();
+ session.setSessionId(toolSessionId);
+ session.setSessionName(toolSessionName);
+ Eadventure eadventure = eadventureDao.getByContentId(toolContentId);
+ session.setEadventure(eadventure);
+ eadventureSessionDao.saveObject(session);
+ }
+
+ public String leaveToolSession(Long toolSessionId, Long learnerId) throws DataMissingException, ToolException {
+ if (toolSessionId == null) {
+ EadventureServiceImpl.log.error("Fail to leave tool Session based on null tool session id.");
+ throw new ToolException("Fail to remove tool Session based on null tool session id.");
+ }
+ if (learnerId == null) {
+ EadventureServiceImpl.log.error("Fail to leave tool Session based on null learner.");
+ throw new ToolException("Fail to remove tool Session based on null learner.");
+ }
+
+ EadventureSession session = eadventureSessionDao.getSessionBySessionId(toolSessionId);
+ if (session != null) {
+ session.setStatus(EadventureConstants.COMPLETED);
+ eadventureSessionDao.saveObject(session);
+ } else {
+ EadventureServiceImpl.log.error("Fail to leave tool Session.Could not find shared eadventure "
+ + "session by given session id: " + toolSessionId);
+ throw new DataMissingException("Fail to leave tool Session."
+ + "Could not find shared eadventure session by given session id: " + toolSessionId);
+ }
+ return learnerService.completeToolSession(toolSessionId, learnerId);
+ }
+
+ public ToolSessionExportOutputData exportToolSession(Long toolSessionId) throws DataMissingException, ToolException {
+ return null;
+ }
+
+ public ToolSessionExportOutputData exportToolSession(List toolSessionIds) throws DataMissingException,
+ ToolException {
+ return null;
+ }
+
+ public void removeToolSession(Long toolSessionId) throws DataMissingException, ToolException {
+ eadventureSessionDao.deleteBySessionId(toolSessionId);
+ }
+
+ /**
+ * Get the tool output for the given tool output names.
+ *
+ * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.util.List, java.lang.Long,
+ * java.lang.Long)
+ */
+ public SortedMap getToolOutput(List names, Long toolSessionId, Long learnerId) {
+ return getEadventureOutputFactory().getToolOutput(names, this, toolSessionId, learnerId);
+ }
+
+ /**
+ * Get the tool output for the given tool output name.
+ *
+ * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.lang.String, java.lang.Long,
+ * java.lang.Long)
+ */
+ public ToolOutput getToolOutput(String name, Long toolSessionId, Long learnerId) {
+ return getEadventureOutputFactory().getToolOutput(name, this, toolSessionId, learnerId);
+ }
+
+ /* ===============Methods implemented from ToolContentImport102Manager =============== */
+
+ /**
+ * Import the data for a 1.0.2 Noticeboard or HTMLNoticeboard
+ */
+ public void import102ToolContent(Long toolContentId, UserDTO user, Hashtable importValues) {
+ Date now = new Date();
+ Eadventure toolContentObj = new Eadventure();
+
+ try {
+ toolContentObj.setTitle((String) importValues.get(ToolContentImport102Manager.CONTENT_TITLE));
+ toolContentObj.setContentId(toolContentId);
+ toolContentObj.setContentInUse(Boolean.FALSE);
+ toolContentObj.setCreated(now);
+ toolContentObj.setDefineLater(Boolean.FALSE);
+ toolContentObj.setInstructions(WebUtil.convertNewlines((String) importValues
+ .get(ToolContentImport102Manager.CONTENT_BODY)));
+ toolContentObj.setOfflineInstructions(null);
+ toolContentObj.setOnlineInstructions(null);
+ toolContentObj.setRunOffline(Boolean.FALSE);
+ toolContentObj.setUpdated(now);
+ toolContentObj.setReflectOnActivity(Boolean.FALSE);
+ toolContentObj.setReflectInstructions(null);
+
+ Boolean bool = WDDXProcessor.convertToBoolean(importValues,
+ ToolContentImport102Manager.CONTENT_URL_RUNTIME_LEARNER_SUBMIT_FILE);
+ bool = WDDXProcessor.convertToBoolean(importValues,
+ ToolContentImport102Manager.CONTENT_URL_RUNTIME_LEARNER_SUBMIT_URL);
+ bool = WDDXProcessor.convertToBoolean(importValues,
+ ToolContentImport102Manager.CONTENT_URL_RUNTIME_LEARNER_SUBMIT_URL);
+ toolContentObj.setLockWhenFinished(Boolean.FALSE);
+
+ // leave as empty, no need to set them to anything.
+ // toolContentObj.setAttachments(attachments);
+
+ /*
+ * unused entries from 1.0.2 [directoryName=] no equivalent in 2.0 [runtimeSubmissionStaffFile=true] no
+ * equivalent in 2.0 [contentShowUser=false] no equivalent in 2.0 [isHTML=false] no equivalent in 2.0
+ * [showbuttons=false] no equivalent in 2.0 [isReusable=false] not used in 1.0.2 (would be lock when
+ * finished)
+ */
+ EadventureUser ruser = new EadventureUser();
+ ruser.setUserId(new Long(user.getUserID().longValue()));
+ ruser.setFirstName(user.getFirstName());
+ ruser.setLastName(user.getLastName());
+ ruser.setLoginName(user.getLogin());
+ createUser(ruser);
+ toolContentObj.setCreatedBy(ruser);
+
+ // Eadventure Items. They are ordered on the screen by create date so they need to be saved in the right
+ // order.
+ // So read them all in first, then go through and assign the dates in the correct order and then save.
+ //TODO nos cargamos la parte de los items.... comprobar que se pase todo bien y no de ning�n problema
+ /* Vector urls = (Vector) importValues.get(ToolContentImport102Manager.CONTENT_URL_URLS);
+ SortedMap items = new TreeMap();
+ if (urls != null) {
+ Iterator iter = urls.iterator();
+ while (iter.hasNext()) {
+ Hashtable urlMap = (Hashtable) iter.next();
+ Integer itemOrder = WDDXProcessor.convertToInteger(urlMap,
+ ToolContentImport102Manager.CONTENT_URL_URL_VIEW_ORDER);
+ EadventureItem item = new EadventureItem();
+ item.setTitle((String) urlMap.get(ToolContentImport102Manager.CONTENT_TITLE));
+ item.setCreateBy(ruser);
+ item.setCreateByAuthor(true);
+ item.setHide(false);
+
+ Vector instructions = (Vector) urlMap
+ .get(ToolContentImport102Manager.CONTENT_URL_URL_INSTRUCTION_ARRAY);
+ if (instructions != null && instructions.size() > 0) {
+ item.setItemInstructions(new HashSet());
+ Iterator insIter = instructions.iterator();
+ while (insIter.hasNext()) {
+ item.getItemInstructions().add(createInstruction((Hashtable) insIter.next()));
+ }
+ }
+
+ String eadventureType = (String) urlMap.get(ToolContentImport102Manager.CONTENT_URL_URL_TYPE);
+ if (ToolContentImport102Manager.URL_RESOURCE_TYPE_URL.equals(eadventureType)) {
+ item.setType(EadventureConstants.RESOURCE_TYPE_URL);
+ item.setUrl((String) urlMap.get(ToolContentImport102Manager.CONTENT_URL_URL_URL));
+ item.setOpenUrlNewWindow(false);
+ } else if (ToolContentImport102Manager.URL_RESOURCE_TYPE_WEBSITE.equals(eadventureType)) {
+ item.setType(EadventureConstants.RESOURCE_TYPE_WEBSITE);
+ } else if (ToolContentImport102Manager.URL_RESOURCE_TYPE_FILE.equals(eadventureType)) {
+ item.setType(EadventureConstants.RESOURCE_TYPE_FILE);
+ } else {
+ throw new ToolException("Invalid eadventure type. Type was " + eadventureType);
+ }
+
+ items.put(itemOrder, item);
+ }
+ }
+
+ Iterator iter = items.values().iterator();
+ Date itemDate = null;
+ while (iter.hasNext()) {
+ if (itemDate != null) {
+ try {
+ Thread.sleep(1000);
+ } catch (Exception e) {
+ }
+ }
+ itemDate = new Date();
+
+ EadventureItem item = (EadventureItem) iter.next();
+ item.setCreateDate(itemDate);
+ toolContentObj.getEadventureItems().add(item);
+ }*/
+
+ } catch (WDDXProcessorConversionException e) {
+ EadventureServiceImpl.log.error("Unable to content for activity " + toolContentObj.getTitle()
+ + "properly due to a WDDXProcessorConversionException.", e);
+ throw new ToolException(
+ "Invalid import data format for activity "
+ + toolContentObj.getTitle()
+ + "- WDDX caused an exception. Some data from the design will have been lost. See log for more details.");
+ }
+
+ eadventureDao.saveObject(toolContentObj);
+
+ }
+
+ // TODO comprobar que no hay problema por quitar esto
+ /*private EadventureItemInstruction createInstruction(Hashtable instructionEntry)
+ throws WDDXProcessorConversionException {
+
+ Integer instructionOrder = WDDXProcessor.convertToInteger(instructionEntry,
+ ToolContentImport102Manager.CONTENT_URL_URL_VIEW_ORDER);
+
+ // the description column in 1.0.2 was longer than 255 chars, so truncate.
+ String instructionText = (String) instructionEntry.get(ToolContentImport102Manager.CONTENT_URL_INSTRUCTION);
+ if (instructionText != null && instructionText.length() > 255) {
+ if (EadventureServiceImpl.log.isDebugEnabled()) {
+ EadventureServiceImpl.log
+ .debug("1.0.2 Import truncating Item Instruction to 255 characters. Original text was\'"
+ + instructionText + "\'");
+ }
+ instructionText = instructionText.substring(0, 255);
+ }
+
+ EadventureItemInstruction instruction = new EadventureItemInstruction();
+ instruction.setDescription(instructionText);
+ instruction.setSequenceId(instructionOrder);
+
+ return instruction;
+ }*/
+
+ /** Set the description, throws away the title value as this is not supported in 2.0 */
+ public void setReflectiveData(Long toolContentId, String title, String description) throws ToolException,
+ DataMissingException {
+
+ Eadventure toolContentObj = getEadventureByContentId(toolContentId);
+ if (toolContentObj == null) {
+ throw new DataMissingException("Unable to set reflective data titled " + title
+ + " on activity toolContentId " + toolContentId + " as the tool content does not exist.");
+ }
+
+ toolContentObj.setReflectOnActivity(Boolean.TRUE);
+ toolContentObj.setReflectInstructions(description);
+ }
+
+ /* =================================================================================== */
+
+ public IExportToolContentService getExportContentService() {
+ return exportContentService;
+ }
+
+ public void setExportContentService(IExportToolContentService exportContentService) {
+ this.exportContentService = exportContentService;
+ }
+
+ public IUserManagementService getUserManagementService() {
+ return userManagementService;
+ }
+
+ public void setUserManagementService(IUserManagementService userManagementService) {
+ this.userManagementService = userManagementService;
+ }
+
+ public ICoreNotebookService getCoreNotebookService() {
+ return coreNotebookService;
+ }
+
+ public void setCoreNotebookService(ICoreNotebookService coreNotebookService) {
+ this.coreNotebookService = coreNotebookService;
+ }
+
+ public IEventNotificationService getEventNotificationService() {
+ return eventNotificationService;
+ }
+
+ public void setEventNotificationService(IEventNotificationService eventNotificationService) {
+ this.eventNotificationService = eventNotificationService;
+ }
+
+ public String getLocalisedMessage(String key, Object[] args) {
+ return messageService.getMessage(key, args);
+ }
+
+ public ILessonService getLessonService() {
+ return lessonService;
+ }
+
+ public void setLessonService(ILessonService lessonService) {
+ this.lessonService = lessonService;
+ }
+
+ /**
+ * Finds out which lesson the given tool content belongs to and returns its monitoring users.
+ *
+ * @param sessionId
+ * tool session ID
+ * @return list of teachers that monitor the lesson which contains the tool with given session ID
+ */
+ public List getMonitorsByToolSessionId(Long sessionId) {
+ return getLessonService().getMonitorsByToolSessionId(sessionId);
+ }
+
+ //TODO Resultado de la actualizaci�n a la brach de release 2.3.5, ver si afecta!!!
+
+ /*public Class[] getSupportedToolOutputDefinitionClasses(int definitionType) {
+ return getEadventureOutputFactory().getSupportedDefinitionClasses(definitionType);
+ }*/
+
+ public EadventureOutputFactory getEadventureOutputFactory() {
+ return eadventureOutputFactory;
+ }
+
+ public void setEadventureOutputFactory(EadventureOutputFactory eadventureOutputFactory) {
+ this.eadventureOutputFactory = eadventureOutputFactory;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean checkCondition(String conditionName, Long toolSessionId, Long userUid) {
+ EadventureUser user = eadventureUserDao.getUserByUserIDAndSessionID(userUid, toolSessionId);
+ Eadventure eadventure = eadventureSessionDao.getSessionBySessionId(toolSessionId).getEadventure();
+ Set conditions = eadventure.getConditions();
+ EadventureCondition condition = null;
+ for (EadventureCondition cond:conditions) {
+ if (cond.getName().equals(conditionName)) {
+ condition = cond;
+ break;
+ }
+ }
+
+ boolean result = true;
+ if (condition != null) {
+ EadventureItemVisitLog visitLog = eadventureItemVisitDao.getEadventureItemLog(eadventure.getUid(), userUid);
+ Set eadV = visitLog.getEadventureVars();
+ List eadventureVars = new ArrayList( eadV);
+ //TODO comprobar si no lo tengo que meter con comparator para que salga en orden
+ Iterator it = condition.getEadListExpression().iterator();
+ String previousOp = null;
+ while(it.hasNext()) {
+ Boolean andExpression= null;
+ boolean iniNewAnd=false;
+ EadventureExpression expr = it.next();
+ String nextOp = expr.getNextOp();
+ if (visitLog != null) {
+ boolean partialResult = checkExpression(expr, eadventureVars);
+ // first expr
+ if (expr.getSequenceId()==0||iniNewAnd)
+ result = partialResult;
+ else if (previousOp==null||previousOp.equals("and"))
+ result &= partialResult;
+ else if (previousOp!=null&&previousOp.equals("or")||!it.hasNext()){
+ if (andExpression==null){
+ andExpression = new Boolean(result);
+ iniNewAnd = true;
+ }else {
+ result = partialResult||andExpression;
+ iniNewAnd=false;
+ andExpression=null;
+ }
+ }
+
+ previousOp = nextOp;
+
+ } else {
+
+ result = false;
+ break;
+ }
+ }
+ } else {
+ //there is no such a condition
+ result = false;
+ }
+
+ return result;
+ }
+
+ private boolean checkExpression(EadventureExpression expr, List eadventureVars){
+ EadventureVars firstVar = getVarByName(expr.getFirstOp().getName(),eadventureVars);
+ EadventureVars secVar = null;
+ String operator = expr.getExpresionOp();
+ String value = expr.getValueIntroduced();
+ if (expr.getVarIntroduced()!=null)
+ secVar = getVarByName(expr.getVarIntroduced().getName(),eadventureVars);
+
+ if (secVar==null)
+ return evalExpr(firstVar.getType(), firstVar.getValue(), value, operator);
+ else
+ return evalExpr(firstVar.getType(), firstVar.getValue(), secVar.getValue(), operator);
+ }
+
+ private boolean evalExpr(String type, String firstValue, String secondValue, String op){
+ if (type.equals("string")){
+ if (op.equals("=="))
+ return firstValue.equals(secondValue);
+ else
+ return !firstValue.equals(secondValue);
+ } else if (type.equals("boolean")){
+ return firstValue.equals(secondValue);
+ }else if (type.equals("integer")){
+ if (op.equals("=="))
+ return Integer.getInteger(firstValue) == Integer.getInteger(secondValue);
+ else if (op.equals("!="))
+ return Integer.getInteger(firstValue) != Integer.getInteger(secondValue);
+ else if (op.equals(">"))
+ return Integer.getInteger(firstValue) > Integer.getInteger(secondValue);
+ else if (op.equals("<"))
+ return Integer.getInteger(firstValue) < Integer.getInteger(secondValue);
+ else if (op.equals(">="))
+ return Integer.getInteger(firstValue) >= Integer.getInteger(secondValue);
+ else if (op.equals("<="))
+ return Integer.getInteger(firstValue) <= Integer.getInteger(secondValue);
+
+
+ }
+
+ return false;
+ }
+
+ private EadventureVars getVarByName(String name, List eadventureVars){
+ for (EadventureVars var: eadventureVars) {
+ if (var.getName().equals(name)) {
+ return var;
+
+ }
+ }
+ return null;
+
+ }
+
+
+
+ //TODO IMPORRRRRRRRRRRRRRRTANTE!!!!!!!!!!!!!!! el par�metro toolContentID que estamos pasando es realmente toolSessionID!!!!
+ @Override
+ public boolean setAppletInput(String name, String value, String userId, String toolContentID) {
+ //TODO restart when
+ EadventureServiceImpl.log.error("EEEEEEEEEEEEEEEEEE " + name);
+ EadventureServiceImpl.log.error("EEEEEEEEEEEEEEEEEE " + value);
+ //EadventureServiceImpl.log.error("USER ID "+ userId);
+ EadventureServiceImpl.log.error("TOOL SESION ID "+ toolContentID);
+ EadventureServiceImpl.log.error("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOEEEEEEEEEEEEEEEE");
+
+
+ //TODO Ahora recuperamos la session para sacar el EAD!!! pero a�adir el toolContentId para que sea mas sencillo!!!
+ //TODO user va a sobrar!! con el userID que ya se nos pasa por par�metro vamos sobraos!!
+ //EadventureUser user = eadventureUserDao.getUserByUserIDAndContentID(Long.parseLong(userId), Long.parseLong(toolContentID));
+ EadventureUser user = eadventureUserDao.getUserByUserIDAndSessionID(Long.parseLong(userId), Long.parseLong(toolContentID));
+ //eadventureUserDao.getUserByUserIDAndSessionID(Long.parseLong(userId), Long.parseLong(toolSessionID));
+ EadventureServiceImpl.log.error("USER ID "+ user.getUserId());
+ EadventureSession eadSession = eadventureSessionDao.getSessionBySessionId( Long.parseLong(toolContentID));
+ //Eadventure ead = eadventureDao.getByContentId(Long.parseLong(toolContentID));
+ EadventureItemVisitLog log = eadventureItemVisitDao.getEadventureItemLog(eadSession.getEadventure().getUid(), user.getUserId());
+ EadventureVars var = eadventureVarsDao.getEadventureVars(log.getUid(), name);
+ if (var==null){
+ var = new EadventureVars();
+ var.setName(name);
+ var.setVisitLog(log);
+ //TODO ver el type
+ //var.setType(type);
+ }
+ var.setValue(value);
+ this.eadventureVarsDao.saveObject(var);
+ boolean changeButton = eadSession.getEadventure().isDefineComplete()&!log.isComplete();
+ if (name.equals("completed")&&value.equals("true")&&changeButton)
+ setItemComplete(eadSession.getEadventure().getUid(), Long.parseLong(userId), eadSession.getSessionId());
+
+ return changeButton;
+ }
+
+ @Override
+ public void setReportInput(String name, String value, String userId, String toolSessionID) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public EadventureItemVisitLog getEadventureItemLog(Long itemUid, Long userId) {
+
+ return eadventureItemVisitDao.getEadventureItemLog(itemUid, userId);
+ }
+
+ @Override
+ public EadventureVars getEadventureVars(Long itemVisitLogID, String name) {
+ return eadventureVarsDao.getEadventureVars(itemVisitLogID, name);
+ }
+
+ public void setEadventureParamDao(EadventureParamDAO eadventureParamDao) {
+ this.eadventureParamDao = eadventureParamDao;
+ }
+
+ public void setEadventureConditionDao(EadventureConditionDAO eadventureConditionDao) {
+ this.eadventureConditionDao = eadventureConditionDao;
+ }
+
+ public void setEadventureExpressionDao(EadventureExpressionDAO eadventureExpressionDao) {
+ this.eadventureExpressionDao = eadventureExpressionDao;
+ }
+
+
+
+
+
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureServiceProxy.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureServiceProxy.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/EadventureServiceProxy.java 2 Nov 2010 22:16:34 -0000 1.1
@@ -0,0 +1,75 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: EadventureServiceProxy.java,v 1.1 2010/11/02 22:16:34 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.service;
+
+import javax.servlet.ServletContext;
+
+import org.lamsfoundation.lams.tool.ToolContentManager;
+import org.lamsfoundation.lams.tool.ToolSessionManager;
+import org.eucm.lams.tool.eadventure.EadventureConstants;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+
+
+
+/**
+ * @author Dapeng.Ni
+ *
+ * This class act as the proxy between web layer and service layer. It is
+ * designed to decouple the presentation logic and business logic completely.
+ * In this way, the presentation tier will no longer be aware of the changes in
+ * service layer. Therefore we can feel free to switch the business logic
+ * implementation.
+ */
+public class EadventureServiceProxy
+{
+ /**
+ * Return the domain service object. It will delegate to the Spring
+ * helper method to retrieve the proper bean from Spring bean factory.
+ * @param servletContext the servletContext for current application
+ * @return Shared eadventure service object.
+ */
+ public static final IEadventureService getEadventureService(ServletContext servletContext)
+ {
+ return (IEadventureService)getEadventureDomainService(servletContext);
+ }
+
+ public static final ToolSessionManager getSessionManager(ServletContext servletContext)
+ {
+ return (ToolSessionManager)getEadventureDomainService(servletContext);
+ }
+
+ public static final ToolContentManager getContentManager(ServletContext servletContext)
+ {
+ return (ToolContentManager)getEadventureDomainService(servletContext);
+ }
+
+ private static Object getEadventureDomainService(ServletContext servletContext)
+ {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
+ return wac.getBean(EadventureConstants.RESOURCE_SERVICE);
+ }
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/IEadventureService.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/IEadventureService.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/IEadventureService.java 2 Nov 2010 22:16:34 -0000 1.1
@@ -0,0 +1,353 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: IEadventureService.java,v 1.1 2010/11/02 22:16:34 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.service;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+
+import org.apache.struts.upload.FormFile;
+import org.lamsfoundation.lams.contentrepository.IVersionedNode;
+import org.lamsfoundation.lams.events.IEventNotificationService;
+import org.lamsfoundation.lams.notebook.model.NotebookEntry;
+import org.eucm.lams.tool.eadventure.dto.ReflectDTO;
+import org.eucm.lams.tool.eadventure.dto.Summary;
+import org.eucm.lams.tool.eadventure.model.Eadventure;
+import org.eucm.lams.tool.eadventure.model.EadventureAttachment;
+import org.eucm.lams.tool.eadventure.model.EadventureCondition;
+import org.eucm.lams.tool.eadventure.model.EadventureExpression;
+import org.eucm.lams.tool.eadventure.model.EadventureItemVisitLog;
+import org.eucm.lams.tool.eadventure.model.EadventureParam;
+import org.eucm.lams.tool.eadventure.model.EadventureSession;
+import org.eucm.lams.tool.eadventure.model.EadventureUser;
+import org.eucm.lams.tool.eadventure.model.EadventureVars;
+import org.lamsfoundation.lams.usermanagement.User;
+
+/**
+ * @author Dapeng.Ni
+ *
+ * Interface that defines the contract that all ShareEadventure service provider must follow.
+ */
+public interface IEadventureService {
+
+
+ public void removeParams(Long toolContentId);
+
+ public List getEadventureParamByContentId(Long contentId);
+
+ public EadventureVars getEadventureVars(Long itemVisitLogID,String name);
+
+ public EadventureItemVisitLog getEadventureItemLog(Long itemUid,Long userId);
+
+ /**
+ * Recibir report del applet
+ */
+ void setReportInput(String name,String value, String userId, String toolSessionID);
+
+
+ /**
+ * Get applet params and set it values in the associated eadventure vars.
+ * @return true if the eadventure is not completed and it was defined as defineCompleted
+ * in order to indicate VarsExchangeServlet to send or not javascript order.
+ */
+ boolean setAppletInput(String name,String value, String userId, String toolSessionID);
+
+ /**
+ * Get file IVersiondNode
by given package id and path.
+ *
+ * @param packageId
+ * @param relPathString
+ * @return
+ * @throws EadventureApplicationException
+ */
+ IVersionedNode getFileNode(Long packageId, String relPathString) throws EadventureApplicationException;
+
+ /**
+ * Get Eadventure
by toolContentID.
+ *
+ * @param contentId
+ * @return
+ */
+ Eadventure getEadventureByContentId(Long contentId);
+
+ /**
+ * Get a cloned copy of tool default tool content (Eadventure) and assign the toolContentId of that copy as the given
+ * contentId
+ *
+ * @param contentId
+ * @return
+ * @throws EadventureApplicationException
+ */
+ Eadventure getDefaultContent(Long contentId) throws EadventureApplicationException;
+
+ /**
+ * Get list of eadventure items by given eadventureUid. These eadventure items must be created by author.
+ *
+ * @param eadventureUid
+ * @return
+ */
+ // List getAuthoredItems(Long eadventureUid);
+
+ /**
+ * Upload instruciton file into repository.
+ *
+ * @param file
+ * @param type
+ * @return
+ * @throws UploadEadventureFileException
+ */
+ EadventureAttachment uploadInstructionFile(FormFile file, String type) throws UploadEadventureFileException;
+
+ /**
+ * Upload eadventure file to repository.
+ *
+ * @param eAdventure
+ * @param file
+ * @throws UploadEadventureFileException
+ */
+ void uploadEadventureFile(Eadventure item, FormFile file) throws UploadEadventureFileException;
+
+ // ********** for user methods *************
+ /**
+ * Create a new user in database.
+ */
+ void createUser(EadventureUser eadventureUser);
+
+ /**
+ * Get user by given userID and toolContentID.
+ *
+ * @param long1
+ * @return
+ */
+ EadventureUser getUserByIDAndContent(Long userID, Long contentId);
+
+ /**
+ * Get user by sessionID and UserID
+ *
+ * @param long1
+ * @param sessionId
+ * @return
+ */
+ EadventureUser getUserByIDAndSession(Long long1, Long sessionId);
+
+ // ********** Repository methods ***********************
+ /**
+ * Delete file from repository.
+ */
+ void deleteFromRepository(Long fileUuid, Long fileVersionId) throws EadventureApplicationException;
+
+ /**
+ * Save or update eadventure into database.
+ *
+ * @param Eadventure
+ */
+ void saveOrUpdateEadventure(Eadventure Eadventure);
+
+ /**
+ * Delete reource attachment(i.e., offline/online instruction file) from database. This method does not delete the
+ * file from repository.
+ *
+ * @param attachmentUid
+ */
+ void deleteEadventureAttachment(Long attachmentUid);
+
+
+ public void saveOrUpdateEadventureConditions(Set eadConditions);
+
+ public void saveOrUpdateEadventureExpressions(Set eadExpressions, Long condUID);
+
+ public void saveOrUpdateEadventureCondition(EadventureCondition eadCondition);
+
+ public void saveOrUpdateEadventureExpression(EadventureExpression eadExpression);
+
+
+ public void deleteEadventureCondition(Long conditionUid);
+
+ public void deleteEadventureExpression(Long expressionUid);
+
+ /**
+ * Delete resoruce item from database.
+ *
+ * @param uid
+ */
+ //void deleteEadventureItem(Long uid);
+
+ /**
+ * Return all reource items within the given toolSessionID.
+ *
+ * @param sessionId
+ * @return
+ */
+ //List getEadventureItemsBySessionId(Long sessionId);
+
+ /**
+ * Get eadventure which is relative with the special toolSession.
+ *
+ * @param sessionId
+ * @return
+ */
+ Eadventure getEadventureBySessionId(Long sessionId);
+
+ /**
+ * Get eadventure toolSession by toolSessionId
+ *
+ * @param sessionId
+ * @return
+ */
+ EadventureSession getEadventureSessionBySessionId(Long sessionId);
+
+
+ /**
+ * Save or update eadventure session.
+ *
+ * @param resSession
+ */
+ void saveOrUpdateEadventureSession(EadventureSession resSession);
+
+ //void retrieveComplete(SortedSet eadventureItemList, EadventureUser user);
+
+ void setItemComplete(Long eadventureItemUid, Long userId, Long sessionId);
+
+ void setItemAccess(Long eadventureItemUid, Long userId, Long sessionId);
+
+ /**
+ * the reqired number minus the count of view of the given user.
+ *
+ * @param userUid
+ * @return
+ */
+ // int checkMiniView(Long toolSessionId, Long userId);
+
+ /**
+ * If success return next activity's url, otherwise return null.
+ *
+ * @param toolSessionId
+ * @param userId
+ * @return
+ */
+ String finishToolSession(Long toolSessionId, Long userId) throws EadventureApplicationException;
+
+ //EadventureItem getEadventureItemByUid(Long itemUid);
+
+ void saveOrUpdateEadventureParams(Set eadParams);
+
+ /**
+ * Return monitoring summary list. The return value is list of eadventure summaries for each groups.
+ *
+ * @param contentId
+ * @return
+ */
+ List getSummary(Long contentId);
+
+ List getUserListBySessionItem(Long sessionId, Long itemUid);
+
+ /**
+ * Set a eadventure item visible or not.
+ *
+ * @param itemUid
+ * @param visible
+ * true, item is visible. False, item is invisible.
+ */
+ void setItemVisible(Long itemUid, boolean visible);
+
+ /**
+ * Get eadventure item Summary
list according to sessionId
+ *
+ * @return
+ */
+ public List exportBySessionId(Long sessionId, Long userId);
+
+ public List exportByContentId(Long contentId);
+
+ /**
+ * Create refection entry into notebook tool.
+ *
+ * @param sessionId
+ * @param notebook_tool
+ * @param tool_signature
+ * @param userId
+ * @param entryText
+ */
+ public Long createNotebookEntry(Long sessionId, Integer notebookToolType, String toolSignature, Integer userId,
+ String entryText);
+
+ /**
+ * Get reflection entry from notebook tool.
+ *
+ * @param sessionId
+ * @param idType
+ * @param signature
+ * @param userID
+ * @return
+ */
+ public NotebookEntry getEntry(Long sessionId, Integer idType, String signature, Integer userID);
+
+ /**
+ * @param notebookEntry
+ */
+ public void updateEntry(NotebookEntry notebookEntry);
+
+ /**
+ * Get Reflect DTO list grouped by sessionID.
+ *
+ * @param contentId
+ * @return
+ */
+ Map> getReflectList(Long contentId, boolean setEntry);
+
+ /**
+ * Get user by UID
+ *
+ * @param uid
+ * @return
+ */
+ EadventureUser getUser(Long uid);
+
+ public IEventNotificationService getEventNotificationService();
+
+ /**
+ * Gets a message from eadventure bundle. Same as
in JSP pages.
+ *
+ * @param key
+ * key of the message
+ * @param args
+ * arguments for the message
+ * @return message content
+ */
+ String getLocalisedMessage(String key, Object[] args);
+
+ /**
+ * Finds out which lesson the given tool content belongs to and returns its monitoring users.
+ *
+ * @param sessionId
+ * tool session ID
+ * @return list of teachers that monitor the lesson which contains the tool with given session ID
+ */
+ public List getMonitorsByToolSessionId(Long sessionId);
+
+ public boolean checkCondition(String conditionName, Long toolSessionId, Long userUid);
+
+ public void removeParam(EadventureParam eadParams);
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/UploadEadventureFileException.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/UploadEadventureFileException.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/service/UploadEadventureFileException.java 2 Nov 2010 22:16:34 -0000 1.1
@@ -0,0 +1,48 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: UploadEadventureFileException.java,v 1.1 2010/11/02 22:16:34 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.service;
+
+public class UploadEadventureFileException extends Exception{
+
+ public UploadEadventureFileException() {
+ super();
+
+ }
+
+ public UploadEadventureFileException(String message, Throwable cause) {
+ super(message, cause);
+
+ }
+
+ public UploadEadventureFileException(String message) {
+ super(message);
+
+ }
+
+ public UploadEadventureFileException(Throwable cause) {
+ super(cause);
+
+ }
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/EadventureConditionComparator.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/EadventureConditionComparator.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/EadventureConditionComparator.java 2 Nov 2010 22:16:26 -0000 1.1
@@ -0,0 +1,42 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureConditionComparator.java,v 1.1 2010/11/02 22:16:26 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.util;
+
+import java.util.Comparator;
+
+import org.eucm.lams.tool.eadventure.dto.ReflectDTO;
+import org.eucm.lams.tool.eadventure.model.EadventureCondition;
+
+public class EadventureConditionComparator implements Comparator {
+
+ public int compare(EadventureCondition o1, EadventureCondition o2) {
+ if(o1 != null && o2 != null){
+ return o1.getSequenceId() - o2.getSequenceId();
+ }else if(o1 != null)
+ return 1;
+ else
+ return -1;
+ }
+}
+
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/EadventureExpressionComparator.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/EadventureExpressionComparator.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/EadventureExpressionComparator.java 2 Nov 2010 22:16:25 -0000 1.1
@@ -0,0 +1,41 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureExpressionComparator.java,v 1.1 2010/11/02 22:16:25 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.util;
+
+import java.util.Comparator;
+import org.eucm.lams.tool.eadventure.model.EadventureExpression;
+
+public class EadventureExpressionComparator implements Comparator {
+
+ public int compare(EadventureExpression o1, EadventureExpression o2) {
+ if(o1 != null && o2 != null){
+ return o1.getSequenceId() - o2.getSequenceId();
+ }else if(o1 != null)
+ return 1;
+ else
+ return -1;
+ }
+
+}
+
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/EadventureToolContentHandler.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/EadventureToolContentHandler.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/EadventureToolContentHandler.java 2 Nov 2010 22:16:25 -0000 1.1
@@ -0,0 +1,68 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: EadventureToolContentHandler.java,v 1.1 2010/11/02 22:16:25 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.util;
+
+import org.lamsfoundation.lams.contentrepository.client.ToolContentHandler;
+
+/**
+ * Simple client for accessing the content repository.
+ *
+ * @author Fiona Malikoff
+ */
+public class EadventureToolContentHandler extends ToolContentHandler {
+
+ private static String repositoryWorkspaceName = "eadventureworkspace";
+ private static String repositoryUser = "eadventure";
+ //sharedeadventure
+ private static char[] repositoryId = {'l','a','m','s','-','e','a','d','v','e','n','t','u','r','e'};
+
+ /**
+ *
+ */
+ public EadventureToolContentHandler() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryWorkspaceName()
+ */
+ public String getRepositoryWorkspaceName() {
+ return repositoryWorkspaceName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryUser()
+ */
+ public String getRepositoryUser() {
+ return repositoryUser;
+ }
+
+ /* (non-Javadoc)
+ * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryId()
+ */
+ public char[] getRepositoryId() {
+ return repositoryId;
+ }
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/EadventureWebUtils.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/EadventureWebUtils.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/EadventureWebUtils.java 2 Nov 2010 22:16:25 -0000 1.1
@@ -0,0 +1,54 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $$Id: EadventureWebUtils.java,v 1.1 2010/11/02 22:16:25 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.util;
+
+import org.eucm.lams.tool.eadventure.EadventureConstants;
+
+/**
+ * Contains helper methods used by the Action Servlets
+ *
+ * @author Anthony Sukkar
+ *
+ */
+public class EadventureWebUtils {
+
+ /**
+ * If there is not url prefix, such as http://, https:// or ftp:// etc, this
+ * method will add default url protocol.
+ *
+ * @param url
+ * @return
+ */
+ public static String protocol(String url) {
+ if (url == null)
+ return "";
+
+ if (!url.matches("^" + EadventureConstants.ALLOW_PROTOCOL_REFIX + ".*"))
+ url = EadventureConstants.DEFUALT_PROTOCOL_REFIX + url;
+
+ return url;
+ }
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/IOdatamodel.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/IOdatamodel.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/IOdatamodel.java 2 Nov 2010 22:16:25 -0000 1.1
@@ -0,0 +1,46 @@
+package org.eucm.lams.tool.eadventure.util;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+public class IOdatamodel {
+
+ private HashMap input;
+
+ private HashMap output;
+
+ public IOdatamodel(){
+ input = new HashMap();
+
+ output = new HashMap();
+ }
+
+ public void addInput(String name, String type){
+ input.put(name, type);
+ }
+
+ public void addOutput(String name, String type){
+ output.put(name, type);
+ }
+
+
+ public HashMap getInput() {
+ return input;
+ }
+
+ public void setInput(HashMap input) {
+ this.input = input;
+ }
+
+ public HashMap getOutput() {
+ return output;
+ }
+
+ public void setOutput(HashMap output) {
+ this.output = output;
+ }
+
+
+
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/InputOutputReader.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/InputOutputReader.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/InputOutputReader.java 2 Nov 2010 22:16:25 -0000 1.1
@@ -0,0 +1,47 @@
+package org.eucm.lams.tool.eadventure.util;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.HashSet;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.SAXException;
+
+public class InputOutputReader {
+
+ //IOdatamodel ioParameterList;
+
+ public static IOdatamodel parseParameters(String url){
+ SaxIOReader io=null;
+ try{
+
+ io = new SaxIOReader();
+ SAXParserFactory spf=SAXParserFactory.newInstance();
+ SAXParser sp = spf.newSAXParser();
+ sp.parse(url, io);
+
+
+ }catch(ParserConfigurationException e){
+ System.err.println("Parameters parse erros");
+ }catch(SAXException e2){
+ System.err.println("sax error: " + e2.getStackTrace());
+ } catch (IOException e3) {
+ // TODO Auto-generated catch block
+ System.err.println("io error: " + e3.getMessage() );
+ }
+
+ return io.getIOdatamodel();
+
+ }
+
+ public static HashMap getOutputParameterList(String url){
+ return parseParameters(url).getOutput();
+ }
+
+
+
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/ReflectDTOComparator.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/ReflectDTOComparator.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/ReflectDTOComparator.java 2 Nov 2010 22:16:25 -0000 1.1
@@ -0,0 +1,38 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+package org.eucm.lams.tool.eadventure.util;
+
+import java.util.Comparator;
+
+import org.eucm.lams.tool.eadventure.dto.ReflectDTO;
+
+public class ReflectDTOComparator implements Comparator {
+ public int compare(ReflectDTO o1, ReflectDTO o2) {
+ if (o1 != null && o2 != null) {
+ return o1.getFullName().compareTo(o2.getFullName());
+ } else if (o1 != null)
+ return 1;
+ else
+ return -1;
+ }
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/SaxIOReader.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/SaxIOReader.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/util/SaxIOReader.java 2 Nov 2010 22:16:25 -0000 1.1
@@ -0,0 +1,67 @@
+package org.eucm.lams.tool.eadventure.util;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class SaxIOReader extends DefaultHandler {
+ String content="";
+ private IOdatamodel ioParameterList= new IOdatamodel();
+
+ /*
+ * Esta funcion el llamada cuando se produce el evento de ver una nueva etiqueta
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) {
+ if ("io-parameter-list".equals(qName)) {
+ ioParameterList = new IOdatamodel();
+ }
+ if ("i-parameter".equals(qName)) {
+ String name=null;
+ String type=null;
+ for( int i = 0; i < attributes.getLength( ); i++ ) {
+ if( attributes.getQName( i ).equals( "name" ) )
+ name = attributes.getValue( i );
+ if( attributes.getQName( i ).equals( "type" ) )
+ type = attributes.getValue( i );
+
+ }
+ ioParameterList.addInput(name, type);
+
+ }
+
+ if ("o-parameter".equals(qName)) {
+ String name=null;
+ String type=null;
+ for( int i = 0; i < attributes.getLength( ); i++ ) {
+ if( attributes.getQName( i ).equals( "name" ) )
+ name = attributes.getValue( i );
+ if( attributes.getQName( i ).equals( "type" ) )
+ type = attributes.getValue( i );
+
+ }
+ ioParameterList.addOutput(name, type);
+
+ }
+
+ }
+ /*
+ * Esta funcion es llamada cuando ve el contenido de una etiqueta
+ */
+ public void characters(char buf[], int offset, int len)
+ throws SAXException
+ {
+ content = new String(buf, offset, len);
+
+ }
+ /*
+ * y esta al llegar al final
+ */
+ public void endElement(String uri, String localName, String qName) {
+
+
+ }
+ public IOdatamodel getIOdatamodel(){
+ return ioParameterList;
+ }
+ }
+
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/AuthoringAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/AuthoringAction.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/AuthoringAction.java 2 Nov 2010 22:16:35 -0000 1.1
@@ -0,0 +1,1368 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: AuthoringAction.java,v 1.1 2010/11/02 22:16:35 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.web.action;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.math.NumberUtils;
+import org.apache.log4j.Logger;
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionErrors;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+import org.apache.struts.upload.FormFile;
+import org.lamsfoundation.lams.authoring.web.AuthoringConstants;
+import org.lamsfoundation.lams.contentrepository.NodeKey;
+import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler;
+import org.lamsfoundation.lams.tool.ToolAccessMode;
+import org.eucm.lams.tool.eadventure.EadventureConstants;
+import org.eucm.lams.tool.eadventure.ims.IContentPackageConverter;
+import org.eucm.lams.tool.eadventure.ims.IMSManifestException;
+import org.eucm.lams.tool.eadventure.ims.ImscpApplicationException;
+import org.eucm.lams.tool.eadventure.ims.SimpleContentPackageConverter;
+import org.eucm.lams.tool.eadventure.model.Eadventure;
+import org.eucm.lams.tool.eadventure.model.EadventureAttachment;
+import org.eucm.lams.tool.eadventure.model.EadventureCondition;
+import org.eucm.lams.tool.eadventure.model.EadventureExpression;
+import org.eucm.lams.tool.eadventure.model.EadventureParam;
+import org.eucm.lams.tool.eadventure.model.EadventureUser;
+import org.eucm.lams.tool.eadventure.service.EadventureServiceImpl;
+import org.eucm.lams.tool.eadventure.service.IEadventureService;
+import org.eucm.lams.tool.eadventure.service.EadventureApplicationException;
+import org.eucm.lams.tool.eadventure.service.UploadEadventureFileException;
+import org.eucm.lams.tool.eadventure.util.EadventureConditionComparator;
+import org.eucm.lams.tool.eadventure.util.InputOutputReader;
+import org.eucm.lams.tool.eadventure.web.form.EadventureForm;
+import org.eucm.lams.tool.eadventure.web.form.EadventureGameForm;
+import org.eucm.lams.tool.eadventure.web.form.EadventurePedagogicalPlannerForm;
+import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
+import org.lamsfoundation.lams.util.FileValidatorUtil;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.util.zipfile.ZipFileUtil;
+import org.lamsfoundation.lams.util.zipfile.ZipFileUtilException;
+import org.lamsfoundation.lams.web.session.SessionManager;
+import org.lamsfoundation.lams.web.util.AttributeNames;
+import org.lamsfoundation.lams.web.util.SessionMap;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+/**
+ * @author Steve.Ni
+ * @version $Revision: 1.1 $
+ */
+public class AuthoringAction extends Action {
+ private static final int INIT_INSTRUCTION_COUNT = 2;
+ private static final String INSTRUCTION_ITEM_DESC_PREFIX = "instructionItemDesc";
+ private static final String INSTRUCTION_ITEM_COUNT = "instructionCount";
+ private static final String ITEM_TYPE = "itemType";
+
+ private static Logger log = Logger.getLogger(AuthoringAction.class);
+
+ @Override
+ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+ String param = mapping.getParameter();
+ // -----------------------Eadventure Author function
+ // ---------------------------
+ if (param.equals("start")) {
+ ToolAccessMode mode = getAccessMode(request);
+ // teacher mode "check for new" button enter.
+ if (mode != null) {
+ request.setAttribute(AttributeNames.ATTR_MODE, mode.toString());
+ } else {
+ request.setAttribute(AttributeNames.ATTR_MODE, ToolAccessMode.AUTHOR.toString());
+ }
+ return start(mapping, form, request, response);
+ }
+ if (param.equals("definelater")) {
+ // update define later flag to true
+ Long contentId = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID));
+ IEadventureService service = getEadventureService();
+ Eadventure eadventure = service.getEadventureByContentId(contentId);
+
+ eadventure.setDefineLater(true);
+ service.saveOrUpdateEadventure(eadventure);
+
+ request.setAttribute(AttributeNames.ATTR_MODE, ToolAccessMode.TEACHER.toString());
+ return start(mapping, form, request, response);
+ }
+ if (param.equals("initPage")) {
+ return initPage(mapping, form, request, response);
+ }
+
+ if (param.equals("updateContent")) {
+ return updateContent(mapping, form, request, response);
+ }
+ if (param.equals("uploadOnlineFile")) {
+ return uploadOnline(mapping, form, request, response);
+ }
+ if (param.equals("uploadOfflineFile")) {
+ return uploadOffline(mapping, form, request, response);
+ }
+ if (param.equals("deleteOnlineFile")) {
+ return deleteOnlineFile(mapping, form, request, response);
+ }
+ if (param.equals("deleteOfflineFile")) {
+ return deleteOfflineFile(mapping, form, request, response);
+ }
+ // ----------------------- Add eadventure item function
+ // ---------------------------
+/* if (param.equals("newItemInit")) {
+ return newItemlInit(mapping, form, request, response);
+ }*/
+ if (param.equals("editGameInit")) {
+ return editGameInit(mapping, form, request, response);
+ }
+ if (param.equals("saveOrUpdateGame")) {
+ return saveOrUpdateGame(mapping, form, request, response);
+ }
+ if (param.equals("removeItem")) {
+ return removeItem(mapping, form, request, response);
+ }
+ // -----------------------Eadventure Item Instruction function
+ // ---------------------------
+ if (param.equals("newInstruction")) {
+ return newInstruction(mapping, form, request, response);
+ }
+ if (param.equals("removeInstruction")) {
+ return removeInstruction(mapping, form, request, response);
+ }
+ if (param.equals("removeGameAttachment")) {
+ return removeGameAttachment(mapping, form, request, response);
+ }
+ if (param.equals("initPedagogicalPlannerForm")) {
+ return initPedagogicalPlannerForm(mapping, form, request, response);
+ }
+ if (param.equals("createPedagogicalPlannerItem")) {
+ return createPedagogicalPlannerItem(mapping, form, request, response);
+ }
+ if (param.equals("saveOrUpdatePedagogicalPlannerForm")) {
+ return saveOrUpdatePedagogicalPlannerForm(mapping, form, request, response);
+ }
+ if (param.equals("switchEadventureItemPosition")) {
+ // return switchEadventureItemPosition(mapping, form, request, response);
+ }
+
+ return mapping.findForward(EadventureConstants.ERROR);
+ }
+
+ /**
+ * Read eadventure data from database and put them into HttpSession. It will
+ * redirect to init.do directly after this method run successfully.
+ *
+ * This method will avoid read database again and lost un-saved resouce item
+ * lost when user "refresh page",
+ *
+ * @throws ServletException
+ *
+ */
+ private ActionForward start(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException {
+
+ // save toolContentID into HTTPSession
+ Long contentId = new Long(WebUtil.readLongParam(request, EadventureConstants.PARAM_TOOL_CONTENT_ID));
+
+ // get back the eadventure and item list and display them on page
+ IEadventureService service = getEadventureService();
+
+ Eadventure eadventure = null;
+ EadventureForm eadventureForm = (EadventureForm) form;
+
+ // Get contentFolderID and save to form.
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ eadventureForm.setContentFolderID(contentFolderID);
+
+ // initial Session Map
+ SessionMap sessionMap = new SessionMap();
+ request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
+ eadventureForm.setSessionMapID(sessionMap.getSessionID());
+
+ try {
+ eadventure = service.getEadventureByContentId(contentId);
+ // if eadventure does not exist, try to use default content instead.
+ //TODO fijar el default content!!!!
+ if (eadventure == null) {
+ eadventure = service.getDefaultContent(contentId);
+ }
+
+ eadventureForm.setEadventure(eadventure);
+ eadventureForm.setHasFile(eadventure.getFileName()!=null);
+ List attachmentList = getAttachmentList(sessionMap);
+ attachmentList.clear();
+ attachmentList.addAll(eadventure.getAttachments());
+ } catch (Exception e) {
+ AuthoringAction.log.error(e);
+ throw new ServletException(e);
+ }
+
+ // init it to avoid null exception in following handling
+
+ EadventureUser eadventureUser = null;
+ // handle system default question: createBy is null, now set it to
+ // current user
+ if (eadventure.getCreatedBy()== null) {
+ if (eadventureUser == null) {
+ // get back login user DTO
+ HttpSession ss = SessionManager.getSession();
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ eadventureUser = new EadventureUser(user, eadventure);
+ }
+ eadventure.setCreatedBy(eadventureUser);
+ }
+
+ // initialize conditions list (getEadventureConditionList puts a new conditions list in sessionMap
+ // if there are not list inside)
+ SortedSet conditionList = getEadventureConditionList(sessionMap);
+ conditionList.clear();
+ conditionList.addAll(eadventure.getConditions());
+ // initialize params list
+ List paramsList = new ArrayList(eadventure.getParams());
+ sessionMap.put(EadventureConstants.ATTR_PARAMS_LIST, paramsList);
+ //initialize deletedParamList
+ List delParamsList = new ArrayList();
+ sessionMap.put(EadventureConstants.ATTR_DELETED_PARAMS_LIST, delParamsList);
+
+
+
+
+ //TODO esta info puede ser redundante, ya que pasamos tb el form en la session
+ if (eadventureForm.isHasFile()){
+ sessionMap.put(EadventureConstants.ATTR_HAS_FILE, "true");
+ sessionMap.put(EadventureConstants.ATTR_OPEN_SAVED_GAME, "true");
+ }else {
+ sessionMap.put(EadventureConstants.ATTR_OPEN_SAVED_GAME, "false");
+ sessionMap.put(EadventureConstants.ATTR_HAS_FILE, "false");
+ }
+
+ sessionMap.put(EadventureConstants.ATTR_CHANGE_FILE, "false");
+ sessionMap.put(EadventureConstants.ATTR_RESOURCE_FORM, eadventureForm);
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ /**
+ * Display same entire authoring page content from HttpSession variable.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws ServletException
+ */
+ private ActionForward initPage(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException {
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ EadventureForm existForm = (EadventureForm) sessionMap.get(EadventureConstants.ATTR_RESOURCE_FORM);
+
+ EadventureForm eadventureForm = (EadventureForm) form;
+ try {
+ PropertyUtils.copyProperties(eadventureForm, existForm);
+ } catch (Exception e) {
+ throw new ServletException(e);
+ }
+ ToolAccessMode mode = getAccessMode(request);
+ if (mode.isAuthor()) {
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ } else {
+ return mapping.findForward(EadventureConstants.DEFINE_LATER);
+ }
+ }
+
+ /**
+ * Display edit page for eadventure game file.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward editGameInit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+
+ // get back sessionMAP
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+
+ //TODO MODIFICAR PARA que sean una llamada javascript o algo asi
+ //((EadventureGameForm) form).setSessionMapID(sessionMapID);
+ //((EadventureGameForm) form).has
+ //EadventureForm eadForm = ((EadventureForm)sessionMap.get(EadventureConstants.ATTR_RESOURCE_FORM));
+ EadventureGameForm eadGameForm = ((EadventureGameForm) form);
+ eadGameForm.setSessionMapID(sessionMapID);
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+
+ /**
+ * This method will get necessary information from eadventure game
+ * save or update into HttpSession
via. Notice,
+ * this save is not persist them into database, just save
+ * HttpSession
temporarily. Only they will be persist when the
+ * entire authoring page is being persisted.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws ServletException
+ */
+ private ActionForward saveOrUpdateGame(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+
+
+ EadventureGameForm gameForm = (EadventureGameForm) form;
+ // get back sessionMAP
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(gameForm.getSessionMapID());
+
+ Eadventure eadventure = ((EadventureForm)sessionMap.get(EadventureConstants.ATTR_RESOURCE_FORM)).getEadventure();
+
+ ActionErrors errors = new ActionErrors();
+ FormFile file = ((EadventureGameForm)form).getFile();
+ if (file.getFileName()==null||file.getFileName().equals(""))
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
+ EadventureConstants.ERROR_NOT_EAD_ADD));
+
+ if (!errors.isEmpty()) {
+ this.addErrors(request, errors);
+ //request.setAttribute(EadventureConstants.ATTR_INSTRUCTION_LIST, instructionList);
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, gameForm.getSessionMapID());
+ return mapping.findForward("addgame");
+ }
+
+ // if the conditions list is not empty, add conditions to deleteConditionsList to delete form the data base
+ // when the eadventure object will be persistent
+
+ //TODO comprobar, lo hacemos en update game tb.....
+ /*Set conditions = eadventure.getConditions();
+ if (conditions.size()!=0){
+ List delEadventureConditionList = getDeletedEadventureConditionList(sessionMap);
+ delEadventureConditionList.addAll(conditions);
+ sessionMap.put(EadventureConstants.ATTR_DELETED_CONDITION_LIST, delEadventureConditionList);
+ // add the related expressions to their delete list
+ List delEadventureExpressionList = this.getDeletedEadventureExpressionList(sessionMap);
+ for (EadventureCondition condition: conditions){
+ Set expressions = condition.getEadListExpression();
+ delEadventureExpressionList.addAll(expressions);
+ }
+ //reset conditions
+ eadventure.setConditions(new HashSet());
+ }*/
+ try {
+
+ IEadventureService service = getEadventureService();
+ service.uploadEadventureFile( eadventure, gameForm.getFile());
+
+ } catch (Exception e) {
+ // any upload exception will display as normal error message rather
+ // then throw exception directly
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_MSG_UPLOAD_FAILED, e.getMessage()));
+ if (!errors.isEmpty()) {
+ this.addErrors(request, errors);
+ return mapping.findForward("addgame");
+ }
+ }
+ sessionMap.put(EadventureConstants.ATTR_HAS_FILE, "true");
+ List paramList = this.getEdventureParamList(sessionMap);
+ paramList.clear();
+ paramList.addAll(eadventure.getParams());
+ sessionMap.put(EadventureConstants.ATTR_PARAMS_LIST, paramList);
+ sessionMap.put(EadventureConstants.ATTR_CHANGE_FILE, "true");
+ ((EadventureForm)sessionMap.get(EadventureConstants.ATTR_RESOURCE_FORM)).setHasFile(true);
+ // set session map ID so that itemlist.jsp can get sessionMAP
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, gameForm.getSessionMapID());
+ request.setAttribute(EadventureConstants.ATTR_GAME_DELETE, "false");
+ // return null to close this window
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ /**
+ * Remove eadventure game. It is a ajax call and just temporarily remove from page, all
+ * permenant change will happen only when user sumbit this eadventure
+ * again.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward removeGameAttachment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ EadventureForm existForm = (EadventureForm) sessionMap.get(EadventureConstants.ATTR_RESOURCE_FORM);
+ // Add to delete list all the conditions and game params
+ List delCondList = getDeletedEadventureConditionList(sessionMap);
+ delCondList.addAll(existForm.getEadventure().getConditions());
+
+
+ //TODO comprobar que etsa bien: solo hay que meter en deleteExpresion cuando borramos la expression, no la cond (xk como
+ // estan definidas las tablas)
+ //Set conditions = existForm.getEadventure().getConditions();
+ //List condList = new ArrayList(conditions);
+ //List delExprlList = getDeletedEadventureExpressionList(sessionMap);
+ /*for (EadventureCondition eadc: condList ){
+ delCondList.add(eadc);
+ delExprlList.addAll(eadc.getEadListExpression());
+ }*/
+
+
+ // the same with the params
+ List delParamsList = getDeletedEadventureParamsList(sessionMap);
+ delParamsList.addAll(existForm.getEadventure().getParams());
+
+
+ sessionMap.put(EadventureConstants.ATTR_CONDITION_LIST, null);
+ sessionMap.put(EadventureConstants.ATTR_EXPRESSION_LIST, null);
+ sessionMap.put(EadventureConstants.ATTR_PARAMS_LIST, null);
+
+ existForm.resetFileInfo();
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, sessionMapID);
+ sessionMap.put(EadventureConstants.ATTR_HAS_FILE, "false");
+ // TODO esta no funciona, se ha arreglado de otra manera en la view, comprobar
+ request.setAttribute(EadventureConstants.ATTR_GAME_DELETE, 1 );
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ /**
+ * Remove eadventure item from HttpSession list and update page display. As
+ * authoring rule, all persist only happen when user submit whole page. So
+ * this remove is just impact HttpSession values.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward removeItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+
+ // get back sessionMAP
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+
+ //int itemIdx = NumberUtils.stringToInt(request.getParameter(EadventureConstants.PARAM_ITEM_INDEX), -1);
+ /*if (itemIdx != -1) {
+ SortedSet eadventureList = getEadventureItemList(sessionMap);
+ List rList = new ArrayList(eadventureList);
+ EadventureItem item = rList.remove(itemIdx);
+ eadventureList.clear();
+ eadventureList.addAll(rList);
+ // add to delList
+ List delList = getDeletedEadventureItemList(sessionMap);
+ delList.add(item);
+ }*/
+
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, sessionMapID);
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+
+
+
+
+ /**
+ * Ajax call, will add one more input line for new eadventure item
+ * instruction.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward newInstruction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+ int numberOfInstructions = getNumberOfInstructionsInRequest(request);
+ List instructionList = new ArrayList(++numberOfInstructions);
+ for (int idx = 0; idx < numberOfInstructions; idx++) {
+ String item = request.getParameter(AuthoringAction.INSTRUCTION_ITEM_DESC_PREFIX + idx);
+ if (item == null) {
+ instructionList.add("");
+ } else {
+ instructionList.add(item);
+ }
+ }
+ request.setAttribute(EadventureConstants.ATTR_INSTRUCTION_LIST, instructionList);
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ /**
+ * Ajax call, remove the given line of instruction of eadventure item.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward removeInstruction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+ int numberOfInstructions = getNumberOfInstructionsInRequest(request);
+ int removeIdx = NumberUtils.stringToInt(request.getParameter("removeIdx"), -1);
+ List instructionList = new ArrayList(numberOfInstructions - 1);
+ for (int idx = 0; idx < numberOfInstructions; idx++) {
+ String item = request.getParameter(AuthoringAction.INSTRUCTION_ITEM_DESC_PREFIX + idx);
+ if (idx == removeIdx) {
+ continue;
+ }
+ if (item == null) {
+ instructionList.add("");
+ } else {
+ instructionList.add(item);
+ }
+ }
+ request.setAttribute(EadventureConstants.ATTR_INSTRUCTION_LIST, instructionList);
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+
+
+
+
+ /**
+ * This method will persist all inforamtion in this authoring page.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws ServletException
+ */
+ private ActionForward updateContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
+ EadventureForm eadventureForm = (EadventureForm) form;
+
+ // get back sessionMAP
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(eadventureForm.getSessionMapID());
+
+ ToolAccessMode mode = getAccessMode(request);
+
+ //TODO mirar si merece la pena llevar el form por sessionMap?�?�?
+ //Eadventure eadventure = eadventureForm.getEadventure();
+ Eadventure eadventure = ((EadventureForm)sessionMap.get(EadventureConstants.ATTR_RESOURCE_FORM)).getEadventure();
+
+
+ ActionMessages errors = validate(eadventureForm, mapping, request);
+ String file = eadventure.getFileName();
+ if (file==null||file.equals(""))
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
+ EadventureConstants.ERROR_NOT_EAD_ADD));
+ if (!errors.isEmpty()) {
+ saveErrors(request, errors);
+ if (mode.isAuthor()) {
+ return mapping.findForward("author");
+ } else {
+ return mapping.findForward("monitor");
+ }
+ }
+
+
+ IEadventureService service = getEadventureService();
+
+ // **********************************Get Eadventure
+ // PO*********************
+ Eadventure eadventurePO = service.getEadventureByContentId(eadventureForm.getEadventure().getContentId());
+ if (eadventurePO == null) {
+ // new Eadventure, create it.
+ eadventurePO = eadventure;
+ eadventurePO.setCreated(new Timestamp(new Date().getTime()));
+ eadventurePO.setUpdated(new Timestamp(new Date().getTime()));
+ } else {
+ //TODO revisar el deine later!!
+ if (mode.isAuthor()) {
+ Long uid = eadventurePO.getUid();
+ //Set params = eadventurePO.getParams();
+ //Set conditions = eadventurePO.getConditions();
+ Date created = eadventurePO.getCreated();
+ PropertyUtils.copyProperties(eadventurePO, eadventure);
+ // get back UID
+ eadventurePO.setUid(uid);
+ eadventurePO.setCreated(created);
+ } else { // if it is Teacher, then just update basic tab content
+ // (definelater)
+ eadventurePO.setInstructions(eadventure.getInstructions());
+ eadventurePO.setTitle(eadventure.getTitle());
+ // change define later status
+ eadventurePO.setDefineLater(false);
+ }
+ eadventurePO.setUpdated(new Timestamp(new Date().getTime()));
+ }
+ // *******************************Handle user*******************
+ // try to get form system session
+ HttpSession ss = SessionManager.getSession();
+ // get back login user DTO
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ EadventureUser eadventureUser = service.getUserByIDAndContent(new Long(user.getUserID().intValue()), eadventureForm.getEadventure().getContentId());
+ if (eadventureUser == null) {
+ eadventureUser = new EadventureUser(user, eadventurePO);
+ }
+ eadventurePO.setCreatedBy(eadventureUser);
+ // **********************************Handle Authoring Instruction
+ // Attachement *********************
+ // merge attachment info
+ // so far, attPOSet will be empty if content is existed. because
+ // PropertyUtils.copyProperties() is executed
+ // For eAdventure tool only store as attachements the online-offline instructions files
+ Set attPOSet = eadventurePO.getAttachments();
+ if (attPOSet == null) {
+ attPOSet = new HashSet();
+ }
+ List attachmentList = getAttachmentList(sessionMap);
+ List deleteAttachmentList = getDeletedAttachmentList(sessionMap);
+
+ // current attachemnt in authoring instruction tab.
+ Iterator iter = attachmentList.iterator();
+ while (iter.hasNext()) {
+ EadventureAttachment newAtt = (EadventureAttachment) iter.next();
+ attPOSet.add(newAtt);
+ }
+ attachmentList.clear();
+
+ // deleted attachment. 2 possible types: one is persist another is
+ // non-persist before.
+ iter = deleteAttachmentList.iterator();
+ while (iter.hasNext()) {
+ EadventureAttachment delAtt = (EadventureAttachment) iter.next();
+ iter.remove();
+ // it is an existed att, then delete it from current attachmentPO
+ if (delAtt.getUid() != null) {
+ Iterator attIter = attPOSet.iterator();
+ while (attIter.hasNext()) {
+ EadventureAttachment att = (EadventureAttachment) attIter.next();
+ if (delAtt.getUid().equals(att.getUid())) {
+ attIter.remove();
+ break;
+ }
+ }
+ service.deleteEadventureAttachment(delAtt.getUid());
+ }// end remove from persist value
+ }
+
+ // copy back
+ eadventurePO.setAttachments(attPOSet);
+
+ service.saveOrUpdateEadventureParams(eadventurePO.getParams());
+
+ // Handle taskList conditions. Also delete conditions that don't contain any taskLIstItems.
+ SortedSet conditionList = getEadventureConditionList(sessionMap);
+ List delEadventureConditionList = getDeletedEadventureConditionList(sessionMap);
+ //iter = conditionList.iterator();
+ if (conditionList.size()>0)
+ service.saveOrUpdateEadventureConditions(conditionList);
+ /*while (iter.hasNext()) {
+ EadventureCondition condition = (EadventureCondition) iter.next();
+ Set eadExprList = condition.getEadListExpression();
+ if (condition.getUid()==null){
+ condition.setEadListExpression(null);
+ service.saveOrUpdateEadventureCondition(condition);
+ Iterator it2 = eadExprList.iterator();
+ while (it2.hasNext()){
+ EadventureExpression eadExp = (EadventureExpression)it2.next();
+ // eadExp.setCondition_uid(condition.getUid());
+ service.saveOrUpdateEadventureExpression(eadExp);
+ }
+ }else {
+ Iterator it2 = eadExprList.iterator();
+ while (it2.hasNext()){
+ EadventureExpression eadExp = (EadventureExpression)it2.next();
+ //eadExp.setCondition_uid(condition.getUid());
+ service.saveOrUpdateEadventureExpression(eadExp);
+ }
+ service.saveOrUpdateEadventureCondition(condition);
+ }
+
+ }*/
+ eadventurePO.setConditions(conditionList);
+ // this method also saves the eAdventure expressions associated to each condition in the list
+ //TODO ver si merece la pena revisar si ha habido algun cambio en cada una de las condiciones, y en caso afirmativo guardar
+
+
+
+
+ // delete TaEadventureConditionfrom database.
+ iter = delEadventureConditionList.iterator();
+ while (iter.hasNext()) {
+ EadventureCondition condition = (EadventureCondition) iter.next();
+ iter.remove();
+
+ if (condition.getUid() != null) {
+ service.deleteEadventureCondition(condition.getUid());
+ }
+ }
+
+ //SortedSet expressionList = getEadventureConditionList(sessionMap);
+ //SortedSet expressionListWithoutEmptyElements = new TreeSet(conditionList);
+ List delEadventureExpressionList = getDeletedEadventureExpressionList(sessionMap);
+
+
+ // delete TaEadventureConditionfrom database.
+ iter = delEadventureExpressionList.iterator();
+ while (iter.hasNext()) {
+ EadventureExpression expression = (EadventureExpression) iter.next();
+ if (expression.getUid() != null) {
+ service.deleteEadventureExpression(expression.getUid());
+ }
+ iter.remove();
+ }
+
+
+
+ // finally persist eadventurePO again
+ //eadventurePO.setParams(eadventurePO.getParams());
+ //if (eadventureForm.getFile()==null)
+ String changeFile = (String) sessionMap.get(EadventureConstants.ATTR_CHANGE_FILE);
+ String openSavedGame = (String) sessionMap.get(EadventureConstants.ATTR_OPEN_SAVED_GAME);
+ if (changeFile.equals("true")&&openSavedGame.equals("true")){
+ //remove the old params
+
+ //service.removeParams(getDeletedEadventureConditionList(sessionMap));
+ List delParamsList = getDeletedEadventureParamsList(sessionMap);
+ Iterator it = delParamsList.iterator();
+ while (it.hasNext()) {
+ EadventureParam eadp = (EadventureParam)it.next();
+ service.removeParam(eadp);
+ }
+ //service.saveOrUpdateEadventureParams(eadventurePO.getParams());
+ //service.uploadEadventureFile(eadventurePO, eadventureForm.getFile());
+ //TODO borrar condiciones y expressiones
+
+ }
+ //TODO ver si hay que borrar params
+ //if (openSavedGame.equals("false"))
+ // service.saveOrUpdateEadventureParams(eadventurePO.getParams());
+
+
+ service.saveOrUpdateEadventure(eadventurePO);
+
+ //TODO por que???
+ // initialize attachmentList again
+ attachmentList = getAttachmentList(sessionMap);
+ attachmentList.addAll(eadventure.getAttachments());
+ eadventureForm.setEadventure(eadventurePO);
+
+ request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, Boolean.TRUE);
+ if (mode.isAuthor()) {
+ return mapping.findForward("author");
+ } else {
+ return mapping.findForward("monitor");
+ }
+ }
+
+ /**
+ * Handle upload online instruction files request.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws UploadEadventureFileException
+ */
+ public ActionForward uploadOnline(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
+ throws UploadEadventureFileException {
+ return uploadFile(mapping, form, IToolContentHandler.TYPE_ONLINE, request);
+ }
+
+ /**
+ * Handle upload offline instruction files request.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws UploadEadventureFileException
+ */
+ public ActionForward uploadOffline(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
+ throws UploadEadventureFileException {
+ return uploadFile(mapping, form, IToolContentHandler.TYPE_OFFLINE, request);
+ }
+
+ /**
+ * Common method to upload online or offline instruction files request.
+ *
+ * @param mapping
+ * @param form
+ * @param type
+ * @param request
+ * @return
+ * @throws UploadEadventureFileException
+ */
+ private ActionForward uploadFile(ActionMapping mapping, ActionForm form, String type, HttpServletRequest request) throws UploadEadventureFileException {
+
+ EadventureForm eadventureForm = (EadventureForm) form;
+ // get back sessionMAP
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(eadventureForm.getSessionMapID());
+
+ FormFile file;
+ if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) {
+ file = eadventureForm.getOfflineFile();
+ } else {
+ file = eadventureForm.getOnlineFile();
+ }
+
+ if (file == null || StringUtils.isBlank(file.getFileName())) {
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ // validate file size
+ ActionMessages errors = new ActionMessages();
+ FileValidatorUtil.validateFileSize(file, true, errors);
+ if (!errors.isEmpty()) {
+ this.saveErrors(request, errors);
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ IEadventureService service = getEadventureService();
+ // upload to repository
+ EadventureAttachment att = service.uploadInstructionFile(file, type);
+ // handle session value
+ List attachmentList = getAttachmentList(sessionMap);
+ List deleteAttachmentList = getDeletedAttachmentList(sessionMap);
+ // first check exist attachment and delete old one (if exist) to
+ // deletedAttachmentList
+ Iterator iter = attachmentList.iterator();
+ EadventureAttachment existAtt;
+ while (iter.hasNext()) {
+ existAtt = (EadventureAttachment) iter.next();
+ if (StringUtils.equals(existAtt.getFileName(), att.getFileName()) && StringUtils.equals(existAtt.getFileType(), att.getFileType())) {
+ // if there is same name attachment, delete old one
+ deleteAttachmentList.add(existAtt);
+ iter.remove();
+ break;
+ }
+ }
+ // add to attachmentList
+ attachmentList.add(att);
+
+ return mapping.findForward(EadventureConstants.SUCCESS);
+
+ }
+
+ /**
+ * Delete offline instruction file from current Eadventure authoring page.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ public ActionForward deleteOfflineFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+ return deleteFile(mapping, request, response, form, IToolContentHandler.TYPE_OFFLINE);
+ }
+
+ /**
+ * Delete online instruction file from current Eadventure authoring page.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ public ActionForward deleteOnlineFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+ return deleteFile(mapping, request, response, form, IToolContentHandler.TYPE_ONLINE);
+ }
+
+ /**
+ * General method to delete file (online or offline)
+ *
+ * @param mapping
+ * @param request
+ * @param response
+ * @param form
+ * @param type
+ * @return
+ */
+ private ActionForward deleteFile(ActionMapping mapping, HttpServletRequest request, HttpServletResponse response, ActionForm form, String type) {
+ Long versionID = new Long(WebUtil.readLongParam(request, EadventureConstants.PARAM_FILE_VERSION_ID));
+ Long uuID = new Long(WebUtil.readLongParam(request, EadventureConstants.PARAM_FILE_UUID));
+
+ // get back sessionMAP
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+
+ // handle session value
+ List attachmentList = getAttachmentList(sessionMap);
+ List deleteAttachmentList = getDeletedAttachmentList(sessionMap);
+ // first check exist attachment and delete old one (if exist) to
+ // deletedAttachmentList
+ Iterator iter = attachmentList.iterator();
+ EadventureAttachment existAtt;
+ while (iter.hasNext()) {
+ existAtt = (EadventureAttachment) iter.next();
+ if (existAtt.getFileUuid().equals(uuID) && existAtt.getFileVersionId().equals(versionID)) {
+ // if there is same name attachment, delete old one
+ deleteAttachmentList.add(existAtt);
+ iter.remove();
+ }
+ }
+
+ request.setAttribute(EadventureConstants.ATTR_FILE_TYPE_FLAG, type);
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, sessionMapID);
+ return mapping.findForward(EadventureConstants.SUCCESS);
+
+ }
+
+ // *************************************************************************************
+ // Private method
+ // *************************************************************************************
+ /**
+ * Return EadventureService bean.
+ */
+ private IEadventureService getEadventureService() {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet().getServletContext());
+ return (IEadventureService) wac.getBean(EadventureConstants.RESOURCE_SERVICE);
+ }
+
+ /**
+ * @param request
+ * @return
+ */
+ private List getAttachmentList(SessionMap sessionMap) {
+ return getListFromSession(sessionMap, EadventureConstants.ATT_ATTACHMENT_LIST);
+ }
+
+
+
+ /**
+ * @param request
+ * @return
+ */
+ private List getDeletedAttachmentList(SessionMap sessionMap) {
+ return getListFromSession(sessionMap, EadventureConstants.ATTR_DELETED_ATTACHMENT_LIST);
+ }
+
+
+
+ /**
+ * List save deleted eadventure items, which could be persisted or
+ * non-persisted items.
+ *
+ * @param request
+ * @return
+ */
+ private List getDeletedEadventureItemList(SessionMap sessionMap) {
+ return getListFromSession(sessionMap, EadventureConstants.ATTR_DELETED_RESOURCE_ITEM_LIST);
+ }
+
+ /**
+ * If a eadventure item has attahment file, and the user edit this item and
+ * change the attachment to new file, then the old file need be deleted when
+ * submitting the whole authoring page. Save the file uuid and version id
+ * into EadventureItem object for temporarily use.
+ *
+ * @param request
+ * @return
+ */
+ private List getDeletedItemAttachmentList(SessionMap sessionMap) {
+ return getListFromSession(sessionMap, EadventureConstants.ATTR_DELETED_RESOURCE_ITEM_ATTACHMENT_LIST);
+ }
+
+
+ /**
+ * List save deleted eadventure conditions, which could be persisted or non-persisted conditions.
+ *
+ * @param request
+ * @return
+ */
+ private List getDeletedEadventureConditionList(SessionMap sessionMap) {
+ return getListFromSession(sessionMap, EadventureConstants.ATTR_DELETED_CONDITION_LIST);
+ }
+
+ /**
+ * List of deleted eadventure expressions, which could be persisted or non-persisted expressions.
+ *
+ * @param request
+ * @return
+ */
+ private List getDeletedEadventureExpressionList(SessionMap sessionMap) {
+ return getListFromSession(sessionMap, EadventureConstants.ATTR_DELETED_EXPRESSION_LIST);
+ }
+
+ /**
+ * List save deleted eadventure params, which could be persisted or non-persisted expressions.
+ *
+ * @param request
+ * @return
+ */
+ private List getDeletedEadventureParamsList(SessionMap sessionMap) {
+ return getListFromSession(sessionMap, EadventureConstants.ATTR_DELETED_PARAMS_LIST);
+ }
+ /**
+ * Get java.util.List
from HttpSession by given name.
+ *
+ * @param request
+ * @param name
+ * @return
+ */
+ private List getListFromSession(SessionMap sessionMap, String name) {
+ List list = (List) sessionMap.get(name);
+ if (list == null) {
+ list = new ArrayList();
+ sessionMap.put(name, list);
+ }
+ return list;
+ }
+
+ /**
+ * Get eadventure items instruction from HttpRequest
+ *
+ * @param request
+ */
+ private List getInstructionsFromRequest(HttpServletRequest request) {
+ String list = request.getParameter("instructionList");
+ String[] params = list.split("&");
+ Map paramMap = new HashMap();
+ String[] pair;
+ for (String item : params) {
+ pair = item.split("=");
+ if (pair == null || pair.length != 2) {
+ continue;
+ }
+ try {
+ paramMap.put(pair[0], URLDecoder.decode(pair[1], "UTF-8"));
+ } catch (UnsupportedEncodingException e) {
+ AuthoringAction.log.error("Error occurs when decode instruction string:" + e.toString());
+ }
+ }
+
+ int count = paramMap.keySet().size();
+ List instructionList = new ArrayList();
+
+ for (int idx = 0; idx < count; idx++) {
+ String item = paramMap.get(AuthoringAction.INSTRUCTION_ITEM_DESC_PREFIX + idx);
+ if (item == null)
+ continue;
+
+ instructionList.add(item);
+ }
+
+ return instructionList;
+
+ }
+
+ /**
+ * Get number of instruction items in the HttpRequest
+ *
+ * @param request
+ * the HttpServletRequest
+ * @return numberOfInstruction the number of instructions in the request
+ */
+ private int getNumberOfInstructionsInRequest(HttpServletRequest request) {
+ int numberOfInstructions = 0;
+ Enumeration e = request.getParameterNames();
+ while (e.hasMoreElements()) {
+ if (e.nextElement().toString().indexOf(AuthoringAction.INSTRUCTION_ITEM_DESC_PREFIX) != -1)
+ numberOfInstructions++;
+ }
+ return numberOfInstructions;
+ }
+
+ /**
+ * List save current eadventure conditions.
+ *
+ * @param request
+ * @return
+ */
+ private SortedSet getEadventureConditionList(SessionMap sessionMap) {
+ SortedSet list = (SortedSet) sessionMap
+ .get(EadventureConstants.ATTR_CONDITION_LIST);
+ if (list == null) {
+ list = new TreeSet(new EadventureConditionComparator());
+ sessionMap.put(EadventureConstants.ATTR_CONDITION_LIST, list);
+ }
+ return list;
+ }
+
+ /**
+ * List save current eadventure params.
+ *
+ * @param request
+ * @return
+ */
+
+ private List getEdventureParamList(SessionMap sessionMap) {
+ return getListFromSession(sessionMap, EadventureConstants.ATTR_PARAMS_LIST);
+ }
+
+
+ /**
+ * Vaidate eadventure item regards to their type (url/file/learning
+ * object/website zip file)
+ *
+ * @param itemForm
+ * @return
+ */
+ /* private ActionErrors validateEadventureItem(EadventureItemForm itemForm) {
+ ActionErrors errors = new ActionErrors();
+ if (StringUtils.isBlank(itemForm.getTitle())) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_MSG_TITLE_BLANK));
+ }
+
+ if (itemForm.getItemType() == EadventureConstants.RESOURCE_TYPE_URL) {
+ if (StringUtils.isBlank(itemForm.getUrl())) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_MSG_URL_BLANK));
+ // URL validation: Commom URL validate(1.3.0) work not very
+ // well: it can not support http://
+ // address:port format!!!
+ // UrlValidator validator = new UrlValidator();
+ // if(!validator.isValid(itemForm.getUrl()))
+ // errors.add(ActionMessages.GLOBAL_MESSAGE,new
+ // ActionMessage(EadventureConstants.ERROR_MSG_INVALID_URL));
+ }
+ }
+ // if(itemForm.getItemType() == EadventureConstants.RESOURCE_TYPE_WEBSITE
+ // ||itemForm.getItemType() ==
+ // EadventureConstants.RESOURCE_TYPE_LEARNING_OBJECT){
+ // if(StringUtils.isBlank(itemForm.getDescription()))
+ // errors.add(ActionMessages.GLOBAL_MESSAGE,new
+ // ActionMessage(EadventureConstants.ERROR_MSG_DESC_BLANK));
+ // }
+ if (itemForm.getItemType() == EadventureConstants.RESOURCE_TYPE_WEBSITE || itemForm.getItemType() == EadventureConstants.RESOURCE_TYPE_LEARNING_OBJECT
+ || itemForm.getItemType() == EadventureConstants.RESOURCE_TYPE_FILE) {
+ // validate item size
+ FileValidatorUtil.validateFileSize(itemForm.getFile(), true, errors);
+ // for edit validate: file already exist
+ if (!itemForm.isHasFile() && (itemForm.getFile() == null || StringUtils.isEmpty(itemForm.getFile().getFileName()))) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_MSG_FILE_BLANK));
+ }
+ }
+ return errors;
+ }
+/*
+ /**
+ * Get ToolAccessMode from HttpRequest parameters. Default value is AUTHOR
+ * mode.
+ *
+ * @param request
+ * @return
+ */
+ private ToolAccessMode getAccessMode(HttpServletRequest request) {
+ ToolAccessMode mode;
+ String modeStr = request.getParameter(AttributeNames.ATTR_MODE);
+ if (StringUtils.equalsIgnoreCase(modeStr, ToolAccessMode.TEACHER.toString())) {
+ mode = ToolAccessMode.TEACHER;
+ } else {
+ mode = ToolAccessMode.AUTHOR;
+ }
+ return mode;
+ }
+
+ private ActionMessages validate(EadventureForm eadventureForm, ActionMapping mapping, HttpServletRequest request) {
+ ActionMessages errors = new ActionMessages();
+ if (StringUtils.isBlank(eadventureForm.getEadventure().getTitle())) {
+ ActionMessage error = new
+ ActionMessage("error.resource.item.title.blank");
+ errors.add(ActionMessages.GLOBAL_MESSAGE, error);
+ }
+
+
+ // define it later mode(TEACHER) skip below validation.
+ String modeStr = request.getParameter(AttributeNames.ATTR_MODE);
+ if (StringUtils.equals(modeStr, ToolAccessMode.TEACHER.toString())) {
+ return errors;
+ }
+
+ // Some other validation outside basic Tab.
+
+ return errors;
+ }
+
+ public ActionForward initPedagogicalPlannerForm(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+ EadventurePedagogicalPlannerForm plannerForm = (EadventurePedagogicalPlannerForm) form;
+ Long toolContentID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID);
+ Eadventure taskList = getEadventureService().getEadventureByContentId(toolContentID);
+ String command = WebUtil.readStrParam(request, AttributeNames.PARAM_COMMAND, true);
+ if (command == null) {
+ plannerForm.fillForm(taskList);
+ String contentFolderId = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ plannerForm.setContentFolderID(contentFolderId);
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ } else {
+ try {
+ String onlineInstructions = taskList.getOnlineInstructions();
+ response.setContentType("text/html;charset=utf-8");
+ PrintWriter writer = response.getWriter();
+
+ if (AttributeNames.COMMAND_CHECK_EDITING_ADVICE.equals(command)) {
+ Integer activityIndex = WebUtil.readIntParam(request, AttributeNames.PARAM_ACTIVITY_INDEX);
+ String responseText = (StringUtils.isEmpty(taskList.getOnlineInstructions()) ? "NO" : "OK") + '&' + activityIndex;
+ writer.print(responseText);
+
+ } else if (AttributeNames.COMMAND_GET_EDITING_ADVICE.equals(command)) {
+ writer.print(onlineInstructions);
+ }
+ } catch (IOException e) {
+ AuthoringAction.log.error(e);
+ }
+ return null;
+ }
+
+ }
+
+ //TODO completar
+ public ActionForward saveOrUpdatePedagogicalPlannerForm(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
+ throws IOException {
+ EadventurePedagogicalPlannerForm plannerForm = (EadventurePedagogicalPlannerForm) form;
+ ActionMessages errors = plannerForm.validate();
+/* if (errors.isEmpty()) {
+ Eadventure taskList = getEadventureService().getEadventureByContentId(plannerForm.getToolContentID());
+ taskList.setInstructions(plannerForm.getInstructions());
+
+ int itemIndex = 0;
+ String title = null;
+ EadventureItem eadventureItem = null;
+ List newItems = new LinkedList();
+ Set eadventureItems = taskList.getEadventureItems();
+ Iterator taskListItemIterator = eadventureItems.iterator();
+ // We need to reverse the order, since the items are delivered
+ // newest-first
+ LinkedList reversedEadventureItems = new LinkedList();
+ while (taskListItemIterator.hasNext()) {
+ reversedEadventureItems.addFirst(taskListItemIterator.next());
+ }
+ taskListItemIterator = reversedEadventureItems.iterator();
+ do {
+ title = plannerForm.getTitle(itemIndex);
+ if (StringUtils.isEmpty(title)) {
+ plannerForm.removeItem(itemIndex);
+ } else {
+ if (taskListItemIterator.hasNext()) {
+ eadventureItem = taskListItemIterator.next();
+ } else {
+ eadventureItem = new EadventureItem();
+ eadventureItem.setCreateByAuthor(true);
+ Date currentDate = new Date();
+ eadventureItem.setCreateDate(currentDate);
+
+ HttpSession session = SessionManager.getSession();
+ UserDTO user = (UserDTO) session.getAttribute(AttributeNames.USER);
+ EadventureUser taskListUser = getEadventureService().getUserByIDAndContent(new Long(user.getUserID().intValue()),
+ plannerForm.getToolContentID());
+ eadventureItem.setCreateBy(taskListUser);
+
+ newItems.add(eadventureItem);
+ }
+ eadventureItem.setTitle(title);
+ Short type = plannerForm.getType(itemIndex);
+ eadventureItem.setType(type);
+ boolean hasFile = eadventureItem.getFileUuid() != null;
+ if (type.equals(EadventureConstants.RESOURCE_TYPE_URL)) {
+ eadventureItem.setUrl(plannerForm.getUrl(itemIndex));
+ if (hasFile) {
+ eadventureItem.setFileName(null);
+ eadventureItem.setFileUuid(null);
+ eadventureItem.setFileVersionId(null);
+ eadventureItem.setFileType(null);
+ }
+ } else if (type.equals(EadventureConstants.RESOURCE_TYPE_FILE)) {
+ FormFile file = plannerForm.getFile(itemIndex);
+ eadventureItem.setUrl(null);
+ IEadventureService service = getEadventureService();
+ if (file != null) {
+ try {
+ if (hasFile) {
+ // delete the old file
+ service.deleteFromRepository(eadventureItem.getFileUuid(), eadventureItem.getFileVersionId());
+ }
+ service.uploadEadventureItemFile(eadventureItem, file);
+ } catch (Exception e) {
+ AuthoringAction.log.error(e);
+ ActionMessage error = new ActionMessage("error.msg.io.exception");
+ errors.add(ActionMessages.GLOBAL_MESSAGE, error);
+ saveErrors(request, errors);
+ plannerForm.setValid(false);
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+ }
+ plannerForm.setFileName(itemIndex, eadventureItem.getFileName());
+ plannerForm.setFileUuid(itemIndex, eadventureItem.getFileUuid());
+ plannerForm.setFileVersion(itemIndex, eadventureItem.getFileVersionId());
+ plannerForm.setFile(itemIndex, null);
+ }
+ itemIndex++;
+ }
+
+ } while (title != null);
+ // we need to clear it now, otherwise we get Hibernate error (item
+ // re-saved by cascade)
+ taskList.getEadventureItems().clear();
+ while (taskListItemIterator.hasNext()) {
+ eadventureItem = taskListItemIterator.next();
+ taskListItemIterator.remove();
+ getEadventureService().deleteEadventureItem(eadventureItem.getUid());
+ }
+ reversedEadventureItems.addAll(newItems);
+
+ taskList.getEadventureItems().addAll(reversedEadventureItems);
+ getEadventureService().saveOrUpdateEadventure(taskList);
+ } else {
+ saveErrors(request, errors);
+ }*/
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ public ActionForward createPedagogicalPlannerItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException {
+ EadventurePedagogicalPlannerForm plannerForm = (EadventurePedagogicalPlannerForm) form;
+ int insertIndex = plannerForm.getItemCount();
+ plannerForm.setTitle(insertIndex, "");
+ plannerForm.setType(insertIndex, new Short(request.getParameter(EadventureConstants.ATTR_ADD_RESOURCE_TYPE)));
+ plannerForm.setUrl(insertIndex, null);
+ plannerForm.setFileName(insertIndex, null);
+ plannerForm.setFile(insertIndex, null);
+ plannerForm.setFileUuid(insertIndex, null);
+ plannerForm.setFileVersion(insertIndex, null);
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/AuthoringEadventureConditionAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/AuthoringEadventureConditionAction.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/AuthoringEadventureConditionAction.java 2 Nov 2010 22:16:35 -0000 1.1
@@ -0,0 +1,1284 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: AuthoringEadventureConditionAction.java,v 1.1 2010/11/02 22:16:35 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.web.action;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.math.NumberUtils;
+import org.apache.log4j.Logger;
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionErrors;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+import org.apache.struts.util.LabelValueBean;
+import org.eucm.lams.tool.eadventure.EadventureConstants;
+import org.eucm.lams.tool.eadventure.dto.ExpressionInfo;
+import org.eucm.lams.tool.eadventure.model.EadventureCondition;
+import org.eucm.lams.tool.eadventure.model.EadventureExpression;
+import org.eucm.lams.tool.eadventure.model.EadventureParam;
+import org.eucm.lams.tool.eadventure.util.EadventureConditionComparator;
+import org.eucm.lams.tool.eadventure.util.EadventureExpressionComparator;
+import org.eucm.lams.tool.eadventure.web.form.EadventureConditionForm;
+import org.eucm.lams.tool.eadventure.web.form.EadventureExpressionForm;
+import org.eucm.lams.tool.eadventure.web.form.EadventureForm;
+import org.exolab.castor.util.Iterator;
+import org.lamsfoundation.lams.tool.ToolAccessMode;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.web.util.AttributeNames;
+import org.lamsfoundation.lams.web.util.SessionMap;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+/**
+ * Auxiliary action in author mode. It contains operations with EadventureCondition. The rest of operations are located in
+ * AuthoringAction
action.
+ *
+ * @author Andrey Balan
+ * @author Angel del Blanco
+ * @see org.eucm.lams.tool.eadventure.web.action.AuthoringAction
+ */
+public class AuthoringEadventureConditionAction extends Action {
+
+ @Override
+ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+
+ String param = mapping.getParameter();
+
+ if (param.equals("showConditions")) {
+ return showConditions(mapping, form, request, response);
+ }
+ if (param.equals("newConditionInit")) {
+ return newConditionInit(mapping, form, request, response);
+ }
+ if (param.equals("editCondition")) {
+ return editCondition(mapping, form, request, response);
+ }
+ if (param.equals("saveOrUpdateCondition")) {
+ return saveOrUpdateCondition(mapping, form, request, response);
+ }
+ if (param.equals("removeCondition")) {
+ return removeCondition(mapping, form, request, response);
+ }
+ if (param.equals("newExpressionInit")) {
+ return newExpressionInit(mapping, form, request, response);
+ }
+ if (param.equals("prepareOperatorAndSecondVar")) {
+ return prepareOperatorAndSecondVar(mapping, form, request, response);
+ }
+ if (param.equals("editExpression")) {
+ return editExpression(mapping, form, request, response);
+ }
+ if (param.equals("saveOrUpdateExpression")) {
+ return saveOrUpdateExpression(mapping, form, request, response);
+ }
+ if (param.equals("removeExpression")) {
+ return removeExpression(mapping, form, request, response);
+ }
+ if (param.equals("upCondition")) {
+ return upCondition(mapping, form, request, response);
+ }
+ if (param.equals("downCondition")) {
+ return downCondition(mapping, form, request, response);
+ }
+ if (param.equals("upExpression")) {
+ return upExpression(mapping, form, request, response);
+ }
+ if (param.equals("downExpression")) {
+ return downExpression(mapping, form, request, response);
+ }
+
+ if (param.equals("checkCondition")) {
+ return checkCondition(mapping, form, request, response);
+ }
+
+ if (param.equals("prepareCheckCondition")) {
+ return prepareCheckCondition(mapping, form, request, response);
+ }
+
+
+ return mapping.findForward(EadventureConstants.ERROR);
+ }
+
+ /**
+ * Display same entire authoring page content from HttpSession variable.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws ServletException
+ */
+
+ private ActionForward showConditions(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws ServletException {
+
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ EadventureForm existForm = (EadventureForm) sessionMap.get(EadventureConstants.ATTR_RESOURCE_FORM);
+
+ EadventureForm eadForm = (EadventureForm) form;
+ try {
+ PropertyUtils.copyProperties(eadForm, existForm);
+ } catch (Exception e) {
+ throw new ServletException(e);
+ }
+
+ ToolAccessMode mode = getAccessMode(request);
+ if (mode.isAuthor()) {
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ } else {
+ return mapping.findForward(EadventureConstants.DEFINE_LATER);
+ }
+ }
+ private ActionForward cleanConditions(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws ServletException {
+
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ //TODO ver lo de recargar la p�gina
+ //sessionMap.put(EadventureConstants., value)
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+
+ /**
+ * Display empty page for new eadventure condition.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward newConditionInit(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ // re-init expressionList
+ sessionMap.put(EadventureConstants.ATTR_EXPRESSION_LIST, null);
+
+ // check if some edventure game has been added
+ // it is not necessary, anulo el boton con javascript�
+ //TODO se puede quitar
+ /*ActionErrors errors = new ActionErrors();
+ String hasFile = (String)sessionMap.get(EadventureConstants.ATTR_HAS_FILE);
+ if (!hasFile.equalsIgnoreCase("true"))
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
+ EadventureConstants.ERROR_NOT_EAD_ADD));
+
+ if (!errors.isEmpty()) {
+ this.addErrors(request, errors);
+ sessionMap.put(EadventureConstants.ATTR_ERROR_IN_CONDITION, "true");
+ return mapping.findForward("conditions");
+ }*/
+
+ ((EadventureConditionForm) form).setSessionMapID(sessionMapID);
+ //Create expressionList and it into sessionMap, delete if already exists
+ SortedSet expressionList = getEadventureExpressionList(sessionMap);
+ //Add to the session that the condition is not being edited. In case of deleting an expression of this conditions, this expression must be deleted from the
+ //conditions too.
+ sessionMap.put(EadventureConstants.ATTR_EDIT_CONDITION, "false");
+ //TODO se puede quitarjunto con el de arriba
+// sessionMap.put(EadventureConstants.ATTR_ERROR_IN_CONDITION, "false");
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ /**
+ * Display edit page for existed taskList item.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward editCondition(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ // get back sessionMAP
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ // re-init expressionList
+ sessionMap.put(EadventureConstants.ATTR_EXPRESSION_LIST, null);
+
+ int position = NumberUtils.stringToInt(request.getParameter(EadventureConstants.PARAM_CONDITION_POSITION), -1);
+ EadventureCondition condition = null;
+ if (position != -1) {
+ SortedSet conditionList = getEadventureConditionList(sessionMap);
+ List rList = new ArrayList(conditionList);
+ condition = rList.get(position);
+ if (condition != null) {
+ ((EadventureConditionForm) form).setName(condition.getName());
+ //TODO va duplicado, creo que mejor solo por atributo
+ ((EadventureConditionForm) form).setExpressionList(condition.getEadListExpression());
+ ((EadventureConditionForm) form).setPosition(String.valueOf(condition.getSequenceId()));
+ SortedSet expressionList = getEadventureExpressionList(sessionMap);
+ expressionList.addAll(condition.getEadListExpression());
+ }
+ }
+ //Add to the session that the condition is being edited. In case of deleting an expression of this conditions, this expression must be deleted from the
+ //conditions too.
+ sessionMap.put(EadventureConstants.ATTR_EDIT_CONDITION, "true");
+ //TODO comprobar el caso null
+ return condition == null ? null : mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+
+ /**
+ * This method will get necessary information from taskList item form and save or update into
+ * HttpSession
TaskListItemList. Notice, this save is not persist them into database, just save
+ * HttpSession
temporarily. Only they will be persist when the entire authoring page is being
+ * persisted.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws ServletException
+ */
+ private ActionForward saveOrUpdateCondition(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ // get back sessionMAP
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+
+ EadventureConditionForm conditionForm = (EadventureConditionForm) form;
+ ActionErrors errors = validateEadventureCondition(conditionForm, request);
+
+ if (!errors.isEmpty()) {
+
+ // expressionList.clear();
+ this.addErrors(request, errors);
+ return mapping.findForward("addcondition");
+ }
+
+ try {
+ extractFormToEadventureCondition(request, conditionForm);
+ } catch (Exception e) {
+ // any upload exception will display as normal error message rather then throw exception directly
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_MSG_UPLOAD_FAILED, e
+ .getMessage()));
+ if (!errors.isEmpty()) {
+ //SortedSet expressionList = getEadventureExpressionList(sessionMap);
+ // expressionList.clear();
+ this.addErrors(request, errors);
+ return mapping.findForward("addcondition");
+ }
+ }
+ // set session map ID so that itemlist.jsp can get sessionMAP
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, conditionForm.getSessionMapID());
+ SortedSet expressionList = getEadventureExpressionList(sessionMap);
+ expressionList.clear();
+ // return null to close this window
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ /**
+ * Remove eadventureCondition from HttpSession list and update page display. As authoring rule, all persist only happen
+ * when user submit whole page. So this remove is just impact HttpSession values.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward removeCondition(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ // get back sessionMAP
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ // re-init expressionList
+ sessionMap.put(EadventureConstants.ATTR_EXPRESSION_LIST, null);
+
+ int sequenceId = NumberUtils.stringToInt(request.getParameter(EadventureConstants.PARAM_CONDITION_POSITION), -1);
+ if (sequenceId != -1) {
+ SortedSet conditionList = getEadventureConditionList(sessionMap);
+ List rList = new ArrayList(conditionList);
+ EadventureCondition condition = rList.remove(sequenceId);
+ for (EadventureCondition otherCondition : conditionList) {
+ if (otherCondition.getSequenceId() > sequenceId) {
+ otherCondition.setSequenceId(otherCondition.getSequenceId() - 1);
+ }
+ }
+ conditionList.clear();
+ conditionList.addAll(rList);
+ // add to delList
+ List delList = getDeletedEadventureConditionList(sessionMap);
+ delList.add(condition);
+ }
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, sessionMapID);
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+
+ /**
+ * Move up current condition.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward upCondition(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ return switchCondition(mapping, request, true);
+ }
+
+ /**
+ * Move down current Condition.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward downCondition(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ return switchCondition(mapping, request, false);
+ }
+
+
+
+ /**
+ * Move up current Expression.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward upExpression(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ //TODO quitar el ultimo parametro
+ return switchExpression(mapping, request, true, 0);
+ }
+
+ /**
+ * Move down current Expression.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward downExpression(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ //TODO quitar el ultimo parametro
+ return switchExpression(mapping, request, false, 0);
+ }
+
+
+
+ /**
+ * Display empty page for new eadventure expression.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward newExpressionInit(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ ((EadventureExpressionForm) form).setSessionMapID(sessionMapID);
+ populateFormWithPossibleVariables(form, request);
+
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ /**
+ * Prepare the operator and the second var of the expression taking into account the type of the first var
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward prepareOperatorAndSecondVar(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+
+ EadventureExpressionForm expForm = ((EadventureExpressionForm) form);
+ expForm.setSessionMapID(sessionMapID);
+ // conserve the all possible varsOp1
+ populateFormWithPossibleVariables(form, request);
+ // fill the form with the selected value
+ expForm.setSelectedVarOp1(WebUtil.readStrParam(request, EadventureConstants.PARAM_VAR_NAME));
+ // now fill the other list of elements taking into account the value selected in the authoringView for the firstOp
+ List listParams = this.getEadventureParamList(sessionMap);
+ String name = WebUtil.readStrParam(request, EadventureConstants.PARAM_VAR_NAME);
+ int selectedVarType = prepareOpAndVarFromType(form,name, listParams);
+ // get the position
+ String position = request.getParameter(EadventureConstants.PARAM_EXPRESSION_POSITION);
+ ((EadventureExpressionForm)form).setPosition(position);
+ ((EadventureExpressionForm)form).setNextOp("and");
+ sessionMap.put(EadventureConstants.ATTR_EXPR_SELECTED_TYPE, selectedVarType);
+
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+ /**
+ * Prepare the operator and the second var of the expression taking into account the type of the first var
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward editExpression(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ int selectedVarType=-1;
+ // get back sessionMAP
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ populateFormWithPossibleVariables(form, request);
+
+ int position = NumberUtils.stringToInt(request.getParameter(EadventureConstants.PARAM_EXPRESSION_POSITION), -1);
+ EadventureExpression expression= null;
+ if (position != -1) {
+ // List expressionList = this.getListFromSession(sessionMap, EadventureConstants.ATTR_EXPRESSION_LIST);
+ SortedSet expressionList = getEadventureExpressionList(sessionMap);
+ List rList = new ArrayList(expressionList);
+ ((EadventureExpressionForm)form).setPosition(String.valueOf(position));
+ List listParams = this.getEadventureParamList(sessionMap);
+ expression = rList.get(position);
+ if (expression != null) {
+ //TODO repasar si merece la pena hacerlo asi o meter algo mas de info sobre los parametros en el form!!!!
+ selectedVarType = prepareOpAndVarFromType(form,expression.getFirstOp().getName(), listParams);
+ ((EadventureExpressionForm)form).setSelectedVarOp1(String.valueOf(expression.getFirstOp().getName()));
+ ((EadventureExpressionForm)form).setSelectedOperator(expression.getExpresionOp());
+ if (expression.getValueIntroduced()==null){
+ ((EadventureExpressionForm)form).setSelectedVarOp2(String.valueOf(expression.getVarIntroduced().getName()));
+ ((EadventureExpressionForm)form).setIntroducedValue(null);
+ ((EadventureExpressionForm)form).setSecondVarSelected(true);
+
+ }else{
+ ((EadventureExpressionForm)form).setIntroducedValue(expression.getValueIntroduced());
+ ((EadventureExpressionForm)form).setSelectedVarOp2(null);
+ ((EadventureExpressionForm)form).setSecondVarSelected(false);
+ }
+ }
+ }
+ ((EadventureExpressionForm)form).setNextOp("and");
+
+ sessionMap.put(EadventureConstants.ATTR_EXPR_SELECTED_TYPE, selectedVarType);
+
+ return mapping.findForward(EadventureConstants.SUCCESS);
+
+ }
+
+ /**
+ * This method will get necessary information from taskList item form and save or update into
+ * HttpSession
TaskListItemList. Notice, this save is not persist them into database, just save
+ * HttpSession
temporarily. Only they will be persist when the entire authoring page is being
+ * persisted.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws ServletException
+ */
+ private ActionForward saveOrUpdateExpression(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+
+ EadventureExpressionForm expressionForm = (EadventureExpressionForm) form;
+ ActionErrors errors = validateEadventureExpression(expressionForm, request);
+
+ if (!errors.isEmpty()) {
+ populateFormWithPossibleVariables(form, request);
+ if (errors.get("no-op").hasNext()){
+ //TODO nuevo metodo, no tiene sentido pasar todo esto!!!!
+ List listParams = this.getEadventureParamList(sessionMap);
+ String name = expressionForm.getSelectedVarOp1();
+ int selectedVarType = prepareOpAndVarFromType(expressionForm,name, listParams);
+ expressionForm.setNextOp("and");
+ }
+
+ this.addErrors(request, errors);
+ return mapping.findForward("addexpression");
+ }
+ try {
+ extractFormToEadventureExpression(request, expressionForm);
+ } catch (Exception e) {
+ // any upload exception will display as normal error message rather then throw exception directly
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_MSG_NO_EXPRESSIONS, e
+ .getMessage()));
+ if (!errors.isEmpty()) {
+ populateFormWithPossibleVariables(form, request);
+ this.addErrors(request, errors);
+ return mapping.findForward("addexpression");
+ }
+ }
+ // set session map ID so that itemlist.jsp can get sessionMAP
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, expressionForm.getSessionMapID());
+ // return null to close this window
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ /**
+ * Remove eadventureExpression from HttpSession list and update page display. As authoring rule, all persist only happen
+ * when user submit whole page. So this remove is just impact HttpSession values.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward removeExpression(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ // get back sessionMAP
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+
+ int position = NumberUtils.stringToInt(request.getParameter(EadventureConstants.PARAM_EXPRESSION_POSITION), -1);
+ if (position != -1) {
+ SortedSet expressionList = getEadventureExpressionList(sessionMap);
+ List rList = new ArrayList(expressionList);
+ EadventureExpression expression = rList.remove(position);
+ for (EadventureExpression otherExpression : expressionList) {
+ if (otherExpression.getSequenceId() > position) {
+ otherExpression.setSequenceId(otherExpression.getSequenceId() - 1);
+ }
+ }
+ // actualize the expressionList in sessionMap
+ expressionList.clear();
+ expressionList.addAll(rList);
+ // add to delList
+ List delList = getDeletedEadventureExpressionList(sessionMap);
+ delList.add(expression);
+ // TODO preguntar si esto es necesario, quiz�s no interesa si no lo damos a salvar!!!!!!!!!!!!!!!!!!!
+ //check if we need delete this expression from a condition in conditions list
+ /* boolean isConditionEdit = Boolean.getBoolean((String)sessionMap.get(EadventureConstants.ATTR_EDIT_CONDITION));
+ if (isConditionEdit){
+ // get the condition in condition list
+ SortedSet conditionList = getEadventureConditionList(sessionMap);
+ List cList = new ArrayList(conditionList);
+ int positionCondition = Integer.parseInt(((EadventureConditionForm)form).getPosition());
+ EadventureCondition condition = cList.get(positionCondition);
+ if (condition != null) {
+ condition.setEadListExpression(expressionList);
+ ((EadventureConditionForm)form).setExpressionList(expressionList);
+ //TODO borrar si esta bien lo anterior
+ /*Set expressionFromConditionList = condition.getEadListExpression();
+ List ecList = new ArrayList(expressionFromConditionList);
+ ecList.remove(expression);
+ //actualize the expression list in the condition in the conditionsList in the sessionMap
+ expressionFromConditionList.clear();
+ expressionFromConditionList.addAll(ecList);
+ ////TODO quitar, creo que no hace falta actualize the expressionList in conditionForm
+
+ }
+ }*/
+ }
+
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, sessionMapID);
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+
+ /**
+ * Prepare the operator and the second var of the expression taking into account the type of the first var
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward prepareCheckCondition(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ // get back sessionMAP
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+
+ SortedSet expressionList = getEadventureExpressionList(sessionMap);
+ List exprList = new ArrayList(expressionList);
+ String description = new String();
+ java.util.Iterator it = exprList.iterator();
+ List params = this.getEadventureParamList(sessionMap);
+ // prepare the data structures to send to jsp
+ ArrayList expressionsInfo = new ArrayList();
+ while(it.hasNext()){
+ EadventureExpression expr = it.next();
+ ExpressionInfo exprInfo = null;
+ // identify the variable
+ String name = expr.getFirstOp().getName();
+ String type = expr.getFirstOp().getType();
+ String operator = expr.getExpresionOp();
+ String nextOp = expr.getNextOp();
+ exprInfo = new ExpressionInfo(name,type,operator,nextOp);
+ if (expr.getValueIntroduced()!=null)
+ exprInfo.setValueInExpression(expr.getValueIntroduced());
+ else
+ exprInfo.setNameSecondOp(expr.getVarIntroduced().getName());
+
+ expressionsInfo.add(exprInfo);
+
+ }
+
+ sessionMap.put(EadventureConstants.ATTR_EXPRS_INFO, expressionsInfo);
+ sessionMap.put(EadventureConstants.ATTR_EXPRS_INFO, expressionsInfo);
+ sessionMap.put(EadventureConstants.ATTR_EXPRS_INFO, expressionsInfo);
+
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ /**
+ * Prepare the operator and the second var of the expression taking into account the type of the first var
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward checkCondition(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+
+
+ // *************************************************************************************
+ // Private methods for internal needs
+ // *************************************************************************************
+ private ActionForward switchCondition(ActionMapping mapping, HttpServletRequest request, boolean up) {
+ // get back sessionMAP
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+
+ int sequenceId = NumberUtils.stringToInt(request.getParameter(EadventureConstants.PARAM_CONDITION_POSITION), -1);
+ if (sequenceId != -1) {
+ SortedSet conditionList = getEadventureConditionList(sessionMap);
+ List rList = new ArrayList(conditionList);
+ // get current and the target condition, and switch their sequnece
+ EadventureCondition condition = rList.get(sequenceId);
+ EadventureCondition repCondition;
+ if (up) {
+ repCondition = rList.get(--sequenceId);
+ } else {
+ repCondition = rList.get(++sequenceId);
+ }
+ int upSeqId = repCondition.getSequenceId();
+ repCondition.setSequenceId(condition.getSequenceId());
+ condition.setSequenceId(upSeqId);
+
+ // put back list, it will be sorted again
+ conditionList.clear();
+ conditionList.addAll(rList);
+ }
+
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, sessionMapID);
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ private ActionForward switchExpression(ActionMapping mapping, HttpServletRequest request, boolean up, int conditionPosition) {
+ // get back sessionMAP
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+
+ int sequenceId = NumberUtils.stringToInt(request.getParameter(EadventureConstants.PARAM_EXPRESSION_POSITION), -1);
+ if (sequenceId != -1) {
+ SortedSet expressionList = getEadventureExpressionList(sessionMap);
+ List rList = new ArrayList(expressionList);
+ // get current and the target item, and switch their sequnece
+ EadventureExpression expression = rList.get(sequenceId);
+ EadventureExpression repExpression;
+ if (up) {
+ repExpression = rList.get(--sequenceId);
+ } else {
+ repExpression = rList.get(++sequenceId);
+ }
+ int upSeqId = repExpression.getSequenceId();
+ repExpression.setSequenceId(expression.getSequenceId());
+ expression.setSequenceId(upSeqId);
+ // put back list, it will be sorted again
+ expressionList.clear();
+ expressionList.addAll(rList);
+
+ // TODO comprobar si esto es necesario, quiz�s no interesa si no le doy a salvar!!!!!!!!!!!!!!!!!!!!!!!!!!
+ //check if we need delete this expression from a condition in conditions list
+ /* boolean isConditionEdit = Boolean.getBoolean((String)sessionMap.get(EadventureConstants.ATTR_EDIT_CONDITION));
+ if (isConditionEdit){
+ // get the condition in condition list
+ SortedSet conditionList = getEadventureConditionList(sessionMap);
+ List cList = new ArrayList(conditionList);
+ EadventureCondition condition = cList.get(conditionPosition);
+ if (condition != null) {
+ condition.setEadListExpression(expressionList);
+ //TODO borrar si sobra!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
+ /*Set expressionFromConditionList = condition.getEadListExpression();
+ List ecList = new ArrayList(expressionFromConditionList);
+ ecList.remove(expression);
+ //actualize the expression list in the condition in the conditionsList in the sessionMap
+ expressionFromConditionList.clear();
+ expressionFromConditionList.addAll(ecList);
+
+ }
+ }*/
+ }
+
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, sessionMapID);
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ // returns the int value to save in sessionMap to know in jsp which type is the selected variable
+ private int prepareOpAndVarFromType(ActionForm form, String varName, List listParams){
+
+ int returnType=-1;
+ // search the type of the param
+ java.util.Iterator it = listParams.iterator();
+ EadventureParam param = null;
+ String type=null;
+ while (it.hasNext()){
+ param = it.next();
+ if (param.getName().equals(varName)){
+ type = param.getType();
+ }
+ }
+
+ String[] operators=null;
+ if (type.equals("integer")){
+ // Initialize the operator .
+ returnType=0;
+ operators = EadventureConstants.IntergerOp;
+ ((EadventureExpressionForm) form).setIntroducedValue("0");
+ } else if (type.equals("string")){
+ returnType=1;
+ operators = EadventureConstants.StringOp;
+
+ } else if (type.equals("boolean")){
+ returnType=2;
+ operators = EadventureConstants.BooleanOp;
+ }
+ ((EadventureExpressionForm) form).setPossibleOperator(operators);
+
+ // prepare the second var taking into account the type of first param
+ String[] params = prepareListOfParams(listParams,type,varName);
+ ((EadventureExpressionForm) form).setPossibleVarsOp2(params);
+
+ return returnType;
+ }
+
+
+
+
+ /**
+ * Return the LabelValueBean list of all the params filter by type.
+ * If type is "none", this method takes all the params.
+ *
+ * @param list
+ * @param type
+ * @return
+ */
+ private String[] prepareListOfParams(List list, String type, String name){
+ // Initialise the LabelValueBeans in the possibleOptions array.
+ //TODO como para el caso de un tipo espec�fico no sabemos cual va a ser el tama�o del array, mejor usa run arrayListparcial y luego
+ // pasarlo a array normal
+
+ ArrayList paramAux = new ArrayList();
+ for (EadventureParam param : list) {
+ //if type is none means that we want to add all params
+ if (type.equals("none")||(type.equals(param.getType()) && !name.equals(param.getName()) ))
+ paramAux.add(param.getName());
+ }
+
+ return paramAux.toArray(new String[paramAux.size()]);
+ }
+
+ private String[] prepareListOfParams(List list){
+ return prepareListOfParams(list,"none","");
+ }
+
+
+ /**
+ * Return TaskListService bean.
+ */
+ /* private ITaskListService getTaskListService() {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet()
+ .getServletContext());
+ return (ITaskListService) wac.getBean(TaskListConstants.RESOURCE_SERVICE);
+ }
+
+ /**
+ * List save current taskList items.
+ *
+ * @param request
+ * @return
+ */
+ /* private SortedSet getTaskListConditionList(SessionMap sessionMap) {
+ SortedSet list = (SortedSet) sessionMap
+ .get(TaskListConstants.ATTR_CONDITION_LIST);
+ if (list == null) {
+ list = new TreeSet(new TaskListConditionComparator());
+ sessionMap.put(TaskListConstants.ATTR_CONDITION_LIST, list);
+ }
+ return list;
+ }
+
+
+
+ /**
+ * List save deleted taskList items, which could be persisted or non-persisted items.
+ *
+ * @param request
+ * @return
+ */
+ private List getDeletedEadventureConditionList(SessionMap sessionMap) {
+ return getListFromSession(sessionMap, EadventureConstants.ATTR_DELETED_CONDITION_LIST);
+ }
+
+
+ /**
+ * List save deleted taskList items, which could be persisted or non-persisted items.
+ *
+ * @param request
+ * @return
+ */
+ private List getDeletedEadventureExpressionList(SessionMap sessionMap) {
+ return getListFromSession(sessionMap, EadventureConstants.ATTR_DELETED_EXPRESSION_LIST);
+ }
+
+ /**
+ * Get java.util.List
from HttpSession by given name.
+ *
+ * @param request
+ * @param name
+ * @return
+ */
+ private List getListFromSession(SessionMap sessionMap, String name) {
+ List list = (List) sessionMap.get(name);
+ if (list == null) {
+ list = new ArrayList();
+ sessionMap.put(name, list);
+ }
+ return list;
+ }
+
+ /**
+ * This method will populate eadventure expression vars information to its form for edit use (for first param).
+ *
+ * @param sequenceId
+ * @param condition
+ * @param form
+ * @param request
+ */
+ private void populateFormWithPossibleVariables(ActionForm form, HttpServletRequest request) {
+
+ // get back sessionMAP
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ EadventureExpressionForm eadForm = ((EadventureExpressionForm) form);
+ List paramsList = getEadventureParamList(sessionMap);
+
+
+ // Initialise the options in the possibleOptions array.
+ String[] params = prepareListOfParams(paramsList);
+ eadForm.setPossibleVarsOp1(params);
+
+ }
+
+
+ /**
+ * List save current eadventure params.
+ *
+ * @param sessionMap
+ * @return
+ */
+
+ private List getEadventureParamList(SessionMap sessionMap) {
+ return getListFromSession(sessionMap, EadventureConstants.ATTR_PARAMS_LIST);
+ }
+
+ /**
+ * List save current eadventure conditions.
+ *
+ * @param request
+ * @return
+ */
+ private SortedSet getEadventureConditionList(SessionMap sessionMap) {
+ SortedSet list = (SortedSet) sessionMap
+ .get(EadventureConstants.ATTR_CONDITION_LIST);
+ if (list == null) {
+ list = new TreeSet(new EadventureConditionComparator());
+ sessionMap.put(EadventureConstants.ATTR_CONDITION_LIST, list);
+ }
+ return list;
+ }
+
+ private SortedSet getEadventureExpressionList(SessionMap sessionMap) {
+ SortedSet list = (SortedSet) sessionMap
+ .get(EadventureConstants.ATTR_EXPRESSION_LIST);
+ if (list == null) {
+ list = new TreeSet(new EadventureExpressionComparator());
+ sessionMap.put(EadventureConstants.ATTR_EXPRESSION_LIST, list);
+ }
+ return list;
+ }
+
+
+
+ /**
+ * Extract form content to eadventureCondition.
+ *
+ * @param request
+ * @param form
+ * @throws TaskListException
+ */
+ private void extractFormToEadventureCondition(HttpServletRequest request, EadventureConditionForm form)
+ throws Exception {
+ /*
+ * BE CAREFUL: This method will copy necessary info from request form to a old or new TaskListItem instance. It
+ * gets all info EXCEPT TaskListItem.createDate and TaskListItem.createBy, which need be set when persisting
+ * this taskList item.
+ */
+
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(form.getSessionMapID());
+ // check whether it is "edit(old item)" or "add(new item)"
+ SortedSet conditionList = getEadventureConditionList(sessionMap);
+ int position = NumberUtils.stringToInt(request.getParameter(EadventureConstants.PARAM_CONDITION_POSITION), -1);
+ EadventureCondition condition = null;
+
+ if (position == -1) { // add
+ condition = new EadventureCondition();
+ int maxSeq = 0;
+ if (conditionList != null && conditionList.size() > 0) {
+ EadventureCondition last = conditionList.last();
+ maxSeq = last.getSequenceId() + 1;
+ }
+ condition.setSequenceId(maxSeq);
+ conditionList.add(condition);
+ } else { // edit
+ List rList = new ArrayList(conditionList);
+ condition = rList.get(position);
+ }
+
+ condition.setName(form.getName());
+
+ SortedSet expressionList = getEadventureExpressionList(sessionMap);
+ // set the condition as parent of all expressions
+ List eList = new ArrayList(expressionList);
+ java.util.Iterator it = eList.iterator();
+ while(it.hasNext()){
+ EadventureExpression eadExpr = it.next();
+ eadExpr.setCondition(condition);
+ }
+ condition.setEadListExpression(expressionList);
+ // re-init expressionList
+ sessionMap.put(EadventureConstants.ATTR_EXPRESSION_LIST, null);
+
+ }
+
+
+ /**
+ * Extract form content to eadventureExpression.
+ *
+ * @param request
+ * @param form
+ * @throws TaskListException
+ */
+ private void extractFormToEadventureExpression(HttpServletRequest request, EadventureExpressionForm form)
+ throws Exception {
+ /*
+ * BE CAREFUL: This method will copy necessary info from request form to a old or new TaskListItem instance. It
+ * gets all info EXCEPT TaskListItem.createDate and TaskListItem.createBy, which need be set when persisting
+ * this taskList item.
+ */
+
+
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(form.getSessionMapID());
+ // check whether it is "edit(old item)" or "add(new item)"
+ SortedSet expressionList = getEadventureExpressionList(sessionMap);
+ //int position = NumberUtils.stringToInt(request.getParameter(EadventureConstants.PARAM_EXPRESSION_POSITION), -1);
+ int position = NumberUtils.stringToInt(((EadventureExpressionForm)form).getPosition());
+ EadventureExpression expression = null;
+
+ if (position == -1) { // add
+ expression = new EadventureExpression();
+ int maxSeq = 0;
+ if (expression != null && expressionList.size() > 0) {
+ EadventureExpression last = expressionList.last();
+ maxSeq = last.getSequenceId() + 1;
+ }
+ expression.setSequenceId(maxSeq);
+ expressionList.add(expression);
+ } else { // edit
+ List rList = new ArrayList(expressionList);
+ expression = rList.get(position);
+ }
+
+ List paramList = this.getEadventureParamList(sessionMap);
+ expression.setFirstOp(getParam(form.getSelectedVarOp1(),paramList));
+ expression.setExpresionOp(form.getSelectedOperator());
+
+
+
+ if (form.isSecondVarSelected()){
+ expression.setVarIntroduced(getParam(form.getSelectedVarOp2(),paramList));
+ expression.setValueIntroduced(null);
+ }else{
+ expression.setValueIntroduced(form.getIntroducedValue());
+ expression.setVarIntroduced(null);
+ }
+ expression.setNextOp(form.getNextOp());
+
+ }
+
+ private EadventureParam getParam(String name, List list){
+
+ java.util.Iterator it = list.iterator();
+ while(it.hasNext()){
+ EadventureParam param = it.next();
+ if (param.getName().equals(name))
+ return param;
+ }
+ return null;
+ }
+
+ /**
+ * Validate EadventureCondition
+ *
+ * @param conditionForm
+ * @return
+ */
+ private ActionErrors validateEadventureCondition(EadventureConditionForm conditionForm, HttpServletRequest request) {
+ ActionErrors errors = new ActionErrors();
+ String sessionMapID = conditionForm.getSessionMapID();
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+
+ String formConditionName = conditionForm.getName();
+ if (StringUtils.isBlank(formConditionName)) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_NAME_CONDITION_BLANK));
+ } else if (StringUtils.contains(formConditionName, '#')) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
+ EadventureConstants.ERROR_MSG_NAME_CONTAINS_WRONG_SYMBOL));
+ } else {
+
+ String formConditionSequenceId = conditionForm.getPosition();
+ SortedSet conditionList = getEadventureConditionList(sessionMap);
+ for (EadventureCondition condition : conditionList) {
+ if (formConditionName.equals(condition.getName())
+ && !formConditionSequenceId.equals((new Integer(condition.getSequenceId())).toString())) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
+ EadventureConstants.ERROR_MSG_NAME_DUPLICATED));
+ break;
+ }
+ }
+ }
+
+ // should be created at least one expression
+ //Set expressionList = conditionForm.getExpressionList();
+ Set expressionList = getEadventureExpressionList(sessionMap);
+ if (expressionList == null || expressionList.size() == 0) {
+ errors
+ .add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
+ EadventureConstants.ERROR_MSG_NO_EXPRESSIONS));
+ }
+
+ return errors;
+ }
+
+
+ /**
+ * Validate EadventureCondition
+ *
+ * @param conditionForm
+ * @return
+ */
+ private ActionErrors validateEadventureExpression(EadventureExpressionForm expressionForm, HttpServletRequest request) {
+ ActionErrors errors = new ActionErrors();
+
+ /*String formEaxpressionName = expressionForm.getName();
+ if (StringUtils.isBlank(formEaxpressionName)) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_NAME_CONDITION_BLANK));
+ } else if (StringUtils.contains(formEaxpressionName, '#')) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
+ EadventureConstants.ERROR_MSG_NAME_CONTAINS_WRONG_SYMBOL));
+ } else {*/
+
+// StringUtils.isNumeric(arg0)
+// StringUtils.
+ //TODO revisar, muchas de estas cosas no se permiten en la vista, por lo que no hace falta comprbarlas aqui
+ String formExpressionSequenceId = expressionForm.getPosition();
+
+ String sessionMapID = expressionForm.getSessionMapID();
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ String firstVar = expressionForm.getSelectedVarOp1();
+ List paramList = this.getEadventureParamList(sessionMap);
+ String type = null;
+ for (EadventureParam param: paramList){
+ if (param.getName().equals(firstVar))
+ type = param.getType();
+ }
+
+ if (firstVar.equals("no-option")){
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR__EXPRESSION_NO_FIRST_VAR));
+ }else {
+
+ if (expressionForm.getSelectedVarOp2()!=null&&!expressionForm.getSelectedVarOp2().equals("")){
+ //validate selected var
+ String secondVar = expressionForm.getSelectedVarOp2();
+ if (firstVar.equals(secondVar))
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_SAME_VARS_NAME));
+ else{
+ String type2 = null;
+ for (EadventureParam param: paramList){
+ if (param.getName().equals(firstVar))
+ type2 = param.getType();
+ }
+ if (type!=null){
+ if (!type2.equals(type))
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_NOT_EQ_VARS_TYPE));
+ }
+ }
+
+ } else if (expressionForm.getIntroducedValue()!=null&&!expressionForm.getIntroducedValue().endsWith("")){
+ //Validate introduced value
+
+ String introducedValue = expressionForm.getIntroducedValue();
+ if (StringUtils.isBlank(introducedValue)) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_NAME_CONDITION_BLANK));
+ } else if (StringUtils.contains(introducedValue, '#')) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
+ EadventureConstants.ERROR_MSG_NAME_CONTAINS_WRONG_SYMBOL));
+ } else {
+ if (type!=null){
+ if (type.equals("string")){
+ if (StringUtils.isBlank(introducedValue)) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_NAME_VALUE_BLANK));
+ } else if (!StringUtils.isAlpha(introducedValue))
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_VALUE_NOT_ALPHA));
+
+ }else if (type.equals("integer")){
+ if (StringUtils.isBlank(introducedValue)) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_NAME_VALUE_BLANK));
+ } else if (!StringUtils.isNumeric(introducedValue))
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_VALUE_NOT_NUMERIC));
+ } else if (type.equals("boolean")){
+ if (StringUtils.isBlank(introducedValue)) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_NAME_VALUE_BLANK));
+ } else if (!introducedValue.equalsIgnoreCase("true")||!introducedValue.equalsIgnoreCase("false")){
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_VALUE_NOT_BOOLEAN));
+
+ }
+ }
+ } else {
+ //TODO caso en que el type no es ninguno de los anteriores
+ }
+ }
+ }
+
+ if (expressionForm.getSelectedOperator()!=null&&expressionForm.getSelectedOperator().equals("no-option")){
+ errors.add("no-op", new ActionMessage(EadventureConstants.ERROR__EXPRESSION_NO_OPERATOR));
+ }else if (expressionForm.isSecondVarSelected() && expressionForm.getSelectedVarOp2().equals("no-option")){
+ errors.add("no-op", new ActionMessage(EadventureConstants.ERROR__EXPRESSION_NO_SECOND_VAR));
+ }
+ }
+
+ return errors;
+ }
+
+
+
+
+ /**
+ * Get ToolAccessMode from HttpRequest parameters. Default value is AUTHOR mode.
+ *
+ * @param request
+ * @return
+ */
+ private ToolAccessMode getAccessMode(HttpServletRequest request) {
+ ToolAccessMode mode;
+ String modeStr = request.getParameter(AttributeNames.ATTR_MODE);
+ if (StringUtils.equalsIgnoreCase(modeStr, ToolAccessMode.TEACHER.toString())) {
+ mode = ToolAccessMode.TEACHER;
+ } else {
+ mode = ToolAccessMode.AUTHOR;
+ }
+ return mode;
+ }
+
+ /*private ActionMessages validate(TaskListForm taskListForm, ActionMapping mapping, HttpServletRequest request) {
+ ActionMessages errors = new ActionMessages();
+ // if (StringUtils.isBlank(taskListForm.getTaskList().getTitle())) {
+ // ActionMessage error = new ActionMessage("error.resource.item.title.blank");
+ // errors.add(ActionMessages.GLOBAL_MESSAGE, error);
+ // }
+
+ // define it later mode(TEACHER) skip below validation.
+ String modeStr = request.getParameter(AttributeNames.ATTR_MODE);
+ if (StringUtils.equals(modeStr, ToolAccessMode.TEACHER.toString())) {
+ return errors;
+ }
+
+ // Some other validation outside basic Tab.
+
+ return errors;
+ }*/
+
+
+}
+
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/ClearSessionAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/ClearSessionAction.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/ClearSessionAction.java 2 Nov 2010 22:16:35 -0000 1.1
@@ -0,0 +1,50 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: ClearSessionAction.java,v 1.1 2010/11/02 22:16:35 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.web.action;
+
+import javax.servlet.http.HttpSession;
+
+import org.lamsfoundation.lams.authoring.web.LamsAuthoringFinishAction;
+import org.lamsfoundation.lams.tool.ToolAccessMode;
+import org.eucm.lams.tool.eadventure.EadventureConstants;
+import org.lamsfoundation.lams.web.util.AttributeNames;
+
+/**
+ * This class give a chance to clear HttpSession when user save/close authoring page.
+ * @author Steve.Ni
+ *
+ * @version $Revision: 1.1 $
+ */
+public class ClearSessionAction extends LamsAuthoringFinishAction {
+
+ @Override
+ public void clearSession(String customiseSessionID, HttpSession session, ToolAccessMode mode) {
+ if(mode.isAuthor()){
+ session.removeAttribute(customiseSessionID);
+ }
+ }
+
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/LearningAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/LearningAction.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/LearningAction.java 2 Nov 2010 22:16:35 -0000 1.1
@@ -0,0 +1,727 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: LearningAction.java,v 1.1 2010/11/02 22:16:35 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.web.action;
+
+import java.io.IOException;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionErrors;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+import org.lamsfoundation.lams.events.DeliveryMethodMail;
+import org.lamsfoundation.lams.notebook.model.NotebookEntry;
+import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants;
+import org.lamsfoundation.lams.tool.ToolAccessMode;
+import org.eucm.lams.tool.eadventure.EadventureConstants;
+import org.eucm.lams.tool.eadventure.model.Eadventure;
+import org.eucm.lams.tool.eadventure.model.EadventureItemVisitLog;
+import org.eucm.lams.tool.eadventure.model.EadventureParam;
+import org.eucm.lams.tool.eadventure.model.EadventureSession;
+import org.eucm.lams.tool.eadventure.model.EadventureUser;
+import org.eucm.lams.tool.eadventure.model.EadventureVars;
+import org.eucm.lams.tool.eadventure.service.IEadventureService;
+import org.eucm.lams.tool.eadventure.service.EadventureApplicationException;
+import org.eucm.lams.tool.eadventure.service.UploadEadventureFileException;
+import org.eucm.lams.tool.eadventure.web.form.ReflectionForm;
+import org.lamsfoundation.lams.usermanagement.User;
+import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
+import org.lamsfoundation.lams.util.FileUtil;
+import org.lamsfoundation.lams.util.FileValidatorUtil;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.web.session.SessionManager;
+import org.lamsfoundation.lams.web.util.AttributeNames;
+import org.lamsfoundation.lams.web.util.SessionMap;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+/**
+ *
+ * @author Steve.Ni
+ *
+ * @version $Revision: 1.1 $
+ */
+public class LearningAction extends Action {
+
+ private static Logger log = Logger.getLogger(LearningAction.class);
+
+ @Override
+ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+
+ String param = mapping.getParameter();
+ // -----------------------Eadventure Learner function ---------------------------
+ if (param.equals("start")) {
+ return start(mapping, form, request, response);
+ }
+ if (param.equals("finish")) {
+ return finish(mapping, form, request, response);
+ }
+ if (param.equals("addfile")) {
+ //return addItem(mapping, form, request, response);
+ }
+ if (param.equals("addurl")) {
+ //return addItem(mapping, form, request, response);
+ }
+ if (param.equals("saveOrUpdateItem")) {
+ //return saveOrUpdateItem(mapping, form, request, response);
+ }
+
+ // ================ Reflection =======================
+ if (param.equals("newReflection")) {
+ return newReflection(mapping, form, request, response);
+ }
+ if (param.equals("submitReflection")) {
+ return submitReflection(mapping, form, request, response);
+ }
+
+ return mapping.findForward(EadventureConstants.ERROR);
+ }
+
+ /**
+ * Initial page for add eadventure item (single file or URL).
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ //TODO eliminar
+ /* private ActionForward addItem(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ EadventureItemForm itemForm = (EadventureItemForm) form;
+ itemForm.setMode(WebUtil.readStrParam(request, AttributeNames.ATTR_MODE));
+ itemForm.setSessionMapID(WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID));
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ /**
+ * Read eadventure data from database and put them into HttpSession. It will redirect to init.do directly after this
+ * method run successfully.
+ *
+ * This method will avoid read database again and lost un-saved resouce item lost when user "refresh page",
+ *
+ */
+ private ActionForward start(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ // initial Session Map
+ SessionMap sessionMap = new SessionMap();
+ request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
+
+ // save toolContentID into HTTPSession
+ ToolAccessMode mode = WebUtil.readToolAccessModeParam(request, AttributeNames.PARAM_MODE, true);
+
+ Long sessionId = new Long(request.getParameter(EadventureConstants.PARAM_TOOL_SESSION_ID));
+
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
+ request.setAttribute(AttributeNames.ATTR_MODE, mode);
+ request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId);
+
+ // get back the eadventure and item list and display them on page
+ IEadventureService service = getEadventureService();
+ EadventureUser eadventureUser = null;
+ if (mode != null && mode.isTeacher()) {
+ // monitoring mode - user is specified in URL
+ // eadventureUser may be null if the user was force completed.
+ eadventureUser = getSpecifiedUser(service, sessionId, WebUtil.readIntParam(request,
+ AttributeNames.PARAM_USER_ID, false));
+ } else {
+ eadventureUser = getCurrentUser(service, sessionId);
+ //TODO mio!!!
+ if (eadventureUser==null){
+ log.debug("VAYA PUES, EADUSER ES NULL!!!!!!!!!!!!!!!!!!!!!!!!1");
+ }else{
+ sessionMap.put(EadventureConstants.ATTR_USER_ID,eadventureUser.getUserId().intValue());
+ sessionMap.put(EadventureConstants.ATTR_USER_FNAME,eadventureUser.getFirstName());
+ sessionMap.put(EadventureConstants.ATTR_USER_LNAME,eadventureUser.getLastName());
+ }
+
+ }
+
+
+ Eadventure eadventure;
+ eadventure = service.getEadventureBySessionId(sessionId);
+ if (eadventure==null)
+ log.error("EAD ===== NULL!!!!!!!!!!");
+
+ // check whehter finish lock is on/off
+ boolean lock = eadventure.getLockWhenFinished() && eadventureUser != null && eadventureUser.isSessionFinished();
+
+ // check whether there is only one eadventure item and run auto flag is true or not.
+ boolean runAuto = false;
+
+ //TODO modify!!
+ // only visible item can be run auto.
+ runAuto = true;
+ request.setAttribute(EadventureConstants.ATTR_RESOURCE_ITEM_UID, eadventure.getUid());
+
+
+
+ // get notebook entry
+ String entryText = new String();
+ boolean completed = false;
+ if (eadventureUser != null) {
+ NotebookEntry notebookEntry = service.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL,
+ EadventureConstants.TOOL_SIGNATURE, eadventureUser.getUserId().intValue());
+ // check if the item is completed previously
+ EadventureItemVisitLog eadLog = service.getEadventureItemLog(eadventure.getUid(), eadventureUser.getUserId());
+ if (eadLog!=null)
+ completed = eadLog.isComplete();
+ if (notebookEntry != null) {
+ entryText = notebookEntry.getEntry();
+ }
+ }
+
+ // check define complete
+ boolean isDefineComplete= false;
+ if (eadventure.isDefineComplete()){
+ List params = service.getEadventureParamByContentId(eadventure.getUid());
+
+ for (EadventureParam param:params){
+ if (param.getName().equals("completed")){
+ isDefineComplete=true;
+ break;
+ }
+ }
+ }
+
+
+ // basic information
+ sessionMap.put(EadventureConstants.ATTR_TITLE, eadventure.getTitle());
+ sessionMap.put(EadventureConstants.ATTR_RESOURCE_INSTRUCTION, eadventure.getInstructions());
+ sessionMap.put(EadventureConstants.ATTR_FINISH_LOCK, lock);
+ sessionMap.put(EadventureConstants.ATTR_LOCK_ON_FINISH, eadventure.getLockWhenFinished());
+ sessionMap.put(EadventureConstants.ATTR_USER_FINISHED, eadventureUser != null && eadventureUser.isSessionFinished());
+
+ //TODO Estamos pasando session ID por atributo y por session!!
+ sessionMap.put(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId);
+ sessionMap.put(AttributeNames.PARAM_TOOL_CONTENT_ID, eadventure.getContentId());
+ sessionMap.put(AttributeNames.ATTR_MODE, mode);
+ // reflection information
+ sessionMap.put(EadventureConstants.ATTR_REFLECTION_ON, eadventure.isReflectOnActivity());
+ sessionMap.put(EadventureConstants.ATTR_REFLECTION_INSTRUCTION, eadventure.getReflectInstructions());
+ sessionMap.put(EadventureConstants.ATTR_REFLECTION_ENTRY, entryText);
+ sessionMap.put(EadventureConstants.ATTR_RUN_AUTO, new Boolean(runAuto));
+ sessionMap.put(EadventureConstants.PARAM_RESOURCE_ITEM_UID, eadventure.getUid());
+ sessionMap.put(EadventureConstants.ATTR_DEFINE_COMPLETED, isDefineComplete);
+ sessionMap.put(EadventureConstants.ATTR_COMPLETED, completed);
+ // add define later support
+ if (eadventure.isDefineLater()) {
+ return mapping.findForward("defineLater");
+ }
+
+ // set contentInUse flag to true!
+ eadventure.setContentInUse(true);
+ eadventure.setDefineLater(false);
+ service.saveOrUpdateEadventure(eadventure);
+
+ // add run offline support
+ if (eadventure.getRunOffline()) {
+ sessionMap.put(EadventureConstants.PARAM_RUN_OFFLINE, true);
+ return mapping.findForward("runOffline");
+ } else {
+ sessionMap.put(EadventureConstants.PARAM_RUN_OFFLINE, false);
+ }
+
+
+
+ // set complete flag for display purpose
+ //TODO getionar el complete
+ //if (eadventureUser != null) {
+ // service.retrieveComplete(eadventureItemList, eadventureUser);
+ //}
+ sessionMap.put(EadventureConstants.ATTR_EADVENTURE, eadventure);
+
+
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ /**
+ * Finish learning session.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward finish(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ // get back SessionMap
+ String sessionMapID = request.getParameter(EadventureConstants.ATTR_SESSION_MAP_ID);
+ //String toolContentID = request.getParameter(EadventureConstants.ATTR_TOOL_CONTENT_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ Long toolContentID = (Long) sessionMap.get(EadventureConstants.ATTR_TOOL_CONTENT_ID);
+ // get mode and ToolSessionID from sessionMAP
+ ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.ATTR_MODE);
+ Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
+
+ // auto run mode, when use finish the only one eadventure item, mark it as complete then finish this activity as
+ // well.
+ String eadventureItemUid = request.getParameter(EadventureConstants.PARAM_RESOURCE_ITEM_UID);
+ IEadventureService service = getEadventureService();
+ Eadventure ead = service.getEadventureByContentId(toolContentID);
+
+ HttpSession ss = SessionManager.getSession();
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ Long userID = new Long(user.getUserID().longValue());
+
+
+ boolean completedFromEad=false;
+ if (ead.isDefineComplete()){
+ EadventureItemVisitLog log = service.getEadventureItemLog(ead.getUid(), userID);
+ EadventureVars var = service.getEadventureVars(log.getUid(), EadventureConstants.VAR_NAME_COMPLETED);
+ if (var!=null&&Boolean.parseBoolean(var.getValue())){
+ completedFromEad=true;
+ }
+ }
+
+ //if (eadventureItemUid != null ){
+
+
+ doComplete(request,ead.getUid());
+ ead.setComplete(true);
+
+ // NOTE:So far this flag is useless(31/08/2006).
+ // set flag, then finish page can know redir target is parent(AUTO_RUN) or self(normal)
+ // request.setAttribute(EadventureConstants.ATTR_RUN_AUTO, true);
+ //} else{
+ // request.setAttribute(EadventureConstants.ATTR_RUN_AUTO, false);
+ //}
+
+ if (!validateBeforeFinish(request, sessionMapID)) {
+ return mapping.getInputForward();
+ }
+
+
+ // get sessionId from HttpServletRequest
+ String nextActivityUrl = null;
+ try {
+ // HttpSession ss = SessionManager.getSession();
+ // UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ // Long userID = new Long(user.getUserID().longValue());
+
+ nextActivityUrl = service.finishToolSession(sessionId, userID);
+ request.setAttribute(EadventureConstants.ATTR_NEXT_ACTIVITY_URL, nextActivityUrl);
+ } catch (EadventureApplicationException e) {
+ LearningAction.log.error("Failed get next activity url:" + e.getMessage());
+ }
+
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ /**
+ * Save file or url eadventure item into database.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ /* private ActionForward saveOrUpdateItem(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ // get back SessionMap
+ String sessionMapID = request.getParameter(EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, sessionMapID);
+
+ Long sessionId = (Long) sessionMap.get(EadventureConstants.ATTR_TOOL_SESSION_ID);
+
+ String mode = request.getParameter(AttributeNames.ATTR_MODE);
+ EadventureItemForm itemForm = (EadventureItemForm) form;
+ ActionErrors errors = validateEadventureItem(itemForm);
+
+ if (!errors.isEmpty()) {
+ this.addErrors(request, errors);
+ return findForward(itemForm.getItemType(), mapping);
+ }
+ short type = itemForm.getItemType();
+
+ // create a new EadventureItem
+ EadventureItem item = new EadventureItem();
+ IEadventureService service = getEadventureService();
+ EadventureUser eadventureUser = getCurrentUser(service, sessionId);
+ item.setType(type);
+ item.setTitle(itemForm.getTitle());
+ item.setDescription(itemForm.getDescription());
+ item.setCreateDate(new Timestamp(new Date().getTime()));
+ item.setCreateByAuthor(false);
+ item.setCreateBy(eadventureUser);
+
+ // special attribute for URL or FILE
+ if (type == EadventureConstants.RESOURCE_TYPE_FILE) {
+ try {
+ service.uploadEadventureItemFile(item, itemForm.getFile());
+ } catch (UploadEadventureFileException e) {
+ LearningAction.log.error("Failed upload Eadventure File " + e.toString());
+ return mapping.findForward(EadventureConstants.ERROR);
+ }
+ } else if (type == EadventureConstants.RESOURCE_TYPE_URL) {
+ item.setUrl(itemForm.getUrl());
+ item.setOpenUrlNewWindow(itemForm.isOpenUrlNewWindow());
+ }
+ // save and update session
+
+ EadventureSession resSession = service.getEadventureSessionBySessionId(sessionId);
+ if (resSession == null) {
+ LearningAction.log.error("Failed update EadventureSession by ID[" + sessionId + "]");
+ return mapping.findForward(EadventureConstants.ERROR);
+ }
+ Set items = resSession.getEadventureItems();
+ if (items == null) {
+ items = new HashSet();
+ resSession.setEadventureItems(items);
+ }
+ items.add(item);
+ service.saveOrUpdateEadventureSession(resSession);
+
+ // update session value
+ SortedSet eadventureItemList = getEadventureItemList(sessionMap);
+ eadventureItemList.add(item);
+
+ // URL or file upload
+ request.setAttribute(EadventureConstants.ATTR_ADD_RESOURCE_TYPE, new Short(type));
+ request.setAttribute(AttributeNames.ATTR_MODE, mode);
+
+ Eadventure eadventure = resSession.getEadventure();
+ if (eadventure.isNotifyTeachersOnAssigmentSumbit()) {
+ List monitoringUsers = service.getMonitorsByToolSessionId(sessionId);
+ if (monitoringUsers != null && !monitoringUsers.isEmpty()) {
+ Long[] monitoringUsersIds = new Long[monitoringUsers.size()];
+ for (int i = 0; i < monitoringUsersIds.length; i++) {
+ monitoringUsersIds[i] = monitoringUsers.get(i).getUserId().longValue();
+ }
+ String fullName = eadventureUser.getLastName() + " " + eadventureUser.getFirstName();
+ service.getEventNotificationService().sendMessage(monitoringUsersIds, DeliveryMethodMail.getInstance(),
+ service.getLocalisedMessage("event.assigment.submit.subject", null),
+ service.getLocalisedMessage("event.assigment.submit.body", new Object[] { fullName }));
+ }
+ }
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ /**
+ * Display empty reflection form.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward newReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ // get session value
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ if (!validateBeforeFinish(request, sessionMapID)) {
+ return mapping.getInputForward();
+ }
+
+ ReflectionForm refForm = (ReflectionForm) form;
+ HttpSession ss = SessionManager.getSession();
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+
+ refForm.setUserID(user.getUserID());
+ refForm.setSessionMapID(sessionMapID);
+
+ // get the existing reflection entry
+ IEadventureService submitFilesService = getEadventureService();
+
+ SessionMap map = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ Long toolSessionID = (Long) map.get(AttributeNames.PARAM_TOOL_SESSION_ID);
+ NotebookEntry entry = submitFilesService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL,
+ EadventureConstants.TOOL_SIGNATURE, user.getUserID());
+
+ if (entry != null) {
+ refForm.setEntryText(entry.getEntry());
+ }
+
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ /**
+ * Submit reflection form input database.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward submitReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ ReflectionForm refForm = (ReflectionForm) form;
+ Integer userId = refForm.getUserID();
+
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
+
+ IEadventureService service = getEadventureService();
+
+ // check for existing notebook entry
+ NotebookEntry entry = service.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL,
+ EadventureConstants.TOOL_SIGNATURE, userId);
+
+ if (entry == null) {
+ // create new entry
+ service.createNotebookEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL,
+ EadventureConstants.TOOL_SIGNATURE, userId, refForm.getEntryText());
+ } else {
+ // update existing entry
+ entry.setEntry(refForm.getEntryText());
+ entry.setLastModified(new Date());
+ service.updateEntry(entry);
+ }
+
+ return finish(mapping, form, request, response);
+ }
+
+ // *************************************************************************************
+ // Private method
+ // *************************************************************************************
+ //TODO valorar eliminarlo
+ private boolean validateBeforeFinish(HttpServletRequest request, String sessionMapID) {
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
+
+ HttpSession ss = SessionManager.getSession();
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ Long userID = new Long(user.getUserID().longValue());
+
+ IEadventureService service = getEadventureService();
+ /*int miniViewFlag = service.checkMiniView(sessionId, userID);
+ // if current user view less than reqired view count number, then just return error message.
+ // if it is runOffline content, then need not check minimum view count
+ Boolean runOffline = (Boolean) sessionMap.get(EadventureConstants.PARAM_RUN_OFFLINE);
+ if (miniViewFlag > 0 && !runOffline) {
+ ActionErrors errors = new ActionErrors();
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("lable.learning.minimum.view.number.less",
+ miniViewFlag));
+ this.addErrors(request, errors);
+ return false;
+ }*/
+
+ return true;
+ }
+
+ private IEadventureService getEadventureService() {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet()
+ .getServletContext());
+ return (IEadventureService) wac.getBean(EadventureConstants.RESOURCE_SERVICE);
+ }
+
+ /**
+ * List save current eadventure items.
+ *
+ * @param request
+ * @return
+ */
+ /* private SortedSet getEadventureItemList(SessionMap sessionMap) {
+ SortedSet list = (SortedSet) sessionMap
+ .get(EadventureConstants.ATTR_RESOURCE_ITEM_LIST);
+ if (list == null) {
+ list = new TreeSet(new EadventureItemComparator());
+ sessionMap.put(EadventureConstants.ATTR_RESOURCE_ITEM_LIST, list);
+ }
+ return list;
+ }
+
+ /**
+ * Get java.util.List
from HttpSession by given name.
+ *
+ * @param request
+ * @param name
+ * @return
+ */
+ private List getListFromSession(SessionMap sessionMap, String name) {
+ List list = (List) sessionMap.get(name);
+ if (list == null) {
+ list = new ArrayList();
+ sessionMap.put(name, list);
+ }
+ return list;
+ }
+
+ /**
+ * Return ActionForward
according to eadventure item type.
+ *
+ * @param type
+ * @param mapping
+ * @return
+ */
+ private ActionForward findForward(short type, ActionMapping mapping) {
+ ActionForward forward;
+ switch (type) {
+ case EadventureConstants.RESOURCE_TYPE_URL:
+ forward = mapping.findForward("url");
+ break;
+ case EadventureConstants.RESOURCE_TYPE_FILE:
+ forward = mapping.findForward("file");
+ break;
+ case EadventureConstants.RESOURCE_TYPE_WEBSITE:
+ forward = mapping.findForward("website");
+ break;
+ case EadventureConstants.RESOURCE_TYPE_LEARNING_OBJECT:
+ forward = mapping.findForward("learningobject");
+ break;
+ default:
+ forward = null;
+ break;
+ }
+ return forward;
+ }
+
+ private EadventureUser getCurrentUser(IEadventureService service, Long sessionId) {
+ // try to get form system session
+ HttpSession ss = SessionManager.getSession();
+ // get back login user DTO
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ EadventureUser eadventureUser = service.getUserByIDAndSession(new Long(user.getUserID().intValue()), sessionId);
+ Eadventure ead = service.getEadventureBySessionId(sessionId);
+ // EadventureUser eadventureUser = service.getUserByIDAndContent(new Long(user.getUserID().intValue()), ead.getContentId());
+
+ if (eadventureUser == null) {
+ EadventureSession session = service.getEadventureSessionBySessionId(sessionId);
+ eadventureUser = new EadventureUser(user, session);
+ // eadventureUser.setEadventure(ead);
+ service.createUser(eadventureUser);
+ log.error("CREAMOS NUEVO USUARIO!!!! en getCurrentUSER");
+ } //TODO meter en un save or update de userDAO
+ //else
+
+ return eadventureUser;
+ }
+
+ private EadventureUser getSpecifiedUser(IEadventureService service, Long sessionId, Integer userId) {
+ EadventureUser eadventureUser = service.getUserByIDAndSession(new Long(userId.intValue()), sessionId);
+ if (eadventureUser == null) {
+ LearningAction.log
+ .error("Unable to find specified user for eadventure activity. Screens are likely to fail. SessionId="
+ + sessionId + " UserId=" + userId);
+ }
+ return eadventureUser;
+ }
+
+ /**
+ * @param itemForm
+ * @return
+ */
+ /*private ActionErrors validateEadventureItem(EadventureItemForm itemForm) {
+ ActionErrors errors = new ActionErrors();
+ if (StringUtils.isBlank(itemForm.getTitle())) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_MSG_TITLE_BLANK));
+ }
+
+ if (itemForm.getItemType() == EadventureConstants.RESOURCE_TYPE_URL) {
+ if (StringUtils.isBlank(itemForm.getUrl())) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_MSG_URL_BLANK));
+ // URL validation: Commom URL validate(1.3.0) work not very well: it can not support http://address:port
+ // format!!!
+ // UrlValidator validator = new UrlValidator();
+ // if(!validator.isValid(itemForm.getUrl()))
+ // errors.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage(EadventureConstants.ERROR_MSG_INVALID_URL));
+ }
+ }
+ // if(itemForm.getItemType() == EadventureConstants.RESOURCE_TYPE_WEBSITE
+ // ||itemForm.getItemType() == EadventureConstants.RESOURCE_TYPE_LEARNING_OBJECT){
+ // if(StringUtils.isBlank(itemForm.getDescription()))
+ // errors.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage(EadventureConstants.ERROR_MSG_DESC_BLANK));
+ // }
+ if (itemForm.getItemType() == EadventureConstants.RESOURCE_TYPE_WEBSITE
+ || itemForm.getItemType() == EadventureConstants.RESOURCE_TYPE_LEARNING_OBJECT
+ || itemForm.getItemType() == EadventureConstants.RESOURCE_TYPE_FILE) {
+
+ if (itemForm.getFile() != null && FileUtil.isExecutableFile(itemForm.getFile().getFileName())) {
+ ActionMessage msg = new ActionMessage("error.attachment.executable");
+ errors.add(ActionMessages.GLOBAL_MESSAGE, msg);
+ }
+
+ // validate item size
+ FileValidatorUtil.validateFileSize(itemForm.getFile(), false, errors);
+
+ // for edit validate: file already exist
+ if (!itemForm.isHasFile()
+ && (itemForm.getFile() == null || StringUtils.isEmpty(itemForm.getFile().getFileName()))) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(EadventureConstants.ERROR_MSG_FILE_BLANK));
+ }
+ }
+ return errors;
+ }*/
+
+ /**
+ * Set complete flag for given eadventure item.
+ *
+ * @param request
+ * @param sessionId
+ */
+ private void doComplete(HttpServletRequest request, Long eadUid) {
+ // get back sessionMap
+ String sessionMapID = request.getParameter(EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+
+ //Long eadventureItemUid = new Long(request.getParameter(EadventureConstants.PARAM_RESOURCE_ITEM_UID));
+ IEadventureService service = getEadventureService();
+ HttpSession ss = SessionManager.getSession();
+ // get back login user DTO
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+
+ Long sessionId = (Long) sessionMap.get(EadventureConstants.ATTR_TOOL_SESSION_ID);
+ service.setItemComplete(eadUid, new Long(user.getUserID().intValue()), sessionId);
+
+ // set eadventure item complete tag
+ //TODO asignar complete
+ /*SortedSet eadventureItemList = getEadventureItemList(sessionMap);
+ for (EadventureItem item : eadventureItemList) {
+ if (item.getUid().equals(eadventureItemUid)) {
+ item.setComplete(true);
+ break;
+ }
+ }*/
+ }
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/MonitoringAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/MonitoringAction.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/MonitoringAction.java 2 Nov 2010 22:16:35 -0000 1.1
@@ -0,0 +1,278 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: MonitoringAction.java,v 1.1 2010/11/02 22:16:35 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.web.action;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.lamsfoundation.lams.notebook.model.NotebookEntry;
+import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants;
+import org.eucm.lams.tool.eadventure.EadventureConstants;
+import org.eucm.lams.tool.eadventure.dto.ReflectDTO;
+import org.eucm.lams.tool.eadventure.dto.Summary;
+import org.eucm.lams.tool.eadventure.model.Eadventure;
+import org.eucm.lams.tool.eadventure.model.EadventureItemVisitLog;
+import org.eucm.lams.tool.eadventure.model.EadventureSession;
+import org.eucm.lams.tool.eadventure.model.EadventureUser;
+import org.eucm.lams.tool.eadventure.model.EadventureVars;
+import org.eucm.lams.tool.eadventure.service.IEadventureService;
+import org.lamsfoundation.lams.tool.ToolOutput;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.web.util.AttributeNames;
+import org.lamsfoundation.lams.web.util.SessionMap;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+public class MonitoringAction extends Action {
+ public static Logger log = Logger.getLogger(MonitoringAction.class);
+
+ @Override
+ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ String param = mapping.getParameter();
+
+ request.setAttribute("initialTabId", WebUtil.readLongParam(request, AttributeNames.PARAM_CURRENT_TAB, true));
+
+ if (param.equals("summary")) {
+ return summary(mapping, form, request, response);
+ }
+
+ if (param.equals("listuser")) {
+ return listuser(mapping, form, request, response);
+ }
+ if (param.equals("showitem")) {
+ return showitem(mapping, form, request, response);
+ }
+ if (param.equals("hideitem")) {
+ return hideitem(mapping, form, request, response);
+ }
+ if (param.equals("viewReflection")) {
+ return viewReflection(mapping, form, request, response);
+ }
+ if (param.equals("showReport")) {
+ return showReport(mapping, form, request, response);
+ }
+
+ return mapping.findForward(EadventureConstants.ERROR);
+ }
+
+ private ActionForward showReport(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ // get back SessionMap
+ String sessionMapID = request.getParameter(EadventureConstants.ATTR_SESSION_MAP_ID);
+ //SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ //request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
+
+
+ IEadventureService service = getEadventureService();
+ Long sessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID);
+ EadventureSession session = service.getEadventureSessionBySessionId(sessionId);
+ Eadventure ead = session.getEadventure();
+ Long uid = WebUtil.readLongParam(request, EadventureConstants.ATTR_USER_UID);
+ EadventureUser user = service.getUser(uid);
+
+ //TODO gestionar el report
+ //EadventureResult result = service.getLastEadventureResult(ead.getUid(), user.getUserId());
+ //
+ EadventureItemVisitLog log = service.getEadventureItemLog(ead.getUid(), user.getUserId());
+
+ EadventureVars var = service.getEadventureVars(log.getUid(), EadventureConstants.VAR_NAME_REPORT);
+ request.setAttribute("html", var.getValue());
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ private ActionForward hideitem(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ Long itemUid = WebUtil.readLongParam(request, EadventureConstants.PARAM_RESOURCE_ITEM_UID);
+ IEadventureService service = getEadventureService();
+ service.setItemVisible(itemUid, false);
+
+ // get back SessionMap
+ String sessionMapID = request.getParameter(EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
+
+ // update session value
+ List groupList = (List) sessionMap.get(EadventureConstants.ATTR_SUMMARY_LIST);
+ if (groupList != null) {
+ for (List group : groupList) {
+ for (Summary sum : group) {
+ if (itemUid.equals(sum.getItemUid())) {
+ sum.setItemHide(true);
+ break;
+ }
+ }
+ }
+ }
+
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ private ActionForward showitem(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ Long itemUid = WebUtil.readLongParam(request, EadventureConstants.PARAM_RESOURCE_ITEM_UID);
+ IEadventureService service = getEadventureService();
+ service.setItemVisible(itemUid, true);
+
+ // get back SessionMap
+ String sessionMapID = request.getParameter(EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
+
+ // update session value
+ List groupList = (List) sessionMap.get(EadventureConstants.ATTR_SUMMARY_LIST);
+ if (groupList != null) {
+ for (List group : groupList) {
+ for (Summary sum : group) {
+ if (itemUid.equals(sum.getItemUid())) {
+ sum.setItemHide(false);
+ break;
+ }
+ }
+ }
+ }
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ private ActionForward summary(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ // initial Session Map
+ SessionMap sessionMap = new SessionMap();
+ request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
+ // save contentFolderID into session
+ sessionMap.put(AttributeNames.PARAM_CONTENT_FOLDER_ID, WebUtil.readStrParam(request,
+ AttributeNames.PARAM_CONTENT_FOLDER_ID));
+
+ Long contentId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID);
+ IEadventureService service = getEadventureService();
+ List groupList = service.getSummary(contentId);
+
+ Eadventure eadventure = service.getEadventureByContentId(contentId);
+ eadventure.toDTO();
+
+ Map> relectList = service.getReflectList(contentId, false);
+
+ // cache into sessionMap
+ sessionMap.put(EadventureConstants.ATTR_SUMMARY_LIST, groupList);
+ sessionMap.put(EadventureConstants.PAGE_EDITABLE, eadventure.isContentInUse());
+ sessionMap.put(EadventureConstants.ATTR_EADVENTURE, eadventure);
+ sessionMap.put(EadventureConstants.ATTR_TOOL_CONTENT_ID, contentId);
+ sessionMap.put(EadventureConstants.ATTR_REFLECT_LIST, relectList);
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ private ActionForward listuser(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ Long sessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID);
+ Long itemUid = WebUtil.readLongParam(request, EadventureConstants.PARAM_RESOURCE_ITEM_UID);
+
+ // get user list by given item uid
+ IEadventureService service = getEadventureService();
+ List list = service.getUserListBySessionItem(sessionId, itemUid);
+
+ // set to request
+ request.setAttribute(EadventureConstants.ATTR_USER_LIST, list);
+ // check if there are associated report
+ EadventureSession session = service.getEadventureSessionBySessionId(sessionId);
+ Eadventure ead = session.getEadventure();
+ Long uid = WebUtil.readLongParam(request, EadventureConstants.ATTR_USER_UID);
+ EadventureUser user = service.getUser(uid);
+
+ //TODO gestionar el report
+ //EadventureResult result = service.getLastEadventureResult(ead.getUid(), user.getUserId());
+ EadventureItemVisitLog log = service.getEadventureItemLog(ead.getUid(), user.getUserId());
+
+ EadventureVars var = service.getEadventureVars(log.getUid(), EadventureConstants.VAR_NAME_REPORT);
+
+
+ int exist;
+ if (var!=null)
+ exist=0;
+ else
+ exist=1;
+ String sessionMapID = request.getParameter(EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
+
+ sessionMap.put("existFile", exist);
+ //request.setAttribute("existFile",exist );
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ private ActionForward viewReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ Long uid = WebUtil.readLongParam(request, EadventureConstants.ATTR_USER_UID);
+ Long sessionID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID);
+
+ IEadventureService service = getEadventureService();
+ EadventureUser user = service.getUser(uid);
+ NotebookEntry notebookEntry = service.getEntry(sessionID, CoreNotebookConstants.NOTEBOOK_TOOL,
+ EadventureConstants.TOOL_SIGNATURE, user.getUserId().intValue());
+
+ EadventureSession session = service.getEadventureSessionBySessionId(sessionID);
+
+ ReflectDTO refDTO = new ReflectDTO(user);
+ if (notebookEntry == null) {
+ refDTO.setFinishReflection(false);
+ refDTO.setReflect(null);
+ } else {
+ refDTO.setFinishReflection(true);
+ refDTO.setReflect(notebookEntry.getEntry());
+ }
+ refDTO.setReflectInstrctions(session.getEadventure().getReflectInstructions());
+
+ request.setAttribute("userDTO", refDTO);
+ return mapping.findForward("success");
+ }
+
+ // *************************************************************************************
+ // Private method
+ // *************************************************************************************
+ private IEadventureService getEadventureService() {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet()
+ .getServletContext());
+ return (IEadventureService) wac.getBean(EadventureConstants.RESOURCE_SERVICE);
+ }
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/ViewItemAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/ViewItemAction.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/action/ViewItemAction.java 2 Nov 2010 22:16:35 -0000 1.1
@@ -0,0 +1,254 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: ViewItemAction.java,v 1.1 2010/11/02 22:16:35 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.web.action;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.lang.math.NumberUtils;
+import org.apache.log4j.Logger;
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.lamsfoundation.lams.tool.ToolAccessMode;
+import org.eucm.lams.tool.eadventure.EadventureConstants;
+import org.eucm.lams.tool.eadventure.dto.InstructionNavDTO;
+import org.eucm.lams.tool.eadventure.model.Eadventure;
+import org.eucm.lams.tool.eadventure.service.IEadventureService;
+import org.eucm.lams.tool.eadventure.service.EadventureServiceProxy;
+import org.eucm.lams.tool.eadventure.util.EadventureWebUtils;
+import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.web.session.SessionManager;
+import org.lamsfoundation.lams.web.util.AttributeNames;
+import org.lamsfoundation.lams.web.util.SessionMap;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+public class ViewItemAction extends Action {
+
+ private static final Logger log = Logger.getLogger(ViewItemAction.class);
+
+ private static IEadventureService eadventureService;
+
+ public ActionForward execute(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
+
+ String param = mapping.getParameter();
+ //-----------------------Display Learning Object function ---------------------------
+ if (param.equals("reviewItem")) {
+ return reviewItem(mapping, form, request, response);
+ }
+ //for preview top frame html page use:
+ if (param.equals("nextInstruction")) {
+ return nextInstruction(mapping, form, request, response);
+ }
+ //for preview top frame html page use:
+ if (param.equals("openUrlPopup")) {
+ //return openUrlPopup(mapping, form, request, response);
+ }
+
+ return mapping.findForward(EadventureConstants.ERROR);
+ }
+ /**
+ * Open url in popup window page.
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ //TODO ver si lo quitamos
+ /*private ActionForward openUrlPopup(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+ String mode = request.getParameter(AttributeNames.ATTR_MODE);
+
+ if (eadventureService == null) {
+ eadventureService = EadventureServiceProxy.getEadventureService(getServlet().getServletContext());
+ }
+
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap)request.getSession().getAttribute(sessionMapID);
+
+ EadventureItem item = getEadventureItem(request,sessionMap, mode);
+
+ request.setAttribute(EadventureConstants.PARAM_OPEN_URL_POPUP,item.getUrl());
+ request.setAttribute(EadventureConstants.PARAM_TITLE,item.getTitle());
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }*/
+ /**
+ * Return next instrucion to page. It need four input parameters, mode, itemIndex or itemUid, and insIdx.
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward nextInstruction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+ String mode = request.getParameter(AttributeNames.ATTR_MODE);
+
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap)request.getSession().getAttribute(sessionMapID);
+
+ Eadventure ead = getEadventure(request, sessionMap, mode);
+ if(ead == null){
+ return mapping.findForward(EadventureConstants.ERROR);
+ }
+
+ String instruction = ead.getInstructions();
+ InstructionNavDTO navDto = new InstructionNavDTO();
+ navDto.setTitle(ead.getTitle());
+ navDto.setInstruction(instruction);
+
+ request.setAttribute(EadventureConstants.ATTR_TOOL_CONTENT_ID,ead.getContentId());
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID,sessionMapID);
+ request.setAttribute(EadventureConstants.ATTR_RESOURCE_INSTRUCTION,navDto);
+
+ return mapping.findForward(EadventureConstants.SUCCESS);
+ }
+
+ /**
+ * Display main frame to display instrcution and item content.
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward reviewItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+ String mode = request.getParameter(AttributeNames.ATTR_MODE);
+
+ String sessionMapID = WebUtil.readStrParam(request, EadventureConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap)request.getSession().getAttribute(sessionMapID);
+
+ Eadventure ead = getEadventure(request,sessionMap, mode);
+
+ String idStr = request.getParameter(EadventureConstants.ATTR_TOOL_SESSION_ID);
+ Long sessionId = NumberUtils.createLong(idStr);
+ //mark this item access flag if it is learner
+ if(ToolAccessMode.LEARNER.toString().equals(mode)){
+ IEadventureService service = getEadventureService();
+ HttpSession ss = SessionManager.getSession();
+ //get back login user DTO
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ log.error("Vamos a setear el userID!!!!!!!!!!!!!!");
+ log.error("el usuario se llama "+ user.getFirstName());
+ log.error("su ID es "+ user.getUserID());
+
+ service.setItemAccess(ead.getUid(),new Long(user.getUserID().intValue()),sessionId);
+ }
+
+ if(ead == null){
+ return mapping.findForward(EadventureConstants.ERROR);
+ }
+ // TODO revisar
+ sessionMap.put(EadventureConstants.ATT_LEARNING_OBJECT,ead);
+
+
+ //params to eaGame
+ /*sessionMap.put(EadventureConstants.ATT_LEARNING_OBJECT,item);
+ sessionMap.put(EadventureConstants.ATT_LEARNING_OBJECT,item);
+ sessionMap.put(EadventureConstants.ATT_LEARNING_OBJECT,item);
+ sessionMap.put(EadventureConstants.ATT_LEARNING_OBJECT,item);*/
+
+ String reviewURL = "/pages/learningobj/mainframe.jsp?sessionMapID="+sessionMapID;
+ int itemIdx = NumberUtils.stringToInt(request.getParameter(EadventureConstants.PARAM_ITEM_INDEX));
+ request.setAttribute(EadventureConstants.ATTR_RESOURCE_REVIEW_URL,reviewURL);
+ //these attribute will be use to instruction navigator page
+ request.setAttribute(AttributeNames.ATTR_MODE,mode);
+ request.setAttribute(EadventureConstants.PARAM_ITEM_INDEX,itemIdx);
+ Long itemUid = NumberUtils.createLong(request.getParameter(EadventureConstants.PARAM_RESOURCE_ITEM_UID));
+ request.setAttribute(EadventureConstants.PARAM_RESOURCE_ITEM_UID,itemUid);
+ request.setAttribute(EadventureConstants.ATTR_TOOL_SESSION_ID,sessionId);
+ request.setAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID,ead.getContentId());
+ request.setAttribute(EadventureConstants.ATTR_SESSION_MAP_ID,sessionMapID);
+
+ return mapping.findForward(EadventureConstants.SUCCESS);
+
+ }
+ //*************************************************************************************
+ // Private method
+ //*************************************************************************************
+ /**
+ * Return eadventure according to ToolAccessMode.
+ * @param request
+ * @param sessionMap
+ * @param mode
+ * @return
+ */
+ private Eadventure getEadventure(HttpServletRequest request, SessionMap sessionMap, String mode) {
+ Eadventure ead = null;
+ if(EadventureConstants.MODE_AUTHOR_SESSION.equals(mode)){
+ //int itemIdx = NumberUtils.stringToInt(request.getParameter(EadventureConstants.PARAM_ITEM_INDEX),0);
+ //authoring: does not save item yet, so only has ItemList from session and identity by Index
+ //List eadventureList = new ArrayList(getEadventureItemList(sessionMap));
+ ead = (Eadventure) sessionMap.get(EadventureConstants.ATTR_EADVENTURE);
+ }else{
+ //Long contentId = NumberUtils.createLong(request.getParameter(EadventureConstants.PARAM_TOOL_CONTENT_ID));
+ Long contentId = ((Long)sessionMap.get(EadventureConstants.PARAM_TOOL_CONTENT_ID));
+ //get back the eadventure and item list and display them on page
+ IEadventureService service = getEadventureService();
+ ead = service.getEadventureByContentId(contentId);
+
+ }
+ return ead;
+ }
+
+ private IEadventureService getEadventureService() {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet().getServletContext());
+ return (IEadventureService) wac.getBean(EadventureConstants.RESOURCE_SERVICE);
+ }
+
+ private static Pattern wikipediaPattern = Pattern.compile("wikipedia", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
+
+
+ /**
+ * List save current eadventure items.
+ * @param request
+ * @return
+ */
+ /*private SortedSet getEadventureItemList(SessionMap sessionMap) {
+ SortedSet list = (SortedSet) sessionMap.get(EadventureConstants.ATTR_RESOURCE_ITEM_LIST);
+ if(list == null){
+ list = new TreeSet(new EadventureItemComparator());
+ sessionMap.put(EadventureConstants.ATTR_RESOURCE_ITEM_LIST,list);
+ }
+ return list;
+ }*/
+
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventureConditionForm.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventureConditionForm.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventureConditionForm.java 2 Nov 2010 22:16:40 -0000 1.1
@@ -0,0 +1,132 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureConditionForm.java,v 1.1 2010/11/02 22:16:40 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.web.form;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.util.LabelValueBean;
+
+/**
+ * Form responsible for representing EadventureCondition
objects on a view layer.
+ *
+ * @author Andrey Balan
+ * @author Angel del Blanco
+ *
+ * @struts.form name="eadventureConditionForm"
+ */
+public class EadventureConditionForm extends ActionForm {
+
+ //tool access mode;
+ private String mode;
+ private String sessionMapID;
+
+ private String name;
+
+ private String position;
+
+ private Set expressionList;
+ // Link the name of the variable with their UUID
+ //TODO renombrar a possibleParams
+ //private LabelValueBean[] possibleVars;
+ //TODO tiene que ser solo un string, ya que no permitimos seleccion multiple
+ //private String[] selectedItems;
+
+ public EadventureConditionForm() {
+ super();
+ expressionList = new HashSet();
+ }
+
+ /**
+ * Returns TaskListCondition name.
+ *
+ * @return TaskListCondition name
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * Sets TaskListCondition title.
+ *
+ * @param title TaskListCondition title
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Returns current SessionMapID.
+ *
+ * @return current SessionMapID
+ */
+ public String getSessionMapID() {
+ return sessionMapID;
+ }
+ /**
+ * Sets current SessionMapID.
+ *
+ * @param sessionMapID current SessionMapID
+ */
+ public void setSessionMapID(String sessionMapID) {
+ this.sessionMapID = sessionMapID;
+ }
+
+ /**
+ * Returns working mode.
+ *
+ * @return working mode
+ */
+ public String getMode() {
+ return mode;
+ }
+ /**
+ * Returns working mode.
+ *
+ * @param mode working mode
+ */
+ public void setMode(String mode) {
+ this.mode = mode;
+ }
+
+ public Set getExpressionList() {
+ return expressionList;
+ }
+
+ public void setExpressionList(Set expressionList) {
+ this.expressionList = expressionList;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+}
+
+
+
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventureExpressionForm.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventureExpressionForm.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventureExpressionForm.java 2 Nov 2010 22:16:40 -0000 1.1
@@ -0,0 +1,154 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureExpressionForm.java,v 1.1 2010/11/02 22:16:40 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.web.form;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.util.LabelValueBean;
+
+/**
+ * Form responsible for representing EadventureExpression
objects on a view layer.
+ *
+ * @author Angel del Blanco
+ *
+ * @struts.form name="eadventureExpressionForm"
+ */
+public class EadventureExpressionForm extends ActionForm {
+
+ private String sessionMapID;
+
+ private String position;
+ // Link the name of the variable with their UUID for the first param
+ private String[] possibleVarsOp1;
+ private String selectedVarOp1;
+ // Select the operator
+ private String[] possibleOperator;
+ private String selectedOperator;
+ // Link the name of the variable with their UUID for the second param
+ private String[] possibleVarsOp2;
+ private String selectedVarOp2;
+ //TODO comprobar el tipo!!!
+ private String introducedValue;
+ // this var identifies if the user selects to introduce a value (false) or a variable as second op (true)
+ private boolean isSecondVarSelected;
+
+
+ private String nextOp;
+
+ public EadventureExpressionForm() {
+ super();
+ position = "-1";
+ }
+
+ public String getSessionMapID() {
+ return sessionMapID;
+ }
+
+ public void setSessionMapID(String sessionMapID) {
+ this.sessionMapID = sessionMapID;
+ }
+
+ public String[] getPossibleVarsOp1() {
+ return possibleVarsOp1;
+ }
+
+ public void setPossibleVarsOp1(String[] possibleVarsOp1) {
+ this.possibleVarsOp1 = possibleVarsOp1;
+ }
+
+ public String getSelectedVarOp1() {
+ return selectedVarOp1;
+ }
+
+ public void setSelectedVarOp1(String selectedVarOp1) {
+ this.selectedVarOp1 = selectedVarOp1;
+ }
+
+ public String[] getPossibleVarsOp2() {
+ return possibleVarsOp2;
+ }
+
+ public void setPossibleVarsOp2(String[] possibleVarsOp2) {
+ this.possibleVarsOp2 = possibleVarsOp2;
+ }
+
+ public String getSelectedVarOp2() {
+ return selectedVarOp2;
+ }
+
+ public void setSelectedVarOp2(String selectedVarOp2) {
+ this.selectedVarOp2 = selectedVarOp2;
+ }
+
+ public String getIntroducedValue() {
+ return introducedValue;
+ }
+
+ public void setIntroducedValue(String introducedValue) {
+ this.introducedValue = introducedValue;
+ }
+
+ public String[] getPossibleOperator() {
+ return possibleOperator;
+ }
+
+ public void setPossibleOperator(String[] possibleOperator) {
+ this.possibleOperator = possibleOperator;
+ }
+
+ public String getSelectedOperator() {
+ return selectedOperator;
+ }
+
+ public void setSelectedOperator(String selectedOperator) {
+ this.selectedOperator = selectedOperator;
+ }
+
+
+
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String position) {
+ this.position = position;
+ }
+
+ public String getNextOp() {
+ return nextOp;
+ }
+
+ public void setNextOp(String nextOp) {
+ this.nextOp = nextOp;
+ }
+
+ public boolean isSecondVarSelected() {
+ return isSecondVarSelected;
+ }
+
+ public void setSecondVarSelected(boolean isSecondVarSelected) {
+ this.isSecondVarSelected = isSecondVarSelected;
+ }
+
+}
+
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventureForm.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventureForm.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventureForm.java 2 Nov 2010 22:16:40 -0000 1.1
@@ -0,0 +1,152 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id: EadventureForm.java,v 1.1 2010/11/02 22:16:40 angel.dba Exp $$ */
+package org.eucm.lams.tool.eadventure.web.form;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.upload.FormFile;
+import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler;
+import org.eucm.lams.tool.eadventure.model.Eadventure;
+import org.eucm.lams.tool.eadventure.model.EadventureAttachment;
+
+/**
+ *
+ * Eadventure Form.
+ * @struts.form name="eadventureForm"
+ *
+ * User: Dapeng.Ni
+ */
+public class EadventureForm extends ActionForm {
+ private static final long serialVersionUID = 3599879328307492312L;
+
+ private static Logger logger = Logger.getLogger(EadventureForm.class.getName());
+
+ //Forum fields
+ private String sessionMapID;
+ private String contentFolderID;
+ private int currentTab;
+ private FormFile offlineFile;
+ private FormFile onlineFile;
+
+ //flag of this item has attachment or not
+ private boolean hasFile;
+
+ private Eadventure eadventure;
+
+ public EadventureForm(){
+ eadventure = new Eadventure();
+ eadventure.setTitle("eAdventure");
+ currentTab = 1;
+ }
+
+ public void resetFileInfo(){
+ hasFile= false;
+ }
+
+ public void setEadventure(Eadventure eadventure) {
+ this.eadventure = eadventure;
+ if(eadventure == null){
+ logger.error("Initial EadventureForum failed by null value of Eadventure.");
+ }
+ }
+ public void reset(ActionMapping mapping, HttpServletRequest request){
+ String param = mapping.getParameter();
+ //if it is start page, all data read out from database or current session
+ //so need not reset checkbox to refresh value!
+ if(!StringUtils.equals(param,"start") && !StringUtils.equals(param,"initPage")){
+ eadventure.setDefineComplete(false);
+ eadventure.setLockWhenFinished(false);
+ eadventure.setDefineLater(false);
+ eadventure.setRunOffline(false);
+ eadventure.setReflectOnActivity(false);
+ }
+ }
+
+ public int getCurrentTab() {
+ return currentTab;
+ }
+
+
+ public void setCurrentTab(int currentTab) {
+ this.currentTab = currentTab;
+ }
+
+
+ public FormFile getOfflineFile() {
+ return offlineFile;
+ }
+
+
+ public void setOfflineFile(FormFile offlineFile) {
+ this.offlineFile = offlineFile;
+ }
+
+
+ public FormFile getOnlineFile() {
+ return onlineFile;
+ }
+
+
+ public void setOnlineFile(FormFile onlineFile) {
+ this.onlineFile = onlineFile;
+ }
+
+
+ public Eadventure getEadventure() {
+ return eadventure;
+ }
+
+ public String getSessionMapID() {
+ return sessionMapID;
+ }
+
+ public void setSessionMapID(String sessionMapID) {
+ this.sessionMapID = sessionMapID;
+ }
+
+ public String getContentFolderID() {
+ return contentFolderID;
+ }
+
+ public void setContentFolderID(String contentFolderID) {
+ this.contentFolderID = contentFolderID;
+ }
+
+ public boolean isHasFile() {
+ return hasFile;
+ }
+
+ public void setHasFile(boolean hasFile) {
+ this.hasFile = hasFile;
+ }
+}
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventureGameForm.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventureGameForm.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventureGameForm.java 2 Nov 2010 22:16:40 -0000 1.1
@@ -0,0 +1,81 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventureGameForm.java,v 1.1 2010/11/02 22:16:40 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.web.form;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.upload.FormFile;
+
+
+/**
+ * Form responsible for representing EadventureCondition
objects on a view layer.
+ *
+ * @author Angel del Blanco
+ *
+ * @struts.form name="eadventureGameForm"
+ */
+public class EadventureGameForm extends ActionForm {
+
+
+ private FormFile file;
+
+ private String sessionMapID;
+
+ private String fileName;
+
+
+ public EadventureGameForm(){
+
+ }
+
+ public String getSessionMapID() {
+ return sessionMapID;
+ }
+
+
+ public void setSessionMapID(String sessionMapID) {
+ this.sessionMapID = sessionMapID;
+ }
+
+ public FormFile getFile() {
+ return file;
+ }
+
+
+ public void setFile(FormFile file) {
+ this.file = file;
+ }
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+
+
+
+}
+
\ No newline at end of file
Index: lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventurePedagogicalPlannerForm.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventurePedagogicalPlannerForm.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_eadventure/src/java/org/eucm/lams/tool/eadventure/web/form/EadventurePedagogicalPlannerForm.java 2 Nov 2010 22:16:40 -0000 1.1
@@ -0,0 +1,310 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id: EadventurePedagogicalPlannerForm.java,v 1.1 2010/11/02 22:16:40 angel.dba Exp $ */
+package org.eucm.lams.tool.eadventure.web.form;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+import org.apache.struts.upload.FormFile;
+import org.eucm.lams.tool.eadventure.EadventureConstants;
+import org.eucm.lams.tool.eadventure.model.Eadventure;
+import org.lamsfoundation.lams.util.FileValidatorUtil;
+import org.lamsfoundation.lams.web.planner.PedagogicalPlannerActivityForm;
+
+/**
+ * @struts.form name="pedagogicalPlannerForm"
+ */
+public class EadventurePedagogicalPlannerForm extends PedagogicalPlannerActivityForm {
+ private List title;
+ private List url;
+ private List file;
+ private List fileName;
+ private List fileUuid;
+ private List