Index: lams_tool_sbmt/build.xml =================================================================== diff -u -rb496f01cb0de2c2968b080bced80c36ce24bb323 -rb610cde22bca23f3ec2c70121db08612edff3912 --- lams_tool_sbmt/build.xml (.../build.xml) (revision b496f01cb0de2c2968b080bced80c36ce24bb323) +++ lams_tool_sbmt/build.xml (.../build.xml) (revision b610cde22bca23f3ec2c70121db08612edff3912) @@ -40,7 +40,10 @@ - + + + + @@ -111,8 +114,56 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_sbmt/conf/hibernate/mappings/hibernate.properties =================================================================== diff -u --- lams_tool_sbmt/conf/hibernate/mappings/hibernate.properties (revision 0) +++ lams_tool_sbmt/conf/hibernate/mappings/hibernate.properties (revision b610cde22bca23f3ec2c70121db08612edff3912) @@ -0,0 +1,7 @@ +hibernate.connection.username=lams +hibernate.connection.password=lamsdemo +hibernate.connection.url=jdbc:mysql://localhost/lams +hibernate.connection.driver_class=com.mysql.jdbc.Driver +hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect + + Index: lams_tool_sbmt/conf/hibernate/mappings/org/lamsfoundation/lams/tool/sbmt/SubmissionDetails.hbm.xml =================================================================== diff -u -reb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8 -rb610cde22bca23f3ec2c70121db08612edff3912 --- lams_tool_sbmt/conf/hibernate/mappings/org/lamsfoundation/lams/tool/sbmt/SubmissionDetails.hbm.xml (.../SubmissionDetails.hbm.xml) (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8) +++ lams_tool_sbmt/conf/hibernate/mappings/org/lamsfoundation/lams/tool/sbmt/SubmissionDetails.hbm.xml (.../SubmissionDetails.hbm.xml) (revision b610cde22bca23f3ec2c70121db08612edff3912) @@ -1,73 +1,114 @@ - + + - - - - - @hibernate.class table="tl_lasbmt11_submission_details" - true + + - - @hibernate.id generator-class="identity" - type="java.lang.Long" column="submission_id" - true - - - - - true - true - @hibernate.property column="filePath" length="250" not-null="true" - + + + + + - - true - true - @hibernate.property column="fileDescription" length="250" not-null="true" - - - - true - true - @hibernate.property column="date_of_submission" length="19" not-null="true" - - - - true - true - @hibernate.property column="user_id" length="20" not-null="true" - - - - true - true - @hibernate.property column="uuid" length="20" not-null="true" - - - - true - true - @hibernate.property column="version_id" length="20" not-null="true" - - - - - true - @hibernate.many-to-one not-null="true" - @hibernate.column name="content_id" - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_sbmt/conf/hibernate/mappings/org/lamsfoundation/lams/tool/sbmt/SubmitFilesContent.hbm.xml =================================================================== diff -u -reb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8 -rb610cde22bca23f3ec2c70121db08612edff3912 --- lams_tool_sbmt/conf/hibernate/mappings/org/lamsfoundation/lams/tool/sbmt/SubmitFilesContent.hbm.xml (.../SubmitFilesContent.hbm.xml) (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8) +++ lams_tool_sbmt/conf/hibernate/mappings/org/lamsfoundation/lams/tool/sbmt/SubmitFilesContent.hbm.xml (.../SubmitFilesContent.hbm.xml) (revision b610cde22bca23f3ec2c70121db08612edff3912) @@ -1,60 +1,100 @@ - + + - - - + + - - @hibernate.class table="tl_lasbmt11_content" - true + + + + + - - @hibernate.id generator-class="assigned" - type="java.lang.Long" column="content_id" - true - - + - - true - true - @hibernate.property column="title" length="64" not-null="true" - - - - true - true - @hibernate.property column="instructions" length="64" not-null="true" - - - - - - - @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" - - - - - - - - @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.SubmissionDetails" - - - - + - + + + + + + + + + + + + + + + + + Index: lams_tool_sbmt/conf/hibernate/mappings/org/lamsfoundation/lams/tool/sbmt/SubmitFilesReport.hbm.xml =================================================================== diff -u -reb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8 -rb610cde22bca23f3ec2c70121db08612edff3912 --- lams_tool_sbmt/conf/hibernate/mappings/org/lamsfoundation/lams/tool/sbmt/SubmitFilesReport.hbm.xml (.../SubmitFilesReport.hbm.xml) (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8) +++ lams_tool_sbmt/conf/hibernate/mappings/org/lamsfoundation/lams/tool/sbmt/SubmitFilesReport.hbm.xml (.../SubmitFilesReport.hbm.xml) (revision b610cde22bca23f3ec2c70121db08612edff3912) @@ -1,54 +1,70 @@ - + + - - - + + - - @hibernate.class table="tl_lasbmt11_report" - true + + + + + - - @hibernate.id generator-class="identity" type="java.lang.Long" column="report_id" - true - - + - - true - true - @hibernate.property column="comments" length="250" - - - - true - true - @hibernate.property column="marks" length="20" - - - - true - true - @hibernate.property column="date_marks_released" length="19" - - - - - - - @hibernate.many-to-one unique="true" - @hibernate.many-to-one not-null="true" - @hibernate.column name="submission_id" - - - + - + + + + + + Index: lams_tool_sbmt/conf/hibernate/mappings/org/lamsfoundation/lams/tool/sbmt/SubmitFilesSession.hbm.xml =================================================================== diff -u -reb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8 -rb610cde22bca23f3ec2c70121db08612edff3912 --- lams_tool_sbmt/conf/hibernate/mappings/org/lamsfoundation/lams/tool/sbmt/SubmitFilesSession.hbm.xml (.../SubmitFilesSession.hbm.xml) (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8) +++ lams_tool_sbmt/conf/hibernate/mappings/org/lamsfoundation/lams/tool/sbmt/SubmitFilesSession.hbm.xml (.../SubmitFilesSession.hbm.xml) (revision b610cde22bca23f3ec2c70121db08612edff3912) @@ -1,42 +1,70 @@ - + + - - - + + - - @hibernate.class table="tl_lasbmt11_session" - true + + + + + - - @hibernate.id generator-class="identity" type="java.lang.Long" column="session_id" - true - - + - - true - true - @hibernate.property column="status" length="11" not-null="true" - + - - - - - true - @hibernate.many-to-one not-null="true" - @hibernate.column name="content_id" - - - + + - + + + + + + + + Index: lams_tool_sbmt/db/model/lams_tool_sbmt.clay =================================================================== diff -u -reb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8 -rb610cde22bca23f3ec2c70121db08612edff3912 --- lams_tool_sbmt/db/model/lams_tool_sbmt.clay (.../lams_tool_sbmt.clay) (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8) +++ lams_tool_sbmt/db/model/lams_tool_sbmt.clay (.../lams_tool_sbmt.clay) (revision b610cde22bca23f3ec2c70121db08612edff3912) @@ -1,117 +1,117 @@ - - - + + + - - + + - - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - + +
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - + + + - - + + - - + + @@ -120,58 +120,58 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + @@ -180,108 +180,108 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - - - - - - - - + + + + + - - - - - + + + + + - - - - - + + + + - - - - + + + + + + + + + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + + - - - - + + + - - + + - - + + - + Index: lams_tool_sbmt/db/sql/create_lams_tool_sbmt.sql =================================================================== diff -u -reb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8 -rb610cde22bca23f3ec2c70121db08612edff3912 --- lams_tool_sbmt/db/sql/create_lams_tool_sbmt.sql (.../create_lams_tool_sbmt.sql) (revision eb8df38a09efc89ecb2524cb7cf70ad9f3ec69d8) +++ lams_tool_sbmt/db/sql/create_lams_tool_sbmt.sql (.../create_lams_tool_sbmt.sql) (revision b610cde22bca23f3ec2c70121db08612edff3912) @@ -1,36 +1,20 @@ +SET FOREIGN_KEY_CHECKS=0; + CREATE TABLE tl_lasbmt11_content ( content_id BIGINT(20) NOT NULL AUTO_INCREMENT , title VARCHAR(64) NOT NULL , instructions VARCHAR(64) NOT NULL + , defineLater TINYINT(1) + , runOffline TINYINT(1) , 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 ( @@ -43,4 +27,22 @@ REFERENCES tl_lasbmt11_content (content_id) )TYPE=InnoDB; - +CREATE TABLE tl_lasbmt11_submission_details ( + submission_id BIGINT(20) NOT NULL AUTO_INCREMENT + , session_id BIGINT(20) NOT NULL + , report_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 (session_id) + , CONSTRAINT FK_tl_lasbmt11_submission_details_1 FOREIGN KEY (session_id) + REFERENCES tl_lasbmt11_session (session_id) + , INDEX (report_id) + , CONSTRAINT FK_tl_lasbmt11_submission_details_2 FOREIGN KEY (report_id) + REFERENCES tl_lasbmt11_report (report_id) +)TYPE=InnoDB; +SET FOREIGN_KEY_CHECKS=1; \ No newline at end of file Index: lams_tool_sbmt/db/sql/table-schema.sql =================================================================== diff -u --- lams_tool_sbmt/db/sql/table-schema.sql (revision 0) +++ lams_tool_sbmt/db/sql/table-schema.sql (revision b610cde22bca23f3ec2c70121db08612edff3912) @@ -0,0 +1,39 @@ +alter table tl_lasbmt11_submission_details drop foreign key FK1411A53CEAF0A006; +drop table if exists tl_lasbmt11_report; +drop table if exists tl_lasbmt11_content; +drop table if exists tl_lasbmt11_submission_details; +drop table if exists tl_lasbmt11_session; +create table tl_lasbmt11_report ( + report_id bigint not null auto_increment, + comments varchar(250), + marks bigint, + date_marks_released datetime, + primary key (report_id) +); +create table tl_lasbmt11_content ( + content_id bigint not null, + title varchar(64) not null, + instructions varchar(64), + defineLater bit, + runOffline bit, + primary key (content_id) +); +create table tl_lasbmt11_submission_details ( + submission_id bigint not null auto_increment, + filePath varchar(250), + fileDescription varchar(250), + date_of_submission datetime, + uuid bigint, + version_id bigint, + report_id bigint, + user_id bigint, + session_id bigint, + primary key (submission_id) +); +create table tl_lasbmt11_session ( + session_id bigint not null auto_increment, + status integer not null, + content_id bigint, + primary key (session_id) +); +alter table tl_lasbmt11_submission_details add index FK1411A53CEAF0A006 (report_id), add constraint FK1411A53CEAF0A006 foreign key (report_id) references tl_lasbmt11_report (report_id); Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmissionDetails.java =================================================================== diff -u -rfea7b488c176b774c9a6058d1eb00fb5996ec47c -rb610cde22bca23f3ec2c70121db08612edff3912 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmissionDetails.java (.../SubmissionDetails.java) (revision fea7b488c176b774c9a6058d1eb00fb5996ec47c) +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmissionDetails.java (.../SubmissionDetails.java) (revision b610cde22bca23f3ec2c70121db08612edff3912) @@ -38,36 +38,31 @@ /** 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.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) { - this.filePath = filePath; - this.fileDescription = fileDescription; - this.dateOfSubmission = dateOfSubmission; - this.uuid = uuid; - this.versionID = versionID; - this.userID = userID; + /** full constructor */ + public SubmissionDetails(String filePath, String fileDescription, Date dateOfSubmission, Long userID, Long uuid, Long versionID, org.lamsfoundation.lams.tool.sbmt.SubmitFilesReport report) { + this.filePath = filePath; + this.fileDescription = fileDescription; + this.dateOfSubmission = dateOfSubmission; + this.userID = userID; + this.uuid = uuid; + this.versionID = versionID; + this.report = report; } + /** minimal constructor */ + public SubmissionDetails(String filePath, String fileDescription, Date dateOfSubmission, Long userID, Long uuid, Long versionID) { + this.filePath = filePath; + this.fileDescription = fileDescription; + this.dateOfSubmission = dateOfSubmission; + this.userID = userID; + this.uuid = uuid; + this.versionID = versionID; + } /** * @hibernate.id generator-class="identity" type="java.lang.Long" * column="submission_id" @@ -173,15 +168,16 @@ } /** - * @hibernate.many-to-one not-null="true" - * @hibernate.column name="report_id" + * @hibernate.many-to-one not-null="true" + * @hibernate.column name="report_id" * @return Returns the report. */ public SubmitFilesReport getReport() { return report; } /** - * @param report The report to set. + * @param report + * The report to set. */ public void setReport(SubmitFilesReport report) { this.report = report; @@ -194,13 +190,16 @@ return userID; } /** - * @param userID The userID to set. + * @param userID + * The userID to set. */ public void setUserID(Long userID) { this.userID = userID; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#clone() */ public Object clone() { @@ -214,4 +213,5 @@ } return obj; } + } Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitFilesContent.java =================================================================== diff -u -r87db12aabbb89e2d5eac26832b1b3f4f8414d8de -rb610cde22bca23f3ec2c70121db08612edff3912 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitFilesContent.java (.../SubmitFilesContent.java) (revision 87db12aabbb89e2d5eac26832b1b3f4f8414d8de) +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitFilesContent.java (.../SubmitFilesContent.java) (revision b610cde22bca23f3ec2c70121db08612edff3912) @@ -27,9 +27,6 @@ /** persistent field */ private Set toolSession; - - /** persistent field */ - private Set submissionDetails; /** persistent field */ private boolean defineLater; @@ -39,11 +36,10 @@ /** full constructor */ public SubmitFilesContent(String title, String instructions, - Set toolSession,Set submissionDetails) { + Set toolSession) { this.title = title; this.instructions = instructions; this.toolSession = toolSession; - this.submissionDetails = submissionDetails; } /** default constructor */ @@ -54,14 +50,13 @@ public SubmitFilesContent(Long contentID, String title, String instructions, - Set toolSession, - Set submissionDetails) { + Set toolSession + ) { super(); this.contentID = contentID; this.title = title; this.instructions = instructions; this.toolSession = toolSession; - this.submissionDetails = submissionDetails; } public SubmitFilesContent(Long contentID, String title, String instructions){ @@ -83,7 +78,6 @@ SubmitFilesContent newContent = new SubmitFilesContent(newContentID, content.getTitle(), content.getInstructions(), - new TreeSet(), new TreeSet()); return newContent; } @@ -159,20 +153,7 @@ .append(getInstructions()).toHashCode(); } - /** - * @hibernate.collection-one-to-many - * - * @return Returns the submissionDetails. - */ - public Set getSubmissionDetails() { - return submissionDetails; - } - /** - * @param submissionDetails The submissionDetails to set. - */ - public void setSubmissionDetails(Set submissionDetails) { - this.submissionDetails = submissionDetails; - } + /** * @hibernate.property column="defineLater" length="1" * @@ -213,16 +194,6 @@ set.add(((SubmitFilesSession)iter.next()).clone()); ((SubmitFilesContent)obj).toolSession = set; } - - //clone SubmissionDetails object - if(submissionDetails != null){ - Iterator iter = submissionDetails.iterator(); - Set set = new TreeSet(); - while(iter.hasNext()) - set.add(((SubmissionDetails)iter.next()).clone()); - ((SubmitFilesContent)obj).submissionDetails = set; - } - } catch (CloneNotSupportedException e) { log.error("When clone " + SubmissionDetails.class + " failed"); } Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitFilesSession.java =================================================================== diff -u -rfea7b488c176b774c9a6058d1eb00fb5996ec47c -rb610cde22bca23f3ec2c70121db08612edff3912 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitFilesSession.java (.../SubmitFilesSession.java) (revision fea7b488c176b774c9a6058d1eb00fb5996ec47c) +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitFilesSession.java (.../SubmitFilesSession.java) (revision b610cde22bca23f3ec2c70121db08612edff3912) @@ -1,6 +1,10 @@ package org.lamsfoundation.lams.tool.sbmt; import java.io.Serializable; +import java.util.Iterator; +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; @@ -21,6 +25,9 @@ /** persistent field */ private Integer status; + + /** persistent field */ + private Set submissionDetails; /** full constructor */ public SubmitFilesSession(Long sessionID,int status) { @@ -86,9 +93,34 @@ Object obj = null; try { obj = super.clone(); + //clone SubmissionDetails object + if(submissionDetails != null){ + Iterator iter = submissionDetails.iterator(); + Set set = new TreeSet(); + while(iter.hasNext()) + set.add(((SubmissionDetails)iter.next()).clone()); + ((SubmitFilesSession)obj).submissionDetails = set; + } + } catch (CloneNotSupportedException e) { log.error("When clone " + SubmissionDetails.class + " failed"); } return obj; } + /** + * @hibernate.collection-one-to-many + * class="org.lamsfoundation.lams.tool.sbmt.SubmissionDetails" + * @hibernate.collection-key column="session_id" + * @hibernate.set lazy="true" inverse="true" cascade="all-delete-orphan" + * @return Returns the submissionDetails. + */ + public Set getSubmissionDetails() { + return submissionDetails; + } + /** + * @param submissionDetails The submissionDetails to set. + */ + public void setSubmissionDetails(Set submissionDetails) { + this.submissionDetails = submissionDetails; + } }