Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/IDimdimAttachmentDAO.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/IDimdimAttachmentDAO.java (.../IDimdimAttachmentDAO.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/IDimdimAttachmentDAO.java (.../IDimdimAttachmentDAO.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -27,8 +27,8 @@ import org.lamsfoundation.lams.dao.IBaseDAO; /** - * DAO for accessing the DimdimAttachment objects - interface defining methods - * to be implemented by the Hibernate or other implementation. + * DAO for accessing the DimdimAttachment objects - interface defining methods to be implemented by the Hibernate or + * other implementation. */ public interface IDimdimAttachmentDAO extends IBaseDAO { Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/IDimdimConfigDAO.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/IDimdimConfigDAO.java (.../IDimdimConfigDAO.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/IDimdimConfigDAO.java (.../IDimdimConfigDAO.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -27,8 +27,8 @@ import org.lamsfoundation.lams.dao.IBaseDAO; /** - * DAO for accessing the DimdimConfig objects - interface defining methods to be - * implemented by the Hibernate or other implementation. + * DAO for accessing the DimdimConfig objects - interface defining methods to be implemented by the Hibernate or other + * implementation. */ public interface IDimdimConfigDAO extends IBaseDAO { Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/IDimdimDAO.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/IDimdimDAO.java (.../IDimdimDAO.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/IDimdimDAO.java (.../IDimdimDAO.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -27,8 +27,8 @@ import org.lamsfoundation.lams.dao.IBaseDAO; /** - * DAO for accessing the DimdimConfig objects - interface defining methods to be - * implemented by the Hibernate or other implementation. + * DAO for accessing the DimdimConfig objects - interface defining methods to be implemented by the Hibernate or other + * implementation. */ public interface IDimdimDAO extends IBaseDAO { Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/IDimdimSessionDAO.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/IDimdimSessionDAO.java (.../IDimdimSessionDAO.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/IDimdimSessionDAO.java (.../IDimdimSessionDAO.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -27,8 +27,8 @@ import org.lamsfoundation.lams.dao.IBaseDAO; /** - * DAO for accessing the DimdimSession objects - interface defining methods to - * be implemented by the Hibernate or other implementation. + * DAO for accessing the DimdimSession objects - interface defining methods to be implemented by the Hibernate or other + * implementation. */ public interface IDimdimSessionDAO extends IBaseDAO { Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/IDimdimUserDAO.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/IDimdimUserDAO.java (.../IDimdimUserDAO.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/IDimdimUserDAO.java (.../IDimdimUserDAO.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -28,16 +28,16 @@ import org.lamsfoundation.lams.tool.dimdim.model.DimdimUser; /** - * DAO for accessing the DimdimUser objects - interface defining methods to be - * implemented by the Hibernate or other implementation. + * DAO for accessing the DimdimUser objects - interface defining methods to be implemented by the Hibernate or other + * implementation. */ public interface IDimdimUserDAO extends IBaseDAO { - /** - * - * @param userId - * @param toolSessionId - * @return - */ - DimdimUser getByUserIdAndSessionId(Long userId, Long toolSessionId); + /** + * + * @param userId + * @param toolSessionId + * @return + */ + DimdimUser getByUserIdAndSessionId(Long userId, Long toolSessionId); } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/hibernate/DimdimAttachmentDAO.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/hibernate/DimdimAttachmentDAO.java (.../DimdimAttachmentDAO.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/hibernate/DimdimAttachmentDAO.java (.../DimdimAttachmentDAO.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -30,6 +30,5 @@ /** * DAO for accessing the DimdimAttachment objects - Hibernate specific code. */ -public class DimdimAttachmentDAO extends BaseDAO implements - IDimdimAttachmentDAO { +public class DimdimAttachmentDAO extends BaseDAO implements IDimdimAttachmentDAO { } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/hibernate/DimdimUserDAO.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/hibernate/DimdimUserDAO.java (.../DimdimUserDAO.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dao/hibernate/DimdimUserDAO.java (.../DimdimUserDAO.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -33,14 +33,11 @@ */ public class DimdimUserDAO extends BaseDAO implements IDimdimUserDAO { - private static final String FIND_BY_USER_ID_SESSION_ID = "from " - + DimdimUser.class.getName() - + " as dimdimUser where dimdimUser.userId=:userId and dimdimUser.dimdimSession.sessionId=:sessionId"; + private static final String FIND_BY_USER_ID_SESSION_ID = "from " + DimdimUser.class.getName() + + " as dimdimUser where dimdimUser.userId=:userId and dimdimUser.dimdimSession.sessionId=:sessionId"; - public DimdimUser getByUserIdAndSessionId(Long userId, Long toolSessionId) { - return (DimdimUser) getSession() - .createQuery(FIND_BY_USER_ID_SESSION_ID).setLong("userId", - userId).setLong("sessionId", toolSessionId) - .uniqueResult(); - } + public DimdimUser getByUserIdAndSessionId(Long userId, Long toolSessionId) { + return (DimdimUser) getSession().createQuery(FIND_BY_USER_ID_SESSION_ID).setLong("userId", userId).setLong( + "sessionId", toolSessionId).uniqueResult(); + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dto/AttachmentDTO.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dto/AttachmentDTO.java (.../AttachmentDTO.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dto/AttachmentDTO.java (.../AttachmentDTO.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -30,69 +30,69 @@ public class AttachmentDTO implements Comparable { - Long uid; + Long uid; - Long fileUuid; + Long fileUuid; - Long fileVersionId; + Long fileVersionId; - String fileName; + String fileName; - Date createDate; + Date createDate; - public AttachmentDTO(DimdimAttachment att) { - this.fileUuid = att.getFileUuid(); - this.fileName = att.getFileName(); - this.fileVersionId = att.getFileVersionId(); - this.createDate = att.getCreateDate(); - this.uid = att.getUid(); - } + public AttachmentDTO(DimdimAttachment att) { + this.fileUuid = att.getFileUuid(); + this.fileName = att.getFileName(); + this.fileVersionId = att.getFileVersionId(); + this.createDate = att.getCreateDate(); + this.uid = att.getUid(); + } - public int compareTo(AttachmentDTO other) { - int ret = this.createDate.compareTo(other.getCreateDate()); - if (ret == 0) { - ret = this.uid.compareTo(other.getUid()); - } - return ret; + public int compareTo(AttachmentDTO other) { + int ret = this.createDate.compareTo(other.getCreateDate()); + if (ret == 0) { + ret = this.uid.compareTo(other.getUid()); } + return ret; + } - public String getFileName() { - return fileName; - } + public String getFileName() { + return fileName; + } - public void setFileName(String fileName) { - this.fileName = fileName; - } + public void setFileName(String fileName) { + this.fileName = fileName; + } - public Long getFileUuid() { - return fileUuid; - } + public Long getFileUuid() { + return fileUuid; + } - public void setFileUuid(Long fileUuid) { - this.fileUuid = fileUuid; - } + public void setFileUuid(Long fileUuid) { + this.fileUuid = fileUuid; + } - public Long getFileVersionId() { - return fileVersionId; - } + public Long getFileVersionId() { + return fileVersionId; + } - public void setFileVersionId(Long fileVersionId) { - this.fileVersionId = fileVersionId; - } + public void setFileVersionId(Long fileVersionId) { + this.fileVersionId = fileVersionId; + } - public Date getCreateDate() { - return createDate; - } + public Date getCreateDate() { + return createDate; + } - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } - public Long getUid() { - return uid; - } + public Long getUid() { + return uid; + } - public void setUid(Long uid) { - this.uid = uid; - } + public void setUid(Long uid) { + this.uid = uid; + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dto/ContentDTO.java =================================================================== diff -u -r65ab476801260e17f27b0f625ec4daa6a5a8d7fd -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dto/ContentDTO.java (.../ContentDTO.java) (revision 65ab476801260e17f27b0f625ec4daa6a5a8d7fd) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dto/ContentDTO.java (.../ContentDTO.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -35,192 +35,188 @@ public class ContentDTO { - private static final Logger logger = Logger.getLogger(ContentDTO.class); + private static final Logger logger = Logger.getLogger(ContentDTO.class); - public Long toolContentId; + public Long toolContentId; - public String title; + public String title; - public String instructions; + public String instructions; - public String onlineInstructions; + public String onlineInstructions; - public String offlineInstructions; + public String offlineInstructions; - public boolean defineLater; + public boolean defineLater; - public boolean contentInUse; + public boolean contentInUse; - public boolean allowRichEditor; + public boolean allowRichEditor; - public boolean lockOnFinish; + public boolean lockOnFinish; - public Set onlineInstructionsFiles; + public Set onlineInstructionsFiles; - public Set offlineInstructionsFiles; + public Set offlineInstructionsFiles; - public Set sessionDTOs = new TreeSet(); + public Set sessionDTOs = new TreeSet(); - public Long currentTab; + public Long currentTab; - private String topic; + private String topic; - private Integer maxAttendeeMikes; + private Integer maxAttendeeMikes; - /* Constructors */ - public ContentDTO() { - } + /* Constructors */ + public ContentDTO() { + } - public ContentDTO(Dimdim dimdim) { - this.toolContentId = dimdim.getToolContentId(); - this.title = dimdim.getTitle(); - this.instructions = dimdim.getInstructions(); - this.onlineInstructions = dimdim.getOnlineInstructions(); - this.offlineInstructions = dimdim.getOfflineInstructions(); - this.contentInUse = dimdim.isContentInUse(); - this.allowRichEditor = dimdim.isAllowRichEditor(); - this.lockOnFinish = dimdim.isLockOnFinished(); + public ContentDTO(Dimdim dimdim) { + this.toolContentId = dimdim.getToolContentId(); + this.title = dimdim.getTitle(); + this.instructions = dimdim.getInstructions(); + this.onlineInstructions = dimdim.getOnlineInstructions(); + this.offlineInstructions = dimdim.getOfflineInstructions(); + this.contentInUse = dimdim.isContentInUse(); + this.allowRichEditor = dimdim.isAllowRichEditor(); + this.lockOnFinish = dimdim.isLockOnFinished(); - this.onlineInstructionsFiles = new TreeSet(); - this.offlineInstructionsFiles = new TreeSet(); + this.onlineInstructionsFiles = new TreeSet(); + this.offlineInstructionsFiles = new TreeSet(); - this.topic = dimdim.getTopic(); - this.maxAttendeeMikes = dimdim.getMaxAttendeeMikes(); + this.topic = dimdim.getTopic(); + this.maxAttendeeMikes = dimdim.getMaxAttendeeMikes(); - for (DimdimAttachment att : dimdim.getDimdimAttachments()) { - Set attSet = null; - if (att.getFileType().equals(IToolContentHandler.TYPE_OFFLINE)) { - attSet = offlineInstructionsFiles; - } else if (att.getFileType() - .equals(IToolContentHandler.TYPE_ONLINE)) { - attSet = onlineInstructionsFiles; - } else { - // something is wrong. Ignore file, log error - logger.error("File with uid " + att.getFileUuid() - + " contains invalid fileType: " + att.getFileType()); - } + for (DimdimAttachment att : dimdim.getDimdimAttachments()) { + Set attSet = null; + if (att.getFileType().equals(IToolContentHandler.TYPE_OFFLINE)) { + attSet = offlineInstructionsFiles; + } else if (att.getFileType().equals(IToolContentHandler.TYPE_ONLINE)) { + attSet = onlineInstructionsFiles; + } else { + // something is wrong. Ignore file, log error + logger.error("File with uid " + att.getFileUuid() + " contains invalid fileType: " + att.getFileType()); + } - if (attSet != null) - attSet.add(new AttachmentDTO(att)); - } - - for (DimdimSession dimdimSession : dimdim.getDimdimSessions()) { - sessionDTOs.add(new SessionDTO(dimdimSession)); - } + if (attSet != null) + attSet.add(new AttachmentDTO(att)); } - /* Getters / Setters */ - public Set getSessionDTOs() { - return sessionDTOs; + for (DimdimSession dimdimSession : dimdim.getDimdimSessions()) { + sessionDTOs.add(new SessionDTO(dimdimSession)); } + } - public void setSessionDTOs(Set sessionDTOs) { - this.sessionDTOs = sessionDTOs; - } + /* Getters / Setters */ + public Set getSessionDTOs() { + return sessionDTOs; + } - public String getInstructions() { - return instructions; - } + public void setSessionDTOs(Set sessionDTOs) { + this.sessionDTOs = sessionDTOs; + } - public void setInstructions(String instructions) { - this.instructions = instructions; - } + public String getInstructions() { + return instructions; + } - public String getOfflineInstructions() { - return offlineInstructions; - } + public void setInstructions(String instructions) { + this.instructions = instructions; + } - public void setOfflineInstructions(String offlineInstructions) { - this.offlineInstructions = offlineInstructions; - } + public String getOfflineInstructions() { + return offlineInstructions; + } - public Set getOfflineInstructionsFiles() { - return offlineInstructionsFiles; - } + public void setOfflineInstructions(String offlineInstructions) { + this.offlineInstructions = offlineInstructions; + } - public void setOfflineInstructionsFiles( - Set offlineInstructionsFiles) { - this.offlineInstructionsFiles = offlineInstructionsFiles; - } + public Set getOfflineInstructionsFiles() { + return offlineInstructionsFiles; + } - public String getOnlineInstructions() { - return onlineInstructions; - } + public void setOfflineInstructionsFiles(Set offlineInstructionsFiles) { + this.offlineInstructionsFiles = offlineInstructionsFiles; + } - public void setOnlineInstructions(String onlineInstructions) { - this.onlineInstructions = onlineInstructions; - } + public String getOnlineInstructions() { + return onlineInstructions; + } - public Set getOnlineInstructionsFiles() { - return onlineInstructionsFiles; - } + public void setOnlineInstructions(String onlineInstructions) { + this.onlineInstructions = onlineInstructions; + } - public void setOnlineInstructionsFiles( - Set onlineInstructionsFiles) { - this.onlineInstructionsFiles = onlineInstructionsFiles; - } + public Set getOnlineInstructionsFiles() { + return onlineInstructionsFiles; + } - public String getTitle() { - return title; - } + public void setOnlineInstructionsFiles(Set onlineInstructionsFiles) { + this.onlineInstructionsFiles = onlineInstructionsFiles; + } - public void setTitle(String title) { - this.title = title; - } + public String getTitle() { + return title; + } - public Long getToolContentId() { - return toolContentId; - } + public void setTitle(String title) { + this.title = title; + } - public void setToolContentId(Long toolContentID) { - this.toolContentId = toolContentID; - } + public Long getToolContentId() { + return toolContentId; + } - public Boolean getContentInUse() { - return contentInUse; - } + public void setToolContentId(Long toolContentID) { + this.toolContentId = toolContentID; + } - public void setContentInUse(Boolean contentInUse) { - this.contentInUse = contentInUse; - } + public Boolean getContentInUse() { + return contentInUse; + } - public boolean isAllowRichEditor() { - return allowRichEditor; - } + public void setContentInUse(Boolean contentInUse) { + this.contentInUse = contentInUse; + } - public void setAllowRichEditor(boolean allowRichEditor) { - this.allowRichEditor = allowRichEditor; - } + public boolean isAllowRichEditor() { + return allowRichEditor; + } - public boolean isLockOnFinish() { - return lockOnFinish; - } + public void setAllowRichEditor(boolean allowRichEditor) { + this.allowRichEditor = allowRichEditor; + } - public void setLockOnFinish(boolean lockOnFinish) { - this.lockOnFinish = lockOnFinish; - } + public boolean isLockOnFinish() { + return lockOnFinish; + } - public Long getCurrentTab() { - return currentTab; - } + public void setLockOnFinish(boolean lockOnFinish) { + this.lockOnFinish = lockOnFinish; + } - public void setCurrentTab(Long currentTab) { - this.currentTab = currentTab; - } + public Long getCurrentTab() { + return currentTab; + } - public String getTopic() { - return topic; - } + public void setCurrentTab(Long currentTab) { + this.currentTab = currentTab; + } - public void setTopic(String topic) { - this.topic = topic; - } + public String getTopic() { + return topic; + } - public Integer getMaxAttendeeMikes() { - return maxAttendeeMikes; - } + public void setTopic(String topic) { + this.topic = topic; + } - public void setMaxAttendeeMikes(Integer maxAttendeeMikes) { - this.maxAttendeeMikes = maxAttendeeMikes; - } + public Integer getMaxAttendeeMikes() { + return maxAttendeeMikes; + } + + public void setMaxAttendeeMikes(Integer maxAttendeeMikes) { + this.maxAttendeeMikes = maxAttendeeMikes; + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dto/NotebookEntryDTO.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dto/NotebookEntryDTO.java (.../NotebookEntryDTO.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dto/NotebookEntryDTO.java (.../NotebookEntryDTO.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -30,50 +30,50 @@ public class NotebookEntryDTO { - private Long uid; + private Long uid; - private String entry; + private String entry; - private Date createDate; + private Date createDate; - private Date lastModified; + private Date lastModified; - public NotebookEntryDTO(NotebookEntry entry) { - this.uid = entry.getUid(); - this.entry = entry.getEntry(); - this.createDate = entry.getCreateDate(); - this.lastModified = entry.getLastModified(); - } + public NotebookEntryDTO(NotebookEntry entry) { + this.uid = entry.getUid(); + this.entry = entry.getEntry(); + this.createDate = entry.getCreateDate(); + this.lastModified = entry.getLastModified(); + } - public Date getCreateDate() { - return createDate; - } + public Date getCreateDate() { + return createDate; + } - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } - public String getEntry() { - return entry; - } + public String getEntry() { + return entry; + } - public void setEntry(String entry) { - this.entry = entry; - } + public void setEntry(String entry) { + this.entry = entry; + } - public Date getLastModified() { - return lastModified; - } + public Date getLastModified() { + return lastModified; + } - public void setLastModified(Date lastModified) { - this.lastModified = lastModified; - } + public void setLastModified(Date lastModified) { + this.lastModified = lastModified; + } - public Long getUid() { - return uid; - } + public Long getUid() { + return uid; + } - public void setUid(Long uid) { - this.uid = uid; - } + public void setUid(Long uid) { + this.uid = uid; + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dto/SessionDTO.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dto/SessionDTO.java (.../SessionDTO.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dto/SessionDTO.java (.../SessionDTO.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -32,82 +32,82 @@ public class SessionDTO implements Comparable { - Long sessionID; + Long sessionID; - String sessionName; + String sessionName; - Set userDTOs = new TreeSet(); + Set userDTOs = new TreeSet(); - int numberOfLearners; + int numberOfLearners; - int numberOfFinishedLearners;; + int numberOfFinishedLearners;; - public SessionDTO(DimdimSession session) { - this.sessionID = session.getSessionId(); - this.sessionName = session.getSessionName(); + public SessionDTO(DimdimSession session) { + this.sessionID = session.getSessionId(); + this.sessionName = session.getSessionName(); - numberOfFinishedLearners = 0; + numberOfFinishedLearners = 0; - for (DimdimUser dimdimUser : session.getDimdimUsers()) { - UserDTO userDTO = new UserDTO(dimdimUser); - if (userDTO.getEntryUID() != null) { - numberOfFinishedLearners++; - } - userDTOs.add(userDTO); - } + for (DimdimUser dimdimUser : session.getDimdimUsers()) { + UserDTO userDTO = new UserDTO(dimdimUser); + if (userDTO.getEntryUID() != null) { + numberOfFinishedLearners++; + } + userDTOs.add(userDTO); + } - numberOfLearners = userDTOs.size(); + numberOfLearners = userDTOs.size(); - } + } - public int compareTo(SessionDTO other) { - int ret = this.sessionName.compareToIgnoreCase(other.sessionName); - if (ret == 0) { - ret = this.sessionID.compareTo(other.sessionID); - } - return ret; + public int compareTo(SessionDTO other) { + int ret = this.sessionName.compareToIgnoreCase(other.sessionName); + if (ret == 0) { + ret = this.sessionID.compareTo(other.sessionID); } + return ret; + } - public SessionDTO() { - } + public SessionDTO() { + } - public Long getSessionID() { - return sessionID; - } + public Long getSessionID() { + return sessionID; + } - public void setSessionID(Long sessionID) { - this.sessionID = sessionID; - } + public void setSessionID(Long sessionID) { + this.sessionID = sessionID; + } - public String getSessionName() { - return sessionName; - } + public String getSessionName() { + return sessionName; + } - public void setSessionName(String sessionName) { - this.sessionName = sessionName; - } + public void setSessionName(String sessionName) { + this.sessionName = sessionName; + } - public Set getUserDTOs() { - return userDTOs; - } + public Set getUserDTOs() { + return userDTOs; + } - public void setUserDTOs(Set dimdimUsers) { - this.userDTOs = dimdimUsers; - } + public void setUserDTOs(Set dimdimUsers) { + this.userDTOs = dimdimUsers; + } - public int getNumberOfLearners() { - return numberOfLearners; - } + public int getNumberOfLearners() { + return numberOfLearners; + } - public void setNumberOfLearners(int numberOfLearners) { - this.numberOfLearners = numberOfLearners; - } + public void setNumberOfLearners(int numberOfLearners) { + this.numberOfLearners = numberOfLearners; + } - public int getNumberOfFinishedLearners() { - return numberOfFinishedLearners; - } + public int getNumberOfFinishedLearners() { + return numberOfFinishedLearners; + } - public void setNumberOfFinishedLearners(int numberOfFinishedLearners) { - this.numberOfFinishedLearners = numberOfFinishedLearners; - } + public void setNumberOfFinishedLearners(int numberOfFinishedLearners) { + this.numberOfFinishedLearners = numberOfFinishedLearners; + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dto/UserDTO.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dto/UserDTO.java (.../UserDTO.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/dto/UserDTO.java (.../UserDTO.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -29,100 +29,100 @@ public class UserDTO implements Comparable { - public Long uid; + public Long uid; - public String loginName; + public String loginName; - public String firstName; + public String firstName; - public String lastName; + public String lastName; - public boolean finishedActivity; + public boolean finishedActivity; - public NotebookEntryDTO entryDTO; + public NotebookEntryDTO entryDTO; - public Long entryUID; + public Long entryUID; - public UserDTO(DimdimUser user, NotebookEntry entry) { - this.uid = user.getUid(); - this.loginName = user.getLoginName(); - this.firstName = user.getFirstName(); - this.lastName = user.getLastName(); - this.finishedActivity = user.isFinishedActivity(); - this.entryUID = user.getEntryUID(); - this.entryDTO = new NotebookEntryDTO(entry); - } + public UserDTO(DimdimUser user, NotebookEntry entry) { + this.uid = user.getUid(); + this.loginName = user.getLoginName(); + this.firstName = user.getFirstName(); + this.lastName = user.getLastName(); + this.finishedActivity = user.isFinishedActivity(); + this.entryUID = user.getEntryUID(); + this.entryDTO = new NotebookEntryDTO(entry); + } - public UserDTO(DimdimUser user) { - this.uid = user.getUid(); - this.loginName = user.getLoginName(); - this.firstName = user.getFirstName(); - this.lastName = user.getLastName(); - this.finishedActivity = user.isFinishedActivity(); - this.entryUID = user.getEntryUID(); - } + public UserDTO(DimdimUser user) { + this.uid = user.getUid(); + this.loginName = user.getLoginName(); + this.firstName = user.getFirstName(); + this.lastName = user.getLastName(); + this.finishedActivity = user.isFinishedActivity(); + this.entryUID = user.getEntryUID(); + } - public int compareTo(UserDTO other) { - int ret = this.lastName.compareToIgnoreCase(other.lastName); - if (ret == 0) { - ret = this.uid.compareTo(other.uid); - } - return ret; + public int compareTo(UserDTO other) { + int ret = this.lastName.compareToIgnoreCase(other.lastName); + if (ret == 0) { + ret = this.uid.compareTo(other.uid); } + return ret; + } - public String getFirstName() { - return firstName; - } + public String getFirstName() { + return firstName; + } - public void setFirstName(String firstName) { - this.firstName = firstName; - } + public void setFirstName(String firstName) { + this.firstName = firstName; + } - public String getLastName() { - return lastName; - } + public String getLastName() { + return lastName; + } - public void setLastName(String lastName) { - this.lastName = lastName; - } + public void setLastName(String lastName) { + this.lastName = lastName; + } - public String getLoginName() { - return loginName; - } + public String getLoginName() { + return loginName; + } - public void setLoginName(String loginName) { - this.loginName = loginName; - } + public void setLoginName(String loginName) { + this.loginName = loginName; + } - public Long getUid() { - return uid; - } + public Long getUid() { + return uid; + } - public void setUid(Long uid) { - this.uid = uid; - } + public void setUid(Long uid) { + this.uid = uid; + } - public NotebookEntryDTO getEntryDTO() { - return entryDTO; - } + public NotebookEntryDTO getEntryDTO() { + return entryDTO; + } - public void setEntryDTO(NotebookEntryDTO entryDTO) { - this.entryDTO = entryDTO; - } + public void setEntryDTO(NotebookEntryDTO entryDTO) { + this.entryDTO = entryDTO; + } - public Long getEntryUID() { - return entryUID; - } + public Long getEntryUID() { + return entryUID; + } - public void setEntryUID(Long entryUID) { - this.entryUID = entryUID; - } + public void setEntryUID(Long entryUID) { + this.entryUID = entryUID; + } - public boolean isFinishedActivity() { - return finishedActivity; - } + public boolean isFinishedActivity() { + return finishedActivity; + } - public void setFinishedActivity(boolean finishedActivity) { - this.finishedActivity = finishedActivity; - } + public void setFinishedActivity(boolean finishedActivity) { + this.finishedActivity = finishedActivity; + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/model/Dimdim.java =================================================================== diff -u -r65ab476801260e17f27b0f625ec4daa6a5a8d7fd -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/model/Dimdim.java (.../Dimdim.java) (revision 65ab476801260e17f27b0f625ec4daa6a5a8d7fd) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/model/Dimdim.java (.../Dimdim.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -39,399 +39,387 @@ public class Dimdim implements java.io.Serializable, Cloneable { - private static final long serialVersionUID = 579733009969321015L; + private static final long serialVersionUID = 579733009969321015L; - private static final Logger logger = Logger.getLogger(Dimdim.class); + private static final Logger logger = Logger.getLogger(Dimdim.class); - private IToolContentHandler toolContentHandler; + private IToolContentHandler toolContentHandler; - // Persistent Fields + // Persistent Fields - private Long uid; + private Long uid; - private Date createDate; + private Date createDate; - private Date updateDate; + private Date updateDate; - private Long createBy; + private Long createBy; - private String title; + private String title; - private String instructions; + private String instructions; - private boolean runOffline; + private boolean runOffline; - private boolean lockOnFinished; + private boolean lockOnFinished; - private boolean allowRichEditor; + private boolean allowRichEditor; - private String onlineInstructions; + private String onlineInstructions; - private String offlineInstructions; + private String offlineInstructions; - private boolean contentInUse; + private boolean contentInUse; - private boolean defineLater; + private boolean defineLater; - private Long toolContentId; + private Long toolContentId; - private Set dimdimAttachments; + private Set dimdimAttachments; - private Set dimdimSessions; + private Set dimdimSessions; - private String topic; + private String topic; - private Integer maxAttendeeMikes; + private Integer maxAttendeeMikes; - // Constructors + // Constructors - /** default constructor */ - public Dimdim() { - } + /** default constructor */ + public Dimdim() { + } - /** full constructor */ - // TODO check full constructor to see whether we need add new fields - public Dimdim(Date createDate, Date updateDate, Long createBy, - String title, String instructions, boolean runOffline, - boolean lockOnFinished, boolean filteringEnabled, - String filterKeywords, String onlineInstructions, - String offlineInstructions, boolean contentInUse, - boolean defineLater, Long toolContentId, - Set dimdimAttachments, - Set dimdimSessions) { - this.createDate = createDate; - this.updateDate = updateDate; - this.createBy = createBy; - this.title = title; - this.instructions = instructions; - this.runOffline = runOffline; - this.lockOnFinished = lockOnFinished; - this.onlineInstructions = onlineInstructions; - this.offlineInstructions = offlineInstructions; - this.contentInUse = contentInUse; - this.defineLater = defineLater; - this.toolContentId = toolContentId; - this.dimdimAttachments = dimdimAttachments; - this.dimdimSessions = dimdimSessions; - } + /** full constructor */ + // TODO check full constructor to see whether we need add new fields + public Dimdim(Date createDate, Date updateDate, Long createBy, String title, String instructions, + boolean runOffline, boolean lockOnFinished, boolean filteringEnabled, String filterKeywords, + String onlineInstructions, String offlineInstructions, boolean contentInUse, boolean defineLater, + Long toolContentId, Set dimdimAttachments, Set dimdimSessions) { + this.createDate = createDate; + this.updateDate = updateDate; + this.createBy = createBy; + this.title = title; + this.instructions = instructions; + this.runOffline = runOffline; + this.lockOnFinished = lockOnFinished; + this.onlineInstructions = onlineInstructions; + this.offlineInstructions = offlineInstructions; + this.contentInUse = contentInUse; + this.defineLater = defineLater; + this.toolContentId = toolContentId; + this.dimdimAttachments = dimdimAttachments; + this.dimdimSessions = dimdimSessions; + } - // Property accessors - /** - * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" - * - */ + // Property accessors + /** + * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" + * + */ - public Long getUid() { - return this.uid; - } + public Long getUid() { + return this.uid; + } - public void setUid(Long uid) { - this.uid = uid; - } + public void setUid(Long uid) { + this.uid = uid; + } - /** - * @hibernate.property column="create_date" - * - */ + /** + * @hibernate.property column="create_date" + * + */ - public Date getCreateDate() { - return this.createDate; - } + public Date getCreateDate() { + return this.createDate; + } - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } - /** - * @hibernate.property column="update_date" - * - */ + /** + * @hibernate.property column="update_date" + * + */ - public Date getUpdateDate() { - return this.updateDate; - } + public Date getUpdateDate() { + return this.updateDate; + } - public void setUpdateDate(Date updateDate) { - this.updateDate = updateDate; - } + public void setUpdateDate(Date updateDate) { + this.updateDate = updateDate; + } - /** - * @hibernate.property column="create_by" length="20" - * - */ + /** + * @hibernate.property column="create_by" length="20" + * + */ - public Long getCreateBy() { - return this.createBy; - } + public Long getCreateBy() { + return this.createBy; + } - public void setCreateBy(Long createBy) { - this.createBy = createBy; - } + public void setCreateBy(Long createBy) { + this.createBy = createBy; + } - /** - * @hibernate.property column="title" length="255" - * - */ + /** + * @hibernate.property column="title" length="255" + * + */ - public String getTitle() { - return this.title; - } + public String getTitle() { + return this.title; + } - public void setTitle(String title) { - this.title = title; - } + public void setTitle(String title) { + this.title = title; + } - /** - * @hibernate.property column="instructions" length="65535" - * - */ + /** + * @hibernate.property column="instructions" length="65535" + * + */ - public String getInstructions() { - return this.instructions; - } + public String getInstructions() { + return this.instructions; + } - public void setInstructions(String instructions) { - this.instructions = instructions; - } + public void setInstructions(String instructions) { + this.instructions = instructions; + } - /** - * @hibernate.property column="run_offline" length="1" - * - */ + /** + * @hibernate.property column="run_offline" length="1" + * + */ - public boolean isRunOffline() { - return this.runOffline; - } + public boolean isRunOffline() { + return this.runOffline; + } - public void setRunOffline(boolean runOffline) { - this.runOffline = runOffline; - } + public void setRunOffline(boolean runOffline) { + this.runOffline = runOffline; + } - /** - * @hibernate.property column="lock_on_finished" length="1" - * - */ + /** + * @hibernate.property column="lock_on_finished" length="1" + * + */ - public boolean isLockOnFinished() { - return this.lockOnFinished; - } + public boolean isLockOnFinished() { + return this.lockOnFinished; + } - public void setLockOnFinished(boolean lockOnFinished) { - this.lockOnFinished = lockOnFinished; - } + public void setLockOnFinished(boolean lockOnFinished) { + this.lockOnFinished = lockOnFinished; + } - /** - * @hibernate.property column="allow_rich_editor" length="1" - * @return - */ - public boolean isAllowRichEditor() { - return allowRichEditor; - } + /** + * @hibernate.property column="allow_rich_editor" length="1" + * @return + */ + public boolean isAllowRichEditor() { + return allowRichEditor; + } - public void setAllowRichEditor(boolean allowRichEditor) { - this.allowRichEditor = allowRichEditor; - } + public void setAllowRichEditor(boolean allowRichEditor) { + this.allowRichEditor = allowRichEditor; + } - /** - * @hibernate.property column="online_instructions" length="65535" - * - */ + /** + * @hibernate.property column="online_instructions" length="65535" + * + */ - public String getOnlineInstructions() { - return this.onlineInstructions; - } + public String getOnlineInstructions() { + return this.onlineInstructions; + } - public void setOnlineInstructions(String onlineInstructions) { - this.onlineInstructions = onlineInstructions; - } + public void setOnlineInstructions(String onlineInstructions) { + this.onlineInstructions = onlineInstructions; + } - /** - * @hibernate.property column="offline_instructions" length="65535" - * - */ + /** + * @hibernate.property column="offline_instructions" length="65535" + * + */ - public String getOfflineInstructions() { - return this.offlineInstructions; - } + public String getOfflineInstructions() { + return this.offlineInstructions; + } - public void setOfflineInstructions(String offlineInstructions) { - this.offlineInstructions = offlineInstructions; - } + public void setOfflineInstructions(String offlineInstructions) { + this.offlineInstructions = offlineInstructions; + } - /** - * @hibernate.property column="content_in_use" length="1" - * - */ + /** + * @hibernate.property column="content_in_use" length="1" + * + */ - public boolean isContentInUse() { - return this.contentInUse; - } + public boolean isContentInUse() { + return this.contentInUse; + } - public void setContentInUse(boolean contentInUse) { - this.contentInUse = contentInUse; - } + public void setContentInUse(boolean contentInUse) { + this.contentInUse = contentInUse; + } - /** - * @hibernate.property column="define_later" length="1" - * - */ + /** + * @hibernate.property column="define_later" length="1" + * + */ - public boolean isDefineLater() { - return this.defineLater; - } + public boolean isDefineLater() { + return this.defineLater; + } - public void setDefineLater(boolean defineLater) { - this.defineLater = defineLater; - } + public void setDefineLater(boolean defineLater) { + this.defineLater = defineLater; + } - /** - * @hibernate.property column="tool_content_id" length="20" - * - */ + /** + * @hibernate.property column="tool_content_id" length="20" + * + */ - public Long getToolContentId() { - return this.toolContentId; - } + public Long getToolContentId() { + return this.toolContentId; + } - public void setToolContentId(Long toolContentId) { - this.toolContentId = toolContentId; - } + public void setToolContentId(Long toolContentId) { + this.toolContentId = toolContentId; + } - /** - * @hibernate.set lazy="true" inverse="false" cascade="all-delete-orphan" - * @hibernate.collection-key column="dimdim_uid" - * @hibernate.collection-one-to-many - * class="org.lamsfoundation.lams.tool.dimdim.model.DimdimAttachment" - * - */ + /** + * @hibernate.set lazy="true" inverse="false" cascade="all-delete-orphan" + * @hibernate.collection-key column="dimdim_uid" + * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.dimdim.model.DimdimAttachment" + * + */ - public Set getDimdimAttachments() { - return this.dimdimAttachments; - } + public Set getDimdimAttachments() { + return this.dimdimAttachments; + } - public void setDimdimAttachments(Set dimdimAttachments) { - this.dimdimAttachments = dimdimAttachments; - } + public void setDimdimAttachments(Set dimdimAttachments) { + this.dimdimAttachments = dimdimAttachments; + } - /** - * @hibernate.set lazy="true" inverse="true" cascade="none" - * @hibernate.collection-key column="dimdim_uid" - * @hibernate.collection-one-to-many - * class="org.lamsfoundation.lams.tool.dimdim.model.DimdimSession" - * - */ - public Set getDimdimSessions() { - return this.dimdimSessions; - } + /** + * @hibernate.set lazy="true" inverse="true" cascade="none" + * @hibernate.collection-key column="dimdim_uid" + * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.dimdim.model.DimdimSession" + * + */ + public Set getDimdimSessions() { + return this.dimdimSessions; + } - public void setDimdimSessions(Set dimdimSessions) { - this.dimdimSessions = dimdimSessions; - } + public void setDimdimSessions(Set dimdimSessions) { + this.dimdimSessions = dimdimSessions; + } - /** - * @hibernate.property column="topic" - * @return - */ - public String getTopic() { - return topic; - } + /** + * @hibernate.property column="topic" + * @return + */ + public String getTopic() { + return topic; + } - public void setTopic(String topic) { - this.topic = topic; - } + public void setTopic(String topic) { + this.topic = topic; + } - /** - * @hibernate.property column="max_attendee_mikes" - * @return - */ - public Integer getMaxAttendeeMikes() { - return maxAttendeeMikes; - } + /** + * @hibernate.property column="max_attendee_mikes" + * @return + */ + public Integer getMaxAttendeeMikes() { + return maxAttendeeMikes; + } - public void setMaxAttendeeMikes(Integer maxAttendeeMikes) { - this.maxAttendeeMikes = maxAttendeeMikes; - } + public void setMaxAttendeeMikes(Integer maxAttendeeMikes) { + this.maxAttendeeMikes = maxAttendeeMikes; + } - /** - * toString - * - * @return String - */ - public String toString() { - StringBuffer buffer = new StringBuffer(); + /** + * toString + * + * @return String + */ + public String toString() { + StringBuffer buffer = new StringBuffer(); - buffer.append(getClass().getName()).append("@").append( - Integer.toHexString(hashCode())).append(" ["); - buffer.append("title").append("='").append(getTitle()).append("' "); - buffer.append("instructions").append("='").append(getInstructions()) - .append("' "); - buffer.append("toolContentId").append("='").append(getToolContentId()) - .append("' "); - buffer.append("]"); + buffer.append(getClass().getName()).append("@").append(Integer.toHexString(hashCode())).append(" ["); + buffer.append("title").append("='").append(getTitle()).append("' "); + buffer.append("instructions").append("='").append(getInstructions()).append("' "); + buffer.append("toolContentId").append("='").append(getToolContentId()).append("' "); + buffer.append("]"); - return buffer.toString(); - } + return buffer.toString(); + } - public boolean equals(Object other) { - if ((this == other)) - return true; - if ((other == null)) - return false; - if (!(other instanceof Dimdim)) - return false; - Dimdim castOther = (Dimdim) other; + public boolean equals(Object other) { + if ((this == other)) + return true; + if ((other == null)) + return false; + if (!(other instanceof Dimdim)) + return false; + Dimdim castOther = (Dimdim) other; - return ((this.getUid() == castOther.getUid()) || (this.getUid() != null - && castOther.getUid() != null && this.getUid().equals( - castOther.getUid()))); - } + return ((this.getUid() == castOther.getUid()) || (this.getUid() != null && castOther.getUid() != null && this + .getUid().equals(castOther.getUid()))); + } - public int hashCode() { - int result = 17; - result = 37 * result - + (getUid() == null ? 0 : this.getUid().hashCode()); - return result; - } + public int hashCode() { + int result = 17; + result = 37 * result + (getUid() == null ? 0 : this.getUid().hashCode()); + return result; + } - public static Dimdim newInstance(Dimdim fromContent, Long toContentId, - IToolContentHandler dimdimToolContentHandler) { - Dimdim toContent = new Dimdim(); - fromContent.toolContentHandler = dimdimToolContentHandler; - toContent = (Dimdim) fromContent.clone(); - toContent.setToolContentId(toContentId); - toContent.setCreateDate(new Date()); - return toContent; - } + public static Dimdim newInstance(Dimdim fromContent, Long toContentId, IToolContentHandler dimdimToolContentHandler) { + Dimdim toContent = new Dimdim(); + fromContent.toolContentHandler = dimdimToolContentHandler; + toContent = (Dimdim) fromContent.clone(); + toContent.setToolContentId(toContentId); + toContent.setCreateDate(new Date()); + return toContent; + } - protected Object clone() { + protected Object clone() { - Dimdim dimdim = null; - try { - dimdim = (Dimdim) super.clone(); - dimdim.setUid(null); + Dimdim dimdim = null; + try { + dimdim = (Dimdim) super.clone(); + dimdim.setUid(null); - if (dimdimAttachments != null) { - // create a copy of the attachments - Set set = new HashSet(); - for (DimdimAttachment att : dimdimAttachments) { - set.add((DimdimAttachment) att.clone()); - } - dimdim.dimdimAttachments = set; - } - // create an empty set for the dimdimSession - dimdim.dimdimSessions = new HashSet(); - - } catch (CloneNotSupportedException cnse) { - logger.error("Error cloning " + Dimdim.class); + if (dimdimAttachments != null) { + // create a copy of the attachments + Set set = new HashSet(); + for (DimdimAttachment att : dimdimAttachments) { + set.add((DimdimAttachment) att.clone()); } - return dimdim; - } + dimdim.dimdimAttachments = set; + } + // create an empty set for the dimdimSession + dimdim.dimdimSessions = new HashSet(); - public IToolContentHandler getToolContentHandler() { - return toolContentHandler; + } catch (CloneNotSupportedException cnse) { + logger.error("Error cloning " + Dimdim.class); } + return dimdim; + } - public void setToolContentHandler(IToolContentHandler toolContentHandler) { - this.toolContentHandler = toolContentHandler; - } + public IToolContentHandler getToolContentHandler() { + return toolContentHandler; + } + + public void setToolContentHandler(IToolContentHandler toolContentHandler) { + this.toolContentHandler = toolContentHandler; + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/model/DimdimAttachment.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/model/DimdimAttachment.java (.../DimdimAttachment.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/model/DimdimAttachment.java (.../DimdimAttachment.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -31,198 +31,187 @@ /** * - * The details of files attached to the tool. In most cases this will be the - * online/offline instruction files. + * The details of files attached to the tool. In most cases this will be the online/offline instruction files. * * @hibernate.class table="tl_laddim10_attachment" * */ public class DimdimAttachment implements java.io.Serializable, Cloneable { - private static final long serialVersionUID = 47452859888067500L; + private static final long serialVersionUID = 47452859888067500L; - private static final Logger logger = Logger - .getLogger(DimdimAttachment.class); + private static final Logger logger = Logger.getLogger(DimdimAttachment.class); - // Fields + // Fields - private Long uid; + private Long uid; - private Long fileVersionId; + private Long fileVersionId; - private String fileType; + private String fileType; - private String fileName; + private String fileName; - private Long fileUuid; + private Long fileUuid; - private Date createDate; + private Date createDate; - private Dimdim dimdim; + private Dimdim dimdim; - // Constructors + // Constructors - /** default constructor */ - public DimdimAttachment() { - } + /** default constructor */ + public DimdimAttachment() { + } - /** Constructor setting up all the properties except for dimdim one */ - public DimdimAttachment(Long fileVersionId, String fileType, - String fileName, Long fileUuid, Date createDate) { - this.fileVersionId = fileVersionId; - this.fileType = fileType; - this.fileName = fileName; - this.fileUuid = fileUuid; - this.createDate = createDate; - } + /** Constructor setting up all the properties except for dimdim one */ + public DimdimAttachment(Long fileVersionId, String fileType, String fileName, Long fileUuid, Date createDate) { + this.fileVersionId = fileVersionId; + this.fileType = fileType; + this.fileName = fileName; + this.fileUuid = fileUuid; + this.createDate = createDate; + } - // Property accessors - /** - * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" - * - */ + // Property accessors + /** + * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" + * + */ - public Long getUid() { - return this.uid; - } + public Long getUid() { + return this.uid; + } - public void setUid(Long uid) { - this.uid = uid; - } + public void setUid(Long uid) { + this.uid = uid; + } - /** - * @hibernate.property column="file_version_id" length="20" - * - */ + /** + * @hibernate.property column="file_version_id" length="20" + * + */ - public Long getFileVersionId() { - return this.fileVersionId; - } + public Long getFileVersionId() { + return this.fileVersionId; + } - public void setFileVersionId(Long fileVersionId) { - this.fileVersionId = fileVersionId; - } + public void setFileVersionId(Long fileVersionId) { + this.fileVersionId = fileVersionId; + } - /** - * @hibernate.property column="file_type" length="255" - * - */ + /** + * @hibernate.property column="file_type" length="255" + * + */ - public String getFileType() { - return this.fileType; - } + public String getFileType() { + return this.fileType; + } - public void setFileType(String fileType) { - this.fileType = fileType; - } + public void setFileType(String fileType) { + this.fileType = fileType; + } - /** - * @hibernate.property column="file_name" length="255" - * - */ + /** + * @hibernate.property column="file_name" length="255" + * + */ - public String getFileName() { - return this.fileName; - } + public String getFileName() { + return this.fileName; + } - public void setFileName(String fileName) { - this.fileName = fileName; - } + public void setFileName(String fileName) { + this.fileName = fileName; + } - /** - * @hibernate.property column="file_uuid" length="20" - * - */ + /** + * @hibernate.property column="file_uuid" length="20" + * + */ - public Long getFileUuid() { - return this.fileUuid; - } + public Long getFileUuid() { + return this.fileUuid; + } - public void setFileUuid(Long fileUuid) { - this.fileUuid = fileUuid; - } + public void setFileUuid(Long fileUuid) { + this.fileUuid = fileUuid; + } - /** - * @hibernate.property column="create_date" - * - */ + /** + * @hibernate.property column="create_date" + * + */ - public Date getCreateDate() { - return this.createDate; - } + public Date getCreateDate() { + return this.createDate; + } - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } - /** - * @hibernate.many-to-one not-null="true" - * foreign-key="fk_laddim10_dimdim_attachment_to_dimdim" - * @hibernate.column name="dimdim_uid" - * - */ + /** + * @hibernate.many-to-one not-null="true" foreign-key="fk_laddim10_dimdim_attachment_to_dimdim" + * @hibernate.column name="dimdim_uid" + * + */ - public Dimdim getDimdim() { - return this.dimdim; - } + public Dimdim getDimdim() { + return this.dimdim; + } - public void setDimdim(Dimdim dimdim) { - this.dimdim = dimdim; - } + public void setDimdim(Dimdim dimdim) { + this.dimdim = dimdim; + } - /** - * toString - * - * @return String - */ - public String toString() { - StringBuffer buffer = new StringBuffer(); + /** + * toString + * + * @return String + */ + public String toString() { + StringBuffer buffer = new StringBuffer(); - buffer.append(getClass().getName()).append("@").append( - Integer.toHexString(hashCode())).append(" ["); - buffer.append("fileVersionId").append("='").append(getFileVersionId()) - .append("' "); - buffer.append("fileName").append("='").append(getFileName()).append( - "' "); - buffer.append("fileUuid").append("='").append(getFileUuid()).append( - "' "); - buffer.append("]"); + buffer.append(getClass().getName()).append("@").append(Integer.toHexString(hashCode())).append(" ["); + buffer.append("fileVersionId").append("='").append(getFileVersionId()).append("' "); + buffer.append("fileName").append("='").append(getFileName()).append("' "); + buffer.append("fileUuid").append("='").append(getFileUuid()).append("' "); + buffer.append("]"); - return buffer.toString(); - } + return buffer.toString(); + } - public boolean equals(Object o) { - if (this == o) - return true; - if (!(o instanceof DimdimAttachment)) - return false; + public boolean equals(Object o) { + if (this == o) + return true; + if (!(o instanceof DimdimAttachment)) + return false; - final DimdimAttachment genericEntity = (DimdimAttachment) o; + final DimdimAttachment genericEntity = (DimdimAttachment) o; - return new EqualsBuilder().append(this.uid, genericEntity.uid).append( - this.fileVersionId, genericEntity.fileVersionId).append( - this.fileName, genericEntity.fileName).append(this.fileType, - genericEntity.fileType).append(this.createDate, - genericEntity.createDate).isEquals(); - } + return new EqualsBuilder().append(this.uid, genericEntity.uid).append(this.fileVersionId, + genericEntity.fileVersionId).append(this.fileName, genericEntity.fileName).append(this.fileType, + genericEntity.fileType).append(this.createDate, genericEntity.createDate).isEquals(); + } - public int hashCode() { - int result = 17; - result = 37 * result - + (getUid() == null ? 0 : this.getUid().hashCode()); - return result; - } + public int hashCode() { + int result = 17; + result = 37 * result + (getUid() == null ? 0 : this.getUid().hashCode()); + return result; + } - public Object clone() { - Object obj = null; - try { - obj = super.clone(); - ((DimdimAttachment) obj).setUid(null); - } catch (CloneNotSupportedException e) { - logger.error("Failed to clone " + DimdimAttachment.class); - } - - return obj; + public Object clone() { + Object obj = null; + try { + obj = super.clone(); + ((DimdimAttachment) obj).setUid(null); + } catch (CloneNotSupportedException e) { + logger.error("Failed to clone " + DimdimAttachment.class); } + + return obj; + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/model/DimdimConfig.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/model/DimdimConfig.java (.../DimdimConfig.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/model/DimdimConfig.java (.../DimdimConfig.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -29,44 +29,44 @@ */ public class DimdimConfig { - private Long uid; + private Long uid; - private String key; + private String key; - private String value; + private String value; - /** - * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" - */ - public Long getUid() { - return uid; - } + /** + * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" + */ + public Long getUid() { + return uid; + } - public void setUid(Long uid) { - this.uid = uid; - } + public void setUid(Long uid) { + this.uid = uid; + } - /** - * @hibernate.property column="config_key" - * @return - */ - public String getKey() { - return key; - } + /** + * @hibernate.property column="config_key" + * @return + */ + public String getKey() { + return key; + } - public void setKey(String key) { - this.key = key; - } + public void setKey(String key) { + this.key = key; + } - /** - * @hibernate.property column="config_value" - * @return - */ - public String getValue() { - return value; - } + /** + * @hibernate.property column="config_value" + * @return + */ + public String getValue() { + return value; + } - public void setValue(String value) { - this.value = value; - } + public void setValue(String value) { + this.value = value; + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/model/DimdimSession.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/model/DimdimSession.java (.../DimdimSession.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/model/DimdimSession.java (.../DimdimSession.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -39,254 +39,244 @@ public class DimdimSession implements java.io.Serializable { - private static final Logger logger = Logger.getLogger(DimdimSession.class); + private static final Logger logger = Logger.getLogger(DimdimSession.class); - private static final long serialVersionUID = 4407078136514639026L; + private static final long serialVersionUID = 4407078136514639026L; - // Fields + // Fields - private Long uid; + private Long uid; - private Date sessionEndDate; + private Date sessionEndDate; - private Date sessionStartDate; + private Date sessionStartDate; - private Integer status; + private Integer status; - private Long sessionId; + private Long sessionId; - private String sessionName; + private String sessionName; - private Dimdim dimdim; + private Dimdim dimdim; - private Set dimdimUsers; + private Set dimdimUsers; - private String topic; + private String topic; - private String meetingKey; + private String meetingKey; - private Integer maxAttendeeMikes; + private Integer maxAttendeeMikes; - // Constructors + // Constructors - /** default constructor */ - public DimdimSession() { - } + /** default constructor */ + public DimdimSession() { + } - /** full constructor */ - public DimdimSession(Date sessionEndDate, Date sessionStartDate, - Integer status, Long sessionId, String sessionName, Dimdim dimdim, - Set dimdimUsers) { - this.sessionEndDate = sessionEndDate; - this.sessionStartDate = sessionStartDate; - this.status = status; - this.sessionId = sessionId; - this.sessionName = sessionName; - this.dimdim = dimdim; - this.dimdimUsers = dimdimUsers; - } + /** full constructor */ + public DimdimSession(Date sessionEndDate, Date sessionStartDate, Integer status, Long sessionId, + String sessionName, Dimdim dimdim, Set dimdimUsers) { + this.sessionEndDate = sessionEndDate; + this.sessionStartDate = sessionStartDate; + this.status = status; + this.sessionId = sessionId; + this.sessionName = sessionName; + this.dimdim = dimdim; + this.dimdimUsers = dimdimUsers; + } - // Property accessors - /** - * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" - * - */ + // Property accessors + /** + * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" + * + */ - public Long getUid() { - return this.uid; - } + public Long getUid() { + return this.uid; + } - public void setUid(Long uid) { - this.uid = uid; - } + public void setUid(Long uid) { + this.uid = uid; + } - /** - * @hibernate.property column="session_end_date" - * - */ + /** + * @hibernate.property column="session_end_date" + * + */ - public Date getSessionEndDate() { - return this.sessionEndDate; - } + public Date getSessionEndDate() { + return this.sessionEndDate; + } - public void setSessionEndDate(Date sessionEndDate) { - this.sessionEndDate = sessionEndDate; - } + public void setSessionEndDate(Date sessionEndDate) { + this.sessionEndDate = sessionEndDate; + } - /** - * @hibernate.property column="session_start_date" - * - */ + /** + * @hibernate.property column="session_start_date" + * + */ - public Date getSessionStartDate() { - return this.sessionStartDate; - } + public Date getSessionStartDate() { + return this.sessionStartDate; + } - public void setSessionStartDate(Date sessionStartDate) { - this.sessionStartDate = sessionStartDate; - } + public void setSessionStartDate(Date sessionStartDate) { + this.sessionStartDate = sessionStartDate; + } - /** - * @hibernate.property column="status" length="11" - * - */ + /** + * @hibernate.property column="status" length="11" + * + */ - public Integer getStatus() { - return this.status; - } + public Integer getStatus() { + return this.status; + } - public void setStatus(Integer status) { - this.status = status; - } + public void setStatus(Integer status) { + this.status = status; + } - /** - * @hibernate.property column="session_id" length="20" - * - */ + /** + * @hibernate.property column="session_id" length="20" + * + */ - public Long getSessionId() { - return this.sessionId; - } + public Long getSessionId() { + return this.sessionId; + } - public void setSessionId(Long sessionId) { - this.sessionId = sessionId; - } + public void setSessionId(Long sessionId) { + this.sessionId = sessionId; + } - /** - * @hibernate.property column="session_name" length="250" - * - */ + /** + * @hibernate.property column="session_name" length="250" + * + */ - public String getSessionName() { - return this.sessionName; - } + public String getSessionName() { + return this.sessionName; + } - public void setSessionName(String sessionName) { - this.sessionName = sessionName; - } + public void setSessionName(String sessionName) { + this.sessionName = sessionName; + } - /** - * @hibernate.many-to-one not-null="true" - * foreign-key="fk_laddim10_dimdim_session_to_dimdim" - * @hibernate.column name="dimdim_uid" - * - */ + /** + * @hibernate.many-to-one not-null="true" foreign-key="fk_laddim10_dimdim_session_to_dimdim" + * @hibernate.column name="dimdim_uid" + * + */ - public Dimdim getDimdim() { - return this.dimdim; - } + public Dimdim getDimdim() { + return this.dimdim; + } - public void setDimdim(Dimdim dimdim) { - this.dimdim = dimdim; - } + public void setDimdim(Dimdim dimdim) { + this.dimdim = dimdim; + } - /** - * @hibernate.set lazy="true" inverse="true" cascade="none" - * @hibernate.collection-key column="dimdim_session_uid" - * @hibernate.collection-one-to-many - * class="org.lamsfoundation.lams.tool.dimdim.model.DimdimUser" - * - */ + /** + * @hibernate.set lazy="true" inverse="true" cascade="none" + * @hibernate.collection-key column="dimdim_session_uid" + * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.dimdim.model.DimdimUser" + * + */ - public Set getDimdimUsers() { - return this.dimdimUsers; - } + public Set getDimdimUsers() { + return this.dimdimUsers; + } - public void setDimdimUsers(Set dimdimUsers) { - this.dimdimUsers = dimdimUsers; - } + public void setDimdimUsers(Set dimdimUsers) { + this.dimdimUsers = dimdimUsers; + } - /** - * @hibernate.property column="topic" - * @return - */ - public String getTopic() { - return topic; - } + /** + * @hibernate.property column="topic" + * @return + */ + public String getTopic() { + return topic; + } - public void setTopic(String topic) { - this.topic = topic; - } + public void setTopic(String topic) { + this.topic = topic; + } - /** - * @hibernate.property column="meeting_key" - * @return - */ - public String getMeetingKey() { - return meetingKey; - } + /** + * @hibernate.property column="meeting_key" + * @return + */ + public String getMeetingKey() { + return meetingKey; + } - public void setMeetingKey(String meetingKey) { - this.meetingKey = meetingKey; - } + public void setMeetingKey(String meetingKey) { + this.meetingKey = meetingKey; + } - /** - * @hibernate.property column="max_attendee_mikes" - * @return - */ - public Integer getMaxAttendeeMikes() { - return maxAttendeeMikes; - } + /** + * @hibernate.property column="max_attendee_mikes" + * @return + */ + public Integer getMaxAttendeeMikes() { + return maxAttendeeMikes; + } - public void setMaxAttendeeMikes(Integer maxAttendeeMikes) { - this.maxAttendeeMikes = maxAttendeeMikes; - } + public void setMaxAttendeeMikes(Integer maxAttendeeMikes) { + this.maxAttendeeMikes = maxAttendeeMikes; + } - /** - * toString - * - * @return String - */ - public String toString() { - StringBuffer buffer = new StringBuffer(); + /** + * toString + * + * @return String + */ + public String toString() { + StringBuffer buffer = new StringBuffer(); - buffer.append(getClass().getName()).append("@").append( - Integer.toHexString(hashCode())).append(" ["); - buffer.append("sessionEndDate").append("='") - .append(getSessionEndDate()).append("' "); - buffer.append("sessionStartDate").append("='").append( - getSessionStartDate()).append("' "); - buffer.append("status").append("='").append(getStatus()).append("' "); - buffer.append("sessionID").append("='").append(getSessionId()).append( - "' "); - buffer.append("sessionName").append("='").append(getSessionName()) - .append("' "); - buffer.append("]"); + buffer.append(getClass().getName()).append("@").append(Integer.toHexString(hashCode())).append(" ["); + buffer.append("sessionEndDate").append("='").append(getSessionEndDate()).append("' "); + buffer.append("sessionStartDate").append("='").append(getSessionStartDate()).append("' "); + buffer.append("status").append("='").append(getStatus()).append("' "); + buffer.append("sessionID").append("='").append(getSessionId()).append("' "); + buffer.append("sessionName").append("='").append(getSessionName()).append("' "); + buffer.append("]"); - return buffer.toString(); - } + return buffer.toString(); + } - public boolean equals(Object other) { - if ((this == other)) - return true; - if ((other == null)) - return false; - if (!(other instanceof DimdimSession)) - return false; - DimdimSession castOther = (DimdimSession) other; + public boolean equals(Object other) { + if ((this == other)) + return true; + if ((other == null)) + return false; + if (!(other instanceof DimdimSession)) + return false; + DimdimSession castOther = (DimdimSession) other; - return ((this.getUid() == castOther.getUid()) || (this.getUid() != null - && castOther.getUid() != null && this.getUid().equals( - castOther.getUid()))); - } + return ((this.getUid() == castOther.getUid()) || (this.getUid() != null && castOther.getUid() != null && this + .getUid().equals(castOther.getUid()))); + } - public int hashCode() { - int result = 17; - result = 37 * result - + (getUid() == null ? 0 : this.getUid().hashCode()); - return result; - } + public int hashCode() { + int result = 17; + result = 37 * result + (getUid() == null ? 0 : this.getUid().hashCode()); + return result; + } - public Object clone() { + public Object clone() { - DimdimSession session = null; - try { - session = (DimdimSession) super.clone(); - session.dimdimUsers = new HashSet(); - } catch (CloneNotSupportedException e) { - logger.error("When clone " + DimdimSession.class + " failed"); - } - return session; + DimdimSession session = null; + try { + session = (DimdimSession) super.clone(); + session.dimdimUsers = new HashSet(); + } catch (CloneNotSupportedException e) { + logger.error("When clone " + DimdimSession.class + " failed"); } + return session; + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/model/DimdimUser.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/model/DimdimUser.java (.../DimdimUser.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/model/DimdimUser.java (.../DimdimUser.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -28,189 +28,183 @@ /** * - * Caches the user details. This allows the tool to be more efficient at - * displaying user names but means that when people's names change, they won't - * change in the "old" tool data. + * Caches the user details. This allows the tool to be more efficient at displaying user names but means that when + * people's names change, they won't change in the "old" tool data. * * @hibernate.class table="tl_laddim10_user" */ public class DimdimUser implements java.io.Serializable { - private static final long serialVersionUID = -3701664859818409197L; + private static final long serialVersionUID = -3701664859818409197L; - // Persistent Fields + // Persistent Fields - private Long uid; + private Long uid; - private Long userId; + private Long userId; - private String lastName; + private String lastName; - private String firstName; + private String firstName; - private String loginName; + private String loginName; - private DimdimSession dimdimSession; + private DimdimSession dimdimSession; - private boolean finishedActivity; + private boolean finishedActivity; - private Long entryUID; + private Long entryUID; - // Constructors + // Constructors - /** default constructor */ - public DimdimUser() { - } + /** default constructor */ + public DimdimUser() { + } - public DimdimUser(UserDTO user, DimdimSession dimdimSession) { - this.userId = new Long(user.getUserID().intValue()); - this.firstName = user.getFirstName(); - this.lastName = user.getLastName(); - this.loginName = user.getLogin(); - this.dimdimSession = dimdimSession; - this.finishedActivity = false; - } + public DimdimUser(UserDTO user, DimdimSession dimdimSession) { + this.userId = new Long(user.getUserID().intValue()); + this.firstName = user.getFirstName(); + this.lastName = user.getLastName(); + this.loginName = user.getLogin(); + this.dimdimSession = dimdimSession; + this.finishedActivity = false; + } - /** full constructor */ - public DimdimUser(Long userId, String lastName, String firstName, - DimdimSession dimdimSession) { - this.userId = userId; - this.lastName = lastName; - this.firstName = firstName; - this.dimdimSession = dimdimSession; - } + /** full constructor */ + public DimdimUser(Long userId, String lastName, String firstName, DimdimSession dimdimSession) { + this.userId = userId; + this.lastName = lastName; + this.firstName = firstName; + this.dimdimSession = dimdimSession; + } - // Property accessors - /** - * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" - */ - public Long getUid() { - return this.uid; - } + // Property accessors + /** + * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" + */ + public Long getUid() { + return this.uid; + } - public void setUid(Long uid) { - this.uid = uid; - } + public void setUid(Long uid) { + this.uid = uid; + } - /** - * @hibernate.property column="user_id" length="20" - * - */ - public Long getUserId() { - return this.userId; - } + /** + * @hibernate.property column="user_id" length="20" + * + */ + public Long getUserId() { + return this.userId; + } - public void setUserId(Long userId) { - this.userId = userId; - } + public void setUserId(Long userId) { + this.userId = userId; + } - /** - * @hibernate.property column="last_name" length="255" - * - */ - public String getLastName() { - return this.lastName; - } + /** + * @hibernate.property column="last_name" length="255" + * + */ + public String getLastName() { + return this.lastName; + } - public void setLastName(String lastName) { - this.lastName = lastName; - } + public void setLastName(String lastName) { + this.lastName = lastName; + } - /** - * @hibernate.property column="login_name" length="255" - * - */ - public String getLoginName() { - return loginName; - } + /** + * @hibernate.property column="login_name" length="255" + * + */ + public String getLoginName() { + return loginName; + } - public void setLoginName(String loginName) { - this.loginName = loginName; - } + public void setLoginName(String loginName) { + this.loginName = loginName; + } - /** - * @hibernate.property column="first_name" length="255" - * - */ - public String getFirstName() { - return this.firstName; - } + /** + * @hibernate.property column="first_name" length="255" + * + */ + public String getFirstName() { + return this.firstName; + } - public void setFirstName(String firstName) { - this.firstName = firstName; - } + public void setFirstName(String firstName) { + this.firstName = firstName; + } - /** - * @hibernate.property column="finishedActivity" - */ - public boolean isFinishedActivity() { - return finishedActivity; - } + /** + * @hibernate.property column="finishedActivity" + */ + public boolean isFinishedActivity() { + return finishedActivity; + } - public void setFinishedActivity(boolean finishedActivity) { - this.finishedActivity = finishedActivity; - } + public void setFinishedActivity(boolean finishedActivity) { + this.finishedActivity = finishedActivity; + } - /** - * @hibernate.many-to-one not-null="true" - * foreign-key="fk_laddim10_dimdim_user_to_dimdim_session" - * @hibernate.column name="dimdim_session_uid" - * - */ - public DimdimSession getDimdimSession() { - return this.dimdimSession; - } + /** + * @hibernate.many-to-one not-null="true" foreign-key="fk_laddim10_dimdim_user_to_dimdim_session" + * @hibernate.column name="dimdim_session_uid" + * + */ + public DimdimSession getDimdimSession() { + return this.dimdimSession; + } - public void setDimdimSession(DimdimSession dimdimSession) { - this.dimdimSession = dimdimSession; - } + public void setDimdimSession(DimdimSession dimdimSession) { + this.dimdimSession = dimdimSession; + } - /** - * @hibernate.property column="entry_uid" - */ - public Long getEntryUID() { - return entryUID; - } + /** + * @hibernate.property column="entry_uid" + */ + public Long getEntryUID() { + return entryUID; + } - public void setEntryUID(Long entryUID) { - this.entryUID = entryUID; - } + public void setEntryUID(Long entryUID) { + this.entryUID = entryUID; + } - /** - * toString - * - * @return String - */ - public String toString() { - StringBuffer buffer = new StringBuffer(); + /** + * toString + * + * @return String + */ + public String toString() { + StringBuffer buffer = new StringBuffer(); - buffer.append(getClass().getName()).append("@").append( - Integer.toHexString(hashCode())).append(" ["); - buffer.append("userId").append("='").append(getUserId()).append("' "); - buffer.append("]"); + buffer.append(getClass().getName()).append("@").append(Integer.toHexString(hashCode())).append(" ["); + buffer.append("userId").append("='").append(getUserId()).append("' "); + buffer.append("]"); - return buffer.toString(); - } + return buffer.toString(); + } - public boolean equals(Object other) { - if ((this == other)) - return true; - if ((other == null)) - return false; - if (!(other instanceof DimdimUser)) - return false; - DimdimUser castOther = (DimdimUser) other; + public boolean equals(Object other) { + if ((this == other)) + return true; + if ((other == null)) + return false; + if (!(other instanceof DimdimUser)) + return false; + DimdimUser castOther = (DimdimUser) other; - return ((this.getUid() == castOther.getUid()) || (this.getUid() != null - && castOther.getUid() != null && this.getUid().equals( - castOther.getUid()))); - } + return ((this.getUid() == castOther.getUid()) || (this.getUid() != null && castOther.getUid() != null && this + .getUid().equals(castOther.getUid()))); + } - public int hashCode() { - int result = 17; - result = 37 * result - + (getUid() == null ? 0 : this.getUid().hashCode()); - return result; - } + public int hashCode() { + int result = 17; + result = 37 * result + (getUid() == null ? 0 : this.getUid().hashCode()); + return result; + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/service/DimdimService.java =================================================================== diff -u -r65ab476801260e17f27b0f625ec4daa6a5a8d7fd -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/service/DimdimService.java (.../DimdimService.java) (revision 65ab476801260e17f27b0f625ec4daa6a5a8d7fd) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/service/DimdimService.java (.../DimdimService.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -91,699 +91,623 @@ /** * An implementation of the IDimdimService interface. * - * As a requirement, all LAMS tool's service bean must implement - * ToolContentManager and ToolSessionManager. + * As a requirement, all LAMS tool's service bean must implement ToolContentManager and ToolSessionManager. */ -public class DimdimService implements ToolSessionManager, ToolContentManager, - IDimdimService, ToolContentImport102Manager { +public class DimdimService implements ToolSessionManager, ToolContentManager, IDimdimService, + ToolContentImport102Manager { - private static final Logger logger = Logger.getLogger(DimdimService.class); + private static final Logger logger = Logger.getLogger(DimdimService.class); - private IDimdimDAO dimdimDAO = null; + private IDimdimDAO dimdimDAO = null; - private IDimdimSessionDAO dimdimSessionDAO = null; + private IDimdimSessionDAO dimdimSessionDAO = null; - private IDimdimUserDAO dimdimUserDAO = null; + private IDimdimUserDAO dimdimUserDAO = null; - private IDimdimAttachmentDAO dimdimAttachmentDAO = null; + private IDimdimAttachmentDAO dimdimAttachmentDAO = null; - private IDimdimConfigDAO dimdimConfigDAO = null; + private IDimdimConfigDAO dimdimConfigDAO = null; - private ILearnerService learnerService; + private ILearnerService learnerService; - private ILamsToolService toolService; + private ILamsToolService toolService; - private IToolContentHandler dimdimToolContentHandler = null; + private IToolContentHandler dimdimToolContentHandler = null; - private IRepositoryService repositoryService = null; + private IRepositoryService repositoryService = null; - private IAuditService auditService = null; + private IAuditService auditService = null; - private IExportToolContentService exportContentService; + private IExportToolContentService exportContentService; - private ICoreNotebookService coreNotebookService; + private ICoreNotebookService coreNotebookService; - public DimdimService() { - super(); - // TODO Auto-generated constructor stub - } + public DimdimService() { + super(); + // TODO Auto-generated constructor stub + } - /* Methods from ToolSessionManager */ - public void createToolSession(Long toolSessionId, String toolSessionName, - Long toolContentId) throws ToolException { - if (logger.isDebugEnabled()) { - logger.debug("entering method createToolSession:" - + " toolSessionId = " + toolSessionId - + " toolSessionName = " + toolSessionName - + " toolContentId = " + toolContentId); - } - - DimdimSession session = new DimdimSession(); - session.setSessionId(toolSessionId); - session.setSessionName(toolSessionName); - // learner starts - // TODO need to also set other fields. - Dimdim dimdim = getDimdimByContentId(toolContentId); - session.setDimdim(dimdim); - dimdimSessionDAO.insertOrUpdate(session); + /* Methods from ToolSessionManager */ + public void createToolSession(Long toolSessionId, String toolSessionName, Long toolContentId) throws ToolException { + if (logger.isDebugEnabled()) { + logger.debug("entering method createToolSession:" + " toolSessionId = " + toolSessionId + + " toolSessionName = " + toolSessionName + " toolContentId = " + toolContentId); } - public String leaveToolSession(Long toolSessionId, Long learnerId) - throws DataMissingException, ToolException { - return learnerService.completeToolSession(toolSessionId, learnerId); - } + DimdimSession session = new DimdimSession(); + session.setSessionId(toolSessionId); + session.setSessionName(toolSessionName); + // learner starts + // TODO need to also set other fields. + Dimdim dimdim = getDimdimByContentId(toolContentId); + session.setDimdim(dimdim); + dimdimSessionDAO.insertOrUpdate(session); + } - public ToolSessionExportOutputData exportToolSession(Long toolSessionId) - throws DataMissingException, ToolException { - // TODO Auto-generated method stub - return null; - } + public String leaveToolSession(Long toolSessionId, Long learnerId) throws DataMissingException, ToolException { + return learnerService.completeToolSession(toolSessionId, learnerId); + } - @SuppressWarnings("unchecked") - public ToolSessionExportOutputData exportToolSession(List toolSessionIds) - throws DataMissingException, ToolException { - // TODO Auto-generated method stub - return null; - } + public ToolSessionExportOutputData exportToolSession(Long toolSessionId) throws DataMissingException, ToolException { + // TODO Auto-generated method stub + return null; + } - public void removeToolSession(Long toolSessionId) - throws DataMissingException, ToolException { - dimdimSessionDAO.deleteByProperty(DimdimSession.class, "sessionId", - toolSessionId); - // TODO check if cascade worked - } + @SuppressWarnings("unchecked") + public ToolSessionExportOutputData exportToolSession(List toolSessionIds) throws DataMissingException, + ToolException { + // TODO Auto-generated method stub + return null; + } - /** - * Get the tool output for the given tool output names. - * - * @see - * org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.util - * .List, java.lang.Long, java.lang.Long) - */ - public SortedMap getToolOutput(List names, - Long toolSessionId, Long learnerId) { - return new TreeMap(); - } + public void removeToolSession(Long toolSessionId) throws DataMissingException, ToolException { + dimdimSessionDAO.deleteByProperty(DimdimSession.class, "sessionId", toolSessionId); + // TODO check if cascade worked + } - /** - * Get the tool output for the given tool output name. - * - * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.lang.String, - * java.lang.Long, java.lang.Long) - */ - public ToolOutput getToolOutput(String name, Long toolSessionId, - Long learnerId) { - return null; - } + /** + * Get the tool output for the given tool output names. + * + * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.util .List, java.lang.Long, + * java.lang.Long) + */ + public SortedMap getToolOutput(List names, Long toolSessionId, Long learnerId) { + return new TreeMap(); + } - /* Methods from ToolContentManager */ + /** + * Get the tool output for the given tool output name. + * + * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.lang.String, java.lang.Long, + * java.lang.Long) + */ + public ToolOutput getToolOutput(String name, Long toolSessionId, Long learnerId) { + return null; + } - public void copyToolContent(Long fromContentId, Long toContentId) - throws ToolException { + /* Methods from ToolContentManager */ - if (logger.isDebugEnabled()) { - logger.debug("entering method copyToolContent:" + " fromContentId=" - + fromContentId + " toContentId=" + toContentId); - } + public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException { - if (toContentId == null) { - String error = "Failed to copy tool content: toContentID is null"; - throw new ToolException(error); - } + if (logger.isDebugEnabled()) { + logger.debug("entering method copyToolContent:" + " fromContentId=" + fromContentId + " toContentId=" + + toContentId); + } - Dimdim fromContent = null; - if (fromContentId != null) { - fromContent = getDimdimByContentId(fromContentId); - } - if (fromContent == null) { - // create the fromContent using the default tool content - fromContent = getDefaultContent(); - } - Dimdim toContent = Dimdim.newInstance(fromContent, toContentId, - dimdimToolContentHandler); - saveOrUpdateDimdim(toContent); + if (toContentId == null) { + String error = "Failed to copy tool content: toContentID is null"; + throw new ToolException(error); } - public void setAsDefineLater(Long toolContentId, boolean value) - throws DataMissingException, ToolException { - Dimdim dimdim = getDimdimByContentId(toolContentId); - if (dimdim == null) { - throw new ToolException("Could not find tool with toolContentID: " - + toolContentId); - } - dimdim.setDefineLater(value); - saveOrUpdateDimdim(dimdim); + Dimdim fromContent = null; + if (fromContentId != null) { + fromContent = getDimdimByContentId(fromContentId); } + if (fromContent == null) { + // create the fromContent using the default tool content + fromContent = getDefaultContent(); + } + Dimdim toContent = Dimdim.newInstance(fromContent, toContentId, dimdimToolContentHandler); + saveOrUpdateDimdim(toContent); + } - public void setAsRunOffline(Long toolContentId, boolean value) - throws DataMissingException, ToolException { - Dimdim dimdim = getDimdimByContentId(toolContentId); - if (dimdim == null) { - throw new ToolException("Could not find tool with toolContentID: " - + toolContentId); - } - dimdim.setRunOffline(value); - saveOrUpdateDimdim(dimdim); + public void setAsDefineLater(Long toolContentId, boolean value) throws DataMissingException, ToolException { + Dimdim dimdim = getDimdimByContentId(toolContentId); + if (dimdim == null) { + throw new ToolException("Could not find tool with toolContentID: " + toolContentId); } + dimdim.setDefineLater(value); + saveOrUpdateDimdim(dimdim); + } - public void removeToolContent(Long toolContentId, boolean removeSessionData) - throws SessionDataExistsException, ToolException { - // TODO Auto-generated method stub + public void setAsRunOffline(Long toolContentId, boolean value) throws DataMissingException, ToolException { + Dimdim dimdim = getDimdimByContentId(toolContentId); + if (dimdim == null) { + throw new ToolException("Could not find tool with toolContentID: " + toolContentId); } + dimdim.setRunOffline(value); + saveOrUpdateDimdim(dimdim); + } - /** - * Export the XML fragment for the tool's content, along with any files - * needed for the content. - * - * @throws DataMissingException - * if no tool content matches the toolSessionId - * @throws ToolException - * if any other error occurs - */ + public void removeToolContent(Long toolContentId, boolean removeSessionData) throws SessionDataExistsException, + ToolException { + // TODO Auto-generated method stub + } - public void exportToolContent(Long toolContentId, String rootPath) - throws DataMissingException, ToolException { - Dimdim dimdim = getDimdimByContentId(toolContentId); - if (dimdim == null) { - dimdim = getDefaultContent(); - } - if (dimdim == null) - throw new DataMissingException( - "Unable to find default content for the dimdim tool"); + /** + * Export the XML fragment for the tool's content, along with any files needed for the content. + * + * @throws DataMissingException + * if no tool content matches the toolSessionId + * @throws ToolException + * if any other error occurs + */ - // set ResourceToolContentHandler as null to avoid copy file node in - // repository again. - dimdim = Dimdim.newInstance(dimdim, toolContentId, null); - dimdim.setToolContentHandler(null); - dimdim.setDimdimSessions(null); - Set atts = dimdim.getDimdimAttachments(); - for (DimdimAttachment att : atts) { - att.setDimdim(null); - } - try { - exportContentService.registerFileClassForExport( - DimdimAttachment.class.getName(), "fileUuid", - "fileVersionId"); - exportContentService.exportToolContent(toolContentId, dimdim, - dimdimToolContentHandler, rootPath); - } catch (ExportToolContentException e) { - throw new ToolException(e); - } + public void exportToolContent(Long toolContentId, String rootPath) throws DataMissingException, ToolException { + Dimdim dimdim = getDimdimByContentId(toolContentId); + if (dimdim == null) { + dimdim = getDefaultContent(); } + if (dimdim == null) + throw new DataMissingException("Unable to find default content for the dimdim tool"); - /** - * Import the XML fragment for the tool's content, along with any files - * needed for the content. - * - * @throws ToolException - * if any other error occurs - */ - public void importToolContent(Long toolContentId, Integer newUserUid, - String toolContentPath, String fromVersion, String toVersion) - throws ToolException { - try { - exportContentService.registerFileClassForImport( - DimdimAttachment.class.getName(), "fileUuid", - "fileVersionId", "fileName", "fileType", null, null); + // set ResourceToolContentHandler as null to avoid copy file node in + // repository again. + dimdim = Dimdim.newInstance(dimdim, toolContentId, null); + dimdim.setToolContentHandler(null); + dimdim.setDimdimSessions(null); + Set atts = dimdim.getDimdimAttachments(); + for (DimdimAttachment att : atts) { + att.setDimdim(null); + } + try { + exportContentService.registerFileClassForExport(DimdimAttachment.class.getName(), "fileUuid", + "fileVersionId"); + exportContentService.exportToolContent(toolContentId, dimdim, dimdimToolContentHandler, rootPath); + } catch (ExportToolContentException e) { + throw new ToolException(e); + } + } - Object toolPOJO = exportContentService.importToolContent( - toolContentPath, dimdimToolContentHandler, fromVersion, - toVersion); - if (!(toolPOJO instanceof Dimdim)) - throw new ImportToolContentException( - "Import Dimdim tool content failed. Deserialized object is " - + toolPOJO); - Dimdim dimdim = (Dimdim) toolPOJO; + /** + * Import the XML fragment for the tool's content, along with any files needed for the content. + * + * @throws ToolException + * if any other error occurs + */ + public void importToolContent(Long toolContentId, Integer newUserUid, String toolContentPath, String fromVersion, + String toVersion) throws ToolException { + try { + exportContentService.registerFileClassForImport(DimdimAttachment.class.getName(), "fileUuid", + "fileVersionId", "fileName", "fileType", null, null); - // reset it to new toolContentId - dimdim.setToolContentId(toolContentId); - dimdim.setCreateBy(new Long(newUserUid.longValue())); + Object toolPOJO = exportContentService.importToolContent(toolContentPath, dimdimToolContentHandler, + fromVersion, toVersion); + if (!(toolPOJO instanceof Dimdim)) + throw new ImportToolContentException("Import Dimdim tool content failed. Deserialized object is " + + toolPOJO); + Dimdim dimdim = (Dimdim) toolPOJO; - saveOrUpdateDimdim(dimdim); - } catch (ImportToolContentException e) { - throw new ToolException(e); - } - } + // reset it to new toolContentId + dimdim.setToolContentId(toolContentId); + dimdim.setCreateBy(new Long(newUserUid.longValue())); - /** - * Get the definitions for possible output for an activity, based on the - * toolContentId. These may be definitions that are always available for the - * tool (e.g. number of marks for Multiple Choice) or a custom definition - * created for a particular activity such as the answer to the third - * question contains the word Koala and hence the need for the toolContentId - * - * @return SortedMap of ToolOutputDefinitions with the key being the name of - * each definition - */ - public SortedMap getToolOutputDefinitions( - Long toolContentId) throws ToolException { - return new TreeMap(); + saveOrUpdateDimdim(dimdim); + } catch (ImportToolContentException e) { + throw new ToolException(e); } + } - /* IDimdimService Methods */ + /** + * Get the definitions for possible output for an activity, based on the toolContentId. These may be definitions + * that are always available for the tool (e.g. number of marks for Multiple Choice) or a custom definition created + * for a particular activity such as the answer to the third question contains the word Koala and hence the need for + * the toolContentId + * + * @return SortedMap of ToolOutputDefinitions with the key being the name of each definition + */ + public SortedMap getToolOutputDefinitions(Long toolContentId) throws ToolException { + return new TreeMap(); + } - public Long createNotebookEntry(Long id, Integer idType, String signature, - Integer userID, String entry) { - return coreNotebookService.createNotebookEntry(id, idType, signature, - userID, "", entry); - } + /* IDimdimService Methods */ - public NotebookEntry getEntry(Long uid) { - return coreNotebookService.getEntry(uid); - } + public Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String entry) { + return coreNotebookService.createNotebookEntry(id, idType, signature, userID, "", entry); + } - public void updateEntry(Long uid, String entry) { - coreNotebookService.updateEntry(uid, "", entry); - } + public NotebookEntry getEntry(Long uid) { + return coreNotebookService.getEntry(uid); + } - public Long getDefaultContentIdBySignature(String toolSignature) { - Long toolContentId = null; - toolContentId = new Long(toolService - .getToolDefaultContentIdBySignature(toolSignature)); - if (toolContentId == null) { - String error = "Could not retrieve default content id for this tool"; - logger.error(error); - throw new DimdimException(error); - } - return toolContentId; + public void updateEntry(Long uid, String entry) { + coreNotebookService.updateEntry(uid, "", entry); + } + + public Long getDefaultContentIdBySignature(String toolSignature) { + Long toolContentId = null; + toolContentId = new Long(toolService.getToolDefaultContentIdBySignature(toolSignature)); + if (toolContentId == null) { + String error = "Could not retrieve default content id for this tool"; + logger.error(error); + throw new DimdimException(error); } + return toolContentId; + } - public Dimdim getDefaultContent() { - Long defaultContentID = getDefaultContentIdBySignature(Constants.TOOL_SIGNATURE); - Dimdim defaultContent = getDimdimByContentId(defaultContentID); - if (defaultContent == null) { - String error = "Could not retrieve default content record for this tool"; - logger.error(error); - throw new DimdimException(error); - } - return defaultContent; + public Dimdim getDefaultContent() { + Long defaultContentID = getDefaultContentIdBySignature(Constants.TOOL_SIGNATURE); + Dimdim defaultContent = getDimdimByContentId(defaultContentID); + if (defaultContent == null) { + String error = "Could not retrieve default content record for this tool"; + logger.error(error); + throw new DimdimException(error); } + return defaultContent; + } - public Dimdim copyDefaultContent(Long newContentID) { + public Dimdim copyDefaultContent(Long newContentID) { - if (newContentID == null) { - String error = "Cannot copy the Dimdim tools default content: + " - + "newContentID is null"; - logger.error(error); - throw new DimdimException(error); - } - - Dimdim defaultContent = getDefaultContent(); - // create new dimdim using the newContentID - Dimdim newContent = new Dimdim(); - newContent = Dimdim.newInstance(defaultContent, newContentID, - dimdimToolContentHandler); - saveOrUpdateDimdim(newContent); - return newContent; + if (newContentID == null) { + String error = "Cannot copy the Dimdim tools default content: + " + "newContentID is null"; + logger.error(error); + throw new DimdimException(error); } - @SuppressWarnings("unchecked") - public Dimdim getDimdimByContentId(Long toolContentID) { - List list = dimdimDAO.findByProperty(Dimdim.class, - "toolContentId", toolContentID); - if (list.isEmpty()) { - return null; - } else { - return list.get(0); - } - } + Dimdim defaultContent = getDefaultContent(); + // create new dimdim using the newContentID + Dimdim newContent = new Dimdim(); + newContent = Dimdim.newInstance(defaultContent, newContentID, dimdimToolContentHandler); + saveOrUpdateDimdim(newContent); + return newContent; + } - @SuppressWarnings("unchecked") - public DimdimSession getSessionBySessionId(Long toolSessionId) { - List list = dimdimSessionDAO.findByProperty( - DimdimSession.class, "sessionId", toolSessionId); - if (list.isEmpty()) { - return null; - } else { - return list.get(0); - } + @SuppressWarnings("unchecked") + public Dimdim getDimdimByContentId(Long toolContentID) { + List list = dimdimDAO.findByProperty(Dimdim.class, "toolContentId", toolContentID); + if (list.isEmpty()) { + return null; + } else { + return list.get(0); } + } - public DimdimUser getUserByUserIdAndSessionId(Long userId, - Long toolSessionId) { - // TODO fix this - return dimdimUserDAO.getByUserIdAndSessionId(userId, toolSessionId); + @SuppressWarnings("unchecked") + public DimdimSession getSessionBySessionId(Long toolSessionId) { + List list = dimdimSessionDAO.findByProperty(DimdimSession.class, "sessionId", toolSessionId); + if (list.isEmpty()) { + return null; + } else { + return list.get(0); } + } - @SuppressWarnings("unchecked") - public DimdimUser getUserByUID(Long uid) { - List list = dimdimUserDAO.findByProperty(DimdimUser.class, - "uid", uid); - if (list.isEmpty()) { - return null; - } else { - return list.get(0); - } + public DimdimUser getUserByUserIdAndSessionId(Long userId, Long toolSessionId) { + // TODO fix this + return dimdimUserDAO.getByUserIdAndSessionId(userId, toolSessionId); + } + @SuppressWarnings("unchecked") + public DimdimUser getUserByUID(Long uid) { + List list = dimdimUserDAO.findByProperty(DimdimUser.class, "uid", uid); + if (list.isEmpty()) { + return null; + } else { + return list.get(0); } - public DimdimAttachment uploadFileToContent(Long toolContentId, - FormFile file, String type) { - if (file == null || StringUtils.isEmpty(file.getFileName())) - throw new DimdimException("Could not find upload file: " + file); + } - NodeKey nodeKey = processFile(file, type); + public DimdimAttachment uploadFileToContent(Long toolContentId, FormFile file, String type) { + if (file == null || StringUtils.isEmpty(file.getFileName())) + throw new DimdimException("Could not find upload file: " + file); - DimdimAttachment attachment = new DimdimAttachment( - nodeKey.getVersion(), type, file.getFileName(), nodeKey - .getUuid(), new Date()); - return attachment; - } + NodeKey nodeKey = processFile(file, type); - public void deleteFromRepository(Long uuid, Long versionID) - throws DimdimException { - ITicket ticket = getRepositoryLoginTicket(); - try { - repositoryService.deleteVersion(ticket, uuid, versionID); - } catch (Exception e) { - throw new DimdimException( - "Exception occured while deleting files from" - + " the repository " + e.getMessage()); - } + DimdimAttachment attachment = new DimdimAttachment(nodeKey.getVersion(), type, file.getFileName(), nodeKey + .getUuid(), new Date()); + return attachment; + } + + public void deleteFromRepository(Long uuid, Long versionID) throws DimdimException { + ITicket ticket = getRepositoryLoginTicket(); + try { + repositoryService.deleteVersion(ticket, uuid, versionID); + } catch (Exception e) { + throw new DimdimException("Exception occured while deleting files from" + " the repository " + + e.getMessage()); } + } - /** - * - * @param url - * @return - */ - private String sendDimdimRequest(URL url) throws Exception { - URLConnection connection = url.openConnection(); + /** + * + * @param url + * @return + */ + private String sendDimdimRequest(URL url) throws Exception { + URLConnection connection = url.openConnection(); - BufferedReader in = new BufferedReader(new InputStreamReader(connection - .getInputStream())); - String dimdimResponse = ""; - String line = ""; + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + String dimdimResponse = ""; + String line = ""; - while ((line = in.readLine()) != null) - dimdimResponse += line; - in.close(); + while ((line = in.readLine()) != null) + dimdimResponse += line; + in.close(); - logger.debug(dimdimResponse + "1"); + logger.debug(dimdimResponse + "1"); - // Extract the connect url from the json string. - Pattern pattern = Pattern.compile("url:\"(.*?)\""); - Matcher matcher = pattern.matcher(dimdimResponse); + // Extract the connect url from the json string. + Pattern pattern = Pattern.compile("url:\"(.*?)\""); + Matcher matcher = pattern.matcher(dimdimResponse); - matcher.find(); - String connectURL = matcher.group(1); + matcher.find(); + String connectURL = matcher.group(1); - return connectURL; + return connectURL; + } + + public String getDimdimJoinConferenceURL(UserDTO userDTO, String meetingKey) throws Exception { + + // Get Dimdim server url + DimdimConfig serverURL = getConfigEntry(Constants.CONFIG_SERVER_URL); + if (serverURL == null) { + throw new DimdimException("Dimdim server url not found"); } - public String getDimdimJoinConferenceURL(UserDTO userDTO, String meetingKey) - throws Exception { + URL url = new URL(serverURL.getValue() + "/dimdim/JoinConferenceCheck.action?" + "email=" + + URLEncoder.encode(userDTO.getEmail(), "UTF8") + "&displayName=" + + URLEncoder.encode(userDTO.getFirstName() + " " + userDTO.getLastName(), "UTF8") + "&confKey=" + + URLEncoder.encode(meetingKey, "UTF8")); - // Get Dimdim server url - DimdimConfig serverURL = getConfigEntry(Constants.CONFIG_SERVER_URL); - if (serverURL == null) { - throw new DimdimException("Dimdim server url not found"); - } + String connectURL = sendDimdimRequest(url); - URL url = new URL(serverURL.getValue() - + "/dimdim/JoinConferenceCheck.action?" - + "email=" - + URLEncoder.encode(userDTO.getEmail(), "UTF8") - + "&displayName=" - + URLEncoder.encode(userDTO.getFirstName() + " " - + userDTO.getLastName(), "UTF8") + "&confKey=" - + URLEncoder.encode(meetingKey, "UTF8")); + return serverURL.getValue() + connectURL; + } - String connectURL = sendDimdimRequest(url); + public String getDimdimStartConferenceURL(UserDTO userDTO, String meetingKey, String topic) throws Exception { - return serverURL.getValue() + connectURL; + // Get Dimdim server url + DimdimConfig serverURL = getConfigEntry(Constants.CONFIG_SERVER_URL); + if (serverURL == null) { + throw new DimdimException("Dimdim server url not found"); } - public String getDimdimStartConferenceURL(UserDTO userDTO, - String meetingKey, String topic) throws Exception { + // get dimdim url - // Get Dimdim server url - DimdimConfig serverURL = getConfigEntry(Constants.CONFIG_SERVER_URL); - if (serverURL == null) { - throw new DimdimException("Dimdim server url not found"); - } + URL url = new URL(serverURL.getValue() + "/dimdim/StartNewConferenceCheck.action?" + "email=" + + URLEncoder.encode(userDTO.getEmail(), "UTF8") + "&displayName=" + + URLEncoder.encode(userDTO.getFirstName() + " " + userDTO.getLastName(), "UTF8") + "&confName=" + + URLEncoder.encode(topic, "UTF8") + "&confKey=" + URLEncoder.encode(meetingKey, "UTF8") + + "&lobby=false" + "&networkProfile=3" + "&meetingHours=99" + "&maxAttendeeMikes=0" + "&returnUrl=asdf" + + "&presenterAV=av" + "&privateChatEnabled=true" + "&publicChatEnabled=true" + + "&screenShareEnabled=true" + "&whiteboardEnabled=true"); - // get dimdim url + String connectURL = sendDimdimRequest(url); - URL url = new URL(serverURL.getValue() - + "/dimdim/StartNewConferenceCheck.action?" - + "email=" - + URLEncoder.encode(userDTO.getEmail(), "UTF8") - + "&displayName=" - + URLEncoder.encode(userDTO.getFirstName() + " " - + userDTO.getLastName(), "UTF8") + "&confName=" - + URLEncoder.encode(topic, "UTF8") + "&confKey=" - + URLEncoder.encode(meetingKey, "UTF8") + "&lobby=false" - + "&networkProfile=3" + "&meetingHours=99" - + "&maxAttendeeMikes=0" + "&returnUrl=asdf" + "&presenterAV=av" - + "&privateChatEnabled=true" + "&publicChatEnabled=true" - + "&screenShareEnabled=true" + "&whiteboardEnabled=true"); + return serverURL.getValue() + connectURL; - String connectURL = sendDimdimRequest(url); + } - return serverURL.getValue() + connectURL; + public void saveOrUpdateDimdim(Dimdim dimdim) { + dimdimDAO.insertOrUpdate(dimdim); + } - } + public void saveOrUpdateDimdimSession(DimdimSession dimdimSession) { + dimdimSessionDAO.insertOrUpdate(dimdimSession); + } - public void saveOrUpdateDimdim(Dimdim dimdim) { - dimdimDAO.insertOrUpdate(dimdim); - } + public void saveOrUpdateDimdimUser(DimdimUser dimdimUser) { + dimdimUserDAO.insertOrUpdate(dimdimUser); + } - public void saveOrUpdateDimdimSession(DimdimSession dimdimSession) { - dimdimSessionDAO.insertOrUpdate(dimdimSession); - } + public DimdimUser createDimdimUser(UserDTO user, DimdimSession dimdimSession) { + DimdimUser dimdimUser = new DimdimUser(user, dimdimSession); + saveOrUpdateDimdimUser(dimdimUser); + return dimdimUser; + } - public void saveOrUpdateDimdimUser(DimdimUser dimdimUser) { - dimdimUserDAO.insertOrUpdate(dimdimUser); + @SuppressWarnings("unchecked") + public DimdimConfig getConfigEntry(String key) { + dimdimConfigDAO.findByProperty(DimdimConfig.class, "key", key); + List list = (List) dimdimConfigDAO.findByProperty(DimdimConfig.class, "key", key); + if (list.isEmpty()) { + return null; + } else { + return list.get(0); } + } - public DimdimUser createDimdimUser(UserDTO user, DimdimSession dimdimSession) { - DimdimUser dimdimUser = new DimdimUser(user, dimdimSession); - saveOrUpdateDimdimUser(dimdimUser); - return dimdimUser; - } + public void saveOrUpdateConfigEntry(DimdimConfig dimdimConfig) { + dimdimConfigDAO.insertOrUpdate(dimdimConfig); + } - @SuppressWarnings("unchecked") - public DimdimConfig getConfigEntry(String key) { - dimdimConfigDAO.findByProperty(DimdimConfig.class, "key", key); - List list = (List) dimdimConfigDAO - .findByProperty(DimdimConfig.class, "key", key); - if (list.isEmpty()) { - return null; - } else { - return list.get(0); - } - } + public IAuditService getAuditService() { + return auditService; + } - public void saveOrUpdateConfigEntry(DimdimConfig dimdimConfig) { - dimdimConfigDAO.insertOrUpdate(dimdimConfig); - } + public void setAuditService(IAuditService auditService) { + this.auditService = auditService; + } - public IAuditService getAuditService() { - return auditService; + private NodeKey processFile(FormFile file, String type) { + NodeKey node = null; + if (file != null && !StringUtils.isEmpty(file.getFileName())) { + String fileName = file.getFileName(); + try { + node = getDimdimToolContentHandler().uploadFile(file.getInputStream(), fileName, file.getContentType(), + type); + } catch (InvalidParameterException e) { + throw new DimdimException("InvalidParameterException occured while trying to upload File" + + e.getMessage()); + } catch (FileNotFoundException e) { + throw new DimdimException("FileNotFoundException occured while trying to upload File" + e.getMessage()); + } catch (RepositoryCheckedException e) { + throw new DimdimException("RepositoryCheckedException occured while trying to upload File" + + e.getMessage()); + } catch (IOException e) { + throw new DimdimException("IOException occured while trying to upload File" + e.getMessage()); + } } + return node; + } - public void setAuditService(IAuditService auditService) { - this.auditService = auditService; + /** + * 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 DimdimException { + repositoryService = RepositoryProxy.getRepositoryService(); + ICredentials credentials = new SimpleCredentials(DimdimToolContentHandler.repositoryUser, + DimdimToolContentHandler.repositoryId); + try { + ITicket ticket = repositoryService.login(credentials, DimdimToolContentHandler.repositoryWorkspaceName); + return ticket; + } catch (AccessDeniedException ae) { + throw new DimdimException("Access Denied to repository." + ae.getMessage()); + } catch (WorkspaceNotFoundException we) { + throw new DimdimException("Workspace not found." + we.getMessage()); + } catch (LoginException e) { + throw new DimdimException("Login failed." + e.getMessage()); } + } - private NodeKey processFile(FormFile file, String type) { - NodeKey node = null; - if (file != null && !StringUtils.isEmpty(file.getFileName())) { - String fileName = file.getFileName(); - try { - node = getDimdimToolContentHandler().uploadFile( - file.getInputStream(), fileName, file.getContentType(), - type); - } catch (InvalidParameterException e) { - throw new DimdimException( - "InvalidParameterException occured while trying to upload File" - + e.getMessage()); - } catch (FileNotFoundException e) { - throw new DimdimException( - "FileNotFoundException occured while trying to upload File" - + e.getMessage()); - } catch (RepositoryCheckedException e) { - throw new DimdimException( - "RepositoryCheckedException occured while trying to upload File" - + e.getMessage()); - } catch (IOException e) { - throw new DimdimException( - "IOException occured while trying to upload File" - + e.getMessage()); - } - } - return node; - } + /* + * ===============Methods implemented from ToolContentImport102Manager =============== + */ - /** - * 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 DimdimException { - repositoryService = RepositoryProxy.getRepositoryService(); - ICredentials credentials = new SimpleCredentials( - DimdimToolContentHandler.repositoryUser, - DimdimToolContentHandler.repositoryId); - try { - ITicket ticket = repositoryService.login(credentials, - DimdimToolContentHandler.repositoryWorkspaceName); - return ticket; - } catch (AccessDeniedException ae) { - throw new DimdimException("Access Denied to repository." - + ae.getMessage()); - } catch (WorkspaceNotFoundException we) { - throw new DimdimException("Workspace not found." + we.getMessage()); - } catch (LoginException e) { - throw new DimdimException("Login failed." + e.getMessage()); - } - } + /** + * Import the data for a 1.0.2 Dimdim + */ + @SuppressWarnings("unchecked") + public void import102ToolContent(Long toolContentId, UserDTO user, Hashtable importValues) { + Date now = new Date(); + Dimdim dimdim = new Dimdim(); + dimdim.setContentInUse(Boolean.FALSE); + dimdim.setCreateBy(new Long(user.getUserID().longValue())); + dimdim.setCreateDate(now); + dimdim.setDefineLater(Boolean.FALSE); + dimdim.setInstructions(WebUtil.convertNewlines((String) importValues + .get(ToolContentImport102Manager.CONTENT_BODY))); + dimdim.setLockOnFinished(Boolean.TRUE); + dimdim.setOfflineInstructions(null); + dimdim.setOnlineInstructions(null); + dimdim.setRunOffline(Boolean.FALSE); + dimdim.setTitle((String) importValues.get(ToolContentImport102Manager.CONTENT_TITLE)); + dimdim.setToolContentId(toolContentId); + dimdim.setUpdateDate(now); + dimdim.setAllowRichEditor(Boolean.FALSE); + // leave as empty, no need to set them to anything. + // setDimdimAttachments(Set dimdimAttachments); + // setDimdimSessions(Set dimdimSessions); + saveOrUpdateDimdim(dimdim); + } - /* - * ===============Methods implemented from ToolContentImport102Manager - * =============== - */ + /** + * Set the description, throws away the title value as this is not supported in 2.0 + */ + public void setReflectiveData(Long toolContentId, String title, String description) throws ToolException, + DataMissingException { - /** - * Import the data for a 1.0.2 Dimdim - */ - @SuppressWarnings("unchecked") - public void import102ToolContent(Long toolContentId, UserDTO user, - Hashtable importValues) { - Date now = new Date(); - Dimdim dimdim = new Dimdim(); - dimdim.setContentInUse(Boolean.FALSE); - dimdim.setCreateBy(new Long(user.getUserID().longValue())); - dimdim.setCreateDate(now); - dimdim.setDefineLater(Boolean.FALSE); - dimdim.setInstructions(WebUtil.convertNewlines((String) importValues - .get(ToolContentImport102Manager.CONTENT_BODY))); - dimdim.setLockOnFinished(Boolean.TRUE); - dimdim.setOfflineInstructions(null); - dimdim.setOnlineInstructions(null); - dimdim.setRunOffline(Boolean.FALSE); - dimdim.setTitle((String) importValues - .get(ToolContentImport102Manager.CONTENT_TITLE)); - dimdim.setToolContentId(toolContentId); - dimdim.setUpdateDate(now); - dimdim.setAllowRichEditor(Boolean.FALSE); - // leave as empty, no need to set them to anything. - // setDimdimAttachments(Set dimdimAttachments); - // setDimdimSessions(Set dimdimSessions); - saveOrUpdateDimdim(dimdim); + logger + .warn("Setting the reflective field on a dimdim. This doesn't make sense as the dimdim is for reflection and we don't reflect on reflection!"); + Dimdim dimdim = getDimdimByContentId(toolContentId); + if (dimdim == null) { + throw new DataMissingException("Unable to set reflective data titled " + title + + " on activity toolContentId " + toolContentId + " as the tool content does not exist."); } - /** - * Set the description, throws away the title value as this is not supported - * in 2.0 - */ - public void setReflectiveData(Long toolContentId, String title, - String description) throws ToolException, DataMissingException { + dimdim.setInstructions(description); + } - logger - .warn("Setting the reflective field on a dimdim. This doesn't make sense as the dimdim is for reflection and we don't reflect on reflection!"); - Dimdim dimdim = getDimdimByContentId(toolContentId); - if (dimdim == null) { - throw new DataMissingException( - "Unable to set reflective data titled " + title - + " on activity toolContentId " + toolContentId - + " as the tool content does not exist."); - } + // ========================================================================== + // =============== + /* Used by Spring to "inject" the linked objects */ - dimdim.setInstructions(description); - } + public IDimdimAttachmentDAO getDimdimAttachmentDAO() { + return dimdimAttachmentDAO; + } - //========================================================================== - // =============== - /* Used by Spring to "inject" the linked objects */ + public void setDimdimAttachmentDAO(IDimdimAttachmentDAO attachmentDAO) { + this.dimdimAttachmentDAO = attachmentDAO; + } - public IDimdimAttachmentDAO getDimdimAttachmentDAO() { - return dimdimAttachmentDAO; - } + public IDimdimDAO getDimdimDAO() { + return dimdimDAO; + } - public void setDimdimAttachmentDAO(IDimdimAttachmentDAO attachmentDAO) { - this.dimdimAttachmentDAO = attachmentDAO; - } + public void setDimdimDAO(IDimdimDAO dimdimDAO) { + this.dimdimDAO = dimdimDAO; + } - public IDimdimDAO getDimdimDAO() { - return dimdimDAO; - } + public IToolContentHandler getDimdimToolContentHandler() { + return dimdimToolContentHandler; + } - public void setDimdimDAO(IDimdimDAO dimdimDAO) { - this.dimdimDAO = dimdimDAO; - } + public void setDimdimToolContentHandler(IToolContentHandler dimdimToolContentHandler) { + this.dimdimToolContentHandler = dimdimToolContentHandler; + } - public IToolContentHandler getDimdimToolContentHandler() { - return dimdimToolContentHandler; - } + public IDimdimSessionDAO getDimdimSessionDAO() { + return dimdimSessionDAO; + } - public void setDimdimToolContentHandler( - IToolContentHandler dimdimToolContentHandler) { - this.dimdimToolContentHandler = dimdimToolContentHandler; - } + public void setDimdimSessionDAO(IDimdimSessionDAO sessionDAO) { + this.dimdimSessionDAO = sessionDAO; + } - public IDimdimSessionDAO getDimdimSessionDAO() { - return dimdimSessionDAO; - } + public IDimdimConfigDAO getDimdimConfigDAO() { + return dimdimConfigDAO; + } - public void setDimdimSessionDAO(IDimdimSessionDAO sessionDAO) { - this.dimdimSessionDAO = sessionDAO; - } + public void setDimdimConfigDAO(IDimdimConfigDAO dimdimConfigDAO) { + this.dimdimConfigDAO = dimdimConfigDAO; + } - public IDimdimConfigDAO getDimdimConfigDAO() { - return dimdimConfigDAO; - } + public ILamsToolService getToolService() { + return toolService; + } - public void setDimdimConfigDAO(IDimdimConfigDAO dimdimConfigDAO) { - this.dimdimConfigDAO = dimdimConfigDAO; - } + public void setToolService(ILamsToolService toolService) { + this.toolService = toolService; + } - public ILamsToolService getToolService() { - return toolService; - } + public IDimdimUserDAO getDimdimUserDAO() { + return dimdimUserDAO; + } - public void setToolService(ILamsToolService toolService) { - this.toolService = toolService; - } + public void setDimdimUserDAO(IDimdimUserDAO userDAO) { + this.dimdimUserDAO = userDAO; + } - public IDimdimUserDAO getDimdimUserDAO() { - return dimdimUserDAO; - } + public ILearnerService getLearnerService() { + return learnerService; + } - public void setDimdimUserDAO(IDimdimUserDAO userDAO) { - this.dimdimUserDAO = userDAO; - } + public void setLearnerService(ILearnerService learnerService) { + this.learnerService = learnerService; + } - public ILearnerService getLearnerService() { - return learnerService; - } + public IExportToolContentService getExportContentService() { + return exportContentService; + } - public void setLearnerService(ILearnerService learnerService) { - this.learnerService = learnerService; - } + public void setExportContentService(IExportToolContentService exportContentService) { + this.exportContentService = exportContentService; + } - public IExportToolContentService getExportContentService() { - return exportContentService; - } + public ICoreNotebookService getCoreNotebookService() { + return coreNotebookService; + } - public void setExportContentService( - IExportToolContentService exportContentService) { - this.exportContentService = exportContentService; - } - - public ICoreNotebookService getCoreNotebookService() { - return coreNotebookService; - } - - public void setCoreNotebookService(ICoreNotebookService coreNotebookService) { - this.coreNotebookService = coreNotebookService; - } + public void setCoreNotebookService(ICoreNotebookService coreNotebookService) { + this.coreNotebookService = coreNotebookService; + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/service/DimdimServiceProxy.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/service/DimdimServiceProxy.java (.../DimdimServiceProxy.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/service/DimdimServiceProxy.java (.../DimdimServiceProxy.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -33,47 +33,39 @@ /** *

- * This class act as the proxy between web layer and service layer. It is - * designed to decouple the presentation logic and business logic completely. In - * this way, the presentation tier will no longer be aware of the changes in - * service layer. Therefore we can feel free to switch the business logic - * implementation. + * This class act as the proxy between web layer and service layer. It is designed to decouple the presentation logic + * and business logic completely. In this way, the presentation tier will no longer be aware of the changes in service + * layer. Therefore we can feel free to switch the business logic implementation. *

*/ public class DimdimServiceProxy { - public static final IDimdimService getDimdimService( - ServletContext servletContext) { - return (IDimdimService) getDimdimDomainService(servletContext); - } + public static final IDimdimService getDimdimService(ServletContext servletContext) { + return (IDimdimService) getDimdimDomainService(servletContext); + } - private static Object getDimdimDomainService(ServletContext servletContext) { - WebApplicationContext wac = WebApplicationContextUtils - .getRequiredWebApplicationContext(servletContext); - return wac.getBean("dimdimService"); - } + private static Object getDimdimDomainService(ServletContext servletContext) { + WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); + return wac.getBean("dimdimService"); + } - /* - * Return the dimdim tool version of tool session manager implementation. It - * will delegate to the Spring helper method to retrieve the proper bean - * from Spring bean factory. @param servletContext the servletContext for - * current application @return noticeboard service object. - */ - public static final ToolSessionManager getDimdimSessionManager( - ServletContext servletContext) { - return (ToolSessionManager) getDimdimDomainService(servletContext); - } + /* + * Return the dimdim tool version of tool session manager implementation. It will delegate to the Spring helper + * method to retrieve the proper bean from Spring bean factory. @param servletContext the servletContext for current + * application @return noticeboard service object. + */ + public static final ToolSessionManager getDimdimSessionManager(ServletContext servletContext) { + return (ToolSessionManager) getDimdimDomainService(servletContext); + } - /* - * Return the dimdim tool version of tool content manager implementation. It - * will delegate to the Spring helper method to retrieve the proper bean - * from Spring bean factory. @param servletContext the servletContext for - * current application @return noticeboard service object. - */ - public static final ToolContentManager getDimdimContentManager( - ServletContext servletContext) { - return (ToolContentManager) getDimdimDomainService(servletContext); - } + /* + * Return the dimdim tool version of tool content manager implementation. It will delegate to the Spring helper + * method to retrieve the proper bean from Spring bean factory. @param servletContext the servletContext for current + * application @return noticeboard service object. + */ + public static final ToolContentManager getDimdimContentManager(ServletContext servletContext) { + return (ToolContentManager) getDimdimDomainService(servletContext); + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/service/IDimdimService.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/service/IDimdimService.java (.../IDimdimService.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/service/IDimdimService.java (.../IDimdimService.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -38,153 +38,147 @@ * Defines the services available to the web layer from the Dimdim Service */ public interface IDimdimService { - /** - * Makes a copy of the default content and assigns it a newContentID - * - * @params newContentID - * @return - */ - public Dimdim copyDefaultContent(Long newContentID); + /** + * Makes a copy of the default content and assigns it a newContentID + * + * @params newContentID + * @return + */ + public Dimdim copyDefaultContent(Long newContentID); - /** - * Returns an instance of the Dimdim tools default content. - * - * @return - */ - public Dimdim getDefaultContent(); + /** + * Returns an instance of the Dimdim tools default content. + * + * @return + */ + public Dimdim getDefaultContent(); - /** - * @param toolSignature - * @return - */ - public Long getDefaultContentIdBySignature(String toolSignature); + /** + * @param toolSignature + * @return + */ + public Long getDefaultContentIdBySignature(String toolSignature); - /** - * @param toolContentID - * @return - */ - public Dimdim getDimdimByContentId(Long toolContentID); + /** + * @param toolContentID + * @return + */ + public Dimdim getDimdimByContentId(Long toolContentID); - /** - * @param toolContentId - * @param file - * @param type - * @return - */ - public DimdimAttachment uploadFileToContent(Long toolContentId, - FormFile file, String type); + /** + * @param toolContentId + * @param file + * @param type + * @return + */ + public DimdimAttachment uploadFileToContent(Long toolContentId, FormFile file, String type); - /** - * @param uuid - * @param versionID - */ - public void deleteFromRepository(Long uuid, Long versionID) - throws DimdimException; + /** + * @param uuid + * @param versionID + */ + public void deleteFromRepository(Long uuid, Long versionID) throws DimdimException; - /** - * @param dimdim - */ - public void saveOrUpdateDimdim(Dimdim dimdim); + /** + * @param dimdim + */ + public void saveOrUpdateDimdim(Dimdim dimdim); - /** - * @param toolSessionId - * @return - */ - public DimdimSession getSessionBySessionId(Long toolSessionId); + /** + * @param toolSessionId + * @return + */ + public DimdimSession getSessionBySessionId(Long toolSessionId); - /** - * @param dimdimSession - */ - public void saveOrUpdateDimdimSession(DimdimSession dimdimSession); + /** + * @param dimdimSession + */ + public void saveOrUpdateDimdimSession(DimdimSession dimdimSession); - /** - * - * @param userId - * @param toolSessionId - * @return - */ - public DimdimUser getUserByUserIdAndSessionId(Long userId, - Long toolSessionId); + /** + * + * @param userId + * @param toolSessionId + * @return + */ + public DimdimUser getUserByUserIdAndSessionId(Long userId, Long toolSessionId); - /** - * - * @param uid - * @return - */ - public DimdimUser getUserByUID(Long uid); + /** + * + * @param uid + * @return + */ + public DimdimUser getUserByUID(Long uid); - /** - * - * @param dimdimUser - */ - public void saveOrUpdateDimdimUser(DimdimUser dimdimUser); + /** + * + * @param dimdimUser + */ + public void saveOrUpdateDimdimUser(DimdimUser dimdimUser); - /** - * - * @param user - * @param dimdimSession - * @return - */ - public DimdimUser createDimdimUser(UserDTO user, DimdimSession dimdimSession); + /** + * + * @param user + * @param dimdimSession + * @return + */ + public DimdimUser createDimdimUser(UserDTO user, DimdimSession dimdimSession); - /** - * - * @param id - * @param idType - * @param signature - * @param userID - * @param title - * @param entry - * @return - */ - Long createNotebookEntry(Long id, Integer idType, String signature, - Integer userID, String entry); + /** + * + * @param id + * @param idType + * @param signature + * @param userID + * @param title + * @param entry + * @return + */ + Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String entry); - /** - * - * @param uid - * @return - */ - NotebookEntry getEntry(Long uid); + /** + * + * @param uid + * @return + */ + NotebookEntry getEntry(Long uid); - /** - * - * @param uid - * @param title - * @param entry - */ - void updateEntry(Long uid, String entry); + /** + * + * @param uid + * @param title + * @param entry + */ + void updateEntry(Long uid, String entry); - /** - * - * @param key - */ - DimdimConfig getConfigEntry(String key); + /** + * + * @param key + */ + DimdimConfig getConfigEntry(String key); - /** - * - * @param key - * @param value - */ - void saveOrUpdateConfigEntry(DimdimConfig dimdimConfig); + /** + * + * @param key + * @param value + */ + void saveOrUpdateConfigEntry(DimdimConfig dimdimConfig); - /** - * - * @param userDTO - * @param meetingKey - * @param topic - * @return - */ - String getDimdimStartConferenceURL(UserDTO userDTO, String meetingKey, - String topic) throws Exception; + /** + * + * @param userDTO + * @param meetingKey + * @param topic + * @return + */ + String getDimdimStartConferenceURL(UserDTO userDTO, String meetingKey, String topic) throws Exception; - /** - * - * @param userDTOm - * @param meetingKey - * @return - */ - String getDimdimJoinConferenceURL(UserDTO userDTO, String meetingKey) - throws Exception; + /** + * + * @param userDTOm + * @param meetingKey + * @return + */ + String getDimdimJoinConferenceURL(UserDTO userDTO, String meetingKey) throws Exception; } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/util/Constants.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/util/Constants.java (.../Constants.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/util/Constants.java (.../Constants.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -24,33 +24,38 @@ package org.lamsfoundation.lams.tool.dimdim.util; -public interface Constants { - public static final String TOOL_SIGNATURE = "laddim10"; +public final class Constants { - // Config keys - public static final String CONFIG_SERVER_URL = "server_url"; + // Tool signature + public static final String TOOL_SIGNATURE = "laddim10"; - // Authoring SessionMap key names - public static final String KEY_TOOL_CONTENT_ID = "toolContentID"; - public static final String KEY_CONTENT_FOLDER_ID = "contentFolderID"; - public static final String KEY_MODE = "mode"; - public static final String KEY_ONLINE_FILES = "onlineFiles"; - public static final String KEY_OFFLINE_FILES = "offlineFiles"; - public static final String KEY_UNSAVED_ONLINE_FILES = "unsavedOnlineFiles"; - public static final String KEY_UNSAVED_OFFLINE_FILES = "unsavedOfflineFiles"; - public static final String KEY_DELETED_FILES = "deletedFiles"; + // Configuration keys + public static final String CONFIG_SERVER_URL = "server_url"; - // Attribute names - public static final String ATTR_CONTENT_DTO = "contentDTO"; - public static final String ATTR_CONTENT_FOLDER_ID = "contentFolderID"; - public static final String ATTR_FINISHED_ACTIVITY = "finishedActivity"; - public static final String ATTR_SESSION_MAP = "sessionMap"; - public static final String ATTR_USER_DTO = "userDTO"; - public static final String ATTR_CONFERENCE_URL = "conferenceURL"; - public static final String ATTR_SAVE_SUCCESS = "saveSuccess"; + // Authoring SessionMap key names + public static final String KEY_TOOL_CONTENT_ID = "toolContentID"; + public static final String KEY_CONTENT_FOLDER_ID = "contentFolderID"; + public static final String KEY_MODE = "mode"; + public static final String KEY_ONLINE_FILES = "onlineFiles"; + public static final String KEY_OFFLINE_FILES = "offlineFiles"; + public static final String KEY_UNSAVED_ONLINE_FILES = "unsavedOnlineFiles"; + public static final String KEY_UNSAVED_OFFLINE_FILES = "unsavedOfflineFiles"; + public static final String KEY_DELETED_FILES = "deletedFiles"; - // Parameter names - public static final String PARAM_USER_UID = "userUID"; - public static final String ATTR_CONFERENCE_OPEN = "conferenceOpen"; + // Attribute names + public static final String ATTR_CONTENT_DTO = "contentDTO"; + public static final String ATTR_CONTENT_FOLDER_ID = "contentFolderID"; + public static final String ATTR_FINISHED_ACTIVITY = "finishedActivity"; + public static final String ATTR_SESSION_MAP = "sessionMap"; + public static final String ATTR_USER_DTO = "userDTO"; + public static final String ATTR_CONFERENCE_URL = "conferenceURL"; + public static final String ATTR_SAVE_SUCCESS = "saveSuccess"; + // Parameter names + public static final String PARAM_USER_UID = "userUID"; + public static final String ATTR_CONFERENCE_OPEN = "conferenceOpen"; + + private Constants() { + // prevent construction + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/util/DimdimException.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/util/DimdimException.java (.../DimdimException.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/util/DimdimException.java (.../DimdimException.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -31,23 +31,23 @@ */ public class DimdimException extends RuntimeException { - private static final long serialVersionUID = -5518806968051758859L; + private static final long serialVersionUID = -5518806968051758859L; - public DimdimException(String message) { - super(message); - } + public DimdimException(String message) { + super(message); + } - public DimdimException(String message, Throwable cause) { - super(message, cause); - } + public DimdimException(String message, Throwable cause) { + super(message, cause); + } - public DimdimException() { - super(); + public DimdimException() { + super(); - } + } - public DimdimException(Throwable cause) { - super(cause); + public DimdimException(Throwable cause) { + super(cause); - } + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/util/DimdimToolContentHandler.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/util/DimdimToolContentHandler.java (.../DimdimToolContentHandler.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/util/DimdimToolContentHandler.java (.../DimdimToolContentHandler.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -31,49 +31,46 @@ */ public class DimdimToolContentHandler extends ToolContentHandler { - // TODO these three fields were changed to public, since accessor methods - // cannot be made static. Check if we can do this a better way. - public static String repositoryWorkspaceName = "dimdimworkspace"; + // TODO these three fields were changed to public, since accessor methods + // cannot be made static. Check if we can do this a better way. + public static String repositoryWorkspaceName = "dimdimworkspace"; - public static String repositoryUser = "dimdim"; + public static String repositoryUser = "dimdim"; - public static char[] repositoryId = { 'l', 'a', 'm', 's', '-', 'e', 'x' }; + public static char[] repositoryId = { 'l', 'a', 'm', 's', '-', 'e', 'x' }; - /** + /** * */ - public DimdimToolContentHandler() { - super(); - } + public DimdimToolContentHandler() { + super(); + } - /* - * (non-Javadoc) - * - * @seeorg.lamsfoundation.lams.contentrepository.client.ToolContentHandler# - * getRepositoryWorkspaceName() - */ - public String getRepositoryWorkspaceName() { - return repositoryWorkspaceName; - } + /* + * (non-Javadoc) + * + * @seeorg.lamsfoundation.lams.contentrepository.client.ToolContentHandler# getRepositoryWorkspaceName() + */ + public String getRepositoryWorkspaceName() { + return repositoryWorkspaceName; + } - /* - * (non-Javadoc) - * - * @seeorg.lamsfoundation.lams.contentrepository.client.ToolContentHandler# - * getRepositoryUser() - */ - public String getRepositoryUser() { - return repositoryUser; - } + /* + * (non-Javadoc) + * + * @seeorg.lamsfoundation.lams.contentrepository.client.ToolContentHandler# getRepositoryUser() + */ + public String getRepositoryUser() { + return repositoryUser; + } - /* - * (non-Javadoc) - * - * @seeorg.lamsfoundation.lams.contentrepository.client.ToolContentHandler# - * getRepositoryId() - */ - public char[] getRepositoryId() { - return repositoryId; - } + /* + * (non-Javadoc) + * + * @seeorg.lamsfoundation.lams.contentrepository.client.ToolContentHandler# getRepositoryId() + */ + public char[] getRepositoryId() { + return repositoryId; + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/util/DimdimUtil.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/util/DimdimUtil.java (.../DimdimUtil.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/util/DimdimUtil.java (.../DimdimUtil.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -28,8 +28,7 @@ public class DimdimUtil { - public static String generateMeetingKey() { - return new Long(System.currentTimeMillis()).toString() + "-" - + (new Random().nextInt()); - } + public static String generateMeetingKey() { + return new Long(System.currentTimeMillis()).toString() + "-" + (new Random().nextInt()); + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/actions/AdminAction.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/actions/AdminAction.java (.../AdminAction.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/actions/AdminAction.java (.../AdminAction.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -38,68 +38,59 @@ import org.lamsfoundation.lams.tool.dimdim.web.forms.AdminForm; /** - * @struts.action path="/admin/main" name="adminForm" parameter="main" - * scope="request" validate="false" + * @struts.action path="/admin/main" name="adminForm" parameter="main" scope="request" validate="false" * @struts.action-forward name="main-success" path="tiles:/admin/main" * - * @struts.action path="/admin/save" name="adminForm" parameter="save" - * scope="request" validate="false" - * @struts.action-forward name="save-success" redirect="true" - * path="/admin/main.do" + * @struts.action path="/admin/save" name="adminForm" parameter="save" scope="request" validate="false" + * @struts.action-forward name="save-success" redirect="true" path="/admin/main.do" * * @author Anthony Sukkar * */ public class AdminAction extends MappingDispatchAction { - private IDimdimService dimdimService; + private IDimdimService dimdimService; - // private static final Logger logger = Logger.getLogger(AdminAction.class); + // private static final Logger logger = Logger.getLogger(AdminAction.class); - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { + @Override + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws Exception { - // set up dimdimService - dimdimService = DimdimServiceProxy.getDimdimService(this.getServlet() - .getServletContext()); + // set up dimdimService + dimdimService = DimdimServiceProxy.getDimdimService(this.getServlet().getServletContext()); - return super.execute(mapping, form, request, response); - } + return super.execute(mapping, form, request, response); + } - public ActionForward main(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { + public ActionForward main(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws Exception { - AdminForm adminForm = (AdminForm) form; - DimdimConfig serverURL = dimdimService - .getConfigEntry(Constants.CONFIG_SERVER_URL); + AdminForm adminForm = (AdminForm) form; + DimdimConfig serverURL = dimdimService.getConfigEntry(Constants.CONFIG_SERVER_URL); - if (serverURL != null) { - adminForm.setDimdimServerURL(serverURL.getValue()); - } - - return mapping.findForward("main-success"); + if (serverURL != null) { + adminForm.setDimdimServerURL(serverURL.getValue()); } - public ActionForward save(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { + return mapping.findForward("main-success"); + } - AdminForm adminForm = (AdminForm) form; + public ActionForward save(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws Exception { - DimdimConfig dimdimConfig = dimdimService - .getConfigEntry(Constants.CONFIG_SERVER_URL); + AdminForm adminForm = (AdminForm) form; - if (dimdimConfig == null) { - dimdimConfig = new DimdimConfig(); - dimdimConfig.setKey(Constants.CONFIG_SERVER_URL); - } + DimdimConfig dimdimConfig = dimdimService.getConfigEntry(Constants.CONFIG_SERVER_URL); - dimdimConfig.setValue(adminForm.getDimdimServerURL()); - dimdimService.saveOrUpdateConfigEntry(dimdimConfig); - - return mapping.findForward("save-success"); + if (dimdimConfig == null) { + dimdimConfig = new DimdimConfig(); + dimdimConfig.setKey(Constants.CONFIG_SERVER_URL); } + + dimdimConfig.setValue(adminForm.getDimdimServerURL()); + dimdimService.saveOrUpdateConfigEntry(dimdimConfig); + + return mapping.findForward("save-success"); + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/actions/AuthoringAction.java =================================================================== diff -u -r65ab476801260e17f27b0f625ec4daa6a5a8d7fd -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/actions/AuthoringAction.java (.../AuthoringAction.java) (revision 65ab476801260e17f27b0f625ec4daa6a5a8d7fd) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/actions/AuthoringAction.java (.../AuthoringAction.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -62,423 +62,388 @@ * @author * @version * - * @struts.action path="/authoring" name="authoringForm" parameter="dispatch" - * scope="request" validate="false" + * @struts.action path="/authoring" name="authoringForm" parameter="dispatch" scope="request" validate="false" * * @struts.action-forward name="success" path="tiles:/authoring/main" * @struts.action-forward name="message_page" path="tiles:/generic/message" */ public class AuthoringAction extends DispatchAction { - // private static final Logger logger = - // Logger.getLogger(AuthoringAction.class); + // private static final Logger logger = + // Logger.getLogger(AuthoringAction.class); - private IDimdimService dimdimService; + private IDimdimService dimdimService; - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { + @Override + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws Exception { - // set up dimdimService - dimdimService = DimdimServiceProxy.getDimdimService(this.getServlet() - .getServletContext()); + // set up dimdimService + dimdimService = DimdimServiceProxy.getDimdimService(this.getServlet().getServletContext()); - return super.execute(mapping, form, request, response); - } + return super.execute(mapping, form, request, response); + } - /** - * Default method when no dispatch parameter is specified. It is expected - * that the parameter toolContentID will be passed in. This - * will be used to retrieve content for this tool. - * - * @throws ServletException - * - */ - protected ActionForward unspecified(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws ServletException { + /** + * Default method when no dispatch parameter is specified. It is expected that the parameter + * toolContentID will be passed in. This will be used to retrieve content for this tool. + * + * @throws ServletException + * + */ + protected ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws ServletException { - // Extract toolContentID from parameters. - Long toolContentID = new Long(WebUtil.readLongParam(request, - AttributeNames.PARAM_TOOL_CONTENT_ID)); + // Extract toolContentID from parameters. + Long toolContentID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID)); - String contentFolderID = WebUtil.readStrParam(request, - AttributeNames.PARAM_CONTENT_FOLDER_ID); + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); - ToolAccessMode mode = WebUtil.readToolAccessModeParam(request, - AttributeNames.PARAM_MODE, true); + ToolAccessMode mode = WebUtil.readToolAccessModeParam(request, AttributeNames.PARAM_MODE, true); - // retrieving Dimdim with given toolContentID - Dimdim dimdim = dimdimService.getDimdimByContentId(toolContentID); - if (dimdim == null) { - dimdim = dimdimService.copyDefaultContent(toolContentID); - dimdim.setCreateDate(new Date()); - dimdimService.saveOrUpdateDimdim(dimdim); - // TODO NOTE: this causes DB orphans when LD not saved. - } + // retrieving Dimdim with given toolContentID + Dimdim dimdim = dimdimService.getDimdimByContentId(toolContentID); + if (dimdim == null) { + dimdim = dimdimService.copyDefaultContent(toolContentID); + dimdim.setCreateDate(new Date()); + dimdimService.saveOrUpdateDimdim(dimdim); + // TODO NOTE: this causes DB orphans when LD not saved. + } - if (mode != null && mode.isTeacher()) { - // Set the defineLater flag so that learners cannot use content - // while we are editing. This flag is released when updateContent is - // called. - dimdim.setDefineLater(true); - dimdimService.saveOrUpdateDimdim(dimdim); - } - - // Set up the authForm. - AuthoringForm authForm = (AuthoringForm) form; - copyProperties(authForm, dimdim); - - // Set up sessionMap - SessionMap map = createSessionMap(dimdim, - getAccessMode(request), contentFolderID, toolContentID); - authForm.setSessionMapID(map.getSessionID()); - - // add the sessionMap to HTTPSession. - request.getSession().setAttribute(map.getSessionID(), map); - request.setAttribute(Constants.ATTR_SESSION_MAP, map); - - return mapping.findForward("success"); + if (mode != null && mode.isTeacher()) { + // Set the defineLater flag so that learners cannot use content + // while we are editing. This flag is released when updateContent is + // called. + dimdim.setDefineLater(true); + dimdimService.saveOrUpdateDimdim(dimdim); } - public ActionForward updateContent(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) { - // TODO need error checking. + // Set up the authForm. + AuthoringForm authForm = (AuthoringForm) form; + copyProperties(authForm, dimdim); - // get authForm and session map. - AuthoringForm authForm = (AuthoringForm) form; - SessionMap map = getSessionMap(request, authForm); + // Set up sessionMap + SessionMap map = createSessionMap(dimdim, getAccessMode(request), contentFolderID, + toolContentID); + authForm.setSessionMapID(map.getSessionID()); - // get dimdim content. - Dimdim dimdim = dimdimService.getDimdimByContentId((Long) map - .get(Constants.KEY_TOOL_CONTENT_ID)); + // add the sessionMap to HTTPSession. + request.getSession().setAttribute(map.getSessionID(), map); + request.setAttribute(Constants.ATTR_SESSION_MAP, map); - // update dimdim content using form inputs. - ToolAccessMode mode = (ToolAccessMode) map.get(Constants.KEY_MODE); - copyProperties(dimdim, authForm, mode); + return mapping.findForward("success"); + } - // remove attachments marked for deletion. - Set attachments = dimdim.getDimdimAttachments(); - if (attachments == null) { - attachments = new HashSet(); - } + public ActionForward updateContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + // TODO need error checking. - for (DimdimAttachment att : getAttList(Constants.KEY_DELETED_FILES, map)) { - // remove from db, leave in repository - attachments.remove(att); - } + // get authForm and session map. + AuthoringForm authForm = (AuthoringForm) form; + SessionMap map = getSessionMap(request, authForm); - // add unsaved attachments - attachments.addAll(getAttList(Constants.KEY_UNSAVED_ONLINE_FILES, map)); - attachments - .addAll(getAttList(Constants.KEY_UNSAVED_OFFLINE_FILES, map)); + // get dimdim content. + Dimdim dimdim = dimdimService.getDimdimByContentId((Long) map.get(Constants.KEY_TOOL_CONTENT_ID)); - // set attachments in case it didn't exist - dimdim.setDimdimAttachments(attachments); + // update dimdim content using form inputs. + ToolAccessMode mode = (ToolAccessMode) map.get(Constants.KEY_MODE); + copyProperties(dimdim, authForm, mode); - // set the update date - dimdim.setUpdateDate(new Date()); + // remove attachments marked for deletion. + Set attachments = dimdim.getDimdimAttachments(); + if (attachments == null) { + attachments = new HashSet(); + } - // releasing defineLater flag so that learner can start using the tool. - dimdim.setDefineLater(false); + for (DimdimAttachment att : getAttList(Constants.KEY_DELETED_FILES, map)) { + // remove from db, leave in repository + attachments.remove(att); + } - dimdimService.saveOrUpdateDimdim(dimdim); + // add unsaved attachments + attachments.addAll(getAttList(Constants.KEY_UNSAVED_ONLINE_FILES, map)); + attachments.addAll(getAttList(Constants.KEY_UNSAVED_OFFLINE_FILES, map)); - request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, - Boolean.TRUE); + // set attachments in case it didn't exist + dimdim.setDimdimAttachments(attachments); - // add the sessionMapID to form - authForm.setSessionMapID(map.getSessionID()); + // set the update date + dimdim.setUpdateDate(new Date()); - request.setAttribute(Constants.ATTR_SESSION_MAP, map); + // releasing defineLater flag so that learner can start using the tool. + dimdim.setDefineLater(false); - return mapping.findForward("success"); - } + dimdimService.saveOrUpdateDimdim(dimdim); - public ActionForward uploadOnline(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) { - return uploadFile(mapping, (AuthoringForm) form, - IToolContentHandler.TYPE_ONLINE, request); - } + request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, Boolean.TRUE); - public ActionForward uploadOffline(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) { - return uploadFile(mapping, (AuthoringForm) form, - IToolContentHandler.TYPE_OFFLINE, request); - } + // add the sessionMapID to form + authForm.setSessionMapID(map.getSessionID()); - public ActionForward deleteOnline(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) { - return deleteFile(mapping, (AuthoringForm) form, - IToolContentHandler.TYPE_ONLINE, request); - } + request.setAttribute(Constants.ATTR_SESSION_MAP, map); - public ActionForward deleteOffline(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) { - return deleteFile(mapping, (AuthoringForm) form, - IToolContentHandler.TYPE_OFFLINE, request); - } + return mapping.findForward("success"); + } - public ActionForward removeUnsavedOnline(ActionMapping mapping, - ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - return removeUnsaved(mapping, (AuthoringForm) form, - IToolContentHandler.TYPE_ONLINE, request); - } + public ActionForward uploadOnline(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + return uploadFile(mapping, (AuthoringForm) form, IToolContentHandler.TYPE_ONLINE, request); + } - public ActionForward removeUnsavedOffline(ActionMapping mapping, - ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - return removeUnsaved(mapping, (AuthoringForm) form, - IToolContentHandler.TYPE_OFFLINE, request); - } + public ActionForward uploadOffline(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + return uploadFile(mapping, (AuthoringForm) form, IToolContentHandler.TYPE_OFFLINE, request); + } - /* ========== Private Methods */ + public ActionForward deleteOnline(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + return deleteFile(mapping, (AuthoringForm) form, IToolContentHandler.TYPE_ONLINE, request); + } - private ActionForward uploadFile(ActionMapping mapping, - AuthoringForm authForm, String type, HttpServletRequest request) { - SessionMap map = getSessionMap(request, authForm); + public ActionForward deleteOffline(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + return deleteFile(mapping, (AuthoringForm) form, IToolContentHandler.TYPE_OFFLINE, request); + } - FormFile file; - List unsavedFiles; - List savedFiles; - if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) { - file = (FormFile) authForm.getOfflineFile(); - unsavedFiles = getAttList(Constants.KEY_UNSAVED_OFFLINE_FILES, map); + public ActionForward removeUnsavedOnline(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + return removeUnsaved(mapping, (AuthoringForm) form, IToolContentHandler.TYPE_ONLINE, request); + } - savedFiles = getAttList(Constants.KEY_OFFLINE_FILES, map); - } else { - file = (FormFile) authForm.getOnlineFile(); - unsavedFiles = getAttList(Constants.KEY_UNSAVED_ONLINE_FILES, map); + public ActionForward removeUnsavedOffline(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + return removeUnsaved(mapping, (AuthoringForm) form, IToolContentHandler.TYPE_OFFLINE, request); + } - savedFiles = getAttList(Constants.KEY_ONLINE_FILES, map); - } + /* ========== Private Methods */ - // validate file max size - ActionMessages errors = new ActionMessages(); - FileValidatorUtil.validateFileSize(file, true, errors); - if (!errors.isEmpty()) { - request.setAttribute(Constants.ATTR_SESSION_MAP, map); - this.saveErrors(request, errors); - return mapping.findForward("success"); - } + private ActionForward uploadFile(ActionMapping mapping, AuthoringForm authForm, String type, + HttpServletRequest request) { + SessionMap map = getSessionMap(request, authForm); - if (file.getFileName().length() != 0) { + FormFile file; + List unsavedFiles; + List savedFiles; + if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) { + file = (FormFile) authForm.getOfflineFile(); + unsavedFiles = getAttList(Constants.KEY_UNSAVED_OFFLINE_FILES, map); - // upload file to repository - DimdimAttachment newAtt = dimdimService.uploadFileToContent( - (Long) map.get(Constants.KEY_TOOL_CONTENT_ID), file, type); + savedFiles = getAttList(Constants.KEY_OFFLINE_FILES, map); + } else { + file = (FormFile) authForm.getOnlineFile(); + unsavedFiles = getAttList(Constants.KEY_UNSAVED_ONLINE_FILES, map); - // Add attachment to unsavedFiles - // check to see if file with same name exists - DimdimAttachment currAtt; - Iterator iter = savedFiles.iterator(); - while (iter.hasNext()) { - currAtt = (DimdimAttachment) iter.next(); - if (StringUtils.equals(currAtt.getFileName(), newAtt - .getFileName()) - && StringUtils.equals(currAtt.getFileType(), newAtt - .getFileType())) { - // move from this this list to deleted list. - getAttList(Constants.KEY_DELETED_FILES, map).add(currAtt); - iter.remove(); - break; - } - } - unsavedFiles.add(newAtt); + savedFiles = getAttList(Constants.KEY_ONLINE_FILES, map); + } - request.setAttribute(Constants.ATTR_SESSION_MAP, map); - } - return mapping.findForward("success"); + // validate file max size + ActionMessages errors = new ActionMessages(); + FileValidatorUtil.validateFileSize(file, true, errors); + if (!errors.isEmpty()) { + request.setAttribute(Constants.ATTR_SESSION_MAP, map); + this.saveErrors(request, errors); + return mapping.findForward("success"); } - private ActionForward deleteFile(ActionMapping mapping, - AuthoringForm authForm, String type, HttpServletRequest request) { - SessionMap map = getSessionMap(request, authForm); + if (file.getFileName().length() != 0) { - List fileList; - if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) { - fileList = getAttList(Constants.KEY_OFFLINE_FILES, map); - } else { - fileList = getAttList(Constants.KEY_ONLINE_FILES, map); + // upload file to repository + DimdimAttachment newAtt = dimdimService.uploadFileToContent((Long) map.get(Constants.KEY_TOOL_CONTENT_ID), + file, type); + + // Add attachment to unsavedFiles + // check to see if file with same name exists + DimdimAttachment currAtt; + Iterator iter = savedFiles.iterator(); + while (iter.hasNext()) { + currAtt = (DimdimAttachment) iter.next(); + if (StringUtils.equals(currAtt.getFileName(), newAtt.getFileName()) + && StringUtils.equals(currAtt.getFileType(), newAtt.getFileType())) { + // move from this this list to deleted list. + getAttList(Constants.KEY_DELETED_FILES, map).add(currAtt); + iter.remove(); + break; } + } + unsavedFiles.add(newAtt); - Iterator iter = fileList.iterator(); + request.setAttribute(Constants.ATTR_SESSION_MAP, map); + } + return mapping.findForward("success"); + } - while (iter.hasNext()) { - DimdimAttachment att = (DimdimAttachment) iter.next(); + private ActionForward deleteFile(ActionMapping mapping, AuthoringForm authForm, String type, + HttpServletRequest request) { + SessionMap map = getSessionMap(request, authForm); - if (att.getFileUuid().equals(authForm.getDeleteFileUuid())) { - // move to delete file list, deleted at next updateContent - getAttList(Constants.KEY_DELETED_FILES, map).add(att); + List fileList; + if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) { + fileList = getAttList(Constants.KEY_OFFLINE_FILES, map); + } else { + fileList = getAttList(Constants.KEY_ONLINE_FILES, map); + } - // remove from this list - iter.remove(); - break; - } - } + Iterator iter = fileList.iterator(); - request.setAttribute(Constants.ATTR_SESSION_MAP, map); + while (iter.hasNext()) { + DimdimAttachment att = (DimdimAttachment) iter.next(); - return mapping.findForward("success"); + if (att.getFileUuid().equals(authForm.getDeleteFileUuid())) { + // move to delete file list, deleted at next updateContent + getAttList(Constants.KEY_DELETED_FILES, map).add(att); + + // remove from this list + iter.remove(); + break; + } } - private ActionForward removeUnsaved(ActionMapping mapping, - AuthoringForm authForm, String type, HttpServletRequest request) { - SessionMap map = getSessionMap(request, authForm); + request.setAttribute(Constants.ATTR_SESSION_MAP, map); - List unsavedFiles; + return mapping.findForward("success"); + } - if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) { - unsavedFiles = getAttList(Constants.KEY_UNSAVED_OFFLINE_FILES, map); - } else { - unsavedFiles = getAttList(Constants.KEY_UNSAVED_ONLINE_FILES, map); - } + private ActionForward removeUnsaved(ActionMapping mapping, AuthoringForm authForm, String type, + HttpServletRequest request) { + SessionMap map = getSessionMap(request, authForm); - Iterator iter = unsavedFiles.iterator(); - while (iter.hasNext()) { - DimdimAttachment att = (DimdimAttachment) iter.next(); + List unsavedFiles; - if (att.getFileUuid().equals(authForm.getDeleteFileUuid())) { - // delete from repository and list - dimdimService.deleteFromRepository(att.getFileUuid(), att - .getFileVersionId()); - iter.remove(); - break; - } - } + if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) { + unsavedFiles = getAttList(Constants.KEY_UNSAVED_OFFLINE_FILES, map); + } else { + unsavedFiles = getAttList(Constants.KEY_UNSAVED_ONLINE_FILES, map); + } - request.setAttribute(Constants.ATTR_SESSION_MAP, map); + Iterator iter = unsavedFiles.iterator(); + while (iter.hasNext()) { + DimdimAttachment att = (DimdimAttachment) iter.next(); - return mapping.findForward("success"); + if (att.getFileUuid().equals(authForm.getDeleteFileUuid())) { + // delete from repository and list + dimdimService.deleteFromRepository(att.getFileUuid(), att.getFileVersionId()); + iter.remove(); + break; + } } - /** - * Updates Dimdim content using AuthoringForm inputs. - * - * @param authForm - * @param mode - * @return - */ - private void copyProperties(Dimdim dimdim, AuthoringForm authForm, - ToolAccessMode mode) { - dimdim.setTitle(authForm.getTitle()); - dimdim.setInstructions(authForm.getInstructions()); - if (mode.isAuthor()) { // Teacher cannot modify following - dimdim.setOfflineInstructions(authForm.getOfflineInstruction()); - dimdim.setOnlineInstructions(authForm.getOnlineInstruction()); - dimdim.setLockOnFinished(authForm.isLockOnFinished()); - dimdim.setAllowRichEditor(authForm.isAllowRichEditor()); + request.setAttribute(Constants.ATTR_SESSION_MAP, map); - // TODO check whether these fields should be in here - dimdim.setTopic(authForm.getTopic()); - dimdim.setMaxAttendeeMikes(authForm.getMaxAttendeeMikes()); - } + return mapping.findForward("success"); + } + + /** + * Updates Dimdim content using AuthoringForm inputs. + * + * @param authForm + * @param mode + * @return + */ + private void copyProperties(Dimdim dimdim, AuthoringForm authForm, ToolAccessMode mode) { + dimdim.setTitle(authForm.getTitle()); + dimdim.setInstructions(authForm.getInstructions()); + if (mode.isAuthor()) { // Teacher cannot modify following + dimdim.setOfflineInstructions(authForm.getOfflineInstruction()); + dimdim.setOnlineInstructions(authForm.getOnlineInstruction()); + dimdim.setLockOnFinished(authForm.isLockOnFinished()); + dimdim.setAllowRichEditor(authForm.isAllowRichEditor()); + + // TODO check whether these fields should be in here + dimdim.setTopic(authForm.getTopic()); + dimdim.setMaxAttendeeMikes(authForm.getMaxAttendeeMikes()); } + } - /** - * Updates AuthoringForm using Dimdim content. - * - * @param dimdim - * @param authForm - * @return - * @throws ServletException - */ - private void copyProperties(AuthoringForm authForm, Dimdim dimdim) - throws ServletException { - try { - BeanUtils.copyProperties(authForm, dimdim); - } catch (IllegalAccessException e) { - throw new ServletException(e); - } catch (InvocationTargetException e) { - throw new ServletException(e); - } + /** + * Updates AuthoringForm using Dimdim content. + * + * @param dimdim + * @param authForm + * @return + * @throws ServletException + */ + private void copyProperties(AuthoringForm authForm, Dimdim dimdim) throws ServletException { + try { + BeanUtils.copyProperties(authForm, dimdim); + } catch (IllegalAccessException e) { + throw new ServletException(e); + } catch (InvocationTargetException e) { + throw new ServletException(e); } + } - /** - * Updates SessionMap using Dimdim content. - * - * @param dimdim - * @param mode - */ - private SessionMap createSessionMap(Dimdim dimdim, - ToolAccessMode mode, String contentFolderID, Long toolContentID) { + /** + * Updates SessionMap using Dimdim content. + * + * @param dimdim + * @param mode + */ + private SessionMap createSessionMap(Dimdim dimdim, ToolAccessMode mode, String contentFolderID, + Long toolContentID) { - SessionMap map = new SessionMap(); + SessionMap map = new SessionMap(); - map.put(Constants.KEY_MODE, mode); - map.put(Constants.KEY_CONTENT_FOLDER_ID, contentFolderID); - map.put(Constants.KEY_TOOL_CONTENT_ID, toolContentID); - map.put(Constants.KEY_ONLINE_FILES, new LinkedList()); - map - .put(Constants.KEY_OFFLINE_FILES, - new LinkedList()); - map.put(Constants.KEY_UNSAVED_ONLINE_FILES, - new LinkedList()); - map.put(Constants.KEY_UNSAVED_OFFLINE_FILES, - new LinkedList()); - map - .put(Constants.KEY_DELETED_FILES, - new LinkedList()); + map.put(Constants.KEY_MODE, mode); + map.put(Constants.KEY_CONTENT_FOLDER_ID, contentFolderID); + map.put(Constants.KEY_TOOL_CONTENT_ID, toolContentID); + map.put(Constants.KEY_ONLINE_FILES, new LinkedList()); + map.put(Constants.KEY_OFFLINE_FILES, new LinkedList()); + map.put(Constants.KEY_UNSAVED_ONLINE_FILES, new LinkedList()); + map.put(Constants.KEY_UNSAVED_OFFLINE_FILES, new LinkedList()); + map.put(Constants.KEY_DELETED_FILES, new LinkedList()); - for (DimdimAttachment attachment : dimdim.getDimdimAttachments()) { - String type = attachment.getFileType(); - if (type.equals(IToolContentHandler.TYPE_OFFLINE)) { - getAttList(Constants.KEY_OFFLINE_FILES, map).add(attachment); - } - if (type.equals(IToolContentHandler.TYPE_ONLINE)) { - getAttList(Constants.KEY_ONLINE_FILES, map).add(attachment); - } - } - - return map; + for (DimdimAttachment attachment : dimdim.getDimdimAttachments()) { + String type = attachment.getFileType(); + if (type.equals(IToolContentHandler.TYPE_OFFLINE)) { + getAttList(Constants.KEY_OFFLINE_FILES, map).add(attachment); + } + if (type.equals(IToolContentHandler.TYPE_ONLINE)) { + getAttList(Constants.KEY_ONLINE_FILES, map).add(attachment); + } } - /** - * Get ToolAccessMode from HttpRequest parameters. Default value is AUTHOR - * mode. - * - * @param request - * @return - */ - private ToolAccessMode getAccessMode(HttpServletRequest request) { - ToolAccessMode mode; - String modeStr = request.getParameter(AttributeNames.ATTR_MODE); - if (StringUtils.equalsIgnoreCase(modeStr, ToolAccessMode.TEACHER - .toString())) { - mode = ToolAccessMode.TEACHER; - } else { - mode = ToolAccessMode.AUTHOR; - } - return mode; - } + return map; + } - /** - * Retrieves a List of attachments from the map using the key. - * - * @param key - * @param map - * @return - */ - @SuppressWarnings("unchecked") - private List getAttList(String key, - SessionMap map) { - List list = (List) map.get(key); - return list; + /** + * Get ToolAccessMode from HttpRequest parameters. Default value is AUTHOR mode. + * + * @param request + * @return + */ + private ToolAccessMode getAccessMode(HttpServletRequest request) { + ToolAccessMode mode; + String modeStr = request.getParameter(AttributeNames.ATTR_MODE); + if (StringUtils.equalsIgnoreCase(modeStr, ToolAccessMode.TEACHER.toString())) { + mode = ToolAccessMode.TEACHER; + } else { + mode = ToolAccessMode.AUTHOR; } + return mode; + } - /** - * Retrieve the SessionMap from the HttpSession. - * - * @param request - * @param authForm - * @return - */ - @SuppressWarnings("unchecked") - private SessionMap getSessionMap( - HttpServletRequest request, AuthoringForm authForm) { - return (SessionMap) request.getSession().getAttribute( - authForm.getSessionMapID()); - } + /** + * Retrieves a List of attachments from the map using the key. + * + * @param key + * @param map + * @return + */ + @SuppressWarnings("unchecked") + private List getAttList(String key, SessionMap map) { + List list = (List) map.get(key); + return list; + } + + /** + * Retrieve the SessionMap from the HttpSession. + * + * @param request + * @param authForm + * @return + */ + @SuppressWarnings("unchecked") + private SessionMap getSessionMap(HttpServletRequest request, AuthoringForm authForm) { + return (SessionMap) request.getSession().getAttribute(authForm.getSessionMapID()); + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/actions/ClearSessionAction.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/actions/ClearSessionAction.java (.../ClearSessionAction.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/actions/ClearSessionAction.java (.../ClearSessionAction.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -30,8 +30,7 @@ import org.lamsfoundation.lams.tool.ToolAccessMode; /** - * This class give a chance to clear HttpSession when user save/close authoring - * page. + * This class give a chance to clear HttpSession when user save/close authoring page. * * @author Steve.Ni * @@ -43,12 +42,11 @@ */ public class ClearSessionAction extends LamsAuthoringFinishAction { - @Override - public void clearSession(String customiseSessionID, HttpSession session, - ToolAccessMode mode) { - if (mode.isAuthor()) { - session.removeAttribute(customiseSessionID); - } + @Override + public void clearSession(String customiseSessionID, HttpSession session, ToolAccessMode mode) { + if (mode.isAuthor()) { + session.removeAttribute(customiseSessionID); } + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/actions/LearningAction.java =================================================================== diff -u -r65ab476801260e17f27b0f625ec4daa6a5a8d7fd -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/actions/LearningAction.java (.../LearningAction.java) (revision 65ab476801260e17f27b0f625ec4daa6a5a8d7fd) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/actions/LearningAction.java (.../LearningAction.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -58,203 +58,179 @@ /** * @author Anthony Sukkar * - * @struts.action path="/learning" parameter="dispatch" scope="request" - * name="learningForm" + * @struts.action path="/learning" parameter="dispatch" scope="request" name="learningForm" * @struts.action-forward name="dimdim" path="tiles:/learning/main" * @struts.action-forward name="runOffline" path="tiles:/learning/runOffline" * @struts.action-forward name="defineLater" path="tiles:/learning/defineLater" */ public class LearningAction extends DispatchAction { - private static final Logger logger = Logger.getLogger(LearningAction.class); + private static final Logger logger = Logger.getLogger(LearningAction.class); - private IDimdimService dimdimService; + private IDimdimService dimdimService; - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { + @Override + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws Exception { - // set up dimdimService - dimdimService = DimdimServiceProxy.getDimdimService(this.getServlet() - .getServletContext()); + // set up dimdimService + dimdimService = DimdimServiceProxy.getDimdimService(this.getServlet().getServletContext()); - return super.execute(mapping, form, request, response); - } + return super.execute(mapping, form, request, response); + } - public ActionForward unspecified(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { + public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws Exception { - LearningForm learningForm = (LearningForm) form; + LearningForm learningForm = (LearningForm) form; - // 'toolSessionID' and 'mode' parameters are expected to be present. - // TODO need to catch exceptions and handle errors. - ToolAccessMode mode = WebUtil.readToolAccessModeParam(request, - AttributeNames.PARAM_MODE, false); + // 'toolSessionID' and 'mode' parameters are expected to be present. + // TODO need to catch exceptions and handle errors. + ToolAccessMode mode = WebUtil.readToolAccessModeParam(request, AttributeNames.PARAM_MODE, false); - Long toolSessionID = WebUtil.readLongParam(request, - AttributeNames.PARAM_TOOL_SESSION_ID); + Long toolSessionID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); - // Retrieve the session and content. - DimdimSession dimdimSession = dimdimService - .getSessionBySessionId(toolSessionID); - if (dimdimSession == null) { - throw new DimdimException( - "Cannot retrieve session with toolSessionID" - + toolSessionID); - } + // Retrieve the session and content. + DimdimSession dimdimSession = dimdimService.getSessionBySessionId(toolSessionID); + if (dimdimSession == null) { + throw new DimdimException("Cannot retrieve session with toolSessionID" + toolSessionID); + } - Dimdim dimdim = dimdimSession.getDimdim(); + Dimdim dimdim = dimdimSession.getDimdim(); - // check defineLater - if (dimdim.isDefineLater()) { - return mapping.findForward("defineLater"); - } + // check defineLater + if (dimdim.isDefineLater()) { + return mapping.findForward("defineLater"); + } - // set mode, toolSessionID and DimdimDTO - request.setAttribute(AttributeNames.ATTR_MODE, mode.toString()); - learningForm.setToolSessionID(toolSessionID); + // set mode, toolSessionID and DimdimDTO + request.setAttribute(AttributeNames.ATTR_MODE, mode.toString()); + learningForm.setToolSessionID(toolSessionID); - ContentDTO contentDTO = new ContentDTO(); - contentDTO.title = dimdim.getTitle(); - contentDTO.instructions = dimdim.getInstructions(); - contentDTO.allowRichEditor = dimdim.isAllowRichEditor(); - contentDTO.lockOnFinish = dimdim.isLockOnFinished(); + ContentDTO contentDTO = new ContentDTO(); + contentDTO.title = dimdim.getTitle(); + contentDTO.instructions = dimdim.getInstructions(); + contentDTO.allowRichEditor = dimdim.isAllowRichEditor(); + contentDTO.lockOnFinish = dimdim.isLockOnFinished(); - request.setAttribute(Constants.ATTR_CONTENT_DTO, contentDTO); + request.setAttribute(Constants.ATTR_CONTENT_DTO, contentDTO); - // Set the content in use flag. - if (!dimdim.isContentInUse()) { - dimdim.setContentInUse(true); - dimdimService.saveOrUpdateDimdim(dimdim); - } + // Set the content in use flag. + if (!dimdim.isContentInUse()) { + dimdim.setContentInUse(true); + dimdimService.saveOrUpdateDimdim(dimdim); + } - // check runOffline - if (dimdim.isRunOffline()) { - return mapping.findForward("runOffline"); - } + // check runOffline + if (dimdim.isRunOffline()) { + return mapping.findForward("runOffline"); + } - DimdimUser dimdimUser; - if (mode.equals(ToolAccessMode.TEACHER)) { - Long userID = WebUtil.readLongParam(request, - AttributeNames.PARAM_USER_ID, false); - dimdimUser = dimdimService.getUserByUserIdAndSessionId(userID, - toolSessionID); - } else { - dimdimUser = getCurrentUser(toolSessionID); - } + DimdimUser dimdimUser; + if (mode.equals(ToolAccessMode.TEACHER)) { + Long userID = WebUtil.readLongParam(request, AttributeNames.PARAM_USER_ID, false); + dimdimUser = dimdimService.getUserByUserIdAndSessionId(userID, toolSessionID); + } else { + dimdimUser = getCurrentUser(toolSessionID); + } - // get any existing dimdim entry - NotebookEntry nbEntry = null; - if (dimdimUser != null) { - nbEntry = dimdimService.getEntry(dimdimUser.getEntryUID()); - } - if (nbEntry != null) { - learningForm.setEntryText(nbEntry.getEntry()); - } + // get any existing dimdim entry + NotebookEntry nbEntry = null; + if (dimdimUser != null) { + nbEntry = dimdimService.getEntry(dimdimUser.getEntryUID()); + } + if (nbEntry != null) { + learningForm.setEntryText(nbEntry.getEntry()); + } - // set readOnly flag. - if (mode.equals(ToolAccessMode.TEACHER) - || (dimdim.isLockOnFinished() && dimdimUser - .isFinishedActivity())) { - request.setAttribute("contentEditable", false); - } else { - request.setAttribute("contentEditable", true); - } - request.setAttribute(Constants.ATTR_FINISHED_ACTIVITY, dimdimUser - .isFinishedActivity()); + // set readOnly flag. + if (mode.equals(ToolAccessMode.TEACHER) || (dimdim.isLockOnFinished() && dimdimUser.isFinishedActivity())) { + request.setAttribute("contentEditable", false); + } else { + request.setAttribute("contentEditable", true); + } + request.setAttribute(Constants.ATTR_FINISHED_ACTIVITY, dimdimUser.isFinishedActivity()); - // Get LAMS userDTO - org.lamsfoundation.lams.usermanagement.dto.UserDTO lamsUserDTO = (org.lamsfoundation.lams.usermanagement.dto.UserDTO) SessionManager - .getSession().getAttribute(AttributeNames.USER); + // Get LAMS userDTO + org.lamsfoundation.lams.usermanagement.dto.UserDTO lamsUserDTO = (org.lamsfoundation.lams.usermanagement.dto.UserDTO) SessionManager + .getSession().getAttribute(AttributeNames.USER); - String connectURL = ""; - if (mode.isAuthor()) { - String meetingKey = DimdimUtil.generateMeetingKey(); - connectURL = dimdimService.getDimdimStartConferenceURL(lamsUserDTO, - meetingKey, dimdim.getTopic()); - } else { - connectURL = dimdimService.getDimdimJoinConferenceURL(lamsUserDTO, - dimdimSession.getMeetingKey()); - } + String connectURL = ""; + if (mode.isAuthor()) { + String meetingKey = DimdimUtil.generateMeetingKey(); + connectURL = dimdimService.getDimdimStartConferenceURL(lamsUserDTO, meetingKey, dimdim.getTopic()); + } else { + connectURL = dimdimService.getDimdimJoinConferenceURL(lamsUserDTO, dimdimSession.getMeetingKey()); + } - boolean conferenceOpen = connectURL.isEmpty() ? false : true; - request.setAttribute(Constants.ATTR_CONFERENCE_OPEN, conferenceOpen); + boolean conferenceOpen = connectURL.isEmpty() ? false : true; + request.setAttribute(Constants.ATTR_CONFERENCE_OPEN, conferenceOpen); - if (conferenceOpen) { - request.setAttribute(Constants.ATTR_CONFERENCE_URL, connectURL); - } - - return mapping.findForward("dimdim"); + if (conferenceOpen) { + request.setAttribute(Constants.ATTR_CONFERENCE_URL, connectURL); } - private DimdimUser getCurrentUser(Long toolSessionId) { - UserDTO user = (UserDTO) SessionManager.getSession().getAttribute( - AttributeNames.USER); + return mapping.findForward("dimdim"); + } - // attempt to retrieve user using userId and toolSessionId - DimdimUser dimdimUser = dimdimService.getUserByUserIdAndSessionId( - new Long(user.getUserID().intValue()), toolSessionId); + private DimdimUser getCurrentUser(Long toolSessionId) { + UserDTO user = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER); - if (dimdimUser == null) { - DimdimSession dimdimSession = dimdimService - .getSessionBySessionId(toolSessionId); - dimdimUser = dimdimService.createDimdimUser(user, dimdimSession); - } + // attempt to retrieve user using userId and toolSessionId + DimdimUser dimdimUser = dimdimService.getUserByUserIdAndSessionId(new Long(user.getUserID().intValue()), + toolSessionId); - return dimdimUser; + if (dimdimUser == null) { + DimdimSession dimdimSession = dimdimService.getSessionBySessionId(toolSessionId); + dimdimUser = dimdimService.createDimdimUser(user, dimdimSession); } - public ActionForward finishActivity(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) { + return dimdimUser; + } - Long toolSessionID = WebUtil.readLongParam(request, - AttributeNames.PARAM_TOOL_SESSION_ID); + public ActionForward finishActivity(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { - DimdimUser dimdimUser = getCurrentUser(toolSessionID); + Long toolSessionID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); - if (dimdimUser != null) { + DimdimUser dimdimUser = getCurrentUser(toolSessionID); - LearningForm learningForm = (LearningForm) form; + if (dimdimUser != null) { - // TODO fix idType to use real value not 999 + LearningForm learningForm = (LearningForm) form; - if (dimdimUser.getEntryUID() == null) { - dimdimUser.setEntryUID(dimdimService.createNotebookEntry( - toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL, - Constants.TOOL_SIGNATURE, dimdimUser.getUserId() - .intValue(), learningForm.getEntryText())); - } else { - // update existing entry. - dimdimService.updateEntry(dimdimUser.getEntryUID(), - learningForm.getEntryText()); - } + // TODO fix idType to use real value not 999 - dimdimUser.setFinishedActivity(true); - dimdimService.saveOrUpdateDimdimUser(dimdimUser); - } else { - logger - .error("finishActivity(): couldn't find/create DimdimUser in toolSessionID: " - + toolSessionID); - } + if (dimdimUser.getEntryUID() == null) { + dimdimUser.setEntryUID(dimdimService.createNotebookEntry(toolSessionID, + CoreNotebookConstants.NOTEBOOK_TOOL, Constants.TOOL_SIGNATURE, dimdimUser.getUserId() + .intValue(), learningForm.getEntryText())); + } else { + // update existing entry. + dimdimService.updateEntry(dimdimUser.getEntryUID(), learningForm.getEntryText()); + } - ToolSessionManager sessionMgrService = DimdimServiceProxy - .getDimdimSessionManager(getServlet().getServletContext()); + dimdimUser.setFinishedActivity(true); + dimdimService.saveOrUpdateDimdimUser(dimdimUser); + } else { + logger.error("finishActivity(): couldn't find/create DimdimUser in toolSessionID: " + toolSessionID); + } - String nextActivityUrl; - try { - nextActivityUrl = sessionMgrService.leaveToolSession(toolSessionID, - dimdimUser.getUserId()); - response.sendRedirect(nextActivityUrl); - } catch (DataMissingException e) { - throw new DimdimException(e); - } catch (ToolException e) { - throw new DimdimException(e); - } catch (IOException e) { - throw new DimdimException(e); - } + ToolSessionManager sessionMgrService = DimdimServiceProxy.getDimdimSessionManager(getServlet() + .getServletContext()); - return null; // TODO need to return proper page. + String nextActivityUrl; + try { + nextActivityUrl = sessionMgrService.leaveToolSession(toolSessionID, dimdimUser.getUserId()); + response.sendRedirect(nextActivityUrl); + } catch (DataMissingException e) { + throw new DimdimException(e); + } catch (ToolException e) { + throw new DimdimException(e); + } catch (IOException e) { + throw new DimdimException(e); } + + return null; // TODO need to return proper page. + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/actions/MonitoringAction.java =================================================================== diff -u -r65ab476801260e17f27b0f625ec4daa6a5a8d7fd -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/actions/MonitoringAction.java (.../MonitoringAction.java) (revision 65ab476801260e17f27b0f625ec4daa6a5a8d7fd) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/actions/MonitoringAction.java (.../MonitoringAction.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -50,108 +50,98 @@ * @author * @version * - * @struts.action path="/monitoring" parameter="dispatch" scope="request" - * name="monitoringForm" validate="false" + * @struts.action path="/monitoring" parameter="dispatch" scope="request" name="monitoringForm" validate="false" * * @struts.action-forward name="success" path="tiles:/monitoring/main" - * @struts.action-forward name="dimdim_display" - * path="tiles:/monitoring/dimdim_display" + * @struts.action-forward name="dimdim_display" path="tiles:/monitoring/dimdim_display" */ public class MonitoringAction extends DispatchAction { - // private static final Logger logger = - // Logger.getLogger(MonitoringAction.class); + // private static final Logger logger = + // Logger.getLogger(MonitoringAction.class); - private IDimdimService dimdimService; + private IDimdimService dimdimService; - @Override - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { + @Override + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws Exception { - // set up dimdimService - dimdimService = DimdimServiceProxy.getDimdimService(this.getServlet() - .getServletContext()); + // set up dimdimService + dimdimService = DimdimServiceProxy.getDimdimService(this.getServlet().getServletContext()); - return super.execute(mapping, form, request, response); - } + return super.execute(mapping, form, request, response); + } - public ActionForward unspecified(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) { + public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { - Long toolContentID = new Long(WebUtil.readLongParam(request, - AttributeNames.PARAM_TOOL_CONTENT_ID)); + Long toolContentID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID)); - String contentFolderID = WebUtil.readStrParam(request, - AttributeNames.PARAM_CONTENT_FOLDER_ID); + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); - Dimdim dimdim = dimdimService.getDimdimByContentId(toolContentID); + Dimdim dimdim = dimdimService.getDimdimByContentId(toolContentID); - if (dimdim == null) { - // TODO error page. - } + if (dimdim == null) { + // TODO error page. + } - ContentDTO contentDT0 = new ContentDTO(dimdim); + ContentDTO contentDT0 = new ContentDTO(dimdim); - MonitoringForm monitoringForm = (MonitoringForm) form; - // populate using authoring values - monitoringForm.setTopic(contentDT0.getTopic()); - monitoringForm.setMaxAttendeeMikes((contentDT0.getMaxAttendeeMikes())); + MonitoringForm monitoringForm = (MonitoringForm) form; + // populate using authoring values + monitoringForm.setTopic(contentDT0.getTopic()); + monitoringForm.setMaxAttendeeMikes((contentDT0.getMaxAttendeeMikes())); - // TODO may need to populate using session values if they already exist + // TODO may need to populate using session values if they already exist - Long currentTab = WebUtil.readLongParam(request, - AttributeNames.PARAM_CURRENT_TAB, true); - contentDT0.setCurrentTab(currentTab); + Long currentTab = WebUtil.readLongParam(request, AttributeNames.PARAM_CURRENT_TAB, true); + contentDT0.setCurrentTab(currentTab); - request.setAttribute(Constants.ATTR_CONTENT_DTO, contentDT0); - request.setAttribute(Constants.ATTR_CONTENT_FOLDER_ID, contentFolderID); - return mapping.findForward("success"); - } + request.setAttribute(Constants.ATTR_CONTENT_DTO, contentDT0); + request.setAttribute(Constants.ATTR_CONTENT_FOLDER_ID, contentFolderID); + return mapping.findForward("success"); + } - public ActionForward showDimdim(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) { - Long uid = new Long(WebUtil.readLongParam(request, - Constants.PARAM_USER_UID)); + public ActionForward showDimdim(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + Long uid = new Long(WebUtil.readLongParam(request, Constants.PARAM_USER_UID)); - DimdimUser user = dimdimService.getUserByUID(uid); - NotebookEntry entry = dimdimService.getEntry(user.getEntryUID()); + DimdimUser user = dimdimService.getUserByUID(uid); + NotebookEntry entry = dimdimService.getEntry(user.getEntryUID()); - UserDTO userDTO = new UserDTO(user, entry); + UserDTO userDTO = new UserDTO(user, entry); - request.setAttribute(Constants.ATTR_USER_DTO, userDTO); + request.setAttribute(Constants.ATTR_USER_DTO, userDTO); - return mapping.findForward("dimdim_display"); - } + return mapping.findForward("dimdim_display"); + } - public ActionForward startDimdim(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) - throws Exception { + public ActionForward startDimdim(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws Exception { - MonitoringForm monitoringForm = (MonitoringForm) form; + MonitoringForm monitoringForm = (MonitoringForm) form; - // get dimdim session - DimdimSession session = dimdimService - .getSessionBySessionId(monitoringForm.getToolSessionID()); + // get dimdim session + DimdimSession session = dimdimService.getSessionBySessionId(monitoringForm.getToolSessionID()); - // update dimdim meeting settings - session.setTopic(monitoringForm.getTopic()); - session.setMaxAttendeeMikes(monitoringForm.getMaxAttendeeMikes()); + // update dimdim meeting settings + session.setTopic(monitoringForm.getTopic()); + session.setMaxAttendeeMikes(monitoringForm.getMaxAttendeeMikes()); - // Get LAMS userDTO - org.lamsfoundation.lams.usermanagement.dto.UserDTO lamsUserDTO = (org.lamsfoundation.lams.usermanagement.dto.UserDTO) SessionManager - .getSession().getAttribute(AttributeNames.USER); + // Get LAMS userDTO + org.lamsfoundation.lams.usermanagement.dto.UserDTO lamsUserDTO = (org.lamsfoundation.lams.usermanagement.dto.UserDTO) SessionManager + .getSession().getAttribute(AttributeNames.USER); - String meetingKey = DimdimUtil.generateMeetingKey(); - session.setMeetingKey(meetingKey); - dimdimService.saveOrUpdateDimdimSession(session); + String meetingKey = DimdimUtil.generateMeetingKey(); + session.setMeetingKey(meetingKey); + dimdimService.saveOrUpdateDimdimSession(session); - String startConferenceURL = dimdimService.getDimdimStartConferenceURL( - lamsUserDTO, session.getMeetingKey(), session.getTopic()); + String startConferenceURL = dimdimService.getDimdimStartConferenceURL(lamsUserDTO, session.getMeetingKey(), + session.getTopic()); - response.sendRedirect(startConferenceURL); + response.sendRedirect(startConferenceURL); - return null; + return null; - } + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/forms/AdminForm.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/forms/AdminForm.java (.../AdminForm.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/forms/AdminForm.java (.../AdminForm.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -37,30 +37,29 @@ */ public class AdminForm extends ActionForm { - private static final long serialVersionUID = 8367278543453322252L; + private static final long serialVersionUID = 8367278543453322252L; - // Fields + // Fields - private String dimdimServerURL; + private String dimdimServerURL; - @Override - public ActionErrors validate(ActionMapping mapping, - HttpServletRequest request) { + @Override + public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { - ActionErrors errors = new ActionErrors(); + ActionErrors errors = new ActionErrors(); - if (StringUtils.isBlank(this.dimdimServerURL)) { - // TODO add error messages; - } - return errors; + if (StringUtils.isBlank(this.dimdimServerURL)) { + // TODO add error messages; } + return errors; + } - public String getDimdimServerURL() { - return dimdimServerURL; - } + public String getDimdimServerURL() { + return dimdimServerURL; + } - public void setDimdimServerURL(String dimdimServerURL) { - this.dimdimServerURL = dimdimServerURL; - } + public void setDimdimServerURL(String dimdimServerURL) { + this.dimdimServerURL = dimdimServerURL; + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/forms/AuthoringForm.java =================================================================== diff -u -r65ab476801260e17f27b0f625ec4daa6a5a8d7fd -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/forms/AuthoringForm.java (.../AuthoringForm.java) (revision 65ab476801260e17f27b0f625ec4daa6a5a8d7fd) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/forms/AuthoringForm.java (.../AuthoringForm.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -39,167 +39,166 @@ */ public class AuthoringForm extends ActionForm { - private static final long serialVersionUID = 3950453134542135495L; + private static final long serialVersionUID = 3950453134542135495L; - // Fields + // Fields - private String title; + private String title; - private String instructions; + private String instructions; - private String offlineInstruction; + private String offlineInstruction; - private String onlineInstruction; + private String onlineInstruction; - private boolean lockOnFinished; + private boolean lockOnFinished; - private boolean allowRichEditor; + private boolean allowRichEditor; - private FormFile onlineFile; + private FormFile onlineFile; - private FormFile offlineFile; + private FormFile offlineFile; - private String currentTab; + private String currentTab; - private String dispatch; + private String dispatch; - private String sessionMapID; + private String sessionMapID; - private Long deleteFileUuid; + private Long deleteFileUuid; - private SessionMap sessionMap; + private SessionMap sessionMap; - private String topic; + private String topic; - private Integer maxAttendeeMikes; + private Integer maxAttendeeMikes; - @Override - public ActionErrors validate(ActionMapping arg0, HttpServletRequest arg1) { - ActionErrors ac = new ActionErrors(); - ac.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage( - "this is an error")); + @Override + public ActionErrors validate(ActionMapping arg0, HttpServletRequest arg1) { + ActionErrors ac = new ActionErrors(); + ac.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("this is an error")); - return ac; - } + return ac; + } - public String getSessionMapID() { - return sessionMapID; - } + public String getSessionMapID() { + return sessionMapID; + } - public void setSessionMapID(String sessionMapID) { - this.sessionMapID = sessionMapID; - } + public void setSessionMapID(String sessionMapID) { + this.sessionMapID = sessionMapID; + } - public String getCurrentTab() { - return currentTab; - } + public String getCurrentTab() { + return currentTab; + } - public void setCurrentTab(String currentTab) { - this.currentTab = currentTab; - } + public void setCurrentTab(String currentTab) { + this.currentTab = currentTab; + } - public String getDispatch() { - return dispatch; - } + public String getDispatch() { + return dispatch; + } - public void setDispatch(String dispatch) { - this.dispatch = dispatch; - } + public void setDispatch(String dispatch) { + this.dispatch = dispatch; + } - public String getInstructions() { - return instructions; - } + public String getInstructions() { + return instructions; + } - public void setInstructions(String instructions) { - this.instructions = instructions; - } + public void setInstructions(String instructions) { + this.instructions = instructions; + } - public boolean isLockOnFinished() { - return lockOnFinished; - } + public boolean isLockOnFinished() { + return lockOnFinished; + } - public void setLockOnFinished(boolean lockOnFinished) { - this.lockOnFinished = lockOnFinished; - } + public void setLockOnFinished(boolean lockOnFinished) { + this.lockOnFinished = lockOnFinished; + } - public FormFile getOfflineFile() { - return offlineFile; - } + public FormFile getOfflineFile() { + return offlineFile; + } - public void setOfflineFile(FormFile offlineFile) { - this.offlineFile = offlineFile; - } + public void setOfflineFile(FormFile offlineFile) { + this.offlineFile = offlineFile; + } - public String getOfflineInstruction() { - return offlineInstruction; - } + public String getOfflineInstruction() { + return offlineInstruction; + } - public void setOfflineInstruction(String offlineInstruction) { - this.offlineInstruction = offlineInstruction; - } + public void setOfflineInstruction(String offlineInstruction) { + this.offlineInstruction = offlineInstruction; + } - public FormFile getOnlineFile() { - return onlineFile; - } + public FormFile getOnlineFile() { + return onlineFile; + } - public void setOnlineFile(FormFile onlineFile) { - this.onlineFile = onlineFile; - } + public void setOnlineFile(FormFile onlineFile) { + this.onlineFile = onlineFile; + } - public String getOnlineInstruction() { - return onlineInstruction; - } + public String getOnlineInstruction() { + return onlineInstruction; + } - public void setOnlineInstruction(String onlineInstruction) { - this.onlineInstruction = onlineInstruction; - } + public void setOnlineInstruction(String onlineInstruction) { + this.onlineInstruction = onlineInstruction; + } - public String getTitle() { - return title; - } + public String getTitle() { + return title; + } - public void setTitle(String title) { - this.title = title; - } + public void setTitle(String title) { + this.title = title; + } - public void setSessionMap(SessionMap sessionMap) { - this.sessionMap = sessionMap; - } + public void setSessionMap(SessionMap sessionMap) { + this.sessionMap = sessionMap; + } - public SessionMap getSessionMap() { - return sessionMap; - } + public SessionMap getSessionMap() { + return sessionMap; + } - public Long getDeleteFileUuid() { - return deleteFileUuid; - } + public Long getDeleteFileUuid() { + return deleteFileUuid; + } - public void setDeleteFileUuid(Long deleteFile) { - this.deleteFileUuid = deleteFile; - } + public void setDeleteFileUuid(Long deleteFile) { + this.deleteFileUuid = deleteFile; + } - public boolean isAllowRichEditor() { - return allowRichEditor; - } + public boolean isAllowRichEditor() { + return allowRichEditor; + } - public void setAllowRichEditor(boolean allowRichEditor) { - this.allowRichEditor = allowRichEditor; - } + public void setAllowRichEditor(boolean allowRichEditor) { + this.allowRichEditor = allowRichEditor; + } - public String getTopic() { - return topic; - } + public String getTopic() { + return topic; + } - public void setTopic(String topic) { - this.topic = topic; - } + public void setTopic(String topic) { + this.topic = topic; + } - public Integer getMaxAttendeeMikes() { - return maxAttendeeMikes; - } + public Integer getMaxAttendeeMikes() { + return maxAttendeeMikes; + } - public void setMaxAttendeeMikes(Integer maxAttendeeMikes) { - this.maxAttendeeMikes = maxAttendeeMikes; - } + public void setMaxAttendeeMikes(Integer maxAttendeeMikes) { + this.maxAttendeeMikes = maxAttendeeMikes; + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/forms/LearningForm.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/forms/LearningForm.java (.../LearningForm.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/forms/LearningForm.java (.../LearningForm.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -34,67 +34,67 @@ */ public class LearningForm extends ActionForm { - private static final long serialVersionUID = -4728946254882237144L; + private static final long serialVersionUID = -4728946254882237144L; - // Fields + // Fields - private String title; + private String title; - private String instructions; + private String instructions; - private String dispatch; + private String dispatch; - private Long toolSessionID; + private Long toolSessionID; - private String mode; + private String mode; - private String entryText; + private String entryText; - public String getMode() { - return mode; - } + public String getMode() { + return mode; + } - public void setMode(String mode) { - this.mode = mode; - } + public void setMode(String mode) { + this.mode = mode; + } - public String getDispatch() { - return dispatch; - } + public String getDispatch() { + return dispatch; + } - public void setDispatch(String dispatch) { - this.dispatch = dispatch; - } + public void setDispatch(String dispatch) { + this.dispatch = dispatch; + } - public Long getToolSessionID() { - return toolSessionID; - } + public Long getToolSessionID() { + return toolSessionID; + } - public void setToolSessionID(Long toolSessionID) { - this.toolSessionID = toolSessionID; - } + public void setToolSessionID(Long toolSessionID) { + this.toolSessionID = toolSessionID; + } - public String getInstructions() { - return instructions; - } + public String getInstructions() { + return instructions; + } - public void setInstructions(String instructions) { - this.instructions = instructions; - } + public void setInstructions(String instructions) { + this.instructions = instructions; + } - public String getTitle() { - return title; - } + public String getTitle() { + return title; + } - public void setTitle(String title) { - this.title = title; - } + public void setTitle(String title) { + this.title = title; + } - public String getEntryText() { - return entryText; - } + public String getEntryText() { + return entryText; + } - public void setEntryText(String entryText) { - this.entryText = entryText; - } + public void setEntryText(String entryText) { + this.entryText = entryText; + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/forms/MonitoringForm.java =================================================================== diff -u -r65ab476801260e17f27b0f625ec4daa6a5a8d7fd -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/forms/MonitoringForm.java (.../MonitoringForm.java) (revision 65ab476801260e17f27b0f625ec4daa6a5a8d7fd) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/forms/MonitoringForm.java (.../MonitoringForm.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -31,47 +31,47 @@ */ public class MonitoringForm extends ActionForm { - private static final long serialVersionUID = 9096908688391850595L; + private static final long serialVersionUID = 9096908688391850595L; - // Fields + // Fields - private String dispatch; + private String dispatch; - private Long toolSessionID; + private Long toolSessionID; - private String topic; + private String topic; - private Integer maxAttendeeMikes; + private Integer maxAttendeeMikes; - public String getDispatch() { - return dispatch; - } + public String getDispatch() { + return dispatch; + } - public void setDispatch(String dispatch) { - this.dispatch = dispatch; - } + public void setDispatch(String dispatch) { + this.dispatch = dispatch; + } - public Long getToolSessionID() { - return toolSessionID; - } + public Long getToolSessionID() { + return toolSessionID; + } - public void setToolSessionID(Long toolSessionID) { - this.toolSessionID = toolSessionID; - } + public void setToolSessionID(Long toolSessionID) { + this.toolSessionID = toolSessionID; + } - public String getTopic() { - return topic; - } + public String getTopic() { + return topic; + } - public void setTopic(String topic) { - this.topic = topic; - } + public void setTopic(String topic) { + this.topic = topic; + } - public Integer getMaxAttendeeMikes() { - return maxAttendeeMikes; - } + public Integer getMaxAttendeeMikes() { + return maxAttendeeMikes; + } - public void setMaxAttendeeMikes(Integer maxAttendeeMikes) { - this.maxAttendeeMikes = maxAttendeeMikes; - } + public void setMaxAttendeeMikes(Integer maxAttendeeMikes) { + this.maxAttendeeMikes = maxAttendeeMikes; + } } Index: lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/servlets/ExportServlet.java =================================================================== diff -u -rdd2cdfe15f7842b4257a1cb2a3c433f12e0929c3 -rd6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6 --- lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/servlets/ExportServlet.java (.../ExportServlet.java) (revision dd2cdfe15f7842b4257a1cb2a3c433f12e0929c3) +++ lams_tool_dimdim/src/java/org/lamsfoundation/lams/tool/dimdim/web/servlets/ExportServlet.java (.../ExportServlet.java) (revision d6d2a4921fc7dcdcf19f722ff0a4d6b28a15fbb6) @@ -41,86 +41,77 @@ public class ExportServlet extends AbstractExportPortfolioServlet { - private static final long serialVersionUID = -2829707715037631881L; + private static final long serialVersionUID = -2829707715037631881L; - private static final Logger logger = Logger.getLogger(ExportServlet.class); + private static final Logger logger = Logger.getLogger(ExportServlet.class); - private final String FILENAME = "dimdim_main.html"; + private final String FILENAME = "dimdim_main.html"; - private IDimdimService dimdimService; + private IDimdimService dimdimService; - protected String doExport(HttpServletRequest request, - HttpServletResponse response, String directoryName, Cookie[] cookies) { + protected String doExport(HttpServletRequest request, HttpServletResponse response, String directoryName, + Cookie[] cookies) { - setupService(); + setupService(); - try { - if (StringUtils.equals(mode, ToolAccessMode.LEARNER.toString())) { - request.getSession().setAttribute(AttributeNames.ATTR_MODE, - ToolAccessMode.LEARNER); - doLearnerExport(request, response, directoryName, cookies); - } else if (StringUtils.equals(mode, ToolAccessMode.TEACHER - .toString())) { - request.getSession().setAttribute(AttributeNames.ATTR_MODE, - ToolAccessMode.TEACHER); - doTeacherExport(request, response, directoryName, cookies); - } - } catch (DimdimException e) { - logger.error("Cannot perform export for dimdim tool."); - } + try { + if (StringUtils.equals(mode, ToolAccessMode.LEARNER.toString())) { + request.getSession().setAttribute(AttributeNames.ATTR_MODE, ToolAccessMode.LEARNER); + doLearnerExport(request, response, directoryName, cookies); + } else if (StringUtils.equals(mode, ToolAccessMode.TEACHER.toString())) { + request.getSession().setAttribute(AttributeNames.ATTR_MODE, ToolAccessMode.TEACHER); + doTeacherExport(request, response, directoryName, cookies); + } + } catch (DimdimException e) { + logger.error("Cannot perform export for dimdim tool."); + } - String basePath = request.getScheme() + "://" + request.getServerName() - + ":" + request.getServerPort() + request.getContextPath(); - writeResponseToFile(basePath + "/pages/export/exportPortfolio.jsp", - directoryName, FILENAME, cookies); + String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + + request.getContextPath(); + writeResponseToFile(basePath + "/pages/export/exportPortfolio.jsp", directoryName, FILENAME, cookies); - return FILENAME; - } + return FILENAME; + } - protected String doOfflineExport(HttpServletRequest request, - HttpServletResponse response, String directoryName, Cookie[] cookies) { - if (toolContentID == null && toolSessionID == null) { - logger - .error("Tool content Id or and session Id are null. Unable to activity title"); - } else { - setupService(); + protected String doOfflineExport(HttpServletRequest request, HttpServletResponse response, String directoryName, + Cookie[] cookies) { + if (toolContentID == null && toolSessionID == null) { + logger.error("Tool content Id or and session Id are null. Unable to activity title"); + } else { + setupService(); - Dimdim content = null; - if (toolContentID != null) { - content = dimdimService.getDimdimByContentId(toolContentID); - } else { - DimdimSession session = dimdimService - .getSessionBySessionId(toolSessionID); - if (session != null) - content = session.getDimdim(); - } - if (content != null) { - activityTitle = content.getTitle(); - } - } - return super.doOfflineExport(request, response, directoryName, cookies); + Dimdim content = null; + if (toolContentID != null) { + content = dimdimService.getDimdimByContentId(toolContentID); + } else { + DimdimSession session = dimdimService.getSessionBySessionId(toolSessionID); + if (session != null) + content = session.getDimdim(); + } + if (content != null) { + activityTitle = content.getTitle(); + } } + return super.doOfflineExport(request, response, directoryName, cookies); + } - private void doLearnerExport(HttpServletRequest request, - HttpServletResponse response, String directoryName, Cookie[] cookies) - throws DimdimException { + private void doLearnerExport(HttpServletRequest request, HttpServletResponse response, String directoryName, + Cookie[] cookies) throws DimdimException { - logger.debug("doExportLearner: toolContentID:" + toolSessionID); + logger.debug("doExportLearner: toolContentID:" + toolSessionID); - } + } - private void doTeacherExport(HttpServletRequest request, - HttpServletResponse response, String directoryName, Cookie[] cookies) - throws DimdimException { + private void doTeacherExport(HttpServletRequest request, HttpServletResponse response, String directoryName, + Cookie[] cookies) throws DimdimException { - logger.debug("doExportTeacher: toolContentID:" + toolContentID); + logger.debug("doExportTeacher: toolContentID:" + toolContentID); - } + } - private void setupService() { - if (dimdimService == null) { - dimdimService = DimdimServiceProxy - .getDimdimService(getServletContext()); - } + private void setupService() { + if (dimdimService == null) { + dimdimService = DimdimServiceProxy.getDimdimService(getServletContext()); } + } }