+
+
+
+
+
Index: lams_tool_sbmt/db/sql/create_lams_tool_sbmt.sql
===================================================================
diff -u
--- lams_tool_sbmt/db/sql/create_lams_tool_sbmt.sql (revision 0)
+++ lams_tool_sbmt/db/sql/create_lams_tool_sbmt.sql (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,46 @@
+CREATE TABLE tl_lasbmt11_content (
+ content_id BIGINT(20) NOT NULL AUTO_INCREMENT
+ , title VARCHAR(64) NOT NULL
+ , instructions VARCHAR(64) NOT NULL
+ , PRIMARY KEY (content_id)
+)TYPE=InnoDB;
+
+CREATE TABLE tl_lasbmt11_submission_details (
+ submission_id BIGINT(20) NOT NULL AUTO_INCREMENT
+ , content_id BIGINT(20) NOT NULL
+ , filePath VARCHAR(250) NOT NULL
+ , fileDescription VARCHAR(250) NOT NULL
+ , date_of_submission DATETIME NOT NULL
+ , uuid BIGINT(20) NOT NULL
+ , version_id BIGINT(20) NOT NULL
+ , user_id BIGINT(20) NOT NULL
+ , PRIMARY KEY (submission_id)
+ , INDEX (content_id)
+ , CONSTRAINT FK_tl_lasbmt11_submission_details_1 FOREIGN KEY (content_id)
+ REFERENCES tl_lasbmt11_content (content_id)
+)TYPE=InnoDB;
+
+CREATE TABLE tl_lasbmt11_report (
+ report_id BIGINT(20) NOT NULL AUTO_INCREMENT
+ , submission_id BIGINT(20) NOT NULL
+ , comments VARCHAR(250)
+ , marks BIGINT(20)
+ , date_marks_released DATETIME
+ , UNIQUE unique_submission_report (submission_id)
+ , PRIMARY KEY (report_id)
+ , INDEX (submission_id)
+ , CONSTRAINT FK_tl_lasbmt11_report_1 FOREIGN KEY (submission_id)
+ REFERENCES tl_lasbmt11_submission_details (submission_id)
+)TYPE=InnoDB;
+
+CREATE TABLE tl_lasbmt11_session (
+ session_id BIGINT(20) NOT NULL AUTO_INCREMENT
+ , content_id BIGINT(20) NOT NULL
+ , status INT(11) NOT NULL
+ , PRIMARY KEY (session_id)
+ , INDEX (content_id)
+ , CONSTRAINT FK_tl_lasbmt11_session_1 FOREIGN KEY (content_id)
+ REFERENCES tl_lasbmt11_content (content_id)
+)TYPE=InnoDB;
+
+
Index: lams_tool_sbmt/db/sql/drop_lams_tool_sbmt.sql
===================================================================
diff -u
--- lams_tool_sbmt/db/sql/drop_lams_tool_sbmt.sql (revision 0)
+++ lams_tool_sbmt/db/sql/drop_lams_tool_sbmt.sql (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,7 @@
+USE LAMS;
+SET FOREIGN_KEY_CHECKS=0;
+DROP TABLE IF EXISTS tl_lasbmt11_session;
+DROP TABLE IF EXISTS tl_lasbmt11_report;
+DROP TABLE IF EXISTS tl_lasbmt11_submission_details;
+DROP TABLE IF EXISTS tl_lasbmt11_content;
+SET FOREIGN_KEY_CHECKS=1;
\ No newline at end of file
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SbmtResources.properties
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SbmtResources.properties (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SbmtResources.properties (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,30 @@
+#=========================labels===========================#
+#-------------------------Authoring Labels-----------------#
+label.authoring.heading=Submission
+label.authoring.title=Title
+label.authoring.instruction=Instruction
+label.authoring.save.button=Save
+label.authoring.cancel.button=Cancel
+
+#-------------------------Learners Labels-----------------#
+label.learner.fileName = File Name
+label.learner.filePath = File
+label.learner.fileDescription = File Description
+label.learner.upload = Upload File
+label.learner.finished = Finished Uploading
+
+label.learner.time = Time Uploaded
+label.learner.dateOfSubmission = Date of Submission
+label.learner.comments = Comments
+label.learner.marks = Marks
+label.learner.dateMarksReleased = Date Marks Released
+
+label.learner.notAvailable = Not Available
+label.learner.noUpload = No files have been uploaded yet.
+label.learner.uploadMessage = Only one file can be uploaded at a time - Maximum file size is 1.0 MB
+
+#-------------------------Monitoring Labels-----------------#
+label.monitoring.needMarking = File(s) need marking
+
+#-------------------------Exception Labels-----------------#
+sbmt.web.action.upload.exception = Upload of file failed.
\ No newline at end of file
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmissionDetails.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmissionDetails.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmissionDetails.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,216 @@
+package org.lamsfoundation.lams.tool.sbmt;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ * @hibernate.class table="tl_lasbmt11_submission_details"
+ */
+public class SubmissionDetails implements Serializable {
+
+ /** identifier field */
+ private Long submissionID;
+
+ /** persistent field */
+ private String filePath;
+
+ /** persistent field */
+ private String fileDescription;
+
+ /** persistent field */
+ private Date dateOfSubmission;
+
+ /** persistent field */
+ private Long userID;
+
+ /** persistent field */
+ private Long uuid;
+
+ /** persistent field */
+ private Long versionID;
+
+ /** persistent field */
+ private SubmitFilesContent content;
+
+ /** persistent field */
+ private SubmitFilesReport report;
+
+ /** full constructor */
+ public SubmissionDetails(String filePath,String fileDescription,
+ Date dateOfSubmission, Long uuid,
+ Long versionID,SubmitFilesContent content,
+ SubmitFilesReport report,Long userID) {
+ this.filePath = filePath;
+ this.fileDescription = fileDescription;
+ this.dateOfSubmission = dateOfSubmission;
+ this.uuid = uuid;
+ this.versionID = versionID;
+ this.content = content;
+ this.report = report;
+ this.userID = userID;
+ }
+
+ /** default constructor */
+ public SubmissionDetails() {
+ }
+
+ /** minimal constructor */
+ public SubmissionDetails(String filePath,String fileDescription,
+ Date dateOfSubmission, Long uuid,
+ Long versionID,Long userID, SubmitFilesContent content) {
+ this.filePath = filePath;
+ this.fileDescription = fileDescription;
+ this.dateOfSubmission = dateOfSubmission;
+ this.uuid = uuid;
+ this.versionID = versionID;
+ this.userID = userID;
+ this.content = content;
+ }
+
+ /**
+ * @hibernate.id generator-class="identity" type="java.lang.Long"
+ * column="submission_id"
+ */
+ public Long getSubmissionID() {
+ return this.submissionID;
+ }
+
+ public void setSubmissionID(Long submissionID) {
+ this.submissionID = submissionID;
+ }
+
+ /**
+ * @hibernate.property column="filePath" length="250"
+ */
+ public String getFilePath() {
+ return this.filePath;
+ }
+
+ public void setFilePath(String filePath) {
+ this.filePath = filePath;
+ }
+
+ /**
+ * @hibernate.property column="fileDescription" length="250"
+ */
+ public String getFileDescription() {
+ return this.fileDescription;
+ }
+
+ public void setFileDescription(String fileDescription) {
+ this.fileDescription = fileDescription;
+ }
+
+ /**
+ * @hibernate.property column="date_of_submission" length="19"
+ */
+ public Date getDateOfSubmission() {
+ return this.dateOfSubmission;
+ }
+
+ public void setDateOfSubmission(Date dateOfSubmission) {
+ this.dateOfSubmission = dateOfSubmission;
+ }
+
+ /**
+ * @hibernate.property column="uuid" length="20"
+ */
+ public Long getUuid() {
+ return this.uuid;
+ }
+
+ public void setUuid(Long uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
+ * @hibernate.property column="version_id" length="20"
+ */
+ public Long getVersionID() {
+ return this.versionID;
+ }
+
+ public void setVersionID(Long versionID) {
+ this.versionID = versionID;
+ }
+
+ /**
+ * @hibernate.many-to-one not-null="true"
+ * @hibernate.column name="content_id"
+ *
+ */
+ public SubmitFilesContent getContent() {
+ return this.content;
+ }
+
+ public void setContent(SubmitFilesContent content) {
+ this.content = content;
+ }
+
+ public String toString() {
+ return new ToStringBuilder(this)
+ .append("submissionID",getSubmissionID()).append("filePath", getFilePath())
+ .append("fileDescription", getFileDescription())
+ .append("dateOfSubmission", getDateOfSubmission())
+ .append("uuid",getUuid())
+ .append("versionID", getVersionID())
+ .append("userID",getUserID())
+ .toString();
+ }
+
+ public boolean equals(Object other) {
+ if ((this == other))
+ return true;
+ if (!(other instanceof SubmissionDetails))
+ return false;
+ SubmissionDetails castOther = (SubmissionDetails) other;
+ return new EqualsBuilder().append(this.getSubmissionID(),
+ castOther.getSubmissionID()).append(this.getFilePath(),
+ castOther.getFilePath()).append(this.getFileDescription(),
+ castOther.getFileDescription()).append(
+ this.getDateOfSubmission(), castOther.getDateOfSubmission())
+ .append(this.getUuid(), castOther.getUuid())
+ .append(this.getVersionID(), castOther.getVersionID())
+ .append(this.getContent(), castOther.getContent())
+ .append(this.getReport(),castOther.getReport())
+ .append(this.getUserID(),castOther.getUserID())
+ .isEquals();
+ }
+
+ public int hashCode() {
+ return new HashCodeBuilder().append(getSubmissionID()).append(
+ getFilePath()).append(getFileDescription()).append(
+ getDateOfSubmission()).append(getUuid()).append(getVersionID())
+ .append(getContent()).append(getReport()).append(getUserID()).toHashCode();
+ }
+
+ /**
+ * @return Returns the report.
+ */
+ public SubmitFilesReport getReport() {
+ return report;
+ }
+ /**
+ * @param report The report to set.
+ */
+ public void setReport(SubmitFilesReport report) {
+ this.report = report;
+ }
+ /**
+ * @hibernate.property column="user_id" length="20"
+ * @return Returns the userID.
+ */
+ public Long getUserID() {
+ return userID;
+ }
+ /**
+ * @param userID The userID to set.
+ */
+ public void setUserID(Long userID) {
+ this.userID = userID;
+ }
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitFilesContent.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitFilesContent.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitFilesContent.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,165 @@
+package org.lamsfoundation.lams.tool.sbmt;
+
+import java.io.Serializable;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ * @hibernate.class table="tl_lasbmt11_content"
+ */
+public class SubmitFilesContent implements Serializable {
+
+ /** identifier field */
+ private Long contentID;
+
+ /** persistent field */
+ private String title;
+
+ /** nullable persistent field */
+ private String instructions;
+
+ /** persistent field */
+ private Set toolSession;
+
+ /** persistent field */
+ private Set submissionDetails;
+
+ /** full constructor */
+ public SubmitFilesContent(String title, String instructions,
+ Set toolSession,Set submissionDetails) {
+ this.title = title;
+ this.instructions = instructions;
+ this.toolSession = toolSession;
+ this.submissionDetails = submissionDetails;
+ }
+
+ /** default constructor */
+ public SubmitFilesContent() {
+ }
+
+ /** minimal constructor */
+ public SubmitFilesContent(Long contentID,
+ String title,
+ String instructions,
+ Set toolSession,
+ Set submissionDetails) {
+ super();
+ this.contentID = contentID;
+ this.title = title;
+ this.instructions = instructions;
+ this.toolSession = toolSession;
+ this.submissionDetails = submissionDetails;
+ }
+
+ public SubmitFilesContent(Long contentID, String title, String instructions){
+ this.contentID = contentID;
+ this.title = title;
+ this.instructions = instructions;
+ }
+
+ /**
+ * Copy constructor to create a new SubmitFiles tool's content.
+ *
+ * @param content The original tool content
+ * @param newContentID The new SubmitFiles contentID
+ * @return SubmitFilesContent The new SubmitFilesContent object
+ */
+ public static SubmitFilesContent newInstance(SubmitFilesContent content,
+ Long newContentID) {
+
+ SubmitFilesContent newContent = new SubmitFilesContent(newContentID,
+ content.getTitle(),
+ content.getInstructions(),
+ new TreeSet(),
+ new TreeSet());
+ return newContent;
+ }
+
+ /**
+ * @hibernate.id generator-class="assigned" type="java.lang.Long"
+ * column="content_id"
+ */
+ public Long getContentID() {
+ return this.contentID;
+ }
+
+ public void setContentID(Long contentID) {
+ this.contentID = contentID;
+ }
+
+ /**
+ * @hibernate.property column="title" length="64" not-null="true"
+ */
+ public String getTitle() {
+ return this.title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ /**
+ * @hibernate.property column="instructions" length="64"
+ */
+ public String getInstructions() {
+ return this.instructions;
+ }
+
+ public void setInstructions(String instructions) {
+ this.instructions = instructions;
+ }
+
+ /**
+ * @hibernate.set lazy="true" inverse="true" cascade="all-delete-orphan"
+ * @hibernate.collection-key column="content_id"
+ * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.sbmt.SubmitFilesSession"
+ *
+ */
+ public Set getToolSession() {
+ return this.toolSession;
+ }
+
+ public void setToolSession(Set toolSession) {
+ this.toolSession = toolSession;
+ }
+
+ public String toString() {
+ return new ToStringBuilder(this).append("contentID", getContentID())
+ .append("title", getTitle()).append("instructions",
+ getInstructions()).toString();
+ }
+
+ public boolean equals(Object other) {
+ if ((this == other))
+ return true;
+ if (!(other instanceof SubmitFilesContent))
+ return false;
+ SubmitFilesContent castOther = (SubmitFilesContent) other;
+ return new EqualsBuilder().append(this.getContentID(),
+ castOther.getContentID()).append(this.getTitle(),
+ castOther.getTitle()).append(this.getInstructions(),
+ castOther.getInstructions()).isEquals();
+ }
+
+ public int hashCode() {
+ return new HashCodeBuilder().append(getContentID()).append(getTitle())
+ .append(getInstructions()).toHashCode();
+ }
+
+ /**
+ * @return Returns the submissionDetails.
+ */
+ public Set getSubmissionDetails() {
+ return submissionDetails;
+ }
+ /**
+ * @param submissionDetails The submissionDetails to set.
+ */
+ public void setSubmissionDetails(Set submissionDetails) {
+ this.submissionDetails = submissionDetails;
+ }
+}
\ No newline at end of file
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitFilesReport.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitFilesReport.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitFilesReport.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,111 @@
+package org.lamsfoundation.lams.tool.sbmt;
+
+import java.io.Serializable;
+import java.util.Date;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+
+/**
+ * @hibernate.class table="tl_lasbmt11_report"
+*/
+public class SubmitFilesReport implements Serializable {
+
+ /** identifier field */
+ private Long reportID;
+
+ /** persistent field */
+ private String comments;
+
+ /** nullable persistent field */
+ private Long marks;
+
+ /** nullable persistent field */
+ private Date dateMarksReleased;
+
+ /** persistent field */
+ private SubmissionDetails submissionDetails;
+
+ /** full constructor */
+ public SubmitFilesReport(String comments, Long marks, Date dateMarksReleased, SubmissionDetails submissionDetails) {
+ this.comments = comments;
+ this.marks = marks;
+ this.dateMarksReleased = dateMarksReleased;
+ this.submissionDetails = submissionDetails;
+ }
+
+ /** default constructor */
+ public SubmitFilesReport() {
+ }
+
+ /** minimal constructor */
+ public SubmitFilesReport(SubmissionDetails submissionDetails) {
+ this.submissionDetails = submissionDetails;
+ }
+
+ /**
+ * @hibernate.id generator-class="identity" type="java.lang.Long" column="report_id"
+ */
+ public Long getReportID() {
+ return this.reportID;
+ }
+
+ public void setReportID(Long reportID) {
+ this.reportID = reportID;
+ }
+
+ /**
+ * @hibernate.property column="comments" length="250"
+ */
+ public String getComments() {
+ return this.comments;
+ }
+
+ public void setComments(String comments) {
+ this.comments = comments;
+ }
+
+ /**
+ * @hibernate.property column="marks" length="20"
+ */
+ public Long getMarks() {
+ return this.marks;
+ }
+
+ public void setMarks(Long marks) {
+ this.marks = marks;
+ }
+
+ /**
+ * @hibernate.property column="date_marks_released" length="19"
+ */
+ public Date getDateMarksReleased() {
+ return this.dateMarksReleased;
+ }
+
+ public void setDateMarksReleased(Date dateMarksReleased) {
+ this.dateMarksReleased = dateMarksReleased;
+ }
+
+ /**
+ * @hibernate.many-to-one not-null="true"
+ * @hibernate.column name="submission_id"
+ */
+ public SubmissionDetails getSubmissionDetails() {
+ return this.submissionDetails;
+ }
+
+ public void setSubmissionDetails(SubmissionDetails submissionDetails) {
+ this.submissionDetails = submissionDetails;
+ }
+
+ public String toString() {
+ return new ToStringBuilder(this)
+ .append("reportID", getReportID())
+ .append("comments", getComments())
+ .append("marks", getMarks())
+ .append("dateMarksReleased", getDateMarksReleased())
+ .toString();
+ }
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitFilesSession.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitFilesSession.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitFilesSession.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,94 @@
+package org.lamsfoundation.lams.tool.sbmt;
+
+import java.io.Serializable;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+
+/**
+ * @hibernate.class table="tl_lasbmt11_session"
+*/
+public class SubmitFilesSession implements Serializable {
+
+ /** identifier field */
+ private Long sessionID;
+
+ /** persistent field */
+ private Integer status;
+
+ /** persistent field */
+ private SubmitFilesContent contentID;
+
+ /** full constructor */
+ public SubmitFilesSession(Integer status, SubmitFilesContent contentID) {
+ this.status = status;
+ this.contentID = contentID;
+ }
+
+ /** default constructor */
+ public SubmitFilesSession() {
+ }
+
+ /**
+ * @hibernate.id generator-class="identity" type="java.lang.Long" column="session_id"
+ */
+ public Long getSessionID() {
+ return this.sessionID;
+ }
+
+ public void setSessionID(Long sessionID) {
+ this.sessionID = sessionID;
+ }
+
+ /**
+ * @hibernate.property column="status" length="11" not-null="true"
+ */
+ public Integer getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ /**
+ * @hibernate.many-to-one not-null="true"
+ * @hibernate.column name="content_id"
+ *
+ */
+ public SubmitFilesContent getContentID() {
+ return this.contentID;
+ }
+
+ public void setContentID(SubmitFilesContent contentID) {
+ this.contentID = contentID;
+ }
+
+ public String toString() {
+ return new ToStringBuilder(this)
+ .append("sessionID", getSessionID())
+ .append("status", getStatus())
+ .toString();
+ }
+
+ public boolean equals(Object other) {
+ if ( (this == other ) ) return true;
+ if ( !(other instanceof SubmitFilesSession) ) return false;
+ SubmitFilesSession castOther = (SubmitFilesSession) other;
+ return new EqualsBuilder()
+ .append(this.getSessionID(), castOther.getSessionID())
+ .append(this.getStatus(), castOther.getStatus())
+ .append(this.getContentID(), castOther.getContentID())
+ .isEquals();
+ }
+
+ public int hashCode() {
+ return new HashCodeBuilder()
+ .append(getSessionID())
+ .append(getStatus())
+ .append(getContentID())
+ .toHashCode();
+ }
+
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/ISubmissionDetailsDAO.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/ISubmissionDetailsDAO.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/ISubmissionDetailsDAO.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,48 @@
+/*
+ * 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.sbmt.dao;
+
+import java.util.List;
+
+import org.lamsfoundation.lams.learningdesign.dao.IBaseDAO;
+import org.lamsfoundation.lams.tool.sbmt.SubmissionDetails;
+
+/**
+ * @author Manpreet Minhas
+ */
+public interface ISubmissionDetailsDAO extends IBaseDAO {
+
+ /**
+ * Returns a SubmissionDetails object
+ * corresponding to given submissionID
+ *
+ * @param submissionID The submission_id to be looked up
+ * @return SubmissionDetails The required populated object
+ */
+ public SubmissionDetails getSubmissionDetailsByID(Long submissionID);
+
+ /**
+ * Returns a list of records coresponding to the given contentID.
+ *
+ * @param contentID The content_id to be looked up
+ * @return List The list of required details
+ */
+ public List getSubmissionDetailsByContentID(Long contentID);
+
+ /**
+ * This method returns a list of files that were uploaded by the
+ * given User for given contentID.
+ *
+ * @param userID The user_id of the User
+ * @param contentID The content_id to be looked up
+ * @return List The list of required objects.
+ */
+ public List getSubmissionDetailsForUserByContent(Long userID,Long contentID);
+
+ public List getUsersForContent(Long contentID);
+
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/ISubmitFilesContentDAO.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/ISubmitFilesContentDAO.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/ISubmitFilesContentDAO.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,26 @@
+/*
+ * Created on May 30, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.lamsfoundation.lams.tool.sbmt.dao;
+
+import org.lamsfoundation.lams.learningdesign.dao.IBaseDAO;
+import org.lamsfoundation.lams.tool.sbmt.SubmitFilesContent;
+
+/**
+ * @author Manpreet Minhas
+ */
+public interface ISubmitFilesContentDAO extends IBaseDAO{
+
+ /**
+ * Returns the content corresponding to the given
+ * contentID
+ *
+ * @param contentID The contentID to be looked up
+ * @return SubmitFilesContent The required populated object
+ */
+ public SubmitFilesContent getContentByID(Long contentID);
+
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/ISubmitFilesReportDAO.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/ISubmitFilesReportDAO.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/ISubmitFilesReportDAO.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,36 @@
+/*
+ * Created on May 30, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.lamsfoundation.lams.tool.sbmt.dao;
+
+
+import org.lamsfoundation.lams.learningdesign.dao.IBaseDAO;
+import org.lamsfoundation.lams.tool.sbmt.SubmitFilesReport;
+
+/**
+ * @author Manpreet Minhas
+ */
+public interface ISubmitFilesReportDAO extends IBaseDAO {
+
+ /**
+ * Returns the report specific to the given
+ * reportID
+ *
+ * @param reportID The reportID to be looked up
+ * @return SubmitFilesReport The required populated object
+ */
+ public SubmitFilesReport getReportByID(Long reportID);
+
+ /**
+ * Returns the record corresponding to the given
+ * submissionID
+ *
+ * @param submissionID
+ * @return SubmitFilesReport The required object
+ */
+ public SubmitFilesReport getReportBySubmissionID(Long submissionID);
+
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/ISubmitFilesSessionDAO.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/ISubmitFilesSessionDAO.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/ISubmitFilesSessionDAO.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,26 @@
+/*
+ * Created on May 30, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.lamsfoundation.lams.tool.sbmt.dao;
+
+import org.lamsfoundation.lams.learningdesign.dao.IBaseDAO;
+import org.lamsfoundation.lams.tool.sbmt.SubmitFilesSession;
+
+/**
+ * @author Manpreet Minhas
+ */
+public interface ISubmitFilesSessionDAO extends IBaseDAO {
+
+ /**
+ * Returns the session record corresponding to the
+ * given sessionID
+ *
+ * @param sessionID The session_id to be looked up
+ * @return SubmitFilesSession The required populated object
+ */
+ public SubmitFilesSession getSessionByID(Long sessionID);
+
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/hibernate/SubmissionDetailsDAO.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/hibernate/SubmissionDetailsDAO.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/hibernate/SubmissionDetailsDAO.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,75 @@
+/*
+ * 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.sbmt.dao.hibernate;
+
+import java.util.List;
+
+import net.sf.hibernate.Hibernate;
+import net.sf.hibernate.HibernateException;
+import net.sf.hibernate.Session;
+import net.sf.hibernate.type.Type;
+
+import org.lamsfoundation.lams.learningdesign.dao.hibernate.BaseDAO;
+import org.lamsfoundation.lams.tool.sbmt.SubmissionDetails;
+import org.lamsfoundation.lams.tool.sbmt.dao.ISubmissionDetailsDAO;
+import org.springframework.orm.hibernate.HibernateCallback;
+
+/**
+ * @author Manpreet Minhas
+ */
+public class SubmissionDetailsDAO extends BaseDAO implements
+ ISubmissionDetailsDAO {
+
+ private static final String TABLENAME = "tl_lasbmt11_submission_details";
+ private static final String FIND_BY_CONTENT_ID = "from " + TABLENAME +
+ " in class " + SubmissionDetails.class.getName() +
+ " where content_id=? ORDER BY user_id";
+ private static final String FIND_FOR_USER_BY_CONTENT = "from " + TABLENAME +
+ " in class " + SubmissionDetails.class.getName() +
+ " where user_id=? AND content_id=?";
+ private static final String FIND_DISTINCT_USER = " select distinct details.userID from SubmissionDetails details " +
+ " where details.content =:contentID";
+
+
+ /**
+ * (non-Javadoc)
+ * @see org.lamsfoundation.lams.tool.sbmt.dao.ISubmissionDetailsDAO#getSubmissionDetailsByID(java.lang.Long)
+ */
+ public SubmissionDetails getSubmissionDetailsByID(Long submissionID) {
+ return (SubmissionDetails) this.getHibernateTemplate().
+ get(SubmissionDetails.class, submissionID);
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.lamsfoundation.lams.tool.sbmt.dao.ISubmissionDetailsDAO#getSubmissionDetailsByContentID(java.lang.Long)
+ */
+ public List getSubmissionDetailsByContentID(Long contentID){
+ return this.getHibernateTemplate().find(FIND_BY_CONTENT_ID,contentID);
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.lamsfoundation.lams.tool.sbmt.dao.ISubmissionDetailsDAO#getSubmissionDetailsForUserByContent(java.lang.Long, java.lang.Long)
+ */
+ public List getSubmissionDetailsForUserByContent(Long userID,Long contentID){
+ List list = this.getHibernateTemplate().find(FIND_FOR_USER_BY_CONTENT,
+ new Object[]{userID, contentID},
+ new Type[]{Hibernate.LONG,Hibernate.LONG});
+ return list;
+ }
+
+ public List getUsersForContent(final Long contentID){
+ return (List) this.getHibernateTemplate().execute(new HibernateCallback(){
+ public Object doInHibernate(Session session) throws HibernateException{
+ return session.createQuery(FIND_DISTINCT_USER)
+ .setLong("contentID",contentID.longValue())
+ .list();
+ }
+ });
+ }
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/hibernate/SubmitFilesContentDAO.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/hibernate/SubmitFilesContentDAO.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/hibernate/SubmitFilesContentDAO.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,25 @@
+/*
+ * Created on May 30, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.lamsfoundation.lams.tool.sbmt.dao.hibernate;
+
+import org.lamsfoundation.lams.learningdesign.dao.hibernate.BaseDAO;
+import org.lamsfoundation.lams.tool.sbmt.SubmitFilesContent;
+import org.lamsfoundation.lams.tool.sbmt.dao.ISubmitFilesContentDAO;
+
+/**
+ * @author Manpreet Minhas
+ */
+public class SubmitFilesContentDAO extends BaseDAO implements ISubmitFilesContentDAO {
+
+ /**
+ * (non-Javadoc)
+ * @see org.lamsfoundation.lams.tool.sbmt.dao.ISubmitFilesContentDAO#getContentByID(java.lang.Long)
+ */
+ public SubmitFilesContent getContentByID(Long contentID) {
+ return (SubmitFilesContent) super.find(SubmitFilesContent.class,contentID);
+ }
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/hibernate/SubmitFilesReportDAO.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/hibernate/SubmitFilesReportDAO.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/hibernate/SubmitFilesReportDAO.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,46 @@
+/*
+ * Created on May 30, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.lamsfoundation.lams.tool.sbmt.dao.hibernate;
+
+import java.util.List;
+import org.lamsfoundation.lams.learningdesign.dao.hibernate.BaseDAO;
+import org.lamsfoundation.lams.tool.sbmt.SubmitFilesReport;
+import org.lamsfoundation.lams.tool.sbmt.dao.ISubmitFilesReportDAO;
+
+/**
+ * @author Manpreet Minhas
+ */
+public class SubmitFilesReportDAO extends BaseDAO implements
+ ISubmitFilesReportDAO {
+
+ private static final String TABLENAME ="tl_lasbmt11_report";
+ private static final String FIND_BY_SUBMISSION = "from " + TABLENAME +
+ " in class " + SubmitFilesReport.class.getName() +
+ " where submission_id=?" ;
+
+ /**
+ * (non-Javadoc)
+ * @see org.lamsfoundation.lams.tool.sbmt.dao.ISubmitFilesReportDAO#getReportByID(java.lang.Long)
+ */
+ public SubmitFilesReport getReportByID(Long reportID) {
+ return (SubmitFilesReport)super.find(SubmitFilesReport.class,reportID);
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.lamsfoundation.lams.tool.sbmt.dao.ISubmitFilesReportDAO#getReportBySubmissionID(java.lang.Long)
+ */
+ public SubmitFilesReport getReportBySubmissionID(Long submissionID){
+
+ List list = this.getHibernateTemplate().find(FIND_BY_SUBMISSION,submissionID);
+ if(list!=null)
+ return (SubmitFilesReport)list.get(0);
+ else
+ return null;
+ }
+
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/hibernate/SubmitFilesSessionDAO.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/hibernate/SubmitFilesSessionDAO.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dao/hibernate/SubmitFilesSessionDAO.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,27 @@
+/*
+ * Created on May 30, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.lamsfoundation.lams.tool.sbmt.dao.hibernate;
+
+import org.lamsfoundation.lams.learningdesign.dao.hibernate.BaseDAO;
+import org.lamsfoundation.lams.tool.sbmt.SubmitFilesSession;
+import org.lamsfoundation.lams.tool.sbmt.dao.ISubmitFilesSessionDAO;
+
+/**
+ * @author Manpreet Minhas
+ */
+public class SubmitFilesSessionDAO extends BaseDAO implements
+ ISubmitFilesSessionDAO {
+
+ /**
+ * (non-Javadoc)
+ * @see org.lamsfoundation.lams.tool.sbmt.dao.ISubmitFilesSessionDAO#getSessionByID(java.lang.Long)
+ */
+ public SubmitFilesSession getSessionByID(Long sessionID) {
+ return (SubmitFilesSession) super.find(SubmitFilesSession.class,sessionID);
+ }
+
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dto/FileDetailsDTO.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dto/FileDetailsDTO.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dto/FileDetailsDTO.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,181 @@
+/****************************************************************
+ * 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.sbmt.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import org.lamsfoundation.lams.tool.sbmt.SubmissionDetails;
+import org.lamsfoundation.lams.tool.sbmt.SubmitFilesReport;
+
+/**
+ * @author Manpreet Minhas
+ */
+public class FileDetailsDTO implements Serializable{
+
+ private Long reportID;
+ private String filePath;
+ private String fileDescription;
+ private Date dateOfSubmission;
+ private Date dateMarksReleased;
+ private String comments;
+ private Long marks;
+ private Long uuID;
+ private Long versionID;
+
+ /** Miinimal Constructor*/
+ public FileDetailsDTO(String filePath, String fileDescription,
+ Date dateOfSubmission,Long reportID, String comments, Long marks) {
+ super();
+ this.filePath = filePath;
+ this.fileDescription = fileDescription;
+ this.dateOfSubmission = dateOfSubmission;
+ this.reportID = reportID;
+ this.comments = comments;
+ this.marks = marks;
+ }
+
+ public FileDetailsDTO(SubmissionDetails details, SubmitFilesReport report){
+
+ this.filePath = details.getFilePath();
+ this.fileDescription = details.getFileDescription();
+ this.dateOfSubmission = details.getDateOfSubmission();
+ this.uuID = details.getUuid();
+ this.versionID = details.getVersionID();
+
+ this.reportID = report.getReportID();
+ this.dateMarksReleased = report.getDateMarksReleased();
+ this.comments = report.getComments();
+ this.marks = report.getMarks();
+ }
+
+ /**
+ * @return Returns the reportID.
+ */
+ public Long getReportID() {
+ return reportID;
+ }
+ /**
+ * @param reportID The reportID to set.
+ */
+ public void setReportID(Long reportID) {
+ this.reportID = reportID;
+ }
+ /**
+ * @return Returns the comments.
+ */
+ public String getComments() {
+ return comments;
+ }
+ /**
+ * @param comments The comments to set.
+ */
+ public void setComments(String comments) {
+ this.comments = comments;
+ }
+ /**
+ * @return Returns the dateOfSubmission.
+ */
+ public Date getDateOfSubmission() {
+ return dateOfSubmission;
+ }
+ /**
+ * @param dateOfSubmission The dateOfSubmission to set.
+ */
+ public void setDateOfSubmission(Date dateOfSubmission) {
+ this.dateOfSubmission = dateOfSubmission;
+ }
+ /**
+ * @return Returns the fileDescription.
+ */
+ public String getFileDescription() {
+ return fileDescription;
+ }
+ /**
+ * @param fileDescription The fileDescription to set.
+ */
+ public void setFileDescription(String fileDescription) {
+ this.fileDescription = fileDescription;
+ }
+ /**
+ * @return Returns the filePath.
+ */
+ public String getFilePath() {
+ return filePath;
+ }
+ /**
+ * @param filePath The filePath to set.
+ */
+ public void setFilePath(String filePath) {
+ this.filePath = filePath;
+ }
+ /**
+ * @return Returns the marks.
+ */
+ public Long getMarks() {
+ return marks;
+ }
+ /**
+ * @param marks The marks to set.
+ */
+ public void setMarks(Long marks) {
+ this.marks = marks;
+ }
+
+ /**
+ * @return Returns the dateMarksReleased.
+ */
+ public Date getDateMarksReleased() {
+ return dateMarksReleased;
+ }
+ /**
+ * @param dateMarksReleased The dateMarksReleased to set.
+ */
+ public void setDateMarksReleased(Date dateMarksReleased) {
+ this.dateMarksReleased = dateMarksReleased;
+ }
+ /**
+ * @return Returns the uuID.
+ */
+ public Long getUuID() {
+ return uuID;
+ }
+ /**
+ * @param uuID The uuID to set.
+ */
+ public void setUuID(Long uuID) {
+ this.uuID = uuID;
+ }
+ /**
+ * @return Returns the versionID.
+ */
+ public Long getVersionID() {
+ return versionID;
+ }
+ /**
+ * @param versionID The versionID to set.
+ */
+ public void setVersionID(Long versionID) {
+ this.versionID = versionID;
+ }
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dto/LearnerDetailsDTO.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dto/LearnerDetailsDTO.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dto/LearnerDetailsDTO.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,113 @@
+/*
+ * Created on May 26, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.lamsfoundation.lams.tool.sbmt.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author Manpreet Minhas
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class LearnerDetailsDTO implements Serializable{
+
+ private String name;
+ private String fileDescription;
+ private Date dateOfSubmission;
+ private String comments;
+ private Long marks;
+ private Date dateMarksReleased;
+
+
+
+
+ public LearnerDetailsDTO(String name,String fileDescription,
+ Date dateOfSubmission, String comments,
+ Long marks, Date dateMarksReleased) {
+ super();
+ this.name = name;
+ this.fileDescription = fileDescription;
+ this.dateOfSubmission = dateOfSubmission;
+ this.comments = comments;
+ this.marks = marks;
+ this.dateMarksReleased = dateMarksReleased;
+ }
+ /**
+ * @return Returns the comments.
+ */
+ public String getComments() {
+ return comments;
+ }
+ /**
+ * @param comments The comments to set.
+ */
+ public void setComments(String comments) {
+ this.comments = comments;
+ }
+ /**
+ * @return Returns the dateMarksReleased.
+ */
+ public Date getDateMarksReleased() {
+ return dateMarksReleased;
+ }
+ /**
+ * @param dateMarksReleased The dateMarksReleased to set.
+ */
+ public void setDateMarksReleased(Date dateMarksReleased) {
+ this.dateMarksReleased = dateMarksReleased;
+ }
+ /**
+ * @return Returns the dateOfSubmission.
+ */
+ public Date getDateOfSubmission() {
+ return dateOfSubmission;
+ }
+ /**
+ * @param dateOfSubmission The dateOfSubmission to set.
+ */
+ public void setDateOfSubmission(Date dateOfSubmission) {
+ this.dateOfSubmission = dateOfSubmission;
+ }
+ /**
+ * @return Returns the fileDescription.
+ */
+ public String getFileDescription() {
+ return fileDescription;
+ }
+ /**
+ * @param fileDescription The fileDescription to set.
+ */
+ public void setFileDescription(String fileDescription) {
+ this.fileDescription = fileDescription;
+ }
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+ /**
+ * @return Returns the marks.
+ */
+ public Long getMarks() {
+ return marks;
+ }
+ /**
+ * @param marks The marks to set.
+ */
+ public void setMarks(Long marks) {
+ this.marks = marks;
+ }
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dto/StatusReportDTO.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dto/StatusReportDTO.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dto/StatusReportDTO.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,95 @@
+/****************************************************************
+ * 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.sbmt.dto;
+
+import java.io.Serializable;
+
+/**
+ * @author Manpreet Minhas
+ */
+public class StatusReportDTO implements Serializable {
+
+ private Long userID;
+ private String login;
+ private String fullName;
+ private Boolean unMarked;
+
+
+ public StatusReportDTO(Integer userID,String login, String fullName, Boolean unMarked) {
+ super();
+ this.login = login;
+ this.fullName = fullName;
+ this.unMarked = unMarked;
+ this.userID = new Long(userID.intValue());
+ }
+ /**
+ * @return Returns the fullName.
+ */
+ public String getFullName() {
+ return fullName;
+ }
+ /**
+ * @param fullName The fullName to set.
+ */
+ public void setFullName(String fullName) {
+ this.fullName = fullName;
+ }
+ /**
+ * @return Returns the login.
+ */
+ public String getLogin() {
+ return login;
+ }
+ /**
+ * @param login The login to set.
+ */
+ public void setLogin(String login) {
+ this.login = login;
+ }
+
+ /**
+ * @return Returns the unMarked.
+ */
+ public Boolean getUnMarked() {
+ return unMarked;
+ }
+ /**
+ * @param unMarked The unMarked to set.
+ */
+ public void setUnMarked(Boolean unMarked) {
+ this.unMarked = unMarked;
+ }
+
+ /**
+ * @return Returns the userID.
+ */
+ public Long getUserID() {
+ return userID;
+ }
+ /**
+ * @param userID The userID to set.
+ */
+ public void setUserID(Long userID) {
+ this.userID = userID;
+ }
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/exception/SubmitFilesException.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/exception/SubmitFilesException.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/exception/SubmitFilesException.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,51 @@
+/*
+ * Created on May 31, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.lamsfoundation.lams.tool.sbmt.exception;
+
+/**
+ * @author Manpreet Minhas
+ */
+public class SubmitFilesException extends RuntimeException {
+
+ /**
+ * Default Constructor
+ */
+ public SubmitFilesException()
+ {
+ super();
+ }
+
+ /**
+ * Constructor for customized error message
+ * @param message
+ */
+ public SubmitFilesException(String message)
+ {
+ super(message);
+ }
+
+ /**
+ * Constructor for wrapping the throwable object
+ * @param cause
+ */
+ public SubmitFilesException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ /**
+ * Constructor for wrapping both the customized error message and
+ * throwable exception object.
+ * @param message
+ * @param cause
+ */
+ public SubmitFilesException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/ISubmitFilesService.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/ISubmitFilesService.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/ISubmitFilesService.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,143 @@
+/**
+ *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.sbmt.service;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+
+import org.lamsfoundation.lams.tool.sbmt.SubmitFilesContent;
+import org.lamsfoundation.lams.tool.sbmt.SubmitFilesReport;
+import org.lamsfoundation.lams.tool.sbmt.dto.FileDetailsDTO;
+import org.lamsfoundation.lams.tool.sbmt.exception.SubmitFilesException;
+import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
+
+/**
+ * @author Manpreet Minhas
+ */
+public interface ISubmitFilesService {
+
+ public static final String SBMT_LOGIN = "SubmitFilesLogin";
+
+ public static final String SBMT_PASSWORD = "SubmitFilesPassword";
+
+ public static final String SBMT_WORKSPACE = "SubmitFilesWorkspace";
+
+ /**
+ * This method adds a new content record to the database.
+ *
+ * @param contentID
+ * The content_id of the new record
+ * @param title
+ * The title of the tool
+ * @param instructions
+ * The instructions for working with that tool
+ */
+ public void addSubmitFilesContent(Long contentID, String title,
+ String instructions);
+
+ /**
+ * Updates the record in the database
+ *
+ * @param submitFilesContent
+ * The SubmitFilesContent to be updated
+ */
+ public void updateSubmitFilesContent(SubmitFilesContent submitFilesContent);
+
+ /**
+ * Returns the SubmitFilesContent object corresponding to the
+ * given contentID
+ *
+ * @param contentID
+ * The content_id of the object to be looked up
+ * @return SubmitFilesContent The required populated object
+ */
+ public SubmitFilesContent getSubmitFilesContent(Long contentID);
+
+ /**
+ *
+ * Returns the SubmitFilesReport object corresponding to the
+ * given reportID
+ *
+ * @param reportID
+ * @return SubmitFilesReport The required populated object
+ */
+ public SubmitFilesReport getSubmitFilesReport(Long reportID);
+
+ /**
+ * This method uploads a file with the given name and description. It's a
+ * two step process
+ *
+ *
It first uploads the file to the content repository
+ *
And then it updates the database
+ *
+ *
+ * @param contentID
+ * The content_id of the record to be updated in the database
+ * @param filePath
+ * The physical location of the file from where it has to be
+ * uploaded
+ * @param fileDescription
+ * The description of the file being uploaded.
+ * @param userID
+ * The User who has uploaded the file.
+ * @throws SubmitFilesException
+ */
+ public void uploadFile(Long contentID, String filePath,
+ String fileDescription, Long userID) throws SubmitFilesException;
+
+ /**
+ * This method returns a list of files that were uploaded by the
+ * given User for given contentID.
+ *
+ * This method is used in the learning enviornment for displaying
+ * the files being uploaded by the given user, as the user
+ * uploads them one by one.
+ *
+ * @param userID The user_id of the User
+ * @param contentID The content_id to be looked up
+ * @return List The list of required objects.
+ */
+ public List getFilesUploadedByUser(Long userID, Long contentID);
+
+ public void removeToolContent(Long contentID);
+
+ /**
+ * This method is required in the monitoring enviornment
+ * when the teacher wants to view all the learners who have
+ * uploaded one file or the other for marking purposes. *
+ *
+ * @param contentID The content_id of the tool
+ * @return Hashtable The required information
+ */
+ public Hashtable generateReport(Long contentID);
+
+ public ArrayList getStatus(Long contentID);
+
+ public void updateMarks(Long reportID, Long marks, String comments);
+
+ public UserDTO getUserDetails(Long userID);
+
+ public FileDetailsDTO getFileDetails(Long reportID);
+
+ public InputStream downloadFile(Long uuid, Long versionID);
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,584 @@
+/****************************************************************
+ * 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.sbmt.service;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+import org.lamsfoundation.lams.contentrepository.AccessDeniedException;
+import org.lamsfoundation.lams.contentrepository.FileException;
+import org.lamsfoundation.lams.contentrepository.ICredentials;
+import org.lamsfoundation.lams.contentrepository.ITicket;
+import org.lamsfoundation.lams.contentrepository.IVersionedNode;
+import org.lamsfoundation.lams.contentrepository.ItemNotFoundException;
+import org.lamsfoundation.lams.contentrepository.LoginException;
+import org.lamsfoundation.lams.contentrepository.NodeKey;
+import org.lamsfoundation.lams.contentrepository.WorkspaceNotFoundException;
+import org.lamsfoundation.lams.contentrepository.service.IRepositoryService;
+import org.lamsfoundation.lams.contentrepository.service.RepositoryProxy;
+import org.lamsfoundation.lams.contentrepository.service.SimpleCredentials;
+import org.lamsfoundation.lams.tool.ToolContentManager;
+import org.lamsfoundation.lams.tool.ToolSessionExportOutputData;
+import org.lamsfoundation.lams.tool.ToolSessionManager;
+import org.lamsfoundation.lams.tool.sbmt.SubmissionDetails;
+import org.lamsfoundation.lams.tool.sbmt.SubmitFilesContent;
+import org.lamsfoundation.lams.tool.sbmt.SubmitFilesReport;
+import org.lamsfoundation.lams.tool.sbmt.dto.LearnerDetailsDTO;
+import org.lamsfoundation.lams.tool.sbmt.dto.StatusReportDTO;
+import org.lamsfoundation.lams.tool.sbmt.dto.FileDetailsDTO;
+import org.lamsfoundation.lams.tool.sbmt.dao.ISubmissionDetailsDAO;
+import org.lamsfoundation.lams.tool.sbmt.dao.ISubmitFilesContentDAO;
+import org.lamsfoundation.lams.tool.sbmt.dao.ISubmitFilesReportDAO;
+import org.lamsfoundation.lams.tool.sbmt.dao.ISubmitFilesSessionDAO;
+import org.lamsfoundation.lams.tool.sbmt.exception.SubmitFilesException;
+import org.lamsfoundation.lams.usermanagement.User;
+import org.lamsfoundation.lams.usermanagement.dao.IUserDAO;
+import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
+import org.lamsfoundation.lams.util.wddx.FlashMessage;
+
+/**
+ * @author Manpreet Minhas
+ */
+public class SubmitFilesService implements ToolContentManager,
+ ToolSessionManager, ISubmitFilesService {
+
+ private ISubmitFilesContentDAO submitFilesContentDAO;
+
+ private ISubmitFilesReportDAO submitFilesReportDAO;
+
+ private ISubmitFilesSessionDAO submitFilesSessionDAO;
+
+ private ISubmissionDetailsDAO submissionDetailsDAO;
+
+ private IUserDAO userDAO;
+
+ private IRepositoryService repositoryService;
+
+ private FlashMessage flashMessage;
+
+ /***************************************************************************
+ * Property Injection Methods
+ **************************************************************************/
+
+ /**
+ * @param submitFilesContentDAO
+ * The submitFilesContentDAO to set.
+ */
+ public void setSubmitFilesContentDAO(
+ ISubmitFilesContentDAO submitFilesContentDAO) {
+ this.submitFilesContentDAO = submitFilesContentDAO;
+ }
+
+ /**
+ * @param submitFilesReportDAO
+ * The submitFilesReportDAO to set.
+ */
+ public void setSubmitFilesReportDAO(
+ ISubmitFilesReportDAO submitFilesReportDAO) {
+ this.submitFilesReportDAO = submitFilesReportDAO;
+ }
+
+ /**
+ * @param submitFilesSessionDAO
+ * The submitFilesSessionDAO to set.
+ */
+ public void setSubmitFilesSessionDAO(
+ ISubmitFilesSessionDAO submitFilesSessionDAO) {
+ this.submitFilesSessionDAO = submitFilesSessionDAO;
+ }
+
+ /**
+ * @param submissionDetailsDAO The submissionDetailsDAO to set.
+ */
+ public void setSubmissionDetailsDAO(
+ ISubmissionDetailsDAO submissionDetailsDAO) {
+ this.submissionDetailsDAO = submissionDetailsDAO;
+ }
+
+ /**
+ * @param userDAO The userDAO to set.
+ */
+ public void setUserDAO(IUserDAO userDAO) {
+ this.userDAO = userDAO;
+ }
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.lamsfoundation.lams.tool.ToolContentManager#copyToolContent(java.lang.Long,
+ * java.lang.Long)
+ */
+ public void copyToolContent(Long fromContentId, Long toContentId) {
+ if (fromContentId == null || toContentId == null)
+ throw new SubmitFilesException(
+ "Failed to create the SubmitFiles tool seession");
+
+ SubmitFilesContent fromContent = submitFilesContentDAO
+ .getContentByID(fromContentId);
+ SubmitFilesContent toContent = SubmitFilesContent.newInstance(
+ fromContent, toContentId);
+ submitFilesContentDAO.insert(toContent);
+ }
+
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.lamsfoundation.lams.tool.ToolContentManager#setAsDefineLater(java.lang.Long)
+ */
+ public void setAsDefineLater(Long toolContentId) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.lamsfoundation.lams.tool.ToolContentManager#setAsRunOffline(java.lang.Long)
+ */
+ public void setAsRunOffline(Long toolContentId) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.lamsfoundation.lams.tool.ToolContentManager#removeToolContent(java.lang.Long)
+ */
+ public void removeToolContent(Long toolContentId)throws SubmitFilesException{
+ SubmitFilesContent submitFilesContent = submitFilesContentDAO
+ .getContentByID(toolContentId);
+ if (submitFilesContent == null)
+ throw new SubmitFilesException(
+ "No such content with a contentID of : " + toolContentId
+ + " exists");
+ else {
+ List filesUploaded = submissionDetailsDAO.getSubmissionDetailsByContentID(toolContentId);
+ if(filesUploaded!=null){
+ Iterator fileIterator = filesUploaded.iterator();
+ while(fileIterator.hasNext()){
+ SubmissionDetails details = (SubmissionDetails)fileIterator.next();
+ deleteFromRepository(details.getUuid(),details.getVersionID());
+ submissionDetailsDAO.delete(details);
+ }
+ submitFilesContentDAO.delete(submitFilesContent);
+ }
+ }
+ }
+
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.lamsfoundation.lams.tool.sbmt.service.ISubmitFilesService#addSubmitFilesContent(java.lang.Long,
+ * java.lang.String, java.lang.String)
+ */
+ public void addSubmitFilesContent(Long contentID, String title,
+ String instructions) {
+ SubmitFilesContent submitFilesContent = new SubmitFilesContent(
+ contentID, title, instructions);
+ submitFilesContentDAO.insert(submitFilesContent);
+ }
+
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.lamsfoundation.lams.tool.sbmt.service.ISubmitFilesService#updateSubmitFilesContent(org.lamsfoundation.lams.tool.sbmt.SubmitFilesContent)
+ */
+ public void updateSubmitFilesContent(SubmitFilesContent submitFilesContent) {
+ submitFilesContentDAO.update(submitFilesContent);
+
+ }
+
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.lamsfoundation.lams.tool.sbmt.service.ISubmitFilesService#getSubmitFilesContent(java.lang.Long)
+ */
+ public SubmitFilesContent getSubmitFilesContent(Long contentID) {
+ return submitFilesContentDAO.getContentByID(contentID);
+ }
+
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.lamsfoundation.lams.tool.sbmt.service.ISubmitFilesService#getSubmitFilesReport(java.lang.Long)
+ */
+ public SubmitFilesReport getSubmitFilesReport(Long reportID) {
+ return submitFilesReportDAO.getReportByID(reportID);
+ }
+
+ /**
+ * This method verifies the credentials of the SubmitFiles Tool and gives it
+ * the Ticket to login and access the Content Repository.
+ *
+ * A valid ticket is needed in order to access the content from the
+ * repository. This method would be called evertime the tool needs to
+ * upload/download files from the content repository.
+ *
+ * @return ITicket The ticket for repostory access
+ * @throws SubmitFilesException
+ */
+ private ITicket getRepositoryLoginTicket() throws SubmitFilesException {
+ repositoryService = RepositoryProxy.getLocalRepositoryService();
+ ICredentials credentials = new SimpleCredentials(
+ ISubmitFilesService.SBMT_LOGIN,
+ ISubmitFilesService.SBMT_PASSWORD.toCharArray());
+ try {
+ ITicket ticket = repositoryService.login(credentials,
+ ISubmitFilesService.SBMT_WORKSPACE);
+ return ticket;
+ } catch (AccessDeniedException ae) {
+ throw new SubmitFilesException("Access Denied to repository."
+ + ae.getMessage());
+ } catch (WorkspaceNotFoundException we) {
+ throw new SubmitFilesException("Workspace not found."
+ + we.getMessage());
+ } catch (LoginException e) {
+ throw new SubmitFilesException("Login failed." + e.getMessage());
+ }
+ }
+
+ /**
+ * This method deletes the content with the given uuid and
+ * versionID from the content repository
+ *
+ * @param uuid
+ * The uuid of the node to be deleted
+ * @param versionID
+ * The version_id of the node to be deleted.
+ * @throws SubmitFilesException
+ */
+ public void deleteFromRepository(Long uuid, Long versionID)
+ throws SubmitFilesException {
+ ITicket ticket = getRepositoryLoginTicket();
+ try {
+ String files[] = repositoryService.deleteVersion(ticket, uuid,versionID);
+ } catch (Exception e) {
+ throw new SubmitFilesException(
+ "Exception occured while deleting files from"
+ + " the repository " + e.getMessage());
+ }
+ }
+
+ /**
+ * This method is called when the user requests to upload a file. It's a
+ * three step process.
+ *
+ *
Firstly, the tool authenticates itself and obtains a valid ticket
+ * from the respository
+ *
Secondly, using the above ticket it uploads the file to the
+ * repository. Upon successful uploading of the file, repository returns a
+ * NodeKey object which is a unique indentifier of the file
+ * in the repsoitory
+ *
Finally, this information is updated into the database for the given
+ * contentID in the following tables
+ *
+ *
tl_lasbmt11_submission_details
+ *
tl_lasbmt11_report
+ *
+ *
+ *
+ *
+ * @param stream
+ * The InputStream representing the data to be
+ * uploaded
+ * @param contentID
+ * The contentID of the file being uploaded
+ * @param filePath
+ * The physical path of the file
+ * @param fileDescription
+ * The description of the file
+ * @param fileName
+ * The name of the file being added
+ * @param mimeType
+ * The MIME type of the file (eg. TXT, DOC, GIF etc)
+ * @param dateOfSubmission
+ * The date this file was uploaded by the user
+ * @param userID
+ * The User who has uploaded the file.
+ * @throws SubmitFilesException
+ */
+ private void uploadFile(InputStream stream, Long contentID, String filePath,
+ String fileDescription, String fileName, String mimeType,
+ Date dateOfSubmission, Long userID) throws SubmitFilesException {
+
+ SubmitFilesContent content = submitFilesContentDAO.getContentByID(contentID);
+ if (content == null)
+ throw new SubmitFilesException(
+ "No such content with a contentID of: " + contentID
+ + " found.");
+ else {
+ NodeKey nodeKey = uploadFileToRepository(stream, fileName, mimeType);
+ SubmissionDetails details = new SubmissionDetails(filePath,fileDescription,dateOfSubmission,
+ nodeKey.getUuid(),nodeKey.getVersion(),
+ userID,content);
+ submissionDetailsDAO.insert(details);
+ submitFilesReportDAO.insert(new SubmitFilesReport(details));
+ }
+ }
+
+ /**
+ * This method is called everytime a new content has to be added to the
+ * repository. In order to do so first of all a valid ticket is obtained
+ * from the Repository hence authenticating the tool(SubmitFiles) and then
+ * the corresponding file is added to the repository.
+ *
+ * @param stream
+ * The InputStream representing the data to be
+ * added
+ * @param fileName
+ * The name of the file being added
+ * @param mimeType
+ * The MIME type of the file (eg. TXT, DOC, GIF etc)
+ * @return NodeKey Represents the two part key - UUID and Version.
+ * @throws SubmitFilesException
+ */
+ public NodeKey uploadFileToRepository(InputStream stream, String fileName,
+ String mimeType) throws SubmitFilesException {
+ ITicket ticket = getRepositoryLoginTicket();
+ try {
+ NodeKey nodeKey = repositoryService.addFileItem(ticket, stream,
+ fileName, mimeType, null);
+ return nodeKey;
+ } catch (Exception e) {
+ throw new SubmitFilesException("Exception occured while trying to"
+ + " upload file into the repository" + e.getMessage());
+ }
+ }
+
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.lamsfoundation.lams.tool.ToolSessionManager#createToolSession(java.lang.Long,
+ * java.lang.Long)
+ */
+ public void createToolSession(Long toolSessionId, Long toolContentId) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.lamsfoundation.lams.tool.ToolSessionManager#leaveToolSession(java.lang.Long,
+ * org.lamsfoundation.lams.usermanagement.User)
+ */
+ public String leaveToolSession(Long toolSessionId, User learner) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.lamsfoundation.lams.tool.ToolSessionManager#exportToolSession(java.lang.Long)
+ */
+ public ToolSessionExportOutputData exportToolSession(Long toolSessionId) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.lamsfoundation.lams.tool.ToolSessionManager#exportToolSession(java.util.List)
+ */
+ public ToolSessionExportOutputData exportToolSession(List toolSessionIds) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.lamsfoundation.lams.tool.sbmt.service.ISubmitFilesService#uploadFile(java.lang.Long,
+ * java.lang.String, java.lang.String)
+ */
+ public void uploadFile(Long contentID, String filePath,
+ String fileDescription, Long userID) throws SubmitFilesException{
+ SubmitFilesContent submitFilesContent = submitFilesContentDAO.getContentByID(contentID);
+ try{
+ File file = new File(filePath);
+ String fileName = file.getName();
+ String mimeType = fileName.substring(fileName.lastIndexOf(".")+1,fileName.length());
+ FileInputStream stream = new FileInputStream(file);
+ uploadFile(stream,contentID,filePath,fileDescription,fileName,mimeType,new Date(),userID);
+ }catch(FileNotFoundException fe){
+ throw new SubmitFilesException("FileNotFoundException occured while trying to upload File" + fe.getMessage());
+ }
+
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.lamsfoundation.lams.tool.sbmt.service.ISubmitFilesService#getFilesUploadedByUserForContent(java.lang.Long, java.lang.Long)
+ */
+ public List getFilesUploadedByUser(Long userID, Long contentID){
+ List list = submissionDetailsDAO.getSubmissionDetailsForUserByContent(userID,contentID);
+ if(list!=null)
+ return getDetails(list.iterator());
+ else
+ return null;
+ }
+ /**
+ * This is a utility method used by getFilesUploadedByUser
+ * method to generate a list of data transfer objects containing the
+ * details of files uploaded by a given user.
+ *
+ * It combines the submission details and the reporting deatils
+ * to generate a generic DTO tailored according to the
+ * application requirements.
+ *
+ * @param iterator
+ * @return ArrayList
+ */
+ private ArrayList getDetails(Iterator iterator){
+ ArrayList details = new ArrayList();
+ while(iterator.hasNext()){
+ SubmissionDetails submissionDetails = (SubmissionDetails)iterator.next();
+ SubmitFilesReport report = submissionDetails.getReport();
+ FileDetailsDTO reportDTO = new FileDetailsDTO(submissionDetails,report);
+ details.add(reportDTO);
+ }
+ return details;
+ }
+ public FileDetailsDTO getFileDetails(Long reportID){
+ SubmitFilesReport report = submitFilesReportDAO.getReportByID(reportID);
+ if(report!=null){
+ SubmissionDetails details = report.getSubmissionDetails();
+ return new FileDetailsDTO(details,report);
+ }else
+ return null;
+ }
+ /**
+ * (non-Javadoc)
+ * @see org.lamsfoundation.lams.tool.sbmt.service.ISubmitFilesService#generateReport(java.lang.Long)
+ */
+ public Hashtable generateReport(Long contentID){
+ List users = submissionDetailsDAO.getUsersForContent(contentID);
+ Iterator iterator = users.iterator();
+ Hashtable table = new Hashtable();
+ while(iterator.hasNext()){
+ Long userID = (Long)iterator.next();
+ User user = userDAO.getUserById(new Integer(userID.intValue()));
+ List userDetails = submissionDetailsDAO.getSubmissionDetailsForUserByContent(userID,contentID);
+ table.put(user.getUserDTO(),getUserDetails(userDetails.iterator()));
+ }
+ return table;
+ }
+ /**
+ * Utility function used by generateReport method
+ * above to assist in generating the report.
+ *
+ * @param iterator
+ * @return ArrayList
+ */
+ private ArrayList getUserDetails(Iterator iterator){
+ ArrayList details = new ArrayList();
+ while(iterator.hasNext()){
+ SubmissionDetails submissionDetails = (SubmissionDetails)iterator.next();
+ details.add(getLearnerDetailsDTO(submissionDetails,
+ submissionDetails.getReport()));
+ }
+ return details;
+ }
+ /**
+ * Utility function used by getUserDetails method
+ * above to assist in generating the report.
+ *
+ * @param details
+ * @param report
+ * @return LearnerDetailsDTO
+ */
+ private LearnerDetailsDTO getLearnerDetailsDTO(SubmissionDetails details,
+ SubmitFilesReport report){
+ Integer userID = new Integer(details.getUserID().intValue());
+ File file = new File(details.getFilePath());
+ return new LearnerDetailsDTO(file.getName(),
+ details.getFileDescription(),
+ details.getDateOfSubmission(),
+ report.getComments(),
+ report.getMarks(),
+ report.getDateMarksReleased());
+ }
+
+ public ArrayList getStatus(Long contentID){
+ ArrayList details = new ArrayList();
+ List users = submissionDetailsDAO.getUsersForContent(contentID);
+ Iterator iterator = users.iterator();
+ while(iterator.hasNext()){
+ Long userID = (Long)iterator.next();
+ List allFiles = submissionDetailsDAO.getSubmissionDetailsForUserByContent(userID,contentID);
+ boolean unmarked = hasUnmarkedContent(allFiles.iterator());
+ details.add(getStatusDetails(userID,unmarked));
+ }
+ return details;
+ }
+ private boolean hasUnmarkedContent(Iterator details){
+ boolean unmarked = false;
+ while(details.hasNext()){
+ SubmissionDetails submissionDetails = (SubmissionDetails)details.next();
+ if(submissionDetails.getReport().getMarks()==null)
+ return true;
+ }
+ return unmarked;
+ }
+ private StatusReportDTO getStatusDetails(Long userID,boolean unmarked){
+ User user = userDAO.getUserById(new Integer(userID.intValue()));
+ return new StatusReportDTO(user.getUserId(),
+ user.getLogin(),
+ user.getFullName(),
+ new Boolean(unmarked));
+ }
+ public void updateMarks(Long reportID, Long marks, String comments){
+ SubmitFilesReport report = submitFilesReportDAO.getReportByID(reportID);
+ if(report!=null){
+ report.setComments(comments);
+ report.setMarks(marks);
+ submitFilesReportDAO.update(report);
+ }
+ }
+ public UserDTO getUserDetails(Long userID){
+ User user = userDAO.getUserById(new Integer(userID.intValue()));
+ return user.getUserDTO();
+ }
+ public InputStream downloadFile(Long uuid, Long versionID)throws SubmitFilesException{
+ ITicket ticket = getRepositoryLoginTicket();
+ try{
+ IVersionedNode node = repositoryService.getFileItem(ticket,uuid,null);
+ return node.getFile();
+ }catch(AccessDeniedException ae){
+ throw new SubmitFilesException("AccessDeniedException occured while trying to download file " + ae.getMessage());
+ }catch(FileException fe){
+ throw new SubmitFilesException("FileException occured while trying to download file " + fe.getMessage());
+ }catch(ItemNotFoundException ie){
+ throw new SubmitFilesException("ItemNotFoundException occured while trying to download file " + ie.getMessage());
+ }
+ }
+}
\ No newline at end of file
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesServiceProxy.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesServiceProxy.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesServiceProxy.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,28 @@
+/*
+ * 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.sbmt.service;
+
+import javax.servlet.ServletContext;
+
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+/**
+ * @author Manpreet Minhas
+ */
+public class SubmitFilesServiceProxy {
+
+ private ISubmitFilesService submitFilesService;
+
+ public static final ISubmitFilesService getSubmitFilesService(ServletContext servletContext){
+ WebApplicationContext context = WebApplicationContextUtils
+ .getRequiredWebApplicationContext(servletContext);
+ return (ISubmitFilesService)context.getBean("submitFilesService");
+ }
+
+
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/submitFilesApplicationContext.xml
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/submitFilesApplicationContext.xml (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/submitFilesApplicationContext.xml (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+ com.mysql.jdbc.Driver
+ jdbc:mysql://localhost/lams?zeroDateTimeBehavior=convertToNull&characterEncoding=utf8
+ lams
+ lamsdemo
+
+
+
+
+
+
+
+ org/lamsfoundation/lams/tool/sbmt/SubmitFilesContent.hbm.xml
+ org/lamsfoundation/lams/tool/sbmt/SubmitFilesReport.hbm.xml
+ org/lamsfoundation/lams/tool/sbmt/SubmitFilesSession.hbm.xml
+ org/lamsfoundation/lams/tool/sbmt/SubmissionDetails.hbm.xml
+
+
+
+
+ net.sf.hibernate.dialect.MySQLDialect
+ false
+ 5
+ 20
+ 1800
+ 50
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PROPAGATION_REQUIRED
+ PROPAGATION_REQUIRED
+ PROPAGATION_REQUIRED
+ PROPAGATION_REQUIRED
+
+
+
+
+
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/util/DownloadFile.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/util/DownloadFile.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/util/DownloadFile.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,254 @@
+package org.lamsfoundation.lams.tool.sbmt.util;
+
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.File;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+/**
+ * Utility class for downloading a file from within a servlet.
+ * Will either download as an attachement (should trigger a
+ * save pop up dialogue) or output the stream and leave the
+ * browser to decide whether to display or save file.
+ *
+ * @author Manpreet Minhas
+ */
+public class DownloadFile
+{
+
+ private static Logger log = Logger.getLogger(DownloadFile.class);
+
+ private final static String UTF_8_ENCODING = "UTF-8";
+
+ /** Send the file as a stream and attempts to have the browser save the file if preferDownload is -true-
+ * or display in the window if preferDownload is -false-. mimeType is optional - if null then calls getMimeType() to
+ * work it out. Assumes that the calling function has already determined that it is okay
+ * to download the file. The servlet context is needed to determine the mime type.
+ * @param filename - just the name.ext filename
+ * @param fullFilename - fill path and filename,
+ * */
+ public static void download(
+ HttpServletResponse response,
+ ServletContext context,
+ String filename,
+ String fullFilename,
+ String inputMimeType,
+ boolean preferDownload)
+ throws IOException
+ {
+ process(response, context, filename, fullFilename, inputMimeType, preferDownload);
+ }
+
+ /** Send the file as a stream and attempts to have the browser save the file rather
+ * than displaying in the window. mimeType is optional - if null then calls getMimeType() to
+ * work it out. Assumes that the calling function has already determined that it is okay
+ * to download the file. The servlet context is needed to determine the mime type.
+ * @param filename - just the name.ext filename
+ * @param fullFilename - fill path and filename,
+ * */
+ public static void download(
+ HttpServletResponse response,
+ ServletContext context,
+ String filename,
+ String fullFilename,
+ String inputMimeType)
+ throws IOException
+ {
+ process(response, context, filename, fullFilename, inputMimeType, true);
+ }
+
+ /** Send the file as a stream and leaves it up to the browser whether to display in a
+ * browser window or save the file. mimeType is optional - if null then calls getMimeType() to
+ * work it out. Assumes that the calling function has already determined that it is okay
+ * to download the file. The servlet context is needed to determine the mime type.
+ * @param filename - just the name.ext filename
+ * @param fullFilename - fill path and filename,
+ * */
+ public static void send(
+ HttpServletResponse response,
+ ServletContext context,
+ String filename,
+ String fullFilename,
+ String inputMimeType)
+ throws IOException
+ {
+ process(
+ response,
+ context,
+ filename,
+ fullFilename,
+ inputMimeType,
+ false);
+ }
+
+ private static void process(
+ HttpServletResponse response,
+ ServletContext context,
+ String filename,
+ String fullFilename,
+ String inputMimeType,
+ boolean saveFile)
+ throws IOException
+ {
+
+ String mimeType = null;
+
+ if (inputMimeType != null)
+ {
+ mimeType = inputMimeType;
+ }
+ else if (context != null)
+ {
+ mimeType = context.getMimeType(filename);
+ }
+
+ if (mimeType == null)
+ {
+ mimeType = "application/octet-stream";
+ }
+
+ log.debug("Downloading file " + filename + " mime type " + mimeType);
+
+ response.setContentType(mimeType);
+
+ InputStream in = null;
+ ServletOutputStream out = null;
+
+ try
+ {
+
+
+ File fileob = new File(fullFilename);
+ // Check if the requested file exists
+ if(fileob.exists())
+ {
+ if (saveFile)
+ {
+ log.debug("Sending as attachment");
+ response.setHeader("Content-Disposition","attachment;filename=" + filename);
+ }
+ else
+ {
+ log.debug("Sending as inline");
+ response.setHeader("Content-Disposition","inline;filename=" + filename);
+ }
+ response.setHeader("Cache-control","must-revalidate");
+ response.addHeader("Content-Description", filename);
+ }
+ else
+ {
+ throw new IOException("Requested File is missing : " + fullFilename);
+ }
+ out = response.getOutputStream();
+ log.debug("Writing out file ");
+ int count = 0;
+
+ FileInputStream fileToRead = new FileInputStream(fileob);
+ in = new BufferedInputStream(fileToRead);
+ int ch;
+ while ((ch = in.read()) != -1)
+ {
+ out.write((char) ch);
+ count++;
+ }
+ log.debug("Wrote out " + count + " bytes");
+ response.setContentLength(count);
+ out.flush();
+ }
+ catch (IOException e)
+ {
+ log.error( "Exception in process():" + e.getMessage());
+ throw new IOException(e.getClass().getName());
+ }
+ finally
+ {
+ try
+ {
+ log.debug("Closing file");
+ if (in != null)
+ in.close(); // very important
+ if (out != null)
+ out.close();
+ }
+ catch (IOException e)
+ {
+ log.error("Error Closing file" + e.getMessage());
+ throw new IOException(e.getClass().getName());
+ }
+ }
+}
+
+
+ /**
+ * Method export. Downloading the data not from a file but
+ * from a byte[]
+ * @param res
+ * @param context
+ * @param designName
+ * @param exportType
+ * @param encryptedContent
+ */
+ public static void export(
+ HttpServletResponse res,
+ ServletContext context,
+ String designName,
+ String exportType,
+ String exportString)
+ throws IOException, ServletException
+ {
+ ServletOutputStream out = null;
+ ByteArrayInputStream bai = null;
+ BufferedInputStream bis = null;
+ try
+ {
+ String filename = designName + "." + exportType;
+ byte[] exportBytes = exportString.getBytes( UTF_8_ENCODING );
+ int size = exportBytes.length;
+ res.setContentType("application/x-lams;name=" + filename);
+ res.setHeader(
+ "Content-Disposition",
+ "attachment; filename=" + filename + ";");
+ res.setHeader("Cache-Control", "no-cache");
+ res.setHeader("Content-Transfer-Encoding", "binary");
+ res.setContentLength(size);
+
+ out = res.getOutputStream();
+ bai = new ByteArrayInputStream( exportBytes );
+ bis = new BufferedInputStream(bai);
+ int data;
+ while ((data = bis.read()) != -1)
+ {
+ out.write(data);
+ }
+ }
+ catch (IOException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new ServletException(e);
+ }
+ finally
+ {
+ if (bis != null)
+ bis.close();
+ if (out != null)
+ {
+ out.flush();
+ out.close();
+ }
+ }
+ }
+
+}
+
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/AuthoringAction.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/AuthoringAction.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/AuthoringAction.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,53 @@
+/*
+ * 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.sbmt.web;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.DynaActionForm;
+import org.apache.struts.actions.DispatchAction;
+import org.lamsfoundation.lams.tool.sbmt.service.ISubmitFilesService;
+import org.lamsfoundation.lams.tool.sbmt.service.SubmitFilesServiceProxy;
+
+/**
+ * @author Manpreet Minhas
+ *
+ * @struts.action
+ * path="/tool/sbmt/authoring"
+ * parameter="method"
+ * name="SbmtAuthoringForm"
+ * input="/sbmtAuthoring.jsp"
+ * scope="request"
+ * validate="true"
+ *
+ * @struts.action-forward name="success" path="/Login.jsp"
+ *
+ */
+public class AuthoringAction extends DispatchAction {
+
+ public ISubmitFilesService submitFilesService;
+ public static Logger logger = Logger.getLogger(AuthoringAction.class);
+
+ public ActionForward updateContent(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response){
+
+ DynaActionForm authForm= (DynaActionForm)form;
+ Long contentID = (Long)authForm.get("contentID");
+ String title = (String) authForm.get("title");
+ String instructions = (String)authForm.get("instructions");
+ submitFilesService = SubmitFilesServiceProxy.getSubmitFilesService(this.getServlet().getServletContext());
+ submitFilesService.addSubmitFilesContent(contentID,title,instructions);
+ return mapping.findForward("success");
+ }
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/LearnerAction.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/LearnerAction.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/LearnerAction.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,88 @@
+/*
+ * 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.sbmt.web;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+import org.apache.struts.action.DynaActionForm;
+import org.apache.struts.actions.DispatchAction;
+import org.lamsfoundation.lams.tool.sbmt.exception.SubmitFilesException;
+import org.lamsfoundation.lams.tool.sbmt.service.ISubmitFilesService;
+import org.lamsfoundation.lams.tool.sbmt.service.SubmitFilesServiceProxy;
+
+/**
+ * @author Manpreet Minhas
+ *
+ * @struts.action
+ * path="/tool/sbmt/learner"
+ * parameter="method"
+ * name="SbmtLearnerForm"
+ * input="/sbmtLearner.jsp"
+ * scope="request"
+ * validate="true"
+ *
+ * @struts.action-forward name="upload" path="/sbmtLearner.jsp"
+ */
+public class LearnerAction extends DispatchAction {
+
+ public ISubmitFilesService submitFilesService;
+ public static Logger logger = Logger.getLogger(LearnerAction.class);
+
+ public ActionForward uploadFile(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response){
+
+ DynaActionForm authForm= (DynaActionForm)form;
+
+ Long contentID =(Long) authForm.get("contentID");
+ String filePath = (String) authForm.get("filePath");
+ String fileDescription = (String) authForm.get("fileDescription");
+ Long userID = (Long)authForm.get("userID");
+
+ submitFilesService = SubmitFilesServiceProxy.getSubmitFilesService(this.getServlet().getServletContext());
+ try{
+ submitFilesService.uploadFile(contentID,filePath,fileDescription,userID);
+ List filesUploaded = submitFilesService.getFilesUploadedByUser(userID,contentID);
+ authForm.set("filesUploaded",filesUploaded);
+ return mapping.getInputForward();
+ }catch(SubmitFilesException se){
+ logger.error("uploadFile: Submit Files Exception has occured" + se.getMessage());
+ return returnErrors(mapping,request,se.getMessage(),"upload");
+ }
+ }
+
+ /**
+ * This is a utily function for forwarding the errors to
+ * the respective JSP page indicated by forward
+ *
+ * @param mapping
+ * @param request
+ * @param errorMessage The error message to be displayed
+ * @param forward The JSP page to which the errors would be forwarded
+ * @return ActionForward
+ */
+ private ActionForward returnErrors(ActionMapping mapping,
+ HttpServletRequest request,
+ String errorMessage,String forward){
+ ActionMessages messages = new ActionMessages();
+ messages.add(ActionMessages.GLOBAL_MESSAGE,
+ new ActionMessage(errorMessage));
+ saveErrors(request,messages);
+ return mapping.findForward(forward);
+ }
+
+}
Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/MonitoringAction.java
===================================================================
diff -u
--- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/MonitoringAction.java (revision 0)
+++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/MonitoringAction.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,139 @@
+/****************************************************************
+ * 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.sbmt.web;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.actions.DispatchAction;
+
+import org.lamsfoundation.lams.tool.sbmt.service.ISubmitFilesService;
+import org.lamsfoundation.lams.tool.sbmt.service.SubmitFilesServiceProxy;
+import org.lamsfoundation.lams.util.WebUtil;
+
+
+/**
+ * @author Manpreet Minhas
+ * @struts.action
+ * path="/monitoring"
+ * parameter="method"
+ * scope="request"
+ * name="emptyForm"
+ *
+ * @struts.action-forward name="report" path="/allLearners.jsp"
+ * @struts.action-forward name="status" path="/Status.jsp"
+ * @struts.action-forward name="userReport" path="/userReport.jsp"
+ * @struts.action-forward name="updateMarks" path="/updateMarks.jsp"
+ *
+ */
+public class MonitoringAction extends DispatchAction {
+
+ public ISubmitFilesService submitFilesService;
+
+ public ISubmitFilesService getSubmitFilesService(){
+ return SubmitFilesServiceProxy
+ .getSubmitFilesService(this.getServlet()
+ .getServletContext());
+ }
+ public ActionForward generateReport(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response){
+ Long contentID =new Long(WebUtil.readLongParam(request,"contentID"));
+ submitFilesService = getSubmitFilesService();
+ Hashtable report = submitFilesService.generateReport(contentID);
+ request.getSession().setAttribute("contentID",contentID);
+ request.getSession().setAttribute("report",report);
+ return mapping.findForward("report");
+ }
+
+ public ActionForward getStatus(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response){
+ Long contentID =new Long(WebUtil.readLongParam(request,"contentID"));
+ submitFilesService = getSubmitFilesService();
+ ArrayList status = submitFilesService.getStatus(contentID);
+ request.getSession().setAttribute("contentID",contentID);
+ request.getSession().setAttribute("status",status);
+ return mapping.findForward("status");
+ }
+ public ActionForward getFilesUploadedByUser(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response){
+ Long contentID =new Long(WebUtil.readLongParam(request,"contentID"));
+ Long userID = new Long(WebUtil.readLongParam(request,"userID"));
+ submitFilesService = getSubmitFilesService();
+ List report = submitFilesService.getFilesUploadedByUser(userID,contentID);
+ request.getSession().setAttribute("contentID",contentID);
+ request.getSession().setAttribute("user",
+ submitFilesService.getUserDetails(userID));
+ request.getSession().setAttribute("userReport",report);
+ return mapping.findForward("userReport");
+ }
+
+ public ActionForward updateMarks(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response){
+ Long contentID =new Long(WebUtil.readLongParam(request,"contentID"));
+ Long reportID =new Long(WebUtil.readLongParam(request,"reportID"));
+ Long marks = new Long(WebUtil.readLongParam(request,"marks"));
+ String comments = WebUtil.readStrParam(request,"comments");
+ Long userID = new Long(WebUtil.readLongParam(request,"userID"));
+
+ submitFilesService = getSubmitFilesService();
+
+ submitFilesService.updateMarks(reportID,marks,comments);
+ List report = submitFilesService.getFilesUploadedByUser(userID,contentID);
+ request.getSession().setAttribute("userReport",report);
+ request.getSession().setAttribute("contentID",contentID);
+ request.getSession().setAttribute("userID",userID);
+ return mapping.findForward("userReport");
+ }
+ public ActionForward markFile(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response){
+ Long contentID =new Long(WebUtil.readLongParam(request,"contentID"));
+ Long userID = new Long(WebUtil.readLongParam(request,"userID"));
+ Long reportID = new Long(WebUtil.readLongParam(request,"reportID"));
+
+ submitFilesService = getSubmitFilesService();
+
+ request.getSession().setAttribute("contentID",contentID);
+ request.getSession().setAttribute("user",
+ submitFilesService.getUserDetails(userID));
+ request.getSession().setAttribute("fileDetails",
+ submitFilesService.getFileDetails(reportID));
+ return mapping.findForward("updateMarks");
+}
+
+}
Index: lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/dao/TestSubmissionDetailsDAO.java
===================================================================
diff -u
--- lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/dao/TestSubmissionDetailsDAO.java (revision 0)
+++ lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/dao/TestSubmissionDetailsDAO.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,66 @@
+/*
+ * 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.sbmt.dao;
+
+import java.util.Date;
+import java.util.List;
+
+import org.lamsfoundation.lams.AbstractLamsTestCase;
+import org.lamsfoundation.lams.tool.sbmt.SubmissionDetails;
+import org.lamsfoundation.lams.tool.sbmt.SubmitFilesContent;
+
+
+/**
+ * @author Manpreet Minhas
+ */
+public class TestSubmissionDetailsDAO extends AbstractLamsTestCase {
+
+ protected ISubmissionDetailsDAO submissionDetailsDAO;
+ protected ISubmitFilesContentDAO submitFilesContentDAO;
+
+ public TestSubmissionDetailsDAO(String name){
+ super(name);
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.lamsfoundation.lams.AbstractLamsTestCase#getContextConfigLocation()
+ */
+ protected String[] getContextConfigLocation() {
+ return new String[] {"org/lamsfoundation/lams/applicationContext.xml",
+ "org/lamsfoundation/lams/workspace/workspaceApplicationContext.xml",
+ "org/lamsfoundation/lams/authoring/authoringApplicationContext.xml",
+ "org/lamsfoundation/lams/tool/sbmt/submitFilesApplicationContext.xml"};
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.lamsfoundation.lams.AbstractLamsTestCase#getHibernateSessionFactoryName()
+ */
+ protected String getHibernateSessionFactoryName() {
+ return "sbmtSessionFactory";
+ }
+ public void setUp()throws Exception{
+ super.setUp();
+ submissionDetailsDAO = (ISubmissionDetailsDAO)context.getBean("submissionDetailsDAO");
+ submitFilesContentDAO = (ISubmitFilesContentDAO)context.getBean("submitFilesContentDAO");
+ }
+
+ public void testAddDetails(){
+ SubmitFilesContent content = submitFilesContentDAO.getContentByID(new Long(1));
+ SubmissionDetails details = new SubmissionDetails("filePath","fileDescription",new Date(),
+ new Long(1),new Long(1),new Long(1),
+ content);
+ submissionDetailsDAO.insert(details);
+ assertNotNull(details.getSubmissionID());
+ }
+ public void testGetDistinctUser(){
+ List list = submissionDetailsDAO.getUsersForContent(new Long(1));
+ assertEquals(list.size(),3);
+ }
+
+}
Index: lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/dao/TestSubmitFilesContentDAO.java
===================================================================
diff -u
--- lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/dao/TestSubmitFilesContentDAO.java (revision 0)
+++ lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/dao/TestSubmitFilesContentDAO.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,53 @@
+package org.lamsfoundation.lams.tool.sbmt.dao;
+
+import org.lamsfoundation.lams.AbstractLamsTestCase;
+import org.lamsfoundation.lams.tool.sbmt.SubmitFilesContent;
+import org.lamsfoundation.lams.tool.sbmt.dao.ISubmitFilesContentDAO;
+/*
+ * Created on May 30, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+
+/**
+ * @author Manpreet Minhas
+ */
+public class TestSubmitFilesContentDAO extends AbstractLamsTestCase {
+
+ protected SubmitFilesContent submitFilesContent;
+ protected ISubmitFilesContentDAO submitFilesContentDAO;
+
+ public TestSubmitFilesContentDAO(String name){
+ super(name);
+ }
+ /**
+ * (non-Javadoc)
+ * @see org.lamsfoundation.lams.AbstractLamsTestCase#getContextConfigLocation()
+ */
+ protected String[] getContextConfigLocation() {
+ return new String[] {"org/lamsfoundation/lams/tool/sbmt/submitFilesApplicationContext.xml"};
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.lamsfoundation.lams.AbstractLamsTestCase#getHibernateSessionFactoryName()
+ */
+ protected String getHibernateSessionFactoryName() {
+ return "sbmtSessionFactory";
+ }
+ public void setUp()throws Exception{
+ super.setUp();
+ submitFilesContentDAO = (ISubmitFilesContentDAO)context.getBean("submitFilesContentDAO");
+ }
+ public void testAddSubmitFilesContent(){
+ submitFilesContent = new SubmitFilesContent(new Long(1),"Trial Content","Trial Instructions");
+ submitFilesContentDAO.insert(submitFilesContent);
+ assertNotNull(submitFilesContent.getContentID());
+ }
+ public void testGetContentByID(){
+ submitFilesContent = submitFilesContentDAO.getContentByID(new Long(1));
+ assertEquals(submitFilesContent.getTitle(), new String("Trial Content"));
+ }
+
+}
Index: lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/dao/TestSubmitFilesReportDAO.java
===================================================================
diff -u
--- lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/dao/TestSubmitFilesReportDAO.java (revision 0)
+++ lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/dao/TestSubmitFilesReportDAO.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,58 @@
+/*
+ * Created on May 30, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.lamsfoundation.lams.tool.sbmt.dao;
+
+import org.lamsfoundation.lams.AbstractLamsTestCase;
+import org.lamsfoundation.lams.tool.sbmt.SubmitFilesContent;
+import org.lamsfoundation.lams.tool.sbmt.SubmitFilesReport;
+import org.lamsfoundation.lams.tool.sbmt.dao.hibernate.SubmitFilesContentDAO;
+import org.lamsfoundation.lams.tool.sbmt.dao.hibernate.SubmitFilesReportDAO;
+
+/**
+ * @author Manpreet Minhas
+ */
+public class TestSubmitFilesReportDAO extends AbstractLamsTestCase {
+
+ protected SubmitFilesReport submitFilesReport;
+ protected SubmitFilesContent submitFilesContent;
+ protected ISubmitFilesContentDAO submitFilesContentDAO;
+ protected ISubmitFilesReportDAO submitFilesReportDAO;
+ protected ISubmissionDetailsDAO submissionDetailsDAO;
+
+ public TestSubmitFilesReportDAO(String name){
+ super(name);
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.lamsfoundation.lams.AbstractLamsTestCase#getContextConfigLocation()
+ */
+ protected String[] getContextConfigLocation() {
+ return new String[] {"org/lamsfoundation/lams/tool/sbmt/submitFilesApplicationContext.xml"};
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.lamsfoundation.lams.AbstractLamsTestCase#getHibernateSessionFactoryName()
+ */
+ protected String getHibernateSessionFactoryName() {
+ return "sbmtSessionFactory";
+ }
+ public void setUp()throws Exception{
+ super.setUp();
+ submitFilesReportDAO = (SubmitFilesReportDAO)context.getBean("submitFilesReportDAO");
+ submitFilesContentDAO = (SubmitFilesContentDAO)context.getBean("submitFilesContentDAO");
+ submissionDetailsDAO = (ISubmissionDetailsDAO)context.getBean("submissionDetailsDAO");
+ }
+ public void testAddSubmitFilesReport(){
+ submitFilesContent = submitFilesContentDAO.getContentByID(new Long(1));
+
+ submitFilesReport = new SubmitFilesReport(submissionDetailsDAO.getSubmissionDetailsByID(new Long(1)));
+ submitFilesReportDAO.insert(submitFilesReport);
+ assertNotNull(submitFilesReport.getReportID());
+ }
+}
Index: lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/dao/TestSubmitFilesSession.java
===================================================================
diff -u
--- lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/dao/TestSubmitFilesSession.java (revision 0)
+++ lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/dao/TestSubmitFilesSession.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,62 @@
+/*
+ * Created on May 30, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.lamsfoundation.lams.tool.sbmt.dao;
+
+import org.lamsfoundation.lams.AbstractLamsTestCase;
+import org.lamsfoundation.lams.tool.sbmt.SubmitFilesContent;
+import org.lamsfoundation.lams.tool.sbmt.SubmitFilesSession;
+import org.lamsfoundation.lams.tool.sbmt.dao.hibernate.SubmitFilesContentDAO;
+import org.lamsfoundation.lams.tool.sbmt.dao.hibernate.SubmitFilesSessionDAO;
+
+/**
+ * @author Manpreet Minhas
+ */
+public class TestSubmitFilesSession extends AbstractLamsTestCase {
+
+ protected SubmitFilesSession submitFilesSession;
+ protected SubmitFilesContent submitFilesContent;
+
+ protected ISubmitFilesContentDAO submitFilesContentDAO;
+ protected ISubmitFilesSessionDAO submitFilesSessionDAO;
+
+ public TestSubmitFilesSession(String name){
+ super(name);
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.lamsfoundation.lams.AbstractLamsTestCase#getContextConfigLocation()
+ */
+ protected String[] getContextConfigLocation() {
+ return new String[] {"org/lamsfoundation/lams/tool/sbmt/submitFilesApplicationContext.xml"};
+ }
+
+ /**
+ * (non-Jsavadoc)
+ * @see org.lamsfoundation.lams.AbstractLamsTestCase#getHibernateSessionFactoryName()
+ */
+ protected String getHibernateSessionFactoryName() {
+ return "sbmtSessionFactory";
+ }
+
+ public void setUp() throws Exception{
+ super.setUp();
+ submitFilesSessionDAO = (SubmitFilesSessionDAO)context.getBean("submitFilesSessionDAO");
+ submitFilesContentDAO = (SubmitFilesContentDAO)context.getBean("submitFilesContentDAO");
+ }
+ public void testAddSubmitFilesSession(){
+ submitFilesContent = submitFilesContentDAO.getContentByID(new Long(1));
+ submitFilesSession = new SubmitFilesSession(new Integer(1),submitFilesContent);
+ submitFilesSessionDAO.insert(submitFilesSession);
+ assertNotNull(submitFilesSession.getSessionID());
+ }
+ public void testGetSessionByID(){
+ submitFilesSession = submitFilesSessionDAO.getSessionByID(new Long(1));
+ assertEquals(submitFilesSession.getStatus(), new Integer(1));
+ }
+
+}
Index: lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/service/TestSubmitFilesService.java
===================================================================
diff -u
--- lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/service/TestSubmitFilesService.java (revision 0)
+++ lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/service/TestSubmitFilesService.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,101 @@
+/*
+ * Created on May 20, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.lamsfoundation.lams.tool.sbmt.service;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import org.lamsfoundation.lams.AbstractLamsTestCase;
+import org.lamsfoundation.lams.tool.sbmt.SubmitFilesContent;
+import org.lamsfoundation.lams.tool.sbmt.dao.ISubmissionDetailsDAO;
+import org.lamsfoundation.lams.tool.sbmt.dao.ISubmitFilesContentDAO;
+import org.lamsfoundation.lams.tool.sbmt.dto.StatusReportDTO;
+import org.springframework.orm.hibernate.HibernateObjectRetrievalFailureException;
+
+/**
+ * @author Manpreet Minhas
+ */
+public class TestSubmitFilesService extends AbstractLamsTestCase {
+
+ protected ISubmitFilesService submitFilesService;
+ protected ISubmitFilesContentDAO submitFilesContentDAO;
+ protected ISubmissionDetailsDAO submissionDetailsDAO;
+
+ protected SubmitFilesContent submitFilesContent;
+
+ public TestSubmitFilesService(String name){
+ super(name);
+ }
+
+ /**
+ *(non-Javadoc)
+ * @see org.lamsfoundation.lams.AbstractLamsTestCase#getContextConfigLocation()
+ */
+ protected String[] getContextConfigLocation() {
+ return new String[] {"org/lamsfoundation/lams/applicationContext.xml",
+ "org/lamsfoundation/lams/workspace/workspaceApplicationContext.xml",
+ "org/lamsfoundation/lams/authoring/authoringApplicationContext.xml",
+ "org/lamsfoundation/lams/tool/sbmt/submitFilesApplicationContext.xml"};
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.lamsfoundation.lams.AbstractLamsTestCase#getHibernateSessionFactoryName()
+ */
+ protected String getHibernateSessionFactoryName() {
+ return "sbmtSessionFactory";
+ }
+
+ public void setUp()throws Exception{
+ super.setUp();
+ submitFilesService = (ISubmitFilesService)context.getBean("submitFilesService");
+ submitFilesContentDAO = (ISubmitFilesContentDAO)context.getBean("submitFilesContentDAO");
+ submissionDetailsDAO = (ISubmissionDetailsDAO)context.getBean("submissionDetailsDAO");
+ }
+
+ /*public void testAddSubmitFilesContent(){
+ submitFilesService.addSubmitFilesContent(new Long(1),"Trial Title Submit Files", "Trial Instructions Submit Files");
+ assertNotNull(submitFilesContentDAO.getContentByID(new Long(1)));
+ }
+ public void testUploadFile(){
+ String filePath = "c:" + File.separator + "mminhas.txt";
+ submitFilesService.uploadFile(new Long(1),filePath,"Trial Content File Description", new Long(1));
+ submitFilesService.uploadFile(new Long(1),filePath,"Trial Content File Description", new Long(1));
+ submitFilesService.uploadFile(new Long(1),filePath,"Trial Content File Description", new Long(2));
+ submitFilesService.uploadFile(new Long(1),filePath,"Trial Content File Description", new Long(3));
+ submitFilesService.uploadFile(new Long(1),filePath,"Trial Content File Description", new Long(1));
+ submitFilesService.uploadFile(new Long(1),filePath,"Trial Content File Description", new Long(2));
+ assertNotNull(submissionDetailsDAO.getSubmissionDetailsByID(new Long(1)));
+ }
+ public void testRemoveToolContent(){
+ submitFilesService.removeToolContent(new Long(1));
+ try{
+ submitFilesContentDAO.getContentByID(new Long(1));
+ fail("Exception should be raised because this object has already been deleted");
+ }catch(HibernateObjectRetrievalFailureException he){
+ assertTrue(true);
+ }
+ }
+ public void testGenerateReport(){
+ Hashtable table = submitFilesService.generateReport(new Long(1));
+ assertEquals(table.size(),3);
+ }*/
+ public void testGetStatus(){
+ ArrayList list = submitFilesService.getStatus(new Long(1));
+ Iterator iterator = list.iterator();
+ while(iterator.hasNext()){
+ StatusReportDTO statusReportDTO = (StatusReportDTO)iterator.next();
+ System.out.print(statusReportDTO.getLogin());
+ System.out.print(statusReportDTO.getFullName());
+ System.out.print(statusReportDTO.getUnMarked());
+ System.out.println();
+ }
+ }
+}
+
\ No newline at end of file
Index: lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/web/TestAuthoringAction.java
===================================================================
diff -u
--- lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/web/TestAuthoringAction.java (revision 0)
+++ lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/web/TestAuthoringAction.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,60 @@
+/****************************************************************
+ * 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.sbmt.web;
+
+import org.springframework.web.context.ContextLoader;
+import org.springframework.web.context.support.XmlWebApplicationContext;
+
+import servletunit.struts.MockStrutsTestCase;
+
+/**
+ * @author Manpreet Minhas
+ */
+public class TestAuthoringAction extends MockStrutsTestCase {
+
+ public TestAuthoringAction(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/sbmt/submitFilesApplicationContext.xml");
+ ctxLoader.initWebApplicationContext(context);
+ }
+ public void testUpdateContent(){
+ setConfigFile("/WEB-INF/struts/struts-config.xml");
+ setRequestPathInfo("/tool/sbmt/authoring");
+ addRequestParameter("method","updateContent");
+ addRequestParameter("contentID","89");
+ addRequestParameter("title","Mock Title");
+ addRequestParameter("instructions","Mock Instructions");
+ actionPerform();
+ verifyForward("success");
+ verifyNoActionErrors();
+ }
+
+}
Index: lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/web/TestLearnerAction.java
===================================================================
diff -u
--- lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/web/TestLearnerAction.java (revision 0)
+++ lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/web/TestLearnerAction.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,51 @@
+/*
+ * 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.sbmt.web;
+
+import java.io.File;
+
+import org.springframework.web.context.ContextLoader;
+import org.springframework.web.context.support.XmlWebApplicationContext;
+
+import servletunit.struts.MockStrutsTestCase;
+
+/**
+ * @author Manpreet Minhas
+ */
+public class TestLearnerAction extends MockStrutsTestCase {
+
+ public TestLearnerAction(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/sbmt/submitFilesApplicationContext.xml");
+ ctxLoader.initWebApplicationContext(context);
+ }
+
+ public void testUploadFile(){
+ setConfigFile("/WEB-INF/struts/struts-config.xml");
+ setRequestPathInfo("/tool/sbmt/learner");
+ addRequestParameter("method","uploadFile");
+
+ addRequestParameter("contentID","1");
+ String filePath = "c:" + File.separator + "mminhas.txt";
+ addRequestParameter("filePath",filePath);
+ addRequestParameter("fileDescription","Mock file description ");
+ addRequestParameter("userID","1");
+
+ actionPerform();
+ verifyForward("upload");
+ verifyNoActionErrors();
+ }
+
+}
Index: lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/web/TestMonitoringAction.java
===================================================================
diff -u
--- lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/web/TestMonitoringAction.java (revision 0)
+++ lams_tool_sbmt/test/java/org/lamsfoundation/lams/tool/sbmt/web/TestMonitoringAction.java (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,70 @@
+/****************************************************************
+ * 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.sbmt.web;
+
+import org.springframework.web.context.ContextLoader;
+import org.springframework.web.context.support.XmlWebApplicationContext;
+
+import servletunit.struts.MockStrutsTestCase;
+
+/**
+ * @author Manpreet Minhas
+ */
+public class TestMonitoringAction extends MockStrutsTestCase {
+
+ public TestMonitoringAction(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/applicationContext.xml," +
+ " org/lamsfoundation/lams/workspace/workspaceApplicationContext.xml," +
+ " org/lamsfoundation/lams/authoring/authoringApplicationContext.xml," +
+ " org/lamsfoundation/lams/tool/sbmt/submitFilesApplicationContext.xml");
+ ctxLoader.initWebApplicationContext(context);
+ }
+ public void testGetStatus(){
+ setConfigFile("/WEB-INF/struts/struts-config.xml");
+ setRequestPathInfo("/monitoring");
+ addRequestParameter("method","getStatus");
+ addRequestParameter("contentID","1");
+ actionPerform();
+ verifyForward("status");
+ verifyNoActionErrors();
+ }
+ public void testMarkFiles(){
+ setConfigFile("/WEB-INF/struts/struts-config.xml");
+ setRequestPathInfo("/monitoring");
+ addRequestParameter("method","markFiles");
+ addRequestParameter("contentID","1");
+ addRequestParameter("userID","1");
+ actionPerform();
+ verifyForward("userReport");
+ verifyNoActionErrors();
+ }
+
+}
Index: lams_tool_sbmt/velocity.log
===================================================================
diff -u
--- lams_tool_sbmt/velocity.log (revision 0)
+++ lams_tool_sbmt/velocity.log (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,34 @@
+2005-05-30 12:57:50,390 - Log4JLogSystem initialized using logfile velocity.log
+2005-05-30 12:57:50,390 - **************************************************************
+2005-05-30 12:57:50,390 - Starting Jakarta Velocity v1.4-dev
+2005-05-30 12:57:50,390 - RuntimeInstance initializing.
+2005-05-30 12:57:50,390 - Default Properties File: org\apache\velocity\runtime\defaults\velocity.properties
+2005-05-30 12:57:50,390 - Trying to use logger class middlegen.DontCloseLog4JLogSystem
+2005-05-30 12:57:50,390 - Using logger class middlegen.DontCloseLog4JLogSystem
+2005-05-30 12:57:50,406 - Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
+2005-05-30 12:57:50,437 - Resource Loader Instantiated: middlegen.KindFileResourceLoader
+2005-05-30 12:57:50,437 - FileResourceLoader : initialization starting.
+2005-05-30 12:57:50,437 - FileResourceLoader : adding path '.'
+2005-05-30 12:57:50,437 - FileResourceLoader : initialization complete.
+2005-05-30 12:57:50,437 - ClasspathResourceLoader : initialization starting.
+2005-05-30 12:57:50,437 - ClasspathResourceLoader : initialization complete.
+2005-05-30 12:57:50,437 - ResourceCache : initialized. (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
+2005-05-30 12:57:50,437 - Default ResourceManager initialization complete.
+2005-05-30 12:57:50,453 - Loaded System Directive: org.apache.velocity.runtime.directive.Literal
+2005-05-30 12:57:50,468 - Loaded System Directive: org.apache.velocity.runtime.directive.Macro
+2005-05-30 12:57:50,468 - Loaded System Directive: org.apache.velocity.runtime.directive.Parse
+2005-05-30 12:57:50,484 - Loaded System Directive: org.apache.velocity.runtime.directive.Include
+2005-05-30 12:57:50,484 - Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
+2005-05-30 12:57:50,781 - Created: 20 parsers.
+2005-05-30 12:57:50,828 - Velocimacro : initialization starting.
+2005-05-30 12:57:50,828 - Velocimacro : adding VMs from VM library template : VM_global_library.vm
+2005-05-30 12:57:50,828 - KindFileResourceLoader : file loader failed to load: VM_global_library.vm
+2005-05-30 12:57:50,875 - ResourceManager : found VM_global_library.vm with loader middlegen.KindFileResourceLoader
+2005-05-30 12:57:50,875 - Velocimacro : VM library template macro registration complete.
+2005-05-30 12:57:50,875 - Velocimacro : allowInline = true : VMs can be defined inline in templates
+2005-05-30 12:57:50,875 - Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
+2005-05-30 12:57:50,875 - Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
+2005-05-30 12:57:50,875 - Velocimacro : messages on : VM system will output logging messages
+2005-05-30 12:57:50,875 - Velocimacro : autoload off : VM system will not automatically reload global library macros
+2005-05-30 12:57:50,875 - Velocimacro : initialization complete.
+2005-05-30 12:57:50,875 - Velocity successfully started.
Index: lams_tool_sbmt/web/Login.jsp
===================================================================
diff -u
--- lams_tool_sbmt/web/Login.jsp (revision 0)
+++ lams_tool_sbmt/web/Login.jsp (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,7 @@
+
+
+Learning Design Details
+
+ Manpreet Minhas!!!
+
+
\ No newline at end of file
Index: lams_tool_sbmt/web/Status.jsp
===================================================================
diff -u
--- lams_tool_sbmt/web/Status.jsp (revision 0)
+++ lams_tool_sbmt/web/Status.jsp (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8)
@@ -0,0 +1,33 @@
+<%@ page language="java"%>
+
+<%@ taglib uri="tags-bean" prefix="bean" %>
+<%@ taglib uri="tags-html" prefix="html" %>
+<%@ taglib uri="tags-logic" prefix="logic" %>
+<%@ taglib uri="tags-tiles" prefix="tiles" %>
+<%@ taglib uri="tags-c" prefix="c" %>
+
+
+
+
+
+ All Learners
+
+
+