Index: lams_tool_chat/db/model/chat_tool.clay =================================================================== diff -u -red16d5f8991580c9160628f30a49e947a0b154bb -r7312ae351ea504413d8b1976d9ed866c91eceb95 --- lams_tool_chat/db/model/chat_tool.clay (.../chat_tool.clay) (revision ed16d5f8991580c9160628f30a49e947a0b154bb) +++ lams_tool_chat/db/model/chat_tool.clay (.../chat_tool.clay) (revision 7312ae351ea504413d8b1976d9ed866c91eceb95) @@ -12,15 +12,15 @@ - +
- + - + @@ -32,8 +32,8 @@ - + @@ -59,8 +59,8 @@ - + @@ -78,8 +78,8 @@ - + @@ -95,25 +95,34 @@ - + - + + + + + + + + + +
- +
- + - + @@ -137,8 +146,8 @@ - + @@ -162,28 +171,14 @@ - - - - - - - - - + + - - - - - - - - - + + @@ -200,35 +195,21 @@ - - - - - - - - - + + - - - - - - - - - + + - + @@ -245,21 +226,21 @@ - + - +
- +
- + - + @@ -268,11 +249,24 @@ - + + + + + + + + + + + + + + @@ -281,59 +275,67 @@ - + - + - - - - - - - - - - - - - - + - + + + + + + + + + - + + + + + + + + + + + + + +
- +
- + - + @@ -357,8 +359,8 @@ - + @@ -367,11 +369,31 @@ - + + + + + + + + + + + + + + + + + + + + + @@ -380,11 +402,61 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + @@ -393,29 +465,72 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + + + + + + + + + +
Index: lams_tool_chat/db/sql/create_lams_tool_chat.sql =================================================================== diff -u -rbbb7be61818ecfad3b0287dd3161ab98fa3b3ebb -r7312ae351ea504413d8b1976d9ed866c91eceb95 --- lams_tool_chat/db/sql/create_lams_tool_chat.sql (.../create_lams_tool_chat.sql) (revision bbb7be61818ecfad3b0287dd3161ab98fa3b3ebb) +++ lams_tool_chat/db/sql/create_lams_tool_chat.sql (.../create_lams_tool_chat.sql) (revision 7312ae351ea504413d8b1976d9ed866c91eceb95) @@ -1,9 +1,9 @@ -- CVS ID: $Id$ SET FOREIGN_KEY_CHECKS=0; - drop table if exists tl_lachat11_attachment; drop table if exists tl_lachat11_chat; +drop table if exists tl_lachat11_message; drop table if exists tl_lachat11_session; drop table if exists tl_lachat11_user; create table tl_lachat11_attachment ( @@ -32,6 +32,14 @@ tool_content_id bigint, primary key (uid) ); +create table tl_lachat11_message ( + uid bigint not null auto_increment, + from_user_id bigint, + to_user_id bigint, + type varchar(255), + body varchar(255), + primary key (uid) +); create table tl_lachat11_session ( uid bigint not null auto_increment, session_end_date datetime, @@ -54,6 +62,8 @@ primary key (uid) ); alter table tl_lachat11_attachment add index FK9ED6CB2E1A3926E3 (chat_uid), add constraint FK9ED6CB2E1A3926E3 foreign key (chat_uid) references tl_lachat11_chat (uid); +alter table tl_lachat11_message add index FKCC08C1DCC15A415F (from_user_id), add constraint FKCC08C1DCC15A415F foreign key (from_user_id) references tl_lachat11_user (uid); +alter table tl_lachat11_message add index FKCC08C1DC50B2D730 (to_user_id), add constraint FKCC08C1DC50B2D730 foreign key (to_user_id) references tl_lachat11_user (uid); alter table tl_lachat11_session add index FK96E446B1A3926E3 (chat_uid), add constraint FK96E446B1A3926E3 foreign key (chat_uid) references tl_lachat11_chat (uid); alter table tl_lachat11_user add index FK4EB8216C10360A0 (session_id), add constraint FK4EB8216C10360A0 foreign key (session_id) references tl_lachat11_session (uid); Index: lams_tool_chat/db/sql/table-schema.sql =================================================================== diff -u -rf6896d81b085f15a8903660c926abf0ad7b2d4bf -r7312ae351ea504413d8b1976d9ed866c91eceb95 --- lams_tool_chat/db/sql/table-schema.sql (.../table-schema.sql) (revision f6896d81b085f15a8903660c926abf0ad7b2d4bf) +++ lams_tool_chat/db/sql/table-schema.sql (.../table-schema.sql) (revision 7312ae351ea504413d8b1976d9ed866c91eceb95) @@ -1,8 +1,11 @@ alter table tl_lachat11_attachment drop foreign key FK9ED6CB2E1A3926E3; +alter table tl_lachat11_message drop foreign key FKCC08C1DCC15A415F; +alter table tl_lachat11_message drop foreign key FKCC08C1DC50B2D730; alter table tl_lachat11_session drop foreign key FK96E446B1A3926E3; alter table tl_lachat11_user drop foreign key FK4EB8216C10360A0; drop table if exists tl_lachat11_attachment; drop table if exists tl_lachat11_chat; +drop table if exists tl_lachat11_message; drop table if exists tl_lachat11_session; drop table if exists tl_lachat11_user; create table tl_lachat11_attachment ( @@ -31,6 +34,14 @@ tool_content_id bigint, primary key (uid) ); +create table tl_lachat11_message ( + uid bigint not null auto_increment, + from_user_id bigint, + to_user_id bigint, + type varchar(255), + body varchar(255), + primary key (uid) +); create table tl_lachat11_session ( uid bigint not null auto_increment, session_end_date datetime, @@ -53,5 +64,7 @@ primary key (uid) ); alter table tl_lachat11_attachment add index FK9ED6CB2E1A3926E3 (chat_uid), add constraint FK9ED6CB2E1A3926E3 foreign key (chat_uid) references tl_lachat11_chat (uid); +alter table tl_lachat11_message add index FKCC08C1DCC15A415F (from_user_id), add constraint FKCC08C1DCC15A415F foreign key (from_user_id) references tl_lachat11_user (uid); +alter table tl_lachat11_message add index FKCC08C1DC50B2D730 (to_user_id), add constraint FKCC08C1DC50B2D730 foreign key (to_user_id) references tl_lachat11_user (uid); alter table tl_lachat11_session add index FK96E446B1A3926E3 (chat_uid), add constraint FK96E446B1A3926E3 foreign key (chat_uid) references tl_lachat11_chat (uid); alter table tl_lachat11_user add index FK4EB8216C10360A0 (session_id), add constraint FK4EB8216C10360A0 foreign key (session_id) references tl_lachat11_session (uid); Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/chatApplicationContext.xml =================================================================== diff -u -rb70e2750284cb613bbe37fb30b69091d679c3bf4 -r7312ae351ea504413d8b1976d9ed866c91eceb95 --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/chatApplicationContext.xml (.../chatApplicationContext.xml) (revision b70e2750284cb613bbe37fb30b69091d679c3bf4) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/chatApplicationContext.xml (.../chatApplicationContext.xml) (revision 7312ae351ea504413d8b1976d9ed866c91eceb95) @@ -18,6 +18,7 @@ org/lamsfoundation/lams/tool/chat/model/Chat.hbm.xml org/lamsfoundation/lams/tool/chat/model/ChatSession.hbm.xml org/lamsfoundation/lams/tool/chat/model/ChatUser.hbm.xml + org/lamsfoundation/lams/tool/chat/model/ChatMessage.hbm.xml org/lamsfoundation/lams/tool/chat/model/ChatAttachment.hbm.xml @@ -30,6 +31,7 @@ + @@ -72,6 +74,10 @@ + + + + Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatMessageDAO.java =================================================================== diff -u --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatMessageDAO.java (revision 0) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/IChatMessageDAO.java (revision 7312ae351ea504413d8b1976d9ed866c91eceb95) @@ -0,0 +1,38 @@ +/**************************************************************** + * 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.dao; + +import org.lamsfoundation.lams.dao.IBaseDAO; +import org.lamsfoundation.lams.tool.chat.model.ChatMessage; + +/** + * DAO for accessing the ChatMessage objects - interface defining + * methods to be implemented by the Hibernate or other implementation. + */ +public interface IChatMessageDAO extends IBaseDAO { + + void saveOrUpdate(ChatMessage chatMessage); +} Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatMessageDAO.java =================================================================== diff -u --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatMessageDAO.java (revision 0) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatMessageDAO.java (revision 7312ae351ea504413d8b1976d9ed866c91eceb95) @@ -0,0 +1,38 @@ +/**************************************************************** + * 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.dao.hibernate; + +import org.lamsfoundation.lams.dao.hibernate.BaseDAO; +import org.lamsfoundation.lams.tool.chat.dao.IChatMessageDAO; +import org.lamsfoundation.lams.tool.chat.model.ChatMessage; + +public class ChatMessageDAO extends BaseDAO implements IChatMessageDAO { + + public void saveOrUpdate(ChatMessage chatMessage) { + this.getHibernateTemplate().saveOrUpdate(chatMessage); + this.getHibernateTemplate().flush(); + } +}