Index: lams_tool_nb/.classpath
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/.classpath,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/.classpath 7 Jun 2005 05:52:19 -0000 1.1
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_nb/.mymetadata
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/.mymetadata,v
diff -u
Binary files differ
Index: lams_tool_nb/.mystrutsdata
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/.mystrutsdata,v
diff -u
Binary files differ
Index: lams_tool_nb/.project
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/.project,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/.project 7 Jun 2005 05:52:19 -0000 1.1
@@ -0,0 +1,50 @@
+
+
+ lams_tool_noticeboard
+
+
+
+
+
+ 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.ast.deploy.core.DeploymentBuilder
+
+
+
+
+
+ com.genuitec.eclipse.ast.deploy.core.deploymentnature
+ com.genuitec.eclipse.j2eedt.core.webnature
+ org.eclipse.jdt.core.javanature
+ com.genuitec.eclipse.cross.easystruts.eclipse.easystrutsnature
+
+
Index: lams_tool_nb/build.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/build.properties,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/build.properties 7 Jun 2005 05:52:19 -0000 1.1
@@ -0,0 +1,79 @@
+# Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+#
+# 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+#
+# http://www.gnu.org/licenses/gpl.txt
+
+# project-wide properties
+project=LAMS
+product=lams-tool-noticeboard
+project_version=1.1
+
+# xdoclet properties
+xdoclet.version=1.2.2
+
+# path properties
+lib=${basedir}/lib
+sharedlib=../lams_build/lib
+j2eelibs=C:/MyEclipse/eclipse/plugins/com.genuitec.eclipse.j2eedt.core_3.8.4/data/libraryset/1.4
+
+sql=${basedir}/db/sql
+src=${basedir}/src
+src.java=${basedir}/src/java
+src.test=${basedir}/test/java
+conf=${basedir}/conf
+
+jboss=${conf}/jboss
+
+hibernate=${conf}/hibernate
+hibernate.mappings=${hibernate}/mapping
+
+web=${basedir}/web
+webinf=${web}/WEB-INF
+
+xdoclet=${conf}/xdoclet
+
+# /var/jboss
+jboss.home=D:/jboss-3.2.6/
+jboss.deploy=${jboss.home}/server/default/deploy/lams.ear
+
+build=${basedir}/build
+build.classes.java=${build}/classes/java
+build.classes.test=${build}/classes/test
+build.lib=${build}/lib
+build.report=${build}/report
+
+package=org/lamsfoundation/lams/tool/noticeboard
+package.name=org.lamsfoundation.lams.tool.noticeboard
+
+
+# database related properties
+database.driver.file=${sharedlib}/mysql/mysql-connector-java-3.1.7-bin.jar
+database.driver.classpath=${database.driver.file}
+database.driver=org.gjt.mm.mysql.Driver
+database.url=jdbc:mysql://localhost/lams?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull
+database.userid=lams
+database.password=lamsdemo
+database.schema=lams
+database.catalog=s
+
+# middlegen properties
+middlegen=${conf}/middlegen
+middlegen.gui=true
+
+# application properties
+sessiontimeout=120
+
Index: lams_tool_nb/build.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/build.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/build.xml 7 Jun 2005 05:52:19 -0000 1.1
@@ -0,0 +1,320 @@
+
+
+
+
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_nb/velocity.log
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/Attic/velocity.log,v
diff -u
Binary files differ
Index: lams_tool_nb/conf/hibernate/mapping/org/lamsfoundation/lams/tool/noticeboard/NoticeboardContent.hbm.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/conf/hibernate/mapping/org/lamsfoundation/lams/tool/noticeboard/Attic/NoticeboardContent.hbm.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/conf/hibernate/mapping/org/lamsfoundation/lams/tool/noticeboard/NoticeboardContent.hbm.xml 7 Jun 2005 05:52:19 -0000 1.1
@@ -0,0 +1,178 @@
+
+
+
+
+
+
+
+
+ @hibernate.class
+ table="tl_lanb11_content"
+
+
+
+
+ @hibernate.id
+ generator-class="assigned"
+ type="java.lang.Long"
+ column="nb_content_id"
+
+
+
+
+
+
+
+
+ @hibernate.property
+ column="title"
+ length="255"
+
+
+
+
+ @hibernate.property
+ column="content"
+ length="65535"
+
+
+
+
+ @hibernate.property
+ column="online_instructions"
+ length="65535"
+
+
+
+
+ @hibernate.property
+ column="offline_instructions"
+ length="65535"
+
+
+
+
+ @hibernate.property
+ column="define_later"
+ length="1"
+
+
+
+
+ @hibernate.property
+ column="force_offline"
+ length="1"
+
+
+
+
+ @hibernate.property
+ column="creator_user_id"
+ length="20"
+
+
+
+
+ @hibernate.property
+ column="date_created"
+ length="19"
+
+
+
+
+ @hibernate.property
+ column="date_updated"
+ length="19"
+
+
+
+
+
+
+
+
+ @hibernate.set
+ lazy="true"
+ inverse="true"
+ cascade="none"
+
+ @hibernate.collection-key
+ column="nb_content_id"
+
+ @hibernate.collection-one-to-many
+ class="org.lamsfoundation.lams.tool.noticeboard.NoticeboardSession"
+
+
+
+
+
+
+
+
+
Index: lams_tool_nb/conf/hibernate/mapping/org/lamsfoundation/lams/tool/noticeboard/NoticeboardSession.hbm.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/conf/hibernate/mapping/org/lamsfoundation/lams/tool/noticeboard/Attic/NoticeboardSession.hbm.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/conf/hibernate/mapping/org/lamsfoundation/lams/tool/noticeboard/NoticeboardSession.hbm.xml 7 Jun 2005 05:52:19 -0000 1.1
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+ @hibernate.class
+ table="tl_lanb11_session"
+
+
+
+
+ @hibernate.id
+ generator-class="assigned"
+ type="java.lang.Long"
+ column="nb_session_id"
+
+
+
+
+
+
+
+
+ @hibernate.property
+ column="session_start_date"
+ length="19"
+
+
+
+
+ @hibernate.property
+ column="session_end_date"
+ length="19"
+
+
+
+
+ @hibernate.property
+ column="session_status"
+ length="100"
+
+
+
+
+
+
+
+
+ @hibernate.many-to-one
+ not-null="true"
+ @hibernate.column name="nb_content_id"
+
+
+
+
+
+
Index: lams_tool_nb/conf/jar/META-INF/MANIFEST.MF
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/conf/jar/META-INF/Attic/MANIFEST.MF,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/conf/jar/META-INF/MANIFEST.MF 7 Jun 2005 05:52:19 -0000 1.1
@@ -0,0 +1,3 @@
+Implementation-Title: Noticeboard Tool
+Implementation-Version: 0.1
+Implementation-Vendor: LAMS Foundation (http://lamsfoundation.org)
\ No newline at end of file
Index: lams_tool_nb/conf/middlegen/${name}-prefs.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/conf/middlegen/Attic/${name}-prefs.properties,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/conf/middlegen/${name}-prefs.properties 7 Jun 2005 05:52:18 -0000 1.1
@@ -0,0 +1,42 @@
+# Middlegen Preferences
+hibernate.tables.tl_lanb11_content.base-class-name=TlLanb11Content
+hibernate.tables.tl_lanb11_content.columns.content.java-name=content
+hibernate.tables.tl_lanb11_content.columns.content.java-type=java.lang.String
+hibernate.tables.tl_lanb11_content.columns.creator_user_id.java-name=creatorUserId
+hibernate.tables.tl_lanb11_content.columns.creator_user_id.java-type=java.lang.Long
+hibernate.tables.tl_lanb11_content.columns.date_created.java-name=dateCreated
+hibernate.tables.tl_lanb11_content.columns.date_created.java-type=java.sql.Timestamp
+hibernate.tables.tl_lanb11_content.columns.date_updated.java-name=dateUpdated
+hibernate.tables.tl_lanb11_content.columns.date_updated.java-type=java.sql.Timestamp
+hibernate.tables.tl_lanb11_content.columns.define_later.java-name=defineLater
+hibernate.tables.tl_lanb11_content.columns.define_later.java-type=java.lang.Byte
+hibernate.tables.tl_lanb11_content.columns.force_offline.java-name=forceOffline
+hibernate.tables.tl_lanb11_content.columns.force_offline.java-type=java.lang.Byte
+hibernate.tables.tl_lanb11_content.columns.nb_content_id.java-name=nbContentId
+hibernate.tables.tl_lanb11_content.columns.nb_content_id.java-type=java.lang.Long
+hibernate.tables.tl_lanb11_content.columns.offline_instructions.java-name=offlineInstructions
+hibernate.tables.tl_lanb11_content.columns.offline_instructions.java-type=java.lang.String
+hibernate.tables.tl_lanb11_content.columns.online_instructions.java-name=onlineInstructions
+hibernate.tables.tl_lanb11_content.columns.online_instructions.java-type=java.lang.String
+hibernate.tables.tl_lanb11_content.columns.title.java-name=title
+hibernate.tables.tl_lanb11_content.columns.title.java-type=java.lang.String
+hibernate.tables.tl_lanb11_session.base-class-name=TlLanb11Session
+hibernate.tables.tl_lanb11_session.columns.nb_content_id.java-name=nbContentId
+hibernate.tables.tl_lanb11_session.columns.nb_content_id.java-type=long
+hibernate.tables.tl_lanb11_session.columns.nb_session_id.java-name=nbSessionId
+hibernate.tables.tl_lanb11_session.columns.nb_session_id.java-type=java.lang.Long
+hibernate.tables.tl_lanb11_session.columns.session_end_date.columnspecialty=property
+hibernate.tables.tl_lanb11_session.columns.session_end_date.java-name=sessionEndDate
+hibernate.tables.tl_lanb11_session.columns.session_end_date.java-type=java.sql.Timestamp
+hibernate.tables.tl_lanb11_session.columns.session_start_date.java-name=sessionStartDate
+hibernate.tables.tl_lanb11_session.columns.session_start_date.java-type=java.sql.Timestamp
+hibernate.tables.tl_lanb11_session.columns.session_status.java-name=sessionStatus
+hibernate.tables.tl_lanb11_session.columns.session_status.java-type=java.lang.String
+relations.tl_lanb11_content-tl_lanb11_session.tl_lanb11_content-has-tl_lanb11_session.enabled=true
+relations.tl_lanb11_content-tl_lanb11_session.tl_lanb11_content-has-tl_lanb11_session.target-many=true
+relations.tl_lanb11_content-tl_lanb11_session.tl_lanb11_session-has-tl_lanb11_content.enabled=true
+relations.tl_lanb11_content-tl_lanb11_session.tl_lanb11_session-has-tl_lanb11_content.target-many=false
+tables.tl_lanb11_content.x=10
+tables.tl_lanb11_content.y=10
+tables.tl_lanb11_session.x=30
+tables.tl_lanb11_session.y=30
Index: lams_tool_nb/conf/middlegen/mysql.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/conf/middlegen/mysql.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/conf/middlegen/mysql.xml 7 Jun 2005 05:52:18 -0000 1.1
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_nb/conf/middlegen/noticeboard-prefs.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/conf/middlegen/Attic/noticeboard-prefs.properties,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/conf/middlegen/noticeboard-prefs.properties 7 Jun 2005 05:52:18 -0000 1.1
@@ -0,0 +1,53 @@
+# Middlegen Preferences
+hibernate.tables.tl_lanb11_content.base-class-name=NoticeboardContent
+hibernate.tables.tl_lanb11_content.columns.content.columnspecialty=property
+hibernate.tables.tl_lanb11_content.columns.content.java-name=content
+hibernate.tables.tl_lanb11_content.columns.content.java-type=java.lang.String
+hibernate.tables.tl_lanb11_content.columns.content_id.columnspecialty=key
+hibernate.tables.tl_lanb11_content.columns.content_id.java-name=contentId
+hibernate.tables.tl_lanb11_content.columns.content_id.java-type=java.lang.Long
+hibernate.tables.tl_lanb11_content.columns.creator_user_id.java-name=creatorUserId
+hibernate.tables.tl_lanb11_content.columns.creator_user_id.java-type=java.lang.Long
+hibernate.tables.tl_lanb11_content.columns.date_created.java-name=dateCreated
+hibernate.tables.tl_lanb11_content.columns.date_created.java-type=java.sql.Timestamp
+hibernate.tables.tl_lanb11_content.columns.date_updated.java-name=dateUpdated
+hibernate.tables.tl_lanb11_content.columns.date_updated.java-type=java.sql.Timestamp
+hibernate.tables.tl_lanb11_content.columns.define_later.java-name=defineLater
+hibernate.tables.tl_lanb11_content.columns.define_later.java-type=boolean
+hibernate.tables.tl_lanb11_content.columns.force_offline.java-name=forceOffline
+hibernate.tables.tl_lanb11_content.columns.force_offline.java-type=boolean
+hibernate.tables.tl_lanb11_content.columns.nb_content_id.java-name=nbContentId
+hibernate.tables.tl_lanb11_content.columns.nb_content_id.java-type=java.lang.Long
+hibernate.tables.tl_lanb11_content.columns.offline_instructions.java-name=offlineInstructions
+hibernate.tables.tl_lanb11_content.columns.offline_instructions.java-type=java.lang.String
+hibernate.tables.tl_lanb11_content.columns.online_instructions.java-name=onlineInstructions
+hibernate.tables.tl_lanb11_content.columns.online_instructions.java-type=java.lang.String
+hibernate.tables.tl_lanb11_content.columns.title.columnspecialty=property
+hibernate.tables.tl_lanb11_content.columns.title.java-name=title
+hibernate.tables.tl_lanb11_content.columns.title.java-type=java.lang.String
+hibernate.tables.tl_lanb11_content.keygenerator=assigned
+hibernate.tables.tl_lanb11_session.base-class-name=NoticeboardSession
+hibernate.tables.tl_lanb11_session.columns.content_id.java-name=contentId
+hibernate.tables.tl_lanb11_session.columns.content_id.java-type=java.lang.Long
+hibernate.tables.tl_lanb11_session.columns.nb_content_id.java-name=nbContentId
+hibernate.tables.tl_lanb11_session.columns.nb_content_id.java-type=long
+hibernate.tables.tl_lanb11_session.columns.nb_session_id.java-name=nbSessionId
+hibernate.tables.tl_lanb11_session.columns.nb_session_id.java-type=java.lang.Long
+hibernate.tables.tl_lanb11_session.columns.session_end_date.java-name=sessionEndDate
+hibernate.tables.tl_lanb11_session.columns.session_end_date.java-type=java.sql.Timestamp
+hibernate.tables.tl_lanb11_session.columns.session_id.columnspecialty=key
+hibernate.tables.tl_lanb11_session.columns.session_id.java-name=sessionId
+hibernate.tables.tl_lanb11_session.columns.session_id.java-type=java.lang.Long
+hibernate.tables.tl_lanb11_session.columns.session_start_date.java-name=sessionStartDate
+hibernate.tables.tl_lanb11_session.columns.session_start_date.java-type=java.sql.Timestamp
+hibernate.tables.tl_lanb11_session.columns.session_status.java-name=sessionStatus
+hibernate.tables.tl_lanb11_session.columns.session_status.java-type=java.lang.String
+hibernate.tables.tl_lanb11_session.keygenerator=assigned
+relations.tl_lanb11_content-tl_lanb11_session.tl_lanb11_content-has-tl_lanb11_session.enabled=true
+relations.tl_lanb11_content-tl_lanb11_session.tl_lanb11_content-has-tl_lanb11_session.target-many=true
+relations.tl_lanb11_content-tl_lanb11_session.tl_lanb11_session-has-tl_lanb11_content.enabled=true
+relations.tl_lanb11_content-tl_lanb11_session.tl_lanb11_session-has-tl_lanb11_content.target-many=false
+tables.tl_lanb11_content.x=317
+tables.tl_lanb11_content.y=7
+tables.tl_lanb11_session.x=29
+tables.tl_lanb11_session.y=9
Index: lams_tool_nb/conf/war/META-INF/MANIFEST.MF
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/conf/war/META-INF/Attic/MANIFEST.MF,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/conf/war/META-INF/MANIFEST.MF 7 Jun 2005 05:52:19 -0000 1.1
@@ -0,0 +1 @@
+Class-Path: ./lams.jar ./lams-tool-noticeboard.jar
\ No newline at end of file
Index: lams_tool_nb/conf/xdoclet/servlet-mappings.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/conf/xdoclet/servlet-mappings.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/conf/xdoclet/servlet-mappings.xml 7 Jun 2005 05:52:18 -0000 1.1
@@ -0,0 +1,5 @@
+
+ action
+ *.do
+
+
\ No newline at end of file
Index: lams_tool_nb/conf/xdoclet/servlets.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/conf/xdoclet/servlets.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/conf/xdoclet/servlets.xml 7 Jun 2005 05:52:18 -0000 1.1
@@ -0,0 +1,44 @@
+
+
+ context
+ org.springframework.web.context.ContextLoaderServlet
+ 1
+
+
+
+ action
+ org.apache.struts.action.ActionServlet
+
+ config
+ /WEB-INF/struts-config.xml
+
+
+ debug
+ 999
+
+
+ detail
+ 2
+
+
+ validate
+ true
+
+ 2
+
+
+
+
+
\ No newline at end of file
Index: lams_tool_nb/conf/xdoclet/struts-message-resources.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/conf/xdoclet/struts-message-resources.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/conf/xdoclet/struts-message-resources.xml 7 Jun 2005 05:52:18 -0000 1.1
@@ -0,0 +1 @@
+
Index: lams_tool_nb/conf/xdoclet/struts-plugins.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/conf/xdoclet/struts-plugins.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/conf/xdoclet/struts-plugins.xml 7 Jun 2005 05:52:18 -0000 1.1
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
\ No newline at end of file
Index: lams_tool_nb/conf/xdoclet/web-settings.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/conf/xdoclet/web-settings.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/conf/xdoclet/web-settings.xml 7 Jun 2005 05:52:18 -0000 1.1
@@ -0,0 +1,15 @@
+
+ javax.servlet.jsp.jstl.fmt.localizationContext
+ org.lamsfoundation.lams.tool.noticeboard.web.ApplicationResources
+
+
+ contextConfigLocation
+
+ classpath:/org/lamsfoundation/lams/tool/noticeboard/applicationContext.xml
+
+
+
+
+ org.springframework.web.context.ContextLoaderListener
+
+
Index: lams_tool_nb/db/model/lams_tool_noticeboard.clay
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/db/model/Attic/lams_tool_noticeboard.clay,v
diff -u
Binary files differ
Index: lams_tool_nb/db/sql/create_lams_tool_nb.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/db/sql/create_lams_tool_nb.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/db/sql/create_lams_tool_nb.sql 7 Jun 2005 05:52:19 -0000 1.1
@@ -0,0 +1,25 @@
+CREATE TABLE lams.tl_lanb11_content (
+ nb_content_id BIGINT(20) NOT NULL
+ , title VARCHAR(255)
+ , content TEXT
+ , online_instructions TEXT
+ , offline_instructions TEXT
+ , define_later TINYINT(1)
+ , force_offline TINYINT(1)
+ , creator_user_id BIGINT(20)
+ , date_created DATETIME
+ , date_updated DATETIME
+ , PRIMARY KEY (nb_content_id)
+)TYPE=InnoDB;
+
+CREATE TABLE lams.tl_lanb11_session (
+ nb_session_id BIGINT(20) NOT NULL
+ , nb_content_id BIGINT(20) NOT NULL
+ , session_start_date DATETIME
+ , session_end_date DATETIME
+ , session_status VARCHAR(100)
+ , PRIMARY KEY (nb_session_id)
+ , INDEX (nb_content_id)
+ , CONSTRAINT FK_tl_lanb11_session_1 FOREIGN KEY (nb_content_id)
+ REFERENCES lams.tl_lanb11_content (nb_content_id)
+)TYPE=InnoDB;
\ No newline at end of file
Index: lams_tool_nb/db/sql/drop_lams_tool_nb.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/db/sql/drop_lams_tool_nb.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/db/sql/drop_lams_tool_nb.sql 7 Jun 2005 05:52:19 -0000 1.1
@@ -0,0 +1,4 @@
+
+DROP TABLE IF EXISTS lams.tl_lanb11_session;
+DROP TABLE IF EXISTS lams.tl_lanb11_content;
+
Index: lams_tool_nb/db/sql/init_lams_tool_nb.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/db/sql/Attic/init_lams_tool_nb.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/db/sql/init_lams_tool_nb.sql 7 Jun 2005 05:52:19 -0000 1.1
@@ -0,0 +1,32 @@
+USE lams;
+
+-- Ensure an existing table does not exist
+DROP TABLE IF EXISTS lams.tl_lanb11_session;
+DROP TABLE IF EXISTS lams.tl_lanb11_content;
+
+-- Create a fresh copy of the noticeboard table
+CREATE TABLE lams.tl_lanb11_content (
+ nb_content_id BIGINT(20) NOT NULL
+ , title VARCHAR(255)
+ , content TEXT
+ , online_instructions TEXT
+ , offline_instructions TEXT
+ , define_later TINYINT(1)
+ , force_offline TINYINT(1)
+ , creator_user_id BIGINT(20)
+ , date_created DATETIME
+ , date_updated DATETIME
+ , PRIMARY KEY (nb_content_id)
+)TYPE=InnoDB;
+
+CREATE TABLE lams.tl_lanb11_session (
+ nb_session_id BIGINT(20) NOT NULL
+ , nb_content_id BIGINT(20) NOT NULL
+ , session_start_date DATETIME
+ , session_end_date DATETIME
+ , session_status VARCHAR(100)
+ , PRIMARY KEY (nb_session_id)
+ , INDEX (nb_content_id)
+ , CONSTRAINT FK_tl_lanb11_session_1 FOREIGN KEY (nb_content_id)
+ REFERENCES lams.tl_lanb11_content (nb_content_id)
+)TYPE=InnoDB;
\ No newline at end of file
Index: lams_tool_nb/db/sql/insert_lams_tool_nb_data.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/db/sql/Attic/insert_lams_tool_nb_data.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/db/sql/insert_lams_tool_nb_data.sql 7 Jun 2005 05:52:19 -0000 1.1
@@ -0,0 +1,71 @@
+
+-- test data for noticeboard content table
+
+INSERT INTO tl_lanb11_content (nb_content_id,
+ title,
+ content,
+ online_instructions,
+ offline_instructions,
+ define_later,
+ force_offline,
+ creator_user_id,
+ date_created,
+ date_updated)
+VALUES ('2500',
+ 'Welcome',
+ 'Welcome to these activities',
+ 'Enter the online instructions here',
+ 'Enter the offline instructions here',
+ 0,
+ 0,
+ '2300',
+ now(),
+ NULL);
+
+INSERT INTO tl_lanb11_session ( nb_session_id,
+ nb_content_id,
+ session_start_date,
+ session_end_date,
+ session_status)
+VALUES ('2400',
+ '2500',
+ now(),
+ now(),
+ 'Inactive');
+
+
+-- test data for noticeboard content table
+
+INSERT INTO tl_lanb11_content (nb_content_id,
+ title,
+ content,
+ online_instructions,
+ offline_instructions,
+ define_later,
+ force_offline,
+ creator_user_id,
+ date_created,
+ date_updated)
+VALUES ('5000',
+ 'Test Noticeboard',
+ 'Test Noticeboard: Welcome to these activities',
+ 'Please Enter the online instructions here',
+ 'Please Enter the offline instructions here',
+ 0,
+ 0,
+ '2300',
+ now(),
+ NULL);
+
+INSERT INTO tl_lanb11_session ( nb_session_id,
+ nb_content_id,
+ session_start_date,
+ session_end_date,
+ session_status)
+VALUES ('6000',
+ '5000',
+ now(),
+ now(),
+ 'Inactive');
+
+
Index: lams_tool_nb/db/sql/lams_tool_noticeboard.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/db/sql/Attic/lams_tool_noticeboard.sql,v
diff -u
Binary files differ
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NbApplicationException.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NbApplicationException.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NbApplicationException.java 7 Jun 2005 05:50:05 -0000 1.1
@@ -0,0 +1,67 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+package org.lamsfoundation.lams.tool.noticeboard;
+
+/** Generic exception class for the noticeboard tool
+ */
+
+public class NbApplicationException extends RuntimeException
+{
+ /**
+ * Default Constructor
+ */
+ public NbApplicationException()
+ {
+ super();
+ }
+
+ /**
+ * Constructor for customized error message
+ * @param message
+ */
+ public NbApplicationException(String message)
+ {
+ super(message);
+ }
+
+ /**
+ * Constructor for wrapping the throwable object
+ * @param cause
+ */
+ public NbApplicationException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ /**
+ * Constructor for wrapping both the customized error message and
+ * throwable exception object.
+ * @param message
+ * @param cause
+ */
+ public NbApplicationException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+}
+
+
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardConstants.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardConstants.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardConstants.java 7 Jun 2005 05:50:05 -0000 1.1
@@ -0,0 +1,82 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+package org.lamsfoundation.lams.tool.noticeboard;
+
+/**
+ * This is a constant utility class that defined all constants need to be
+ * shared around the noticeboard tool.
+ *
+ *
+ */
+public class NoticeboardConstants
+{
+ /**
+ * Private Construtor to avoid instantiation.
+ */
+ private NoticeboardConstants(){}
+
+ // ------------------------------------------
+ // DEFAULT IDs for testing purposes
+ // ------------------------------------------
+ public static final Long DEFAULT_CONTENT_ID = new Long(2500);
+ public static final Long DEFAULT_SESSION_ID = new Long(2400);
+ public static final Long DEFAULT_CREATOR_ID = new Long(2300);
+
+ // -------------------------------------------
+ // Action Forward names
+ // -------------------------------------------
+
+ public static final String LOAD_NB_FORM = "loadNbForm";
+ public static final String BASIC_PAGE = "basic";
+ public static final String ADVANCED_PAGE = "advanced";
+ public static final String INSTRUCTIONS_PAGE = "instructions";
+
+ // ------------------------------
+ // Action Names
+ // ------------------------------
+ public static final String DONE = "done";
+ public static final String SAVE = "save";
+
+ // --------------------------------------------
+ // Session Attributes
+ // --------------------------------------------
+
+ public static final String TITLE = "title";
+ public static final String CONTENT = "content";
+ public static final String ONLINE_INSTRUCTIONS = "onlineInstructions";
+ public static final String OFFLINE_INSTRUCTIONS = "offlineInstructions";
+ public static final String TOOL_CONTENT_ID = "toolContentId";
+
+ // ---------------------------------------------------------------------------
+ // Lookup Dispatch Action Keys (used in NbAuthoringAction class),
+ // labels used in ApplicationResources.properties
+ // ---------------------------------------------------------------------------
+
+ public static final String BUTTON_BASIC = "button.basic";
+ public static final String BUTTON_ADVANCED = "button.advanced";
+ public static final String BUTTON_INSTRUCTIONS = "button.instructions";
+ public static final String BUTTON_SAVE = "button.ok";
+ public static final String BUTTON_DONE = "button.done";
+
+
+
+
+}
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardContent.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardContent.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardContent.java 7 Jun 2005 05:50:05 -0000 1.1
@@ -0,0 +1,286 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+package org.lamsfoundation.lams.tool.noticeboard;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Set;
+import java.util.TreeSet;
+
+/**
+ * Persistent noticeboard object/bean that defines the content for the noticeboard tool.
+ * Provides accessors and mutators to get/set noticeboard attributes
+ * @author mtruong
+ *
+ */
+public class NoticeboardContent implements Serializable {
+
+ /** identifier field */
+ private Long nbContentId;
+
+ /** nullable persistent field */
+ private String title;
+
+ /** nullable persistent field */
+ private String content;
+
+ /** nullable persistent field */
+ private String onlineInstructions;
+
+ /** nullable persistent field */
+ private String offlineInstructions;
+
+ /** nullable persistent field */
+ private boolean defineLater;
+
+ /** nullable persistent field */
+ private boolean forceOffline;
+
+ /** nullable persistent field */
+ private Long creatorUserId;
+
+ /** nullable persistent field */
+ private Date dateCreated;
+
+ /** nullable persistent field */
+ private Date dateUpdated;
+
+ /** persistent field */
+ private Set nbSessions;
+
+ /** default constructor */
+ public NoticeboardContent()
+ {
+ }
+
+ /** full constructor */
+ public NoticeboardContent(Long nbContentId,
+ String title,
+ String content,
+ String onlineInstructions,
+ String offlineInstructions,
+ boolean defineLater,
+ boolean forceOffline,
+ Long creatorUserId,
+ Date dateCreated,
+ Date dateUpdated,
+ Set nbSessions)
+ {
+ this.nbContentId = nbContentId;
+ this.title = title;
+ this.content = content;
+ this.onlineInstructions = onlineInstructions;
+ this.offlineInstructions = offlineInstructions;
+ this.defineLater = defineLater;
+ this.forceOffline = forceOffline;
+ this.creatorUserId = creatorUserId;
+ this.dateCreated = dateCreated;
+ this.dateUpdated = dateUpdated;
+ this.nbSessions = nbSessions;
+ }
+
+
+
+
+
+ /**
+ * @hibernate.property
+ * column="content"
+ * length="65535"
+ */
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ /**
+ *
+ * @hibernate.property
+ * column="creator_user_id"
+ * length="20"
+ */
+ public Long getCreatorUserId() {
+ return creatorUserId;
+ }
+
+ public void setCreatorUserId(Long creatorUserId) {
+ this.creatorUserId = creatorUserId;
+ }
+
+ /**
+ *
+ * @hibernate.property
+ * column="date_created"
+ * length="19"
+ */
+ public Date getDateCreated() {
+ return dateCreated;
+ }
+
+ public void setDateCreated(Date dateCreated) {
+ this.dateCreated = dateCreated;
+ }
+
+ /**
+ *
+ * @hibernate.property
+ * column="date_updated"
+ * length="19"
+ */
+ public Date getDateUpdated() {
+ return dateUpdated;
+ }
+
+ public void setDateUpdated(Date dateUpdated) {
+ this.dateUpdated = dateUpdated;
+ }
+
+ /**
+ * @hibernate.property
+ * column="define_later"
+ * length="1"
+ */
+ public boolean isDefineLater() {
+ return defineLater;
+ }
+
+ public void setDefineLater(boolean defineLater) {
+ this.defineLater = defineLater;
+ }
+
+ /**
+ * @hibernate.property
+ * column="force_offline"
+ * length="1"
+ */
+ public boolean isForceOffline() {
+ return forceOffline;
+ }
+
+ public void setForceOffline(boolean forceOffline) {
+ this.forceOffline = forceOffline;
+ }
+
+
+ /**
+ * @hibernate.id
+ * generator-class="assigned"
+ * type="java.lang.Long"
+ * column="nb_content_id"
+ *
+ */
+
+ public Long getNbContentId() {
+ return nbContentId;
+ }
+
+ public void setNbContentId(Long nbContentId) {
+ this.nbContentId = nbContentId;
+ }
+ /**
+ * @hibernate.set
+ * lazy="true"
+ * inverse="true"
+ * cascade="none"
+ * @hibernate.collection-key
+ * column="nb_content_id"
+ * @hibernate.collection-one-to-many
+ * class="org.lamsfoundation.lams.tool.noticeboard.NoticeboardSession"
+ */
+ public Set getNbSessions() {
+ if (this.nbSessions == null)
+ {
+ setNbSessions(new TreeSet());
+ }
+ return nbSessions;
+ }
+
+ public void setNbSessions(Set nbSessions) {
+ this.nbSessions = nbSessions;
+ }
+
+ /**
+ *
+ * @hibernate.property
+ * column="offline_instructions"
+ * length="65535"
+ */
+ public String getOfflineInstructions() {
+ return offlineInstructions;
+ }
+
+ public void setOfflineInstructions(String offlineInstructions) {
+ this.offlineInstructions = offlineInstructions;
+ }
+
+ /**
+ *
+ * @hibernate.property
+ * column="online_instructions"
+ * length="65535"
+ */
+ public String getOnlineInstructions() {
+ return onlineInstructions;
+ }
+
+ public void setOnlineInstructions(String onlineInstructions) {
+ this.onlineInstructions = onlineInstructions;
+ }
+
+ /**
+ * @hibernate.property
+ * column="title"
+ * length="255"
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ /**
+ *
+ * @param nb NoticeboardContent object containing the content to copy from
+ * @param toContentId The new Id of the new noticeboard object
+ * @return newContent The new noticeboard content object
+ */
+ public static NoticeboardContent newInstance(NoticeboardContent nb, Long toContentId)
+ {
+ NoticeboardContent newContent = new NoticeboardContent(toContentId,
+ nb.getTitle(),
+ nb.getContent(),
+ nb.getOnlineInstructions(),
+ nb.getOfflineInstructions(),
+ nb.isDefineLater(),
+ nb.isForceOffline(),
+ nb.getCreatorUserId(),
+ nb.getDateCreated(),
+ nb.getDateUpdated(),
+ new TreeSet());
+ return newContent;
+ }
+}
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardSession.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardSession.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardSession.java 7 Jun 2005 05:50:05 -0000 1.1
@@ -0,0 +1,148 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+package org.lamsfoundation.lams.tool.noticeboard;
+
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author mtruong
+ *
+ */
+
+public class NoticeboardSession implements Serializable {
+
+ /** identifier field */
+ private Long nbSessionId;
+
+ /** persistent field */
+// private Long nbContentId;
+
+ /** nullable persistent field */
+ private Date sessionStartDate;
+
+ /** nullable persistent field */
+ private Date sessionEndDate;
+
+ /** nullable persistent field */
+ private String sessionStatus;
+
+ /** persistent field */
+ private NoticeboardContent nbContent;
+
+ /** default constructor */
+ public NoticeboardSession()
+ {
+
+ }
+
+ /** full constructor */
+ public NoticeboardSession(Long nbSessionId,
+ NoticeboardContent nbContent,
+ Date sessionStartDate,
+ Date sessionEndDate,
+ String sessionStatus)
+ {
+ this.nbSessionId = nbSessionId;
+ //this.nbContentId = nbContentId;
+ this.nbContent = nbContent;
+ this.sessionStartDate = sessionStartDate;
+ this.sessionEndDate = sessionEndDate;
+ this.sessionStatus = sessionStatus;
+ }
+
+
+ /**
+ * @hibernate.many-to-one
+ * not-null="true"
+ * @hibernate.column name="nb_content_id"
+ */
+ public NoticeboardContent getNbContent() {
+ return nbContent;
+ }
+
+ public void setNbContent(NoticeboardContent nbContent) {
+ this.nbContent = nbContent;
+ }
+
+ /*
+ public Long getNbContentId() {
+ return nbContentId;
+ }
+
+ public void setNbContentId(Long nbContentId) {
+ this.nbContentId = nbContentId;
+ }*/
+
+ /**
+ * @hibernate.id
+ * generator-class="assigned"
+ * type="java.lang.Long"
+ * column="nb_session_id"
+ */
+ public Long getNbSessionId() {
+ return nbSessionId;
+ }
+
+ public void setNbSessionId(Long nbSessionId) {
+ this.nbSessionId = nbSessionId;
+ }
+
+ /**
+ * @hibernate.property
+ * column="session_end_date"
+ * length="19"
+ */
+ public Date getSessionEndDate() {
+ return sessionEndDate;
+ }
+
+ public void setSessionEndDate(Date sessionEndDate) {
+ this.sessionEndDate = sessionEndDate;
+ }
+
+ /**
+ * @hibernate.property
+ * column="session_start_date"
+ * length="19"
+ */
+ public Date getSessionStartDate() {
+ return sessionStartDate;
+ }
+
+ public void setSessionStartDate(Date sessionStartDate) {
+ this.sessionStartDate = sessionStartDate;
+ }
+
+ /**
+ * @hibernate.property
+ * column="session_status"
+ * length="100"
+ */
+ public String getSessionStatus() {
+ return sessionStatus;
+ }
+
+ public void setSessionStatus(String sessionStatus) {
+ this.sessionStatus = sessionStatus;
+ }
+}
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/applicationContext.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/Attic/applicationContext.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/applicationContext.xml 7 Jun 2005 05:50:05 -0000 1.1
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ com.mysql.jdbc.Driver
+ jdbc:mysql://localhost/lams?characterEncoding=utf8
+ lams
+ lamsdemo
+
+
+
+
+
+
+
+ org/lamsfoundation/lams/tool/noticeboard/NoticeboardContent.hbm.xml
+ org/lamsfoundation/lams/tool/noticeboard/NoticeboardSession.hbm.xml
+
+
+
+
+ net.sf.hibernate.dialect.MySQLDialect
+ false
+ 5
+ 20
+ 1800
+ 50
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PROPAGATION_REQUIRED
+ PROPAGATION_REQUIRED
+ PROPAGATION_REQUIRED
+ PROPAGATION_REQUIRED
+ PROPAGATION_REQUIRED
+ PROPAGATION_REQUIRED
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dao/INoticeboardContentDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dao/INoticeboardContentDAO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dao/INoticeboardContentDAO.java 7 Jun 2005 05:50:05 -0000 1.1
@@ -0,0 +1,47 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+package org.lamsfoundation.lams.tool.noticeboard.dao;
+
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent;
+
+
+/**
+ * Interface for the NoticeboardContent DAO, defines methods needed to access/modify
+ * noticeboard content
+ * @author mtruong
+ */
+public interface INoticeboardContentDAO {
+
+ public NoticeboardContent getNbContentById(Long nbContentId);
+
+ public NoticeboardContent loadNbContentById(Long nbContentId);
+
+ public NoticeboardContent getNbContentBySession(Long nbSessionId);
+
+ public void saveNbContent(NoticeboardContent nbContent);
+
+ public void updateNbContent(NoticeboardContent nbContent);
+
+ public void removeNoticeboard(Long nbContentId);
+
+ public void removeNbSessions(NoticeboardContent nbContent);
+
+}
\ No newline at end of file
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dao/INoticeboardSessionDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dao/INoticeboardSessionDAO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dao/INoticeboardSessionDAO.java 7 Jun 2005 05:50:05 -0000 1.1
@@ -0,0 +1,43 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+package org.lamsfoundation.lams.tool.noticeboard.dao;
+
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardSession;
+
+
+/**
+ * Interface for the NoticeboardContent DAO, defines methods needed to access/modify
+ * noticeboard content
+ * @author mtruong
+ */
+public interface INoticeboardSessionDAO {
+
+ public NoticeboardSession getNbSessionById(Long nbSessionId);
+
+ public NoticeboardSession loadNbSessionById(Long nbSessionId);
+
+ public void saveNbSession(NoticeboardSession nbSession);
+
+ public void updateNbSession(NoticeboardSession nbSession);
+
+ public void removeNbSession(Long nbSessionId);
+
+}
\ No newline at end of file
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dao/hibernate/NoticeboardContentDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dao/hibernate/NoticeboardContentDAO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dao/hibernate/NoticeboardContentDAO.java 7 Jun 2005 05:50:05 -0000 1.1
@@ -0,0 +1,96 @@
+/*
+Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+
+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; either version 2 of the License, or
+(at your option) any later version.
+
+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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+http://www.gnu.org/licenses/gpl.txt
+*/
+
+package org.lamsfoundation.lams.tool.noticeboard.dao.hibernate;
+
+import net.sf.hibernate.HibernateException;
+import net.sf.hibernate.Session;
+
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent;
+import org.lamsfoundation.lams.tool.noticeboard.dao.INoticeboardContentDAO;
+import org.springframework.orm.hibernate.HibernateCallback;
+import org.springframework.orm.hibernate.support.HibernateDaoSupport;
+
+/**
+ * @author mtruong
+ * Hibernate implementation for database access for the noticeboard tool.
+ */
+
+public class NoticeboardContentDAO extends HibernateDaoSupport implements INoticeboardContentDAO {
+
+
+ private static final String LOAD_NB_BY_SESSION = "select nb from NoticeboardContent nb left join fetch "
+ + "nb.nbSessions session where session.nbSessionId=:sessionId";
+
+
+ /** Finds a noticeboard by its noticeboard id and returns
+ * null if not found
+ */
+
+ public NoticeboardContent getNbContentById(Long nbContentId)
+ {
+ return (NoticeboardContent) this.getHibernateTemplate()
+ .get(NoticeboardContent.class, nbContentId);
+ }
+
+ public NoticeboardContent loadNbContentById(Long nbContentId)
+ {
+ return (NoticeboardContent) this.getHibernateTemplate()
+ .load(NoticeboardContent.class, nbContentId);
+ }
+
+ public NoticeboardContent getNbContentBySession(final Long nbSessionId)
+ {
+ return (NoticeboardContent) getHibernateTemplate().execute(new HibernateCallback()
+ {
+
+ public Object doInHibernate(Session session) throws HibernateException
+ {
+ return session.createQuery(LOAD_NB_BY_SESSION)
+ .setLong("sessionId",
+ nbSessionId.longValue())
+ .uniqueResult();
+ }
+ });
+ }
+
+ public void saveNbContent(NoticeboardContent nbContent)
+ {
+ this.getHibernateTemplate().save(nbContent);
+ }
+
+ public void updateNbContent(NoticeboardContent nbContent)
+ {
+ this.getHibernateTemplate().update(nbContent);
+ }
+
+ public void removeNoticeboard(Long nbContentId)
+ {
+ NoticeboardContent nb = (NoticeboardContent)getHibernateTemplate().get(NoticeboardContent.class, nbContentId);
+ getHibernateTemplate().delete(nb);
+ }
+
+ public void removeNbSessions(NoticeboardContent nbContent)
+ {
+ this.getHibernateTemplate().deleteAll(nbContent.getNbSessions());
+ }
+
+}
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dao/hibernate/NoticeboardSessionDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dao/hibernate/NoticeboardSessionDAO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dao/hibernate/NoticeboardSessionDAO.java 7 Jun 2005 05:50:05 -0000 1.1
@@ -0,0 +1,68 @@
+/*
+Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+
+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; either version 2 of the License, or
+(at your option) any later version.
+
+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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+http://www.gnu.org/licenses/gpl.txt
+*/
+
+package org.lamsfoundation.lams.tool.noticeboard.dao.hibernate;
+
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardSession;
+import org.lamsfoundation.lams.tool.noticeboard.dao.INoticeboardSessionDAO;
+import org.springframework.orm.hibernate.support.HibernateDaoSupport;
+
+/**
+ * @author mtruong
+ * Hibernate implementation for database access for the noticeboard tool.
+ */
+
+public class NoticeboardSessionDAO extends HibernateDaoSupport implements INoticeboardSessionDAO {
+
+
+ /** Finds a noticeboard by its noticeboard id and returns
+ * null if not found
+ */
+
+ public NoticeboardSession getNbSessionById(Long nbSessionId)
+ {
+ return (NoticeboardSession) this.getHibernateTemplate()
+ .get(NoticeboardSession.class, nbSessionId);
+ }
+
+ public NoticeboardSession loadNbSessionById(Long nbSessionId)
+ {
+ return (NoticeboardSession) this.getHibernateTemplate()
+ .load(NoticeboardSession.class, nbSessionId);
+ }
+
+ public void saveNbSession(NoticeboardSession nbSession)
+ {
+ this.getHibernateTemplate().save(nbSession);
+ }
+
+ public void updateNbSession(NoticeboardSession nbSession)
+ {
+ this.getHibernateTemplate().update(nbSession);
+ }
+
+ public void removeNbSession(Long nbSessionId)
+ {
+ NoticeboardSession nb = (NoticeboardSession)getHibernateTemplate().get(NoticeboardSession.class, nbSessionId);
+ getHibernateTemplate().delete(nb);
+ }
+
+}
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dto/NoticeboardContentDTO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dto/Attic/NoticeboardContentDTO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dto/NoticeboardContentDTO.java 7 Jun 2005 05:50:05 -0000 1.1
@@ -0,0 +1,102 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+package org.lamsfoundation.lams.tool.noticeboard.dto;
+
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent;
+/**
+ * @author mtruong
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+
+/**
+ * DTO for noticeboard content. This object is stored in the session and
+ * parsed into the jsp in order to access each individual values.
+ * @author mtruong
+ *
+ */
+
+public class NoticeboardContentDTO {
+
+ private Long contentId;
+ private String title;
+ private String content;
+ private String onlineInstructions;
+ private String offlineInstructions;
+
+ public NoticeboardContentDTO()
+ {
+ }
+
+ public NoticeboardContentDTO(Long contentId,
+ String title,
+ String content,
+ String onlineInstructions,
+ String offlineInstructions)
+ {
+ this.contentId = contentId;
+ this.title = title;
+ this.content = content;
+ this.onlineInstructions = onlineInstructions;
+ this.offlineInstructions = offlineInstructions;
+ }
+
+ public NoticeboardContentDTO(NoticeboardContent nbContent)
+ {
+ this.contentId = nbContent.getNbContentId();
+ this.title = nbContent.getTitle();
+ this.content = nbContent.getContent();
+ this.onlineInstructions = nbContent.getOnlineInstructions();
+ this.offlineInstructions = nbContent.getOfflineInstructions();
+ }
+
+ /**
+ * @return Returns the content.
+ */
+ public String getContent() {
+ return content;
+ }
+ /**
+ * @return Returns the content_id.
+ */
+ public Long getContentId() {
+ return contentId;
+ }
+ /**
+ * @return Returns the offlineInstructions.
+ */
+ public String getOfflineInstructions() {
+ return offlineInstructions;
+ }
+ /**
+ * @return Returns the onlineInstructions.
+ */
+ public String getOnlineInstructions() {
+ return onlineInstructions;
+ }
+ /**
+ * @return Returns the title.
+ */
+ public String getTitle() {
+ return title;
+ }
+}
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/service/INoticeboardService.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/service/INoticeboardService.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/service/INoticeboardService.java 7 Jun 2005 05:50:05 -0000 1.1
@@ -0,0 +1,80 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+
+package org.lamsfoundation.lams.tool.noticeboard.service;
+
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent;
+
+/**
+ * Defines the contract that the tool service provider must follow
+ *
+ *
+ */
+public interface INoticeboardService {
+
+ /**
+ * Return the noticeboard object according to the requested content id.
+ *
+ * @param nbContentid The id of the requested noticeboard object
+ * @return NoticeboardContent object or null if not found
+ */
+
+ public NoticeboardContent retrieveNoticeboard(Long nbContentId);
+
+ /**
+ * Update the content of the noticeboard object with id corresponding
+ * to that specified in the argument.
+ *
+ * @param nbContentid The id of the requested noticeboard object
+ *
+ */
+ public void updateNoticeboard(NoticeboardContent nbContent);
+
+
+ /**
+ * Save the content of the noticeboard object
+ *
+ */
+ public void saveNoticeboard(NoticeboardContent nbContent);
+
+
+ /**
+ * Remove the noticeboard sessions which contain the noticeboard content
+ * object that is specified in the argument
+ *
+ * @param nbContent The noticeboard content in which its corresponding sessions
+ * must be removed
+ *
+ */
+
+ public void removeNoticeboardSessions(NoticeboardContent nbContent);
+
+ /**
+ * Remove the noticeboard object with content id of
+ * that specified in the argument.
+ *
+ * @param nbContentid The id of the requested noticeboard object
+ *
+ */
+ public void removeNoticeboard(Long nbContentId);
+
+
+}
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/service/NoticeboardServicePOJO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/service/NoticeboardServicePOJO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/service/NoticeboardServicePOJO.java 7 Jun 2005 05:50:05 -0000 1.1
@@ -0,0 +1,186 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+
+package org.lamsfoundation.lams.tool.noticeboard.service;
+
+import org.apache.log4j.Logger;
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent;
+import org.lamsfoundation.lams.tool.noticeboard.dao.INoticeboardContentDAO;
+import org.springframework.dao.DataAccessException;
+import org.lamsfoundation.lams.tool.noticeboard.NbApplicationException;
+import org.lamsfoundation.lams.tool.ToolContentManager;
+
+/**
+ * An implementation of the NoticeboardService interface.
+ * @author mtruong
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class NoticeboardServicePOJO implements INoticeboardService, ToolContentManager {
+
+ private NoticeboardContent nbContent;
+ private INoticeboardContentDAO nbContentDAO=null;
+
+ private static Logger log = Logger.getLogger(NoticeboardServicePOJO.class);
+
+
+ public NoticeboardContent retrieveNoticeboard(Long nbContentId)
+ {
+ try
+ {
+ nbContent = nbContentDAO.getNbContentById(nbContentId);
+ }
+ catch (DataAccessException e)
+ {
+ throw new NbApplicationException("An exception has occured when trying to retrieve noticeboard content object: "
+ + e.getMessage(),
+ e);
+ }
+
+ return nbContent;
+ }
+
+ public void updateNoticeboard(NoticeboardContent nbContent)
+ {
+ try
+ {
+ nbContentDAO.updateNbContent(nbContent);
+ }
+ catch (DataAccessException e)
+ {
+ throw new NbApplicationException("An exception has occured while trying to update a noticeboard content object: "
+ + e.getMessage(),
+ e);
+ }
+
+ }
+
+ public void saveNoticeboard(NoticeboardContent nbContent)
+ {
+ try
+ {
+ nbContentDAO.saveNbContent(nbContent);
+ }
+ catch (DataAccessException e)
+ {
+ throw new NbApplicationException("EXCEPTION: An exception has occurred while trying to save the noticeboard content object: "
+ + e.getMessage(), e);
+ }
+ }
+
+ public void removeNoticeboardSessions(NoticeboardContent nbContent)
+ {
+ try
+ {
+ nbContentDAO.removeNbSessions(nbContent);
+ }
+ catch (DataAccessException e)
+ {
+ throw new NbApplicationException("EXCEPTION: An exception has occurred while trying to remove the sessions associated with this noticeboard content object: "
+ + e.getMessage(), e);
+ }
+
+ }
+
+ public void removeNoticeboard(Long nbContentId)
+ {
+ try
+ {
+ nbContentDAO.removeNoticeboard(nbContentId);
+ }
+ catch (DataAccessException e)
+ {
+ throw new NbApplicationException("EXCEPTION: An exception has occurred while trying to remove this noticeboard content object: "
+ + e.getMessage(), e);
+ }
+ }
+
+ /* ===============Methods implemented from ToolContentManager =============== */
+
+ public void copyToolContent(Long fromContentId, Long toContentId) throws NbApplicationException
+ {
+
+ NoticeboardContent originalNb = retrieveNoticeboard(fromContentId);
+
+ try
+ {
+ if (originalNb != null)
+ {
+ NoticeboardContent newNbContent = NoticeboardContent.newInstance(originalNb, toContentId);
+ if (newNbContent == null)
+ throw new NbApplicationException("Error: Can not create a new copy fromContentId" + fromContentId);
+
+ saveNoticeboard(newNbContent);
+ }
+ else
+ {
+ throw new NbApplicationException("ERROR: Can not retrieve original NoticeboardContent, null object returned");
+ }
+
+
+ }
+ catch (DataAccessException e)
+ {
+ throw new NbApplicationException("Exception occured when copying tool content from ID:"+ fromContentId +
+ " to ID:" + toContentId
+ + e.getMessage(),e);
+ }
+
+ }
+
+ public void setAsDefineLater(Long toolContentId)
+ {
+ NoticeboardContent nbContent = retrieveNoticeboard(toolContentId);
+ nbContent.setDefineLater(true);
+ updateNoticeboard(nbContent);
+
+ }
+
+ public void setAsRunOffline(Long toolContentId)
+ {
+ NoticeboardContent nbContent = retrieveNoticeboard(toolContentId);
+ nbContent.setForceOffline(true);
+ updateNoticeboard(nbContent);
+ }
+
+ public void removeToolContent(Long toolContentId)
+ {
+ //all sessions relating to this content id is removed first
+ //then remove the tool that is associated with this toolContentId
+
+ NoticeboardContent nbContent = retrieveNoticeboard(toolContentId);
+ removeNoticeboardSessions(nbContent);
+
+ removeNoticeboard(toolContentId);
+ }
+
+/* getter setter methods to obtain the service bean */
+ public INoticeboardContentDAO getNbContentDAO()
+ {
+ return nbContentDAO;
+ }
+
+ public void setNbContentDAO(INoticeboardContentDAO nbContentDAO)
+ {
+ this.nbContentDAO = nbContentDAO;
+ }
+}
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/service/NoticeboardServiceProxy.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/service/NoticeboardServiceProxy.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/service/NoticeboardServiceProxy.java 7 Jun 2005 05:50:05 -0000 1.1
@@ -0,0 +1,52 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+package org.lamsfoundation.lams.tool.noticeboard.service;
+
+import javax.servlet.ServletContext;
+import org.lamsfoundation.lams.tool.noticeboard.service.INoticeboardService;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+
+/**
+ *
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 NoticeboardServiceProxy {
+
+ public static final INoticeboardService getNbService(ServletContext servletContext)
+ {
+ return (INoticeboardService)getNbDomainService(servletContext);
+ }
+
+ private static Object getNbDomainService(ServletContext servletContext)
+ {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
+ return wac.getBean("nbService");
+ }
+
+
+}
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/util/NbAuthoringUtil.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/util/Attic/NbAuthoringUtil.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/util/NbAuthoringUtil.java 7 Jun 2005 05:50:05 -0000 1.1
@@ -0,0 +1,43 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+package org.lamsfoundation.lams.tool.noticeboard.util;
+
+/**
+ * @author mtruong
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class NbAuthoringUtil {
+
+ private NbAuthoringUtil() {}
+
+ /**
+ * Converts the request parameter toolContentId, from a string to a Long
+ * @author mtruong
+ */
+
+ public static Long convertToLong(String toolContentId)
+ {
+ Long contentId = new Long(Long.parseLong(toolContentId));
+ return contentId;
+ }
+}
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/ApplicationResources.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/Attic/ApplicationResources.properties,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/ApplicationResources.properties 7 Jun 2005 05:50:05 -0000 1.1
@@ -0,0 +1,21 @@
+# Resources for parameter 'org.lamsfoundation.lams.tool.noticeboard.web.ApplicationResources'
+# Project P/lams_tool_noticeboard
+
+# ========== Authoring Page ===========
+
+button.basic=Basic
+button.advanced=Advanced
+button.instructions=Instructions
+
+# Basic Page
+basic.title=Title:
+basic.content=Content:
+
+#Instructions Page
+instructions.onlineInstructions=Online Instructions
+instructions.offlineInstructions=Offline Instructions
+
+#buttons
+button.cancel=Cancel
+button.ok=OK
+button.done=Done
\ No newline at end of file
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbAuthoringAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbAuthoringAction.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbAuthoringAction.java 7 Jun 2005 05:50:05 -0000 1.1
@@ -0,0 +1,165 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+
+package org.lamsfoundation.lams.tool.noticeboard.web;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.HashMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.actions.LookupDispatchAction;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardConstants;
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent;
+import org.lamsfoundation.lams.tool.noticeboard.NbApplicationException;
+
+import org.lamsfoundation.lams.tool.noticeboard.service.INoticeboardService;
+import org.lamsfoundation.lams.tool.noticeboard.service.NoticeboardServiceProxy;
+
+
+
+
+/**
+ * Creation Date: 20-05-05
+ * Modified Date: 03-06-05
+ * ----------------XDoclet Tags--------------------
+ *
+ * @struts:action path="/tool/nb/authoring" name="NbAuthoringForm" scope="session"
+ * type="org.lamsfoundation.lams.tool.noticeboard.web.NbAuthoringAction"
+ * input=".nbForm" parameter="method"
+ * @struts:action-forward name="loadNbForm" path=".nbForm"
+ * @struts:action-forward name="basic" path=".nb_basic"
+ * @struts:action-forward name="advanced" path=".nb_advanced"
+ * @struts:action-forward name="instructions" path=".nb_instructions"
+ *
+ * ----------------XDoclet Tags--------------------
+ */
+
+public class NbAuthoringAction extends LookupDispatchAction {
+
+
+ protected Map getKeyMethodMap()
+ {
+ Map map = new HashMap();
+ map.put(NoticeboardConstants.BUTTON_BASIC, "basic" );
+ map.put(NoticeboardConstants.BUTTON_ADVANCED, "advanced" );
+ map.put(NoticeboardConstants.BUTTON_INSTRUCTIONS, "instructions");
+ map.put(NoticeboardConstants.BUTTON_DONE, "done");
+ map.put(NoticeboardConstants.BUTTON_SAVE, "save");
+ return map;
+ }
+
+ /**
+ * Forwards to the basic page.
+ */
+ public ActionForward basic(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+ return mapping.findForward(NoticeboardConstants.BASIC_PAGE);
+ }
+
+ /**
+ * Forwards to the advanced page.
+ */
+
+ public ActionForward advanced(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+ return mapping.findForward(NoticeboardConstants.ADVANCED_PAGE);
+ }
+
+ /**
+ * Forwards to the instructions page.
+ */
+
+ public ActionForward instructions(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+ return mapping.findForward(NoticeboardConstants.INSTRUCTIONS_PAGE);
+ }
+
+ /**
+ * Online/Offline instructions entered, form values saved and forward to the basic page.
+ */
+
+ public ActionForward done(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+ return mapping.findForward(NoticeboardConstants.BASIC_PAGE);
+ }
+
+ /**
+ * Persist the values of the noticeboard content (title, content, online and offline instructions)
+ * into the database.
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws NbApplicationException
+ */
+ public ActionForward save(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws NbApplicationException {
+
+ NbAuthoringForm nbForm = (NbAuthoringForm)form;
+
+ //retrieve the service
+ INoticeboardService nbService = NoticeboardServiceProxy.getNbService(getServlet().getServletContext());
+
+ //retrieve the id
+ Long content_id = (Long)request.getSession().getAttribute(NoticeboardConstants.TOOL_CONTENT_ID);
+
+ if (content_id == null)
+ {
+ String error = "Tool content id missing. Unable to continue.";
+
+ throw new NbApplicationException(error);
+ }
+
+ // retrieve the content
+ NoticeboardContent nbContent = nbService.retrieveNoticeboard(content_id);
+
+ //update the noticeboard object
+ /* nbContent.setNbContentId(content_id);
+ nbContent.setTitle(nbForm.getTitle());
+ nbContent.setContent(nbForm.getContent());
+ nbContent.setOnlineInstructions(nbForm.getOnlineInstructions());
+ nbContent.setOfflineInstructions(nbForm.getOfflineInstructions());
+ nbContent.setDateUpdated(new Date(System.currentTimeMillis()));
+ */
+
+ nbForm.copyValuesIntoNbContent(nbContent);
+ //save the noticeboard object into the db
+ nbService.updateNoticeboard(nbContent);
+
+ return mapping.findForward(NoticeboardConstants.BASIC_PAGE);
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
\ No newline at end of file
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbAuthoringForm.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbAuthoringForm.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbAuthoringForm.java 7 Jun 2005 05:50:05 -0000 1.1
@@ -0,0 +1,184 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+
+
+/*
+ * Created on May 19, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.lamsfoundation.lams.tool.noticeboard.web;
+
+import java.util.Date;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent;
+import org.lamsfoundation.lams.tool.noticeboard.util.NbAuthoringUtil;
+
+
+//import org.lamsfoundation.lams.tool.noticeboard.NoticeboardConstants;
+
+/**
+ * ActionForm which holds the state of the noticeboard form content in the Authoring
+ * environment. Stores all values in the session scope.
+ */
+
+/**
+ * Creation Date: 19-05-05
+ *
+ * ----------------XDoclet Tags--------------------
+ *
+ * @struts:form name="NbAuthoringForm" type="org.lamsfoundation.lams.tool.noticeboard.web.NbAuthoringForm"
+ *
+ * ----------------XDoclet Tags--------------------
+ */
+public class NbAuthoringForm extends ActionForm {
+
+ static Logger logger = Logger.getLogger(NbAuthoringForm.class.getName());
+
+ private String title;
+ private String content;
+ private String onlineInstructions;
+ private String offlineInstructions;
+
+ private String method;
+ private String toolContentId;
+
+
+
+
+
+ /**
+ * @return Returns the content.
+ */
+ public String getContent() {
+ return content;
+ }
+ /**
+ * @param content The content to set.
+ */
+ public void setContent(String content) {
+ this.content = content;
+ }
+ /**
+ * @return Returns the title.
+ */
+ public String getTitle() {
+ return title;
+ }
+ /**
+ * @param title The title to set.
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ /**
+ * @return Returns the online instructions
+ */
+ public String getOnlineInstructions()
+ {
+ return onlineInstructions;
+ }
+
+ /**
+ * @param onlineInstructions The online instructions to set
+ */
+ public void setOnlineInstructions(String onlineInstructions)
+ {
+ this.onlineInstructions = onlineInstructions;
+ }
+
+ /**
+ * @return Returns the offline instructions
+ */
+ public String getOfflineInstructions()
+ {
+ return offlineInstructions;
+ }
+
+ /**
+ * @param offlineInstructions The offline instructions to set
+ */
+ public void setOfflineInstructions(String offlineInstructions)
+ {
+ this.offlineInstructions = offlineInstructions;
+ }
+
+ /**
+ * @return Returns the method.
+ */
+ public String getMethod() {
+ return method;
+ }
+ /**
+ * @param method The method to set.
+ */
+ public void setMethod(String method) {
+ this.method = method;
+ }
+ /**
+ * @return Returns the toolContentID.
+ */
+ public String getToolContentId() {
+ return toolContentId;
+ }
+ /**
+ * @param toolContentID The toolContentID to set.
+ */
+ public void setToolContentId(String toolContentID) {
+ this.toolContentId = toolContentID;
+ }
+
+ public void reset()
+ {
+ this.content = null;
+ this.title = null;
+ this.onlineInstructions = null;
+ this.offlineInstructions = null;
+
+ }
+
+ /**
+ * This method is to prepopulate the form with values from a noticeboard content
+ * object. Used in AuthoringStarterAction
+ * @param nbContent
+ */
+ public void populateFormWithNbContentValues(NoticeboardContent nbContent)
+ {
+ setTitle(nbContent.getTitle());
+ setContent(nbContent.getContent());
+ setOnlineInstructions(nbContent.getOnlineInstructions());
+ setOfflineInstructions(nbContent.getOfflineInstructions());
+ }
+
+ public void copyValuesIntoNbContent(NoticeboardContent nbContent)
+ {
+ nbContent.setContent(getContent());
+ nbContent.setOnlineInstructions(getOnlineInstructions());
+ nbContent.setOfflineInstructions(getOfflineInstructions());
+ nbContent.setDateUpdated(new Date(System.currentTimeMillis()));
+ }
+
+
+}
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbAuthoringStarterAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/Attic/NbAuthoringStarterAction.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbAuthoringStarterAction.java 7 Jun 2005 05:50:05 -0000 1.1
@@ -0,0 +1,152 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+
+/*
+ * Created on May 19, 2005
+ * @author mtruong
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.lamsfoundation.lams.tool.noticeboard.web;
+
+import java.util.Date;
+
+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.tool.noticeboard.NoticeboardConstants;
+
+import org.lamsfoundation.lams.tool.noticeboard.service.INoticeboardService;
+import org.lamsfoundation.lams.tool.noticeboard.service.NoticeboardServiceProxy;
+
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent;
+import org.lamsfoundation.lams.tool.noticeboard.util.NbAuthoringUtil;
+
+import org.lamsfoundation.lams.tool.noticeboard.NbApplicationException;
+
+/**
+ * Creation Date: 19-05-05
+ *
+ * ----------------XDoclet Tags--------------------
+ *
+ * @struts:action path="/tool/nb/starter/authoring" name="NbAuthoringForm" scope="session" type="org.lamsfoundation.lams.tool.noticeboard.web.NbAuthoringStarterAction"
+ * input="/index.jsp" validate="false"
+ * @struts:action-forward name="basic" path=".nb_basic"
+ * ----------------XDoclet Tags--------------------
+ */
+
+public class NbAuthoringStarterAction extends Action {
+
+ static Logger logger = Logger.getLogger(NbAuthoringAction.class.getName());
+
+ /**
+ * This struts action class gets called when the author double clicks
+ * on the tool icon. If the toolContentId already exists in the tool content
+ * table, the content is then extracted from the content table and is displayed.
+ * Otherwise, if the toolContentId does not exist in the content table, a new
+ * record is created with this toolContentId and default content is used.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return ActionForward, the action path to take once completed.
+ */
+ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws NbApplicationException {
+
+ NbAuthoringForm nbForm = (NbAuthoringForm)form;
+
+ Long contentId = NbAuthoringUtil.convertToLong(request.getParameter(NoticeboardConstants.TOOL_CONTENT_ID));
+
+ if(contentId == null)
+ {
+ String error = "Tool content id missing. Unable to continue.";
+ throw new NbApplicationException(error);
+ }
+
+ request.getSession().setAttribute(NoticeboardConstants.TOOL_CONTENT_ID, contentId);
+
+
+ /*
+ * Retrieve the Service
+ */
+ INoticeboardService nbService = NoticeboardServiceProxy.getNbService(getServlet().getServletContext());
+
+ if (!contentExists(nbService, contentId))
+ {
+ // Pre-fill the form with the default content
+ NoticeboardContent nb = nbService.retrieveNoticeboard(NoticeboardConstants.DEFAULT_CONTENT_ID);
+
+ //create a new noticeboard object and prefill with default content, save to database
+ NoticeboardContent nbContentNew = new NoticeboardContent();
+
+ nbContentNew.setNbContentId(contentId);
+ nbContentNew.setDateCreated(new Date(System.currentTimeMillis()));
+ nbContentNew.setTitle(nb.getTitle());
+ nbContentNew.setContent(nb.getContent());
+ nbContentNew.setOnlineInstructions(nb.getOnlineInstructions());
+ nbContentNew.setOfflineInstructions(nb.getOfflineInstructions());
+
+ //save new tool content into db
+ nbService.saveNoticeboard(nbContentNew);
+
+ //initialise the values in the form, so the values will be shown in the jsp
+ nbForm.populateFormWithNbContentValues(nbContentNew);
+
+ }
+ else
+ {
+ //get the values from the database
+ NoticeboardContent nb = nbService.retrieveNoticeboard(contentId);
+
+ nbForm.populateFormWithNbContentValues(nb);
+
+ }
+
+ return mapping.findForward(NoticeboardConstants.BASIC_PAGE);
+ }
+
+ /**
+ * Checks the session to see if the title and content session variables exist or not.
+ *
+ * @param session The HttpSession to check.
+ * @return true if the parameters title and content exists in the session, false otherwise
+ */
+ private boolean contentExists(INoticeboardService service, Long id)
+ {
+ NoticeboardContent nb = service.retrieveNoticeboard(id);
+ if (nb == null)
+ return false;
+ else
+ return true;
+
+ }
+
+
+
+}
\ No newline at end of file
Index: lams_tool_nb/test/java/org/lamsfoundation/lams/AbstractLamsTestCase.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/test/java/org/lamsfoundation/lams/Attic/AbstractLamsTestCase.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/test/java/org/lamsfoundation/lams/AbstractLamsTestCase.java 7 Jun 2005 05:52:18 -0000 1.1
@@ -0,0 +1,113 @@
+/* ********************************************************************************
+ * Copyright Notice
+ * =================
+ * This file contains propriety information of LAMS Foundation.
+ * Copying or reproduction with prior written permission is prohibited.
+ * Copyright (c) 2005
+ * Created on 2/02/2005
+ ******************************************************************************** */
+
+package org.lamsfoundation.lams;
+
+import junit.framework.TestCase;
+
+import net.sf.hibernate.HibernateException;
+import net.sf.hibernate.Session;
+import net.sf.hibernate.SessionFactory;
+
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.orm.hibernate.SessionFactoryUtils;
+import org.springframework.orm.hibernate.SessionHolder;
+import org.springframework.transaction.support.TransactionSynchronizationManager;
+
+
+/**
+ *
+ * @author Jacky Fang 2/02/2005
+ *
+ */
+public abstract class AbstractLamsTestCase extends TestCase
+{
+ protected ApplicationContext context;
+
+ private boolean shouldFlush = true;
+ /**
+ *
+ */
+ public AbstractLamsTestCase(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ context = new ClassPathXmlApplicationContext(getContextConfigLocation());
+ initializeHibernateSession();
+ }
+
+ protected abstract String[] getContextConfigLocation();
+
+ /**
+ * @return
+ */
+ protected abstract String getHibernateSessionFactoryName();
+
+ /**
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ finalizeHibernateSession();
+ }
+
+ /**
+ * @throws HibernateException
+ */
+ protected void initializeHibernateSession() throws HibernateException
+ {
+ //hold the hibernate session
+ SessionFactory sessionFactory = (SessionFactory) this.context.getBean(getHibernateSessionFactoryName());
+ Session s = sessionFactory.openSession();
+ TransactionSynchronizationManager.bindResource(sessionFactory, new SessionHolder(s));
+ }
+
+
+ /**
+ * @throws HibernateException
+ */
+ protected void finalizeHibernateSession() throws HibernateException
+ {
+ //clean the hibernate session
+ SessionFactory sessionFactory = (SessionFactory)this.context.getBean(getHibernateSessionFactoryName());
+ SessionHolder holder = (SessionHolder)TransactionSynchronizationManager.getResource(sessionFactory);
+ if (holder != null&&shouldFlush) {
+ Session s = holder.getSession();
+ s.flush();
+ TransactionSynchronizationManager.unbindResource(sessionFactory);
+ SessionFactoryUtils.closeSessionIfNecessary(s, sessionFactory);
+ }
+ }
+
+ protected Session getSession()
+ {
+ SessionFactory sessionFactory = (SessionFactory)this.context.getBean(getHibernateSessionFactoryName());
+ SessionHolder holder = (SessionHolder)TransactionSynchronizationManager.getResource(sessionFactory);
+ if (holder != null)
+ return holder.getSession();
+ else
+ return null;
+ }
+ /**
+ * @param shouldFlush The shouldFlush to set.
+ */
+ public void setShouldFlush(boolean shouldFlush)
+ {
+ this.shouldFlush = shouldFlush;
+ }
+}
Index: lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/NbDataAccessTestCase.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/Attic/NbDataAccessTestCase.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/NbDataAccessTestCase.java 7 Jun 2005 05:52:17 -0000 1.1
@@ -0,0 +1,194 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+
+
+/*
+ * Created on May 11, 2005
+ */
+
+package org.lamsfoundation.lams.tool.noticeboard;
+
+import org.lamsfoundation.lams.AbstractLamsTestCase;
+import org.lamsfoundation.lams.tool.noticeboard.dao.hibernate.NoticeboardContentDAO;
+import org.lamsfoundation.lams.tool.noticeboard.dao.hibernate.NoticeboardSessionDAO;
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent;
+import java.util.Date;
+import java.util.TreeSet;
+
+/**
+ * @author mtruong
+ */
+public class NbDataAccessTestCase extends AbstractLamsTestCase
+{
+
+ //---------------------------------------------------------------------
+ // DAO instances for initializing data
+ //---------------------------------------------------------------------
+ private NoticeboardContentDAO noticeboardDAO;
+ private NoticeboardSessionDAO nbSessionDAO;
+
+ //---------------------------------------------------------------------
+ // Domain Object instances
+ //---------------------------------------------------------------------
+ protected NoticeboardContent nbContent;
+ protected NoticeboardSession nbSession;
+
+ //---------------------------------------------------------------------
+ // Constant data used for Testing
+ //---------------------------------------------------------------------
+
+ protected final long ONE_DAY = 60 * 60 * 1000 * 24;
+
+ protected final Long TEST_NB_ID = new Long(1500);
+ protected final Long TEST_COPYNB_ID = new Long(3500);
+
+ protected final String TEST_TITLE = "Test Title";
+ protected final String TEST_CONTENT = "Welcome! We hope you enjoy the activities that are set out.";
+ protected final String TEST_ONLINE_INSTRUCTIONS = "Put your online instructions here";
+ protected final String TEST_OFFLINE_INSTRUCTIONS = "Put your offline instructions here";
+ protected final boolean TEST_DEFINE_LATER = false;
+ protected final boolean TEST_FORCE_OFFLINE = false;
+ protected final Date TEST_DATE_CREATED = new Date(System.currentTimeMillis());
+ protected final Date TEST_DATE_UPDATED = new Date();
+ protected final Long TEST_CREATOR_USER_ID = new Long(1300);
+
+ protected final Long TEST_SESSION_ID = new Long("1400");
+ protected final Date TEST_SESSION_START_DATE = new Date(System.currentTimeMillis());
+ protected final Date TEST_SESSION_END_DATE = new Date(System.currentTimeMillis() + ONE_DAY);
+ protected final String TEST_SESSION_STATUS = "Active";
+
+
+
+ /** Default Constructor */
+ public NbDataAccessTestCase(String name)
+ {
+ super(name);
+ }
+
+ //---------------------------------------------------------------------
+ // Inherited Methods
+ //---------------------------------------------------------------------
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ noticeboardDAO = (NoticeboardContentDAO) this.context.getBean("nbContentDAO");
+ nbSessionDAO = (NoticeboardSessionDAO) this.context.getBean("nbSessionDAO");
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /** Define the context files. Overrides method in AbstractLamsTestCase */
+ protected String[] getContextConfigLocation() {
+ return new String[] {
+ "org/lamsfoundation/lams/tool/noticeboard/testApplicationContext.xml"};
+ }
+
+ /** Define the sessionFactory bean name located in testApplication.xml. */
+ protected String getHibernateSessionFactoryName()
+ {
+ return "nbSessionFactory";
+ }
+
+ protected void initNbContentData()
+ {
+ //noticeboardDAO = (NoticeboardContentDao) this.context.getBean("nbContentDAO");
+ /* Check to see if data exist or not, if not then add to database */
+
+
+ nbContent = new NoticeboardContent(TEST_NB_ID,
+ TEST_TITLE,
+ TEST_CONTENT,
+ TEST_ONLINE_INSTRUCTIONS,
+ TEST_OFFLINE_INSTRUCTIONS,
+ TEST_DEFINE_LATER,
+ TEST_FORCE_OFFLINE,
+ TEST_CREATOR_USER_ID,
+ TEST_DATE_CREATED,
+ TEST_DATE_UPDATED,
+ new TreeSet()
+ );
+
+ noticeboardDAO.saveNbContent(nbContent);
+
+ }
+
+ protected void cleanNbContentData()
+ {
+ noticeboardDAO.removeNoticeboard(TEST_NB_ID);
+ }
+
+ protected Long getTestNoticeboardId()
+ {
+ return this.TEST_NB_ID;
+ }
+
+ protected void initNbSessionContent()
+ {
+
+ NoticeboardContent nb = noticeboardDAO.getNbContentById(TEST_NB_ID);
+
+ nbSession = new NoticeboardSession(TEST_SESSION_ID,
+ nb,
+ TEST_SESSION_START_DATE,
+ TEST_SESSION_END_DATE,
+ TEST_SESSION_STATUS);
+
+ nbSessionDAO.saveNbSession(nbSession);
+
+ //associate the session with the content
+ nb.getNbSessions().add(nbSession);
+
+ }
+
+ protected void cleanNbSessionContent()
+ {
+ nbSessionDAO.removeNbSession(TEST_SESSION_ID);
+ }
+
+ protected void cleanNbCopiedContent()
+ {
+ noticeboardDAO.removeNoticeboard(TEST_COPYNB_ID);
+ }
+
+ protected void initAllData()
+ {
+ initNbContentData();
+ initNbSessionContent();
+ }
+
+ protected void cleanAllData()
+ {
+ cleanNbSessionContent();
+ cleanNbContentData();
+
+ }
+
+ /*
+ *
+ * @author mtruong
+ *
+ * TODO write a test case to test the getter and setter methods
+ * for the POJO
+ */
+
+}
Index: lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/testApplicationContext.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/Attic/testApplicationContext.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/testApplicationContext.xml 7 Jun 2005 05:52:17 -0000 1.1
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+ com.mysql.jdbc.Driver
+ jdbc:mysql://localhost/lams?characterEncoding=utf8
+ lams
+ lamsdemo
+
+
+
+
+
+
+
+ org/lamsfoundation/lams/tool/noticeboard/NoticeboardContent.hbm.xml
+ org/lamsfoundation/lams/tool/noticeboard/NoticeboardSession.hbm.xml
+
+
+
+
+ net.sf.hibernate.dialect.MySQLDialect
+ false
+ 5
+ 20
+ 1800
+ 50
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PROPAGATION_REQUIRED
+ PROPAGATION_REQUIRED
+ PROPAGATION_REQUIRED
+ PROPAGATION_REQUIRED
+ PROPAGATION_REQUIRED
+ PROPAGATION_REQUIRED
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/dao/hibernate/TestNoticeboardContentDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/dao/hibernate/Attic/TestNoticeboardContentDAO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/dao/hibernate/TestNoticeboardContentDAO.java 7 Jun 2005 05:52:19 -0000 1.1
@@ -0,0 +1,225 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+
+/*
+ * Created on May 11, 2005
+ *
+ */
+package org.lamsfoundation.lams.tool.noticeboard.dao.hibernate;
+
+import org.lamsfoundation.lams.tool.noticeboard.NbDataAccessTestCase;
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent;
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardSession;
+import org.lamsfoundation.lams.tool.noticeboard.dao.hibernate.NoticeboardContentDAO;
+
+import org.springframework.orm.hibernate.HibernateObjectRetrievalFailureException;
+
+
+//import java.util.*;
+
+/**
+ * @author mtruong
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class TestNoticeboardContentDAO extends NbDataAccessTestCase
+{
+ private NoticeboardContentDAO noticeboardDAO;
+ private NoticeboardSessionDAO nbSessionDAO;
+ //private NoticeboardContent noticeboardContent;
+ private boolean cleanContentData = true;
+ private boolean cleanAllData = true;
+
+ public TestNoticeboardContentDAO(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * @see NbDataAccessTestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ //set up default noticeboard content for each test
+ noticeboardDAO = (NoticeboardContentDAO) this.context.getBean("nbContentDAO");
+ nbSessionDAO = (NoticeboardSessionDAO) this.context.getBean("nbSessionDAO");
+ this.initNbContentData();
+ this.initNbSessionContent();
+ //super.initAllData();
+ }
+
+ /**
+ * @see NbDataAccessTestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ //remove noticeboard content after each test
+ if (cleanAllData)
+ {
+ super.cleanAllData();
+ }
+ else if(cleanContentData)
+ {
+ super.cleanNbContentData();
+ }
+ }
+
+ public void testgetNbContentById()
+ {
+ /* Retrieve the previously saved noticeboard object from the database */
+
+ nbContent = noticeboardDAO.getNbContentById(getTestNoticeboardId());
+
+ /* Ensure that all content is what is was suppose to be */
+ //assertEquals(noticeboardContent.getNoticeboardId(), TEST_NB_ID);
+
+ assertEquals(nbContent.getTitle(), TEST_TITLE);
+ assertEquals(nbContent.getContent(), TEST_CONTENT);
+ assertEquals(nbContent.getOnlineInstructions(), TEST_ONLINE_INSTRUCTIONS);
+ assertEquals(nbContent.getOfflineInstructions(), TEST_OFFLINE_INSTRUCTIONS);
+ assertEquals(nbContent.isDefineLater(), TEST_DEFINE_LATER);
+ assertEquals(nbContent.isForceOffline(), TEST_FORCE_OFFLINE);
+ assertEquals(nbContent.getCreatorUserId(), TEST_CREATOR_USER_ID);
+ assertEquals(nbContent.getDateCreated(), TEST_DATE_CREATED);
+
+
+
+ }
+
+ public void testloadNbContentById(Long nbContentId)
+ {
+ /* Retrieve the previously saved noticeboard object from the database */
+
+ nbContent = noticeboardDAO.loadNbContentById(getTestNoticeboardId());
+
+ /* Ensure that all content is what is was suppose to be */
+ //assertEquals(noticeboardContent.getNoticeboardId(), TEST_NB_ID);
+
+ assertEquals(nbContent.getTitle(), TEST_TITLE);
+ assertEquals(nbContent.getContent(), TEST_CONTENT);
+ assertEquals(nbContent.getOnlineInstructions(), TEST_ONLINE_INSTRUCTIONS);
+ assertEquals(nbContent.getOfflineInstructions(), TEST_OFFLINE_INSTRUCTIONS);
+ assertEquals(nbContent.isDefineLater(), TEST_DEFINE_LATER);
+ assertEquals(nbContent.isForceOffline(), TEST_FORCE_OFFLINE);
+ assertEquals(nbContent.getCreatorUserId(), TEST_CREATOR_USER_ID);
+ assertEquals(nbContent.getDateCreated(), TEST_DATE_CREATED);
+ }
+
+ public void testgetNbContentBySession()
+ {
+ nbContent = noticeboardDAO.getNbContentBySession(TEST_SESSION_ID);
+
+ assertEquals(nbContent.getTitle(), TEST_TITLE);
+ assertEquals(nbContent.getContent(), TEST_CONTENT);
+ assertEquals(nbContent.getOnlineInstructions(), TEST_ONLINE_INSTRUCTIONS);
+ assertEquals(nbContent.getOfflineInstructions(), TEST_OFFLINE_INSTRUCTIONS);
+ assertEquals(nbContent.isDefineLater(), TEST_DEFINE_LATER);
+ assertEquals(nbContent.isForceOffline(), TEST_FORCE_OFFLINE);
+ assertEquals(nbContent.getCreatorUserId(), TEST_CREATOR_USER_ID);
+ assertEquals(nbContent.getDateCreated(), TEST_DATE_CREATED);
+ }
+
+ public void testsaveNbContent()
+ {
+ /**
+ * an object already created when setUp() is called, so dont need to save another instance
+ * TODO: change this, actually test the save method
+ */
+
+
+ nbContent = noticeboardDAO.loadNbContentById(getTestNoticeboardId());
+
+ assertEquals(nbContent.getNbContentId(), getTestNoticeboardId());
+
+ assertEquals(nbContent.getTitle(), TEST_TITLE);
+ assertEquals(nbContent.getContent(), TEST_CONTENT);
+ assertEquals(nbContent.getOnlineInstructions(), TEST_ONLINE_INSTRUCTIONS);
+ assertEquals(nbContent.getOfflineInstructions(), TEST_OFFLINE_INSTRUCTIONS);
+ assertEquals(nbContent.isDefineLater(), TEST_DEFINE_LATER);
+ assertEquals(nbContent.isForceOffline(), TEST_FORCE_OFFLINE);
+ assertEquals(nbContent.getCreatorUserId(), TEST_CREATOR_USER_ID);
+ assertEquals(nbContent.getDateCreated(), TEST_DATE_CREATED);
+
+ }
+
+ public void testupdateNbContent()
+ {
+ // Update the noticeboard to have a new value for its content field
+ String newContent = "New updated content";
+
+ nbContent = noticeboardDAO.loadNbContentById(getTestNoticeboardId());
+ nbContent.setContent(newContent);
+
+ noticeboardDAO.updateNbContent(nbContent);
+
+ //Check whether the value has been updated
+
+ nbContent = noticeboardDAO.getNbContentById(getTestNoticeboardId());
+
+ assertEquals(nbContent.getContent(), newContent);
+
+ }
+
+ public void testremoveNoticeboard()
+ {
+ cleanContentData = false;
+ cleanAllData = false;
+ NoticeboardContent nb = noticeboardDAO.getNbContentById(TEST_NB_ID);
+ noticeboardDAO.removeNbSessions(nb);
+ noticeboardDAO.removeNoticeboard(TEST_NB_ID);
+ try
+ {
+
+ NoticeboardContent emptyNbContent = noticeboardDAO.getNbContentById(TEST_NB_ID);
+ fail("An exception should be raised as the object has already been deleted");
+ }
+ catch (HibernateObjectRetrievalFailureException e)
+ {
+ assertTrue(true);
+ }
+
+ }
+
+ public void testremoveNbSessions()
+ {
+
+ cleanAllData = false;
+ cleanContentData = true;
+
+ nbContent = noticeboardDAO.getNbContentById(getTestNoticeboardId());
+
+ noticeboardDAO.removeNbSessions(nbContent);
+ NoticeboardContent nb = noticeboardDAO.getNbContentById(getTestNoticeboardId());
+ try
+ {
+ NoticeboardSession nbSession = nbSessionDAO.getNbSessionById(TEST_SESSION_ID);
+ fail("An exception should be raised");
+ }
+ catch (HibernateObjectRetrievalFailureException e)
+ {
+ assertTrue(true);
+ }
+
+ }
+
+
+}
Index: lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/dao/hibernate/TestNoticeboardSessionDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/dao/hibernate/Attic/TestNoticeboardSessionDAO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/dao/hibernate/TestNoticeboardSessionDAO.java 7 Jun 2005 05:52:19 -0000 1.1
@@ -0,0 +1,165 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+
+/*
+ * Created on May 16, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.lamsfoundation.lams.tool.noticeboard.dao.hibernate;
+
+import org.lamsfoundation.lams.tool.noticeboard.NbDataAccessTestCase;
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent;
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardSession;
+//import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent;
+//import org.lamsfoundation.lams.tool.noticeboard.NoticeboardSession;
+
+
+/**
+ * @author mtruong
+ *
+ */
+public class TestNoticeboardSessionDAO extends NbDataAccessTestCase {
+
+ private NoticeboardSessionDAO nbSessionDAO;
+ private NoticeboardContentDAO nbContentDAO;
+
+ private boolean cleanSessionContentData = true;
+
+ public TestNoticeboardSessionDAO(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * @see NbDataAccessTestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ nbContentDAO = (NoticeboardContentDAO) this.context.getBean("nbContentDAO");
+ nbSessionDAO = (NoticeboardSessionDAO) this.context.getBean("nbSessionDAO");
+
+ /* initialise data for noticeboard content and create a session containing this data */
+ this.initNbContentData();
+ this.initNbSessionContent();
+ }
+
+ /**
+ * @see NbDataAccessTestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ //remove noticeboard content after each test
+ if (cleanSessionContentData)
+ {
+
+ super.cleanAllData();
+
+ }
+ else
+ {
+ super.cleanNbContentData();
+ }
+ }
+
+ public void testgetNbSessionById()
+ {
+
+ //NoticeboardSession newNbSession = nbSessionDAO.getNbSessionById(TEST_SESSION_ID);
+ nbSession = nbSessionDAO.getNbSessionById(TEST_SESSION_ID);
+
+
+ assertEquals("Validate session id ",nbSession.getNbSessionId(), TEST_SESSION_ID);
+ assertEquals("Validate content id ",nbSession.getNbContent().getNbContentId(), TEST_NB_ID);
+ assertEquals("Validate session start date", nbSession.getSessionStartDate(), TEST_SESSION_START_DATE);
+ assertEquals("Validate session end date", nbSession.getSessionEndDate(), TEST_SESSION_END_DATE);
+ assertEquals("Validate session status", nbSession.getSessionStatus(), TEST_SESSION_STATUS);
+
+
+ }
+
+ public void testloadNbSessionById()
+ {
+ nbSession = nbSessionDAO.loadNbSessionById(TEST_SESSION_ID);
+
+ assertEquals("Validate session id ",nbSession.getNbSessionId(), TEST_SESSION_ID);
+ assertEquals("Validate content id ",nbSession.getNbContent().getNbContentId(), TEST_NB_ID);
+ assertEquals("Validate session start date", nbSession.getSessionStartDate(), TEST_SESSION_START_DATE);
+ assertEquals("Validate session end date", nbSession.getSessionEndDate(), TEST_SESSION_END_DATE);
+ assertEquals("Validate session status", nbSession.getSessionStatus(), TEST_SESSION_STATUS);
+
+ }
+
+ public void testsaveNbSession()
+ {
+ /* remove data that has been setup by setUp() */
+ this.cleanNbSessionContent();
+
+ NoticeboardContent nb = nbContentDAO.getNbContentById(TEST_NB_ID);
+
+ nbSession = new NoticeboardSession(TEST_SESSION_ID,
+ nb,
+ TEST_SESSION_START_DATE,
+ TEST_SESSION_END_DATE,
+ TEST_SESSION_STATUS);
+
+ nbSessionDAO.saveNbSession(nbSession);
+
+ assertEquals("Validate session id ",nbSession.getNbSessionId(), TEST_SESSION_ID);
+ assertEquals("Validate content id ",nbSession.getNbContent().getNbContentId(), TEST_NB_ID);
+ assertEquals("Validate session start date", nbSession.getSessionStartDate(), TEST_SESSION_START_DATE);
+ assertEquals("Validate session end date", nbSession.getSessionEndDate(), TEST_SESSION_END_DATE);
+ assertEquals("Validate session status", nbSession.getSessionStatus(), TEST_SESSION_STATUS);
+
+
+ }
+
+
+ public void testupdateNbSession()
+ {
+ String sessionStatus = "Suspended";
+
+ nbSession = nbSessionDAO.getNbSessionById(TEST_SESSION_ID);
+
+ nbSession.setSessionStatus(sessionStatus);
+
+ nbSessionDAO.updateNbSession(nbSession);
+
+ assertEquals("Validate session id ",nbSession.getNbSessionId(), TEST_SESSION_ID);
+ assertEquals("Validate new session status",nbSession.getSessionStatus(), sessionStatus);
+ }
+
+
+ public void testremoveNbSession()
+ {
+ cleanSessionContentData = false;
+ nbSessionDAO.removeNbSession(TEST_SESSION_ID);
+
+ NoticeboardSession session = new NoticeboardSession();
+
+ assertNull(session.getNbSessionId());
+
+ }
+
+
+}
Index: lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/dto/TestNoticeboardContentDTO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/dto/Attic/TestNoticeboardContentDTO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/dto/TestNoticeboardContentDTO.java 7 Jun 2005 05:52:20 -0000 1.1
@@ -0,0 +1,86 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+
+/*
+ * Created on Jun 1, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.lamsfoundation.lams.tool.noticeboard.dto;
+
+import java.util.TreeSet;
+
+import org.lamsfoundation.lams.tool.noticeboard.NbDataAccessTestCase;
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent;
+import org.lamsfoundation.lams.tool.noticeboard.dto.NoticeboardContentDTO;
+
+/**
+ * @author mtruong
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class TestNoticeboardContentDTO extends NbDataAccessTestCase {
+
+ public TestNoticeboardContentDTO(String name)
+ {
+ super(name);
+ }
+
+ public void testFullConstructor()
+ {
+ NoticeboardContentDTO nbDTO = new NoticeboardContentDTO(TEST_NB_ID,
+ TEST_TITLE,
+ TEST_CONTENT,
+ TEST_ONLINE_INSTRUCTIONS,
+ TEST_OFFLINE_INSTRUCTIONS);
+
+ assertEquals(nbDTO.getContentId(), TEST_NB_ID);
+ assertEquals(nbDTO.getTitle(), TEST_TITLE);
+ assertEquals(nbDTO.getContent(), TEST_CONTENT);
+ assertEquals(nbDTO.getOnlineInstructions(), TEST_ONLINE_INSTRUCTIONS);
+ assertEquals(nbDTO.getOfflineInstructions(), TEST_OFFLINE_INSTRUCTIONS);
+ }
+
+ public void testOtherConstructor()
+ {
+ NoticeboardContent nbContent = new NoticeboardContent(TEST_NB_ID,
+ TEST_TITLE,
+ TEST_CONTENT,
+ TEST_ONLINE_INSTRUCTIONS,
+ TEST_OFFLINE_INSTRUCTIONS,
+ TEST_DEFINE_LATER,
+ TEST_FORCE_OFFLINE,
+ TEST_CREATOR_USER_ID,
+ TEST_DATE_CREATED,
+ TEST_DATE_UPDATED,
+ new TreeSet());
+
+ NoticeboardContentDTO nbDTO = new NoticeboardContentDTO(nbContent);
+
+ assertEquals(nbDTO.getContentId(), TEST_NB_ID);
+ assertEquals(nbDTO.getTitle(), TEST_TITLE);
+ assertEquals(nbDTO.getContent(), TEST_CONTENT);
+ assertEquals(nbDTO.getOnlineInstructions(), TEST_ONLINE_INSTRUCTIONS);
+ assertEquals(nbDTO.getOfflineInstructions(), TEST_OFFLINE_INSTRUCTIONS);
+ }
+}
Index: lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/service/TestNoticeboardServicePOJO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/service/Attic/TestNoticeboardServicePOJO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/service/TestNoticeboardServicePOJO.java 7 Jun 2005 05:52:19 -0000 1.1
@@ -0,0 +1,153 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+
+/*
+ * Created on May 23, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.lamsfoundation.lams.tool.noticeboard.service;
+
+import org.lamsfoundation.lams.tool.noticeboard.NbDataAccessTestCase;
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent;
+import org.lamsfoundation.lams.tool.noticeboard.service.INoticeboardService;
+
+
+/**
+ * @author mtruong
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class TestNoticeboardServicePOJO extends NbDataAccessTestCase
+{
+
+ private INoticeboardService nbService = null;
+ //private INoticeboardContentDAO nbContentDAO = null;
+ private NoticeboardContent nb;
+
+ private boolean cleanContentData = true;
+ private boolean cleanAllData = true;
+
+ public TestNoticeboardServicePOJO(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ //setup some data
+ nbService = (INoticeboardService)this.context.getBean("nbService");
+ this.initNbContentData();
+ this.initNbSessionContent();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+
+ //delete data
+ if (cleanAllData)
+ {
+ super.cleanAllData();
+ }
+ else if(cleanContentData)
+ {
+ super.cleanNbContentData();
+ }
+
+ }
+
+ public void testretrieveNoticeboard()
+ {
+ nb = nbService.retrieveNoticeboard(TEST_NB_ID);
+
+ assertEquals(nb.getNbContentId(), TEST_NB_ID);
+
+ assertEquals(nb.getTitle(), TEST_TITLE);
+ assertEquals(nb.getContent(), TEST_CONTENT);
+ assertEquals(nb.getOnlineInstructions(), TEST_ONLINE_INSTRUCTIONS);
+ assertEquals(nb.getOfflineInstructions(), TEST_OFFLINE_INSTRUCTIONS);
+ assertEquals(nb.isDefineLater(), TEST_DEFINE_LATER);
+ assertEquals(nb.isForceOffline(), TEST_FORCE_OFFLINE);
+ assertEquals(nb.getCreatorUserId(), TEST_CREATOR_USER_ID);
+ assertEquals(nb.getDateCreated(), TEST_DATE_CREATED);
+
+ }
+
+ public void testupdateNoticeboard()
+ {
+ String newContent = "New updated content";
+ nb = nbService.retrieveNoticeboard(TEST_NB_ID);
+ nb.setContent(newContent);
+
+ //save the new changes
+ nbService.updateNoticeboard(nb);
+
+ //check whether the changes has been saved
+ NoticeboardContent newNb = nbService.retrieveNoticeboard(TEST_NB_ID);
+
+ assertEquals(newNb.getTitle(), TEST_TITLE);
+ assertEquals(newNb.getContent(), newContent);
+ assertEquals(newNb.getOnlineInstructions(), TEST_ONLINE_INSTRUCTIONS);
+ assertEquals(newNb.getOfflineInstructions(), TEST_OFFLINE_INSTRUCTIONS);
+ assertEquals(newNb.isDefineLater(), TEST_DEFINE_LATER);
+ assertEquals(newNb.isForceOffline(), TEST_FORCE_OFFLINE);
+ assertEquals(newNb.getCreatorUserId(), TEST_CREATOR_USER_ID);
+ assertEquals(newNb.getDateCreated(), TEST_DATE_CREATED);
+ }
+
+ public void testsaveNoticeboard()
+ {
+ //same as test retrieve
+ /**
+ * TODO: rewrite these tests
+ */
+
+ }
+
+ public void testremoveNoticeboard()
+ {
+
+ cleanAllData = false;
+ cleanContentData = false;
+ //remove associated sessions first, then remove the noticeboard content
+ nb = nbService.retrieveNoticeboard(TEST_NB_ID);
+
+ nbService.removeNoticeboardSessions(nb);
+ nbService.removeNoticeboard(TEST_NB_ID);
+
+ NoticeboardContent emptyNbContent = nbService.retrieveNoticeboard(TEST_NB_ID);
+ assertNull(emptyNbContent);
+ }
+
+// public void testremoveNoticeboardSessions()
+ //{
+ /**
+ * TODO: do this later when the session stuff is added into the survey service
+ */
+ //}
+
+
+
+}
Index: lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/service/TestToolContentManager.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/service/Attic/TestToolContentManager.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/service/TestToolContentManager.java 7 Jun 2005 05:52:19 -0000 1.1
@@ -0,0 +1,142 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+
+/*
+ * Created on May 24, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.lamsfoundation.lams.tool.noticeboard.service;
+
+import org.lamsfoundation.lams.tool.noticeboard.NbDataAccessTestCase;
+import org.lamsfoundation.lams.tool.ToolContentManager;
+import org.lamsfoundation.lams.tool.noticeboard.service.INoticeboardService;
+
+
+
+/**
+ * @author mtruong
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class TestToolContentManager extends NbDataAccessTestCase {
+
+ private ToolContentManager nbContentManager = null;
+ //private INoticeboardContentDAO nbContentDAO = null;
+ //private NoticeboardContent nb;
+ private INoticeboardService nbService = null;
+
+ private boolean cleanContentData = true;
+ private boolean cleanAllData = true;
+ private boolean cleanCopyContent = false;
+
+
+ public TestToolContentManager(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ //setup some data
+ nbContentManager = (ToolContentManager)this.context.getBean("nbService");
+ nbService = (INoticeboardService)this.context.getBean("nbService");
+ this.initNbContentData();
+ this.initNbSessionContent();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+
+ //delete data
+ if (cleanAllData)
+ {
+ super.cleanAllData();
+ }
+ else
+ {
+ if(cleanContentData)
+ {
+ super.cleanNbContentData();
+ }
+ }
+
+ if(cleanCopyContent)
+ {
+ super.cleanNbCopiedContent();
+ }
+ }
+
+ public void testcopyToolContent()
+ {
+ //ensure that the copied data is deleted after use
+ cleanCopyContent = true;
+
+ nbContentManager.copyToolContent(TEST_NB_ID, TEST_COPYNB_ID);
+
+ nbContent = nbService.retrieveNoticeboard(TEST_COPYNB_ID);
+
+ // check whether this new object contains the right content
+ assertEquals(nbContent.getNbContentId(), TEST_COPYNB_ID);
+
+ assertEquals(nbContent.getTitle(), TEST_TITLE);
+ assertEquals(nbContent.getContent(), TEST_CONTENT);
+ assertEquals(nbContent.getOnlineInstructions(), TEST_ONLINE_INSTRUCTIONS);
+ assertEquals(nbContent.getOfflineInstructions(), TEST_OFFLINE_INSTRUCTIONS);
+ assertEquals(nbContent.isDefineLater(), TEST_DEFINE_LATER);
+ assertEquals(nbContent.isForceOffline(), TEST_FORCE_OFFLINE);
+ assertEquals(nbContent.getCreatorUserId(), TEST_CREATOR_USER_ID);
+ assertEquals(nbContent.getDateCreated(), TEST_DATE_CREATED);
+ }
+
+ public void testsetAsDefineLater()
+ {
+ nbContentManager.setAsDefineLater(TEST_NB_ID);
+
+ nbContent = nbService.retrieveNoticeboard(TEST_NB_ID);
+
+ assertTrue(nbContent.isDefineLater());
+ }
+
+ public void testsetAsRunOffline()
+ {
+ nbContentManager.setAsRunOffline(TEST_NB_ID);
+ nbContent = nbService.retrieveNoticeboard(TEST_NB_ID);
+ assertTrue(nbContent.isForceOffline());
+ }
+
+ public void testremoveToolContent()
+ {
+ cleanAllData = false;
+ cleanContentData = false;
+ nbContentManager.removeToolContent(TEST_NB_ID);
+
+ nbContent = nbService.retrieveNoticeboard(TEST_NB_ID);
+ assertNull(nbContent);
+
+ }
+
+
+}
Index: lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/web/TestNbAuthoringStarterAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/web/Attic/TestNbAuthoringStarterAction.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/test/java/org/lamsfoundation/lams/tool/noticeboard/web/TestNbAuthoringStarterAction.java 7 Jun 2005 05:52:19 -0000 1.1
@@ -0,0 +1,78 @@
+/*
+ *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ *
+ *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; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *USA
+ *
+ *http://www.gnu.org/licenses/gpl.txt
+ */
+
+/*
+ * Created on May 25, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.lamsfoundation.lams.tool.noticeboard.web;
+
+import servletunit.struts.MockStrutsTestCase;
+import org.springframework.web.context.ContextLoader;
+import org.springframework.web.context.support.XmlWebApplicationContext;
+import org.lamsfoundation.lams.tool.noticeboard.NoticeboardConstants;
+
+
+/**
+ * @author mtruong
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class TestNbAuthoringStarterAction extends MockStrutsTestCase {
+
+ public TestNbAuthoringStarterAction(String name)
+ {
+ super(name);
+ }
+
+ public void setUp()throws Exception
+ {
+ super.setUp();
+ ContextLoader ctxLoader = new ContextLoader();
+ context.setInitParameter(ContextLoader.CONTEXT_CLASS_PARAM,
+ XmlWebApplicationContext.class.getName());
+
+ context.setInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
+ "/org/lamsfoundation/lams/tool/noticeboard/testApplicationContext.xml");
+ ctxLoader.initWebApplicationContext(context);
+
+ }
+
+ public void testLoadPage()
+ {
+
+ /* setConfigFile("/WEB-INF/struts-config.xml");
+ setRequestPathInfo("/tool/nb/starter/authoring");
+
+ actionPerform(); */
+
+ // verifyForward("loadNbForm");
+
+ // verifyNoActionErrors();
+
+ }
+
+
+
+}
Index: lams_tool_nb/web/footer.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/web/footer.jsp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/web/footer.jsp 7 Jun 2005 05:52:18 -0000 1.1
@@ -0,0 +1,30 @@
+
+