Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitFilesContent.java =================================================================== diff -u -rbe07c35c372d904a65581d98660e73f3b13b69db -r767fd29b0456340736521c9a22c54ad6aa7b02e0 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitFilesContent.java (.../SubmitFilesContent.java) (revision be07c35c372d904a65581d98660e73f3b13b69db) +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitFilesContent.java (.../SubmitFilesContent.java) (revision 767fd29b0456340736521c9a22c54ad6aa7b02e0) @@ -26,15 +26,11 @@ import java.io.Serializable; import java.util.Date; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.log4j.Logger; -import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; /** * @hibernate.class table="tl_lasbmt11_content" @@ -207,16 +203,21 @@ @Override public Object clone() { - Object obj = null; + SubmitFilesContent content = null; try { - obj = super.clone(); + content = (SubmitFilesContent) super.clone(); // never clone key! - ((SubmitFilesContent) obj).setContentID(null); + content.setContentID(null); + + // clone SubmitUser as well + if (createdBy != null) { + content.setCreatedBy((SubmitUser) createdBy.clone()); + } } catch (CloneNotSupportedException e) { SubmitFilesContent.log.error("When clone " + SubmitFilesContent.class + " failed"); } - return obj; + return content; } /** Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitUser.java =================================================================== diff -u -r920894ca746cba5e080023c5cc80167d64d1653d -r767fd29b0456340736521c9a22c54ad6aa7b02e0 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitUser.java (.../SubmitUser.java) (revision 920894ca746cba5e080023c5cc80167d64d1653d) +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/SubmitUser.java (.../SubmitUser.java) (revision 767fd29b0456340736521c9a22c54ad6aa7b02e0) @@ -21,13 +21,14 @@ * **************************************************************** */ -/* $$Id$$ */ +/* $$Id$$ */ package org.lamsfoundation.lams.tool.sbmt; import java.io.Serializable; import java.util.Set; import org.apache.log4j.Logger; + /** * * @hibernate.class table="tl_lasbmt11_user" @@ -36,138 +37,147 @@ * @version $Revision$ * @serial 4951104689120529660L; */ -public class SubmitUser implements Serializable,Cloneable{ +public class SubmitUser implements Serializable, Cloneable { - private static final long serialVersionUID = 4951104689120529660L; - private static Logger log = Logger.getLogger(SubmitUser.class); - - //key + private static final long serialVersionUID = 4951104689120529660L; + private static Logger log = Logger.getLogger(SubmitUser.class); + + // key private Long uid; - //lams User ID - private Integer userID; - private String firstName; - private String lastName; - private String login; - private Long sessionID; - private Long contentID; - - private boolean finished; - - - /* (non-Javadoc) - * @see java.lang.Object#clone() - */ - public Object clone() { - - Object obj = null; - try { - obj = super.clone(); - } catch (CloneNotSupportedException e) { - log.error("When clone " + SubmitUser.class + " failed"); - } - return obj; - } - - //*********************************************************** - // Get / Set methods - //*********************************************************** - /** - * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" - * @return Returns the learnerID. - */ - public Long getUid() { - return uid; - } - /** - * @param learnerID The learnerID to set. - */ - public void setUid(Long uid) { - this.uid = uid; - } + // lams User ID + private Integer userID; + private String firstName; + private String lastName; + private String login; + private Long sessionID; + private Long contentID; - /** - * @hibernate.property column="user_id" length="20" - * @return Returns the userID. - */ - public Integer getUserID() { - return userID; - } - /** - * @param userID - * The userID to set. - */ - public void setUserID(Integer userID) { - this.userID = userID; - } - /** - * @hibernate.property column="finished" length="1" - * @return Returns the finished. - */ - public boolean isFinished() { - return finished; - } - /** - * @param finished The finished to set. - */ - public void setFinished(boolean finished) { - this.finished = finished; - } + private boolean finished; - /** - * @hibernate.property column="session_id" length="20" - * @return Returns the sessionID. - */ - public Long getSessionID() { - return sessionID; - } - /** - * @param sessionID The sessionID to set. - */ - public void setSessionID(Long sessionID) { - this.sessionID = sessionID; - } + @Override + public Object clone() { - /** - * @hibernate.property column="first_name" - */ - public String getFirstName() { - return firstName; + SubmitUser user = null; + try { + user = (SubmitUser) super.clone(); + user.setUid(null); + // never clone session + user.setSessionID(null); + } catch (CloneNotSupportedException e) { + log.error("When clone " + SubmitUser.class + " failed"); } + return user; + } - public void setFirstName(String firstName) { - this.firstName = firstName; - } + // *********************************************************** + // Get / Set methods + // *********************************************************** + /** + * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" + * @return Returns the learnerID. + */ + public Long getUid() { + return uid; + } - /** - * @hibernate.property column="login_name" - */ - public String getLogin() { - return login; - } + /** + * @param learnerID + * The learnerID to set. + */ + public void setUid(Long uid) { + this.uid = uid; + } - public void setLogin(String loginName) { - this.login = loginName; - } + /** + * @hibernate.property column="user_id" length="20" + * @return Returns the userID. + */ + public Integer getUserID() { + return userID; + } - /** - * @hibernate.property column="last_name" - */ - public String getLastName() { - return lastName; - } + /** + * @param userID + * The userID to set. + */ + public void setUserID(Integer userID) { + this.userID = userID; + } - public void setLastName(String secondName) { - this.lastName = secondName; - } - /** - * @hibernate.property column="content_id" - * @return Returns the sessionID. - */ - public Long getContentID() { - return contentID; - } + /** + * @hibernate.property column="finished" length="1" + * @return Returns the finished. + */ + public boolean isFinished() { + return finished; + } - public void setContentID(Long contentID) { - this.contentID = contentID; - } + /** + * @param finished + * The finished to set. + */ + public void setFinished(boolean finished) { + this.finished = finished; + } + + /** + * @hibernate.property column="session_id" length="20" + * @return Returns the sessionID. + */ + public Long getSessionID() { + return sessionID; + } + + /** + * @param sessionID + * The sessionID to set. + */ + public void setSessionID(Long sessionID) { + this.sessionID = sessionID; + } + + /** + * @hibernate.property column="first_name" + */ + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + /** + * @hibernate.property column="login_name" + */ + public String getLogin() { + return login; + } + + public void setLogin(String loginName) { + this.login = loginName; + } + + /** + * @hibernate.property column="last_name" + */ + public String getLastName() { + return lastName; + } + + public void setLastName(String secondName) { + this.lastName = secondName; + } + + /** + * @hibernate.property column="content_id" + * @return Returns the sessionID. + */ + public Long getContentID() { + return contentID; + } + + public void setContentID(Long contentID) { + this.contentID = contentID; + } }