Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dto/ChatAttachmentDTO.java =================================================================== diff -u --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dto/ChatAttachmentDTO.java (revision 0) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dto/ChatAttachmentDTO.java (revision 1b0542c70afa5992161c6504bfbf7499ab37a1de) @@ -0,0 +1,67 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ + +package org.lamsfoundation.lams.tool.chat.dto; + +import org.lamsfoundation.lams.tool.chat.model.ChatAttachment; + +public class ChatAttachmentDTO { + + public ChatAttachmentDTO(ChatAttachment att) { + this.fileUuid = att.getFileUuid(); + this.fileName = att.getFileName(); + this.fileVersionId = att.getFileVersionId(); + } + + Long fileUuid; + + Long fileVersionId; + + String fileName; + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public Long getFileUuid() { + return fileUuid; + } + + public void setFileUuid(Long fileUuid) { + this.fileUuid = fileUuid; + } + + public Long getFileVersionId() { + return fileVersionId; + } + + public void setFileVersionId(Long fileVersionId) { + this.fileVersionId = fileVersionId; + } +} Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dto/ChatSessionDTO.java =================================================================== diff -u --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dto/ChatSessionDTO.java (revision 0) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dto/ChatSessionDTO.java (revision 1b0542c70afa5992161c6504bfbf7499ab37a1de) @@ -0,0 +1,55 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ + +package org.lamsfoundation.lams.tool.chat.dto; + +import org.lamsfoundation.lams.tool.chat.model.ChatSession; + +public class ChatSessionDTO { + public ChatSessionDTO(ChatSession sess) { + this.sessionId = sess.getSessionId(); + this.sessionName = sess.getSessionName(); + } + + Long sessionId; + + String sessionName; + + public Long getSessionId() { + return sessionId; + } + + public void setSessionId(Long sessionId) { + this.sessionId = sessionId; + } + + public String getSessionName() { + return sessionName; + } + + public void setSessionName(String sessionName) { + this.sessionName = sessionName; + } +} Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dto/MonitoringDTO.java =================================================================== diff -u --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dto/MonitoringDTO.java (revision 0) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dto/MonitoringDTO.java (revision 1b0542c70afa5992161c6504bfbf7499ab37a1de) @@ -0,0 +1,167 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ + +package org.lamsfoundation.lams.tool.chat.dto; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; +import java.util.TreeSet; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; +import org.lamsfoundation.lams.tool.chat.model.Chat; +import org.lamsfoundation.lams.tool.chat.model.ChatAttachment; +import org.lamsfoundation.lams.tool.chat.model.ChatSession; + +public class MonitoringDTO { + + private static Logger logger = Logger.getLogger(MonitoringDTO.class); + + public MonitoringDTO(Chat chat) { + toolContentId = chat.getToolContentId(); + title = chat.getTitle(); + instructions = chat.getInstructions(); + onlineInstructions = chat.getOnlineInstructions(); + offlineInstructions = chat.getOfflineInstructions(); + + // TODO create comparators for TreeSets. + onlineInstructionsFiles = new HashSet(); + offlineInstructionsFiles = new HashSet(); + + for (Iterator i = chat.getChatAttachments().iterator(); i.hasNext();) { + ChatAttachment att = (ChatAttachment) i.next(); + if (att.getFileType().equals(IToolContentHandler.TYPE_OFFLINE)) { + ChatAttachmentDTO attDTO = new ChatAttachmentDTO(att); + offlineInstructionsFiles.add(attDTO); + } else if (att.getFileType() + .equals(IToolContentHandler.TYPE_ONLINE)) { + ChatAttachmentDTO attDTO = new ChatAttachmentDTO(att); + onlineInstructionsFiles.add(attDTO); + } else { + // something is wrong. Ignore file, log error + logger.error("File with uid " + att.getFileUuid() + + " contains invalid fileType: " + att.getFileType()); + } + } + + chatSessions = new TreeSet(); + for (Iterator i = chat.getChatSessions().iterator(); i.hasNext();) { + chatSessions.add(new ChatSessionDTO((ChatSession) i.next())); + } + } + + public Long toolContentId; + + public String title; + + public String instructions; + + public String onlineInstructions; + + public String offlineInstructions; + + public Set onlineInstructionsFiles; + + public Set offlineInstructionsFiles; + + public Set chatSessions; + + public boolean chatEditable; + + public Set getChatSessions() { + return chatSessions; + } + + public void setChatSessions(Set chatSessions) { + this.chatSessions = chatSessions; + } + + public String getInstructions() { + return instructions; + } + + public void setInstructions(String instructions) { + this.instructions = instructions; + } + + public String getOfflineInstructions() { + return offlineInstructions; + } + + public void setOfflineInstructions(String offlineInstructions) { + this.offlineInstructions = offlineInstructions; + } + + public Set getOfflineInstructionsFiles() { + return offlineInstructionsFiles; + } + + public void setOfflineInstructionsFiles( + Set offlineInstructionsFiles) { + this.offlineInstructionsFiles = offlineInstructionsFiles; + } + + public String getOnlineInstructions() { + return onlineInstructions; + } + + public void setOnlineInstructions(String onlineInstructions) { + this.onlineInstructions = onlineInstructions; + } + + public Set getOnlineInstructionsFiles() { + return onlineInstructionsFiles; + } + + public void setOnlineInstructionsFiles( + Set onlineInstructionsFiles) { + this.onlineInstructionsFiles = onlineInstructionsFiles; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Long getToolContentId() { + return toolContentId; + } + + public void setToolContentId(Long toolContentID) { + this.toolContentId = toolContentID; + } + + public boolean isChatEditable() { + return chatEditable; + } + + public void setChatEditable(boolean chatEditable) { + this.chatEditable = chatEditable; + } +} \ No newline at end of file