From ee179c67cd47f2158b3502134166c5be297a62fe Mon Sep 17 00:00:00 2001 From: idfx Date: Sat, 6 Nov 2004 16:20:48 +0000 Subject: [PATCH] restoring head --- .../org/codecoop/mir/core/dao/DatabaseFailure.java | 55 +++ source/org/codecoop/mir/core/dao/IArticleDAO.java | 41 ++ .../codecoop/mir/core/dao/IArticleStatusDAO.java | 41 ++ .../org/codecoop/mir/core/dao/IArticleTypeDAO.java | 39 ++ source/org/codecoop/mir/core/dao/IBreakingDAO.java | 41 ++ source/org/codecoop/mir/core/dao/ICategoryDAO.java | 41 ++ .../codecoop/mir/core/dao/ICategoryTypeDAO.java | 41 ++ source/org/codecoop/mir/core/dao/IDAO.java | 52 +++ source/org/codecoop/mir/core/dao/IDAOFactory.java | 53 +++ source/org/codecoop/mir/core/dao/ILanguageDAO.java | 41 ++ source/org/codecoop/mir/core/dao/IMediaDAO.java | 41 ++ .../org/codecoop/mir/core/dao/IMediaFolderDAO.java | 41 ++ .../mir/core/dao/IMediaRelationTypeDAO.java | 42 ++ source/org/codecoop/mir/core/dao/IMessageDAO.java | 41 ++ .../org/codecoop/mir/core/dao/IQueryCriteria.java | 47 +++ .../codecoop/mir/core/dao/IQueryExpression.java | 41 ++ .../org/codecoop/mir/core/dao/IQueryFactory.java | 58 +++ source/org/codecoop/mir/core/dao/IQueryOrder.java | 40 ++ source/org/codecoop/mir/core/dao/ITransaction.java | 52 +++ .../codecoop/mir/core/dao/ITransactionManager.java | 48 +++ .../codecoop/mir/core/dao/IUploadedMediaDAO.java | 41 ++ source/org/codecoop/mir/core/dao/IUserDAO.java | 39 ++ source/org/codecoop/mir/core/dao/QueryFailure.java | 49 +++ .../mir/core/dao/hibernate/AbstractDAO.java | 434 +++++++++++++++++++++ .../mir/core/dao/hibernate/AllEqExpression.java | 54 +++ .../mir/core/dao/hibernate/ArticleDAO.java | 74 ++++ .../mir/core/dao/hibernate/ArticleStatusDAO.java | 60 +++ .../mir/core/dao/hibernate/ArticleTypeDAO.java | 57 +++ .../mir/core/dao/hibernate/BreakingDAO.java | 60 +++ .../mir/core/dao/hibernate/CategoryDAO.java | 44 +++ .../mir/core/dao/hibernate/CategoryTypeDAO.java | 60 +++ .../mir/core/dao/hibernate/EqExpression.java | 62 +++ .../mir/core/dao/hibernate/GeExpression.java | 53 +++ .../mir/core/dao/hibernate/GtExpression.java | 53 +++ .../core/dao/hibernate/HibernateDAOFactory.java | 164 ++++++++ .../core/dao/hibernate/HibernateQueryFactory.java | 133 +++++++ .../dao/hibernate/HibernateSessionManager.java | 210 ++++++++++ .../mir/core/dao/hibernate/LanguageDAO.java | 60 +++ .../mir/core/dao/hibernate/LeExpression.java | 53 +++ .../mir/core/dao/hibernate/LikeExpression.java | 53 +++ .../mir/core/dao/hibernate/LtExpression.java | 53 +++ .../codecoop/mir/core/dao/hibernate/MediaDAO.java | 94 +++++ .../mir/core/dao/hibernate/MediaFolderDAO.java | 60 +++ .../core/dao/hibernate/MediaRelationTypeDAO.java | 61 +++ .../mir/core/dao/hibernate/MessageDAO.java | 60 +++ .../mir/core/dao/hibernate/NotExpression.java | 54 +++ .../mir/core/dao/hibernate/QueryCriteria.java | 128 ++++++ .../mir/core/dao/hibernate/QueryExpression.java | 53 +++ .../mir/core/dao/hibernate/QueryOrder.java | 62 +++ .../mir/core/dao/hibernate/Transaction.java | 109 ++++++ .../mir/core/dao/hibernate/TransactionManager.java | 53 +++ .../mir/core/dao/hibernate/UploadedMediaDAO.java | 58 +++ .../codecoop/mir/core/dao/hibernate/UserDAO.java | 55 +++ source/org/codecoop/mir/core/model/Article.hbm.xml | 91 +++++ source/org/codecoop/mir/core/model/Article.java | 215 ++++++++++ .../codecoop/mir/core/model/ArticleStatus.hbm.xml | 26 ++ .../org/codecoop/mir/core/model/ArticleStatus.java | 111 ++++++ .../codecoop/mir/core/model/ArticleType.hbm.xml | 23 ++ .../org/codecoop/mir/core/model/ArticleType.java | 110 ++++++ .../mir/core/model/BreakingNewsItem.hbm.xml | 31 ++ .../codecoop/mir/core/model/BreakingNewsItem.java | 118 ++++++ .../org/codecoop/mir/core/model/Category.hbm.xml | 45 +++ source/org/codecoop/mir/core/model/Category.java | 188 +++++++++ .../codecoop/mir/core/model/CategoryType.hbm.xml | 23 ++ .../org/codecoop/mir/core/model/CategoryType.java | 111 ++++++ source/org/codecoop/mir/core/model/Group.hbm.xml | 34 ++ source/org/codecoop/mir/core/model/Group.java | 146 +++++++ .../org/codecoop/mir/core/model/Language.hbm.xml | 29 ++ source/org/codecoop/mir/core/model/Language.java | 123 ++++++ source/org/codecoop/mir/core/model/Media.hbm.xml | 111 ++++++ source/org/codecoop/mir/core/model/Media.java | 262 +++++++++++++ .../codecoop/mir/core/model/MediaFolder.hbm.xml | 62 +++ .../org/codecoop/mir/core/model/MediaFolder.java | 174 +++++++++ .../mir/core/model/MediaRelationType.hbm.xml | 21 + .../codecoop/mir/core/model/MediaRelationType.java | 97 +++++ .../org/codecoop/mir/core/model/MediaType.hbm.xml | 49 +++ source/org/codecoop/mir/core/model/MediaType.java | 149 +++++++ source/org/codecoop/mir/core/model/Message.hbm.xml | 41 ++ source/org/codecoop/mir/core/model/Message.java | 140 +++++++ source/org/codecoop/mir/core/model/Right.hbm.xml | 27 ++ source/org/codecoop/mir/core/model/Right.java | 117 ++++++ source/org/codecoop/mir/core/model/Role.hbm.xml | 36 ++ source/org/codecoop/mir/core/model/Role.java | 161 ++++++++ .../codecoop/mir/core/model/TypedCategory.hbm.xml | 27 ++ .../org/codecoop/mir/core/model/TypedCategory.java | 126 ++++++ .../codecoop/mir/core/model/UploadedMedia.hbm.xml | 36 ++ .../org/codecoop/mir/core/model/UploadedMedia.java | 184 +++++++++ source/org/codecoop/mir/core/model/User.hbm.xml | 69 ++++ source/org/codecoop/mir/core/model/User.java | 195 +++++++++ 89 files changed, 7117 insertions(+) create mode 100755 source/org/codecoop/mir/core/dao/DatabaseFailure.java create mode 100755 source/org/codecoop/mir/core/dao/IArticleDAO.java create mode 100755 source/org/codecoop/mir/core/dao/IArticleStatusDAO.java create mode 100755 source/org/codecoop/mir/core/dao/IArticleTypeDAO.java create mode 100755 source/org/codecoop/mir/core/dao/IBreakingDAO.java create mode 100755 source/org/codecoop/mir/core/dao/ICategoryDAO.java create mode 100755 source/org/codecoop/mir/core/dao/ICategoryTypeDAO.java create mode 100755 source/org/codecoop/mir/core/dao/IDAO.java create mode 100755 source/org/codecoop/mir/core/dao/IDAOFactory.java create mode 100755 source/org/codecoop/mir/core/dao/ILanguageDAO.java create mode 100755 source/org/codecoop/mir/core/dao/IMediaDAO.java create mode 100755 source/org/codecoop/mir/core/dao/IMediaFolderDAO.java create mode 100755 source/org/codecoop/mir/core/dao/IMediaRelationTypeDAO.java create mode 100755 source/org/codecoop/mir/core/dao/IMessageDAO.java create mode 100755 source/org/codecoop/mir/core/dao/IQueryCriteria.java create mode 100755 source/org/codecoop/mir/core/dao/IQueryExpression.java create mode 100755 source/org/codecoop/mir/core/dao/IQueryFactory.java create mode 100755 source/org/codecoop/mir/core/dao/IQueryOrder.java create mode 100755 source/org/codecoop/mir/core/dao/ITransaction.java create mode 100755 source/org/codecoop/mir/core/dao/ITransactionManager.java create mode 100755 source/org/codecoop/mir/core/dao/IUploadedMediaDAO.java create mode 100755 source/org/codecoop/mir/core/dao/IUserDAO.java create mode 100755 source/org/codecoop/mir/core/dao/QueryFailure.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/AbstractDAO.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/AllEqExpression.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/ArticleDAO.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/ArticleStatusDAO.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/ArticleTypeDAO.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/BreakingDAO.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/CategoryDAO.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/CategoryTypeDAO.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/EqExpression.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/GeExpression.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/GtExpression.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/HibernateDAOFactory.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/HibernateQueryFactory.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/HibernateSessionManager.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/LanguageDAO.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/LeExpression.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/LikeExpression.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/LtExpression.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/MediaDAO.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/MediaFolderDAO.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/MediaRelationTypeDAO.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/MessageDAO.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/NotExpression.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/QueryCriteria.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/QueryExpression.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/QueryOrder.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/Transaction.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/TransactionManager.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/UploadedMediaDAO.java create mode 100755 source/org/codecoop/mir/core/dao/hibernate/UserDAO.java create mode 100755 source/org/codecoop/mir/core/model/Article.hbm.xml create mode 100755 source/org/codecoop/mir/core/model/Article.java create mode 100755 source/org/codecoop/mir/core/model/ArticleStatus.hbm.xml create mode 100755 source/org/codecoop/mir/core/model/ArticleStatus.java create mode 100755 source/org/codecoop/mir/core/model/ArticleType.hbm.xml create mode 100755 source/org/codecoop/mir/core/model/ArticleType.java create mode 100755 source/org/codecoop/mir/core/model/BreakingNewsItem.hbm.xml create mode 100755 source/org/codecoop/mir/core/model/BreakingNewsItem.java create mode 100755 source/org/codecoop/mir/core/model/Category.hbm.xml create mode 100755 source/org/codecoop/mir/core/model/Category.java create mode 100755 source/org/codecoop/mir/core/model/CategoryType.hbm.xml create mode 100755 source/org/codecoop/mir/core/model/CategoryType.java create mode 100755 source/org/codecoop/mir/core/model/Group.hbm.xml create mode 100755 source/org/codecoop/mir/core/model/Group.java create mode 100755 source/org/codecoop/mir/core/model/Language.hbm.xml create mode 100755 source/org/codecoop/mir/core/model/Language.java create mode 100755 source/org/codecoop/mir/core/model/Media.hbm.xml create mode 100755 source/org/codecoop/mir/core/model/Media.java create mode 100755 source/org/codecoop/mir/core/model/MediaFolder.hbm.xml create mode 100755 source/org/codecoop/mir/core/model/MediaFolder.java create mode 100755 source/org/codecoop/mir/core/model/MediaRelationType.hbm.xml create mode 100755 source/org/codecoop/mir/core/model/MediaRelationType.java create mode 100755 source/org/codecoop/mir/core/model/MediaType.hbm.xml create mode 100755 source/org/codecoop/mir/core/model/MediaType.java create mode 100755 source/org/codecoop/mir/core/model/Message.hbm.xml create mode 100755 source/org/codecoop/mir/core/model/Message.java create mode 100755 source/org/codecoop/mir/core/model/Right.hbm.xml create mode 100755 source/org/codecoop/mir/core/model/Right.java create mode 100755 source/org/codecoop/mir/core/model/Role.hbm.xml create mode 100755 source/org/codecoop/mir/core/model/Role.java create mode 100755 source/org/codecoop/mir/core/model/TypedCategory.hbm.xml create mode 100755 source/org/codecoop/mir/core/model/TypedCategory.java create mode 100755 source/org/codecoop/mir/core/model/UploadedMedia.hbm.xml create mode 100755 source/org/codecoop/mir/core/model/UploadedMedia.java create mode 100755 source/org/codecoop/mir/core/model/User.hbm.xml create mode 100755 source/org/codecoop/mir/core/model/User.java diff --git a/source/org/codecoop/mir/core/dao/DatabaseFailure.java b/source/org/codecoop/mir/core/dao/DatabaseFailure.java new file mode 100755 index 00000000..a9ad41f2 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/DatabaseFailure.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + +import org.apache.commons.lang.exception.NestableException; + +/** + * DatabaseExc + * @author idefix + * @version $Id: DatabaseFailure.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + */ +public class DatabaseFailure extends NestableException { + /** + * + * @param e + */ + public DatabaseFailure(Throwable e) { + super("A DatabaseFailure occured", e); + } + + /** + * @param string + */ + public DatabaseFailure(String msg) { + super(msg); + } + +} diff --git a/source/org/codecoop/mir/core/dao/IArticleDAO.java b/source/org/codecoop/mir/core/dao/IArticleDAO.java new file mode 100755 index 00000000..62b3b881 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/IArticleDAO.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + +import org.codecoop.mir.core.model.Article; + +/** + * IArticleDAO + * @author idefix + * @version $Id: IArticleDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + */ +public interface IArticleDAO extends IDAO { + public abstract Article findArticleById(Integer id) throws DatabaseFailure; +} diff --git a/source/org/codecoop/mir/core/dao/IArticleStatusDAO.java b/source/org/codecoop/mir/core/dao/IArticleStatusDAO.java new file mode 100755 index 00000000..6795ace1 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/IArticleStatusDAO.java @@ -0,0 +1,41 @@ +/* + * $Id: IArticleStatusDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + +/** + * ICommentStatusDAO + * @author idefix + * @version $Revision: 1.1 $ + */ +public interface IArticleStatusDAO extends IDAO { + +} diff --git a/source/org/codecoop/mir/core/dao/IArticleTypeDAO.java b/source/org/codecoop/mir/core/dao/IArticleTypeDAO.java new file mode 100755 index 00000000..643e438b --- /dev/null +++ b/source/org/codecoop/mir/core/dao/IArticleTypeDAO.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + +/** + * IArticleTypeDAO + * @author idefix + * @version $Id: IArticleTypeDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + */ +public interface IArticleTypeDAO extends IDAO { + +} diff --git a/source/org/codecoop/mir/core/dao/IBreakingDAO.java b/source/org/codecoop/mir/core/dao/IBreakingDAO.java new file mode 100755 index 00000000..21b205a9 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/IBreakingDAO.java @@ -0,0 +1,41 @@ +/* + * $Id: IBreakingDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + +/** + * IBreakingDAO + * @author idefix + * @version $Revision: 1.1 $ + */ +public interface IBreakingDAO extends IDAO { + +} diff --git a/source/org/codecoop/mir/core/dao/ICategoryDAO.java b/source/org/codecoop/mir/core/dao/ICategoryDAO.java new file mode 100755 index 00000000..0cc82029 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/ICategoryDAO.java @@ -0,0 +1,41 @@ +/* + * $Id: ICategoryDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + +/** + * ICategoryDAO + * @author idefix + * @version $Revision: 1.1 $ + */ +public interface ICategoryDAO extends IDAO { + +} diff --git a/source/org/codecoop/mir/core/dao/ICategoryTypeDAO.java b/source/org/codecoop/mir/core/dao/ICategoryTypeDAO.java new file mode 100755 index 00000000..79438265 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/ICategoryTypeDAO.java @@ -0,0 +1,41 @@ +/* + * $Id: ICategoryTypeDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + +/** + * ICategoryTypeDAO + * @author idefix + * @version $Revision: 1.1 $ + */ +public interface ICategoryTypeDAO extends IDAO { + +} diff --git a/source/org/codecoop/mir/core/dao/IDAO.java b/source/org/codecoop/mir/core/dao/IDAO.java new file mode 100755 index 00000000..ccb57a0b --- /dev/null +++ b/source/org/codecoop/mir/core/dao/IDAO.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + +import java.io.Serializable; +import java.util.List; + + + +/** + * IDAO + * @author idefix + * @version $Id: IDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + */ +public interface IDAO { + public abstract List findAll() throws DatabaseFailure; + public abstract List find(int limit, int offset) throws DatabaseFailure; + public abstract List find(int limit, int offset, Object example) throws DatabaseFailure; + public abstract List find(IQueryCriteria criteria) throws DatabaseFailure; + public abstract List find(String query) throws DatabaseFailure; + public abstract void update(Object o) throws DatabaseFailure; + public abstract void saveOrUpdate(Object o) throws DatabaseFailure; + public abstract Serializable save(Object o) throws DatabaseFailure; + public abstract void delete(Object o) throws DatabaseFailure; +} diff --git a/source/org/codecoop/mir/core/dao/IDAOFactory.java b/source/org/codecoop/mir/core/dao/IDAOFactory.java new file mode 100755 index 00000000..b04bcec0 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/IDAOFactory.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + +/** + * IDAOFactory + * @author idefix + * @version $Id: IDAOFactory.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + */ +public interface IDAOFactory { + public abstract ITransactionManager createTransactionManager(); + public abstract IArticleDAO createArticleDAO(); + public abstract IArticleTypeDAO createArticleTypeDAO(); + public abstract IArticleStatusDAO createArticleStatusDAO(); + public abstract IBreakingDAO createBreakingDAO(); + public abstract ICategoryDAO createCategoryDAO(); + public abstract ICategoryTypeDAO createCategoryTypeDAO(); + public abstract IArticleStatusDAO createCommentStatusDAO(); + public abstract ILanguageDAO createLanugaeDAO(); + public abstract IMediaDAO createMediaDAO(); + public abstract IMediaFolderDAO createMediaFolderDAO(); + public abstract IMediaRelationTypeDAO createMediaRelationTypeDAO(); + public abstract IMessageDAO createMessageDAO(); + public abstract IUploadedMediaDAO createUploadedMediaDAO(); + public abstract IUserDAO createUserDAO(); +} diff --git a/source/org/codecoop/mir/core/dao/ILanguageDAO.java b/source/org/codecoop/mir/core/dao/ILanguageDAO.java new file mode 100755 index 00000000..fa45181e --- /dev/null +++ b/source/org/codecoop/mir/core/dao/ILanguageDAO.java @@ -0,0 +1,41 @@ +/* + * $Id: ILanguageDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + +/** + * ILanguageDAO + * @author idefix + * @version $Revision: 1.1 $ + */ +public interface ILanguageDAO extends IDAO { + +} diff --git a/source/org/codecoop/mir/core/dao/IMediaDAO.java b/source/org/codecoop/mir/core/dao/IMediaDAO.java new file mode 100755 index 00000000..717b2220 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/IMediaDAO.java @@ -0,0 +1,41 @@ +/* + * $Id: IMediaDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + +/** + * IMediaDAO + * @author idefix + * @version $Revision: 1.1 $ + */ +public interface IMediaDAO extends IDAO { + +} diff --git a/source/org/codecoop/mir/core/dao/IMediaFolderDAO.java b/source/org/codecoop/mir/core/dao/IMediaFolderDAO.java new file mode 100755 index 00000000..22adf76e --- /dev/null +++ b/source/org/codecoop/mir/core/dao/IMediaFolderDAO.java @@ -0,0 +1,41 @@ +/* + * $Id: IMediaFolderDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + +/** + * IMediaFolderDAO + * @author idefix + * @version $Revision: 1.1 $ + */ +public interface IMediaFolderDAO extends IDAO { + +} diff --git a/source/org/codecoop/mir/core/dao/IMediaRelationTypeDAO.java b/source/org/codecoop/mir/core/dao/IMediaRelationTypeDAO.java new file mode 100755 index 00000000..f3d8a284 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/IMediaRelationTypeDAO.java @@ -0,0 +1,42 @@ +/* + * $Id: IMediaRelationTypeDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + + +/** + * IMediaRelationTypeDAO + * @author idefix + * @version $Revision: 1.1 $ + */ +public interface IMediaRelationTypeDAO extends IDAO { + +} diff --git a/source/org/codecoop/mir/core/dao/IMessageDAO.java b/source/org/codecoop/mir/core/dao/IMessageDAO.java new file mode 100755 index 00000000..562f5bb4 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/IMessageDAO.java @@ -0,0 +1,41 @@ +/* + * $Id: IMessageDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + +/** + * IMessageDAO + * @author idefix + * @version $Revision: 1.1 $ + */ +public interface IMessageDAO extends IDAO { + +} diff --git a/source/org/codecoop/mir/core/dao/IQueryCriteria.java b/source/org/codecoop/mir/core/dao/IQueryCriteria.java new file mode 100755 index 00000000..dbc5204c --- /dev/null +++ b/source/org/codecoop/mir/core/dao/IQueryCriteria.java @@ -0,0 +1,47 @@ +/* + * $Id: IQueryCriteria.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + + + +/** + * IQueryCriteria + * @author idefix + * @version $Revision: 1.1 $ + */ +public interface IQueryCriteria { + public abstract IQueryCriteria add(IQueryExpression expression); + public abstract IQueryCriteria addOrder(IQueryOrder order); + public abstract IQueryCriteria createCriteria(String property) throws DatabaseFailure; + public abstract IQueryCriteria setLimit(int limit); + public abstract IQueryCriteria setOffset(int offset); +} diff --git a/source/org/codecoop/mir/core/dao/IQueryExpression.java b/source/org/codecoop/mir/core/dao/IQueryExpression.java new file mode 100755 index 00000000..d93fe01d --- /dev/null +++ b/source/org/codecoop/mir/core/dao/IQueryExpression.java @@ -0,0 +1,41 @@ +/* + * $Id: IQueryExpression.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + + +/** + * IExpression + * @author idefix + * @version $Revision: 1.1 $ + */ +public interface IQueryExpression { +} diff --git a/source/org/codecoop/mir/core/dao/IQueryFactory.java b/source/org/codecoop/mir/core/dao/IQueryFactory.java new file mode 100755 index 00000000..0073ba51 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/IQueryFactory.java @@ -0,0 +1,58 @@ +/* + * $Id: IQueryFactory.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + +import java.util.Map; + +/** + * IQueryFactory + * @author idefix + * @version $Revision: 1.1 $ + */ +public interface IQueryFactory { + public abstract IQueryCriteria createCriteria(Class persistentClass) + throws QueryFailure; + public abstract IQueryOrder descOrder(String property); + public abstract IQueryOrder ascOrder(String property); + public abstract IQueryExpression allEq(Map propertyNameValue); + public abstract IQueryExpression eq(String property, Object value, boolean ignoreCase); + public abstract IQueryExpression eq(String property, Object value); + public abstract IQueryExpression not(IQueryExpression expression); + public abstract IQueryExpression gt(String property, Object value); + public abstract IQueryExpression ge(String property, Object value); + public abstract IQueryExpression lt(String property, Object value); + public abstract IQueryExpression le(String property, Object value); + public abstract IQueryExpression like(String property, Object value); + + + +} diff --git a/source/org/codecoop/mir/core/dao/IQueryOrder.java b/source/org/codecoop/mir/core/dao/IQueryOrder.java new file mode 100755 index 00000000..3399e818 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/IQueryOrder.java @@ -0,0 +1,40 @@ +/* + * $Id: IQueryOrder.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + +/** + * IQueryOrder + * @author idefix + * @version $Revision: 1.1 $ + */ +public interface IQueryOrder { +} diff --git a/source/org/codecoop/mir/core/dao/ITransaction.java b/source/org/codecoop/mir/core/dao/ITransaction.java new file mode 100755 index 00000000..cee3b240 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/ITransaction.java @@ -0,0 +1,52 @@ +/* + * $Id: ITransaction.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + + +/** + * ITransactionManager + * @author idefix + * @version $Revision: 1.1 $ + */ +public interface ITransaction { + + /** + * commits the transaction + * @throws DatabaseFailure + */ + public abstract void commit() throws DatabaseFailure; + + /** + * rolls back the transaction + */ + public abstract void rollback() throws DatabaseFailure; +} diff --git a/source/org/codecoop/mir/core/dao/ITransactionManager.java b/source/org/codecoop/mir/core/dao/ITransactionManager.java new file mode 100755 index 00000000..a23de49b --- /dev/null +++ b/source/org/codecoop/mir/core/dao/ITransactionManager.java @@ -0,0 +1,48 @@ +/* + * $Id: ITransactionManager.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + + +/** + * ITransactionManager + * @author idefix + * @version $Revision: 1.1 $ + */ +public interface ITransactionManager { + + /** + * Builds a Transaction object and begins the transaction + * @return the Transaction object + * @throws DatabaseFailure + */ + public abstract ITransaction beginTransaction() throws DatabaseFailure; +} diff --git a/source/org/codecoop/mir/core/dao/IUploadedMediaDAO.java b/source/org/codecoop/mir/core/dao/IUploadedMediaDAO.java new file mode 100755 index 00000000..30b92d1a --- /dev/null +++ b/source/org/codecoop/mir/core/dao/IUploadedMediaDAO.java @@ -0,0 +1,41 @@ +/* + * $Id: IUploadedMediaDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + +/** + * IUploadedMediaDAO + * @author idefix + * @version $Revision: 1.1 $ + */ +public interface IUploadedMediaDAO extends IDAO { + +} diff --git a/source/org/codecoop/mir/core/dao/IUserDAO.java b/source/org/codecoop/mir/core/dao/IUserDAO.java new file mode 100755 index 00000000..3c50e615 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/IUserDAO.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + +/** + * IUserDAO + * @author idefix + * @version $Id: IUserDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + */ +public interface IUserDAO extends IDAO { + +} diff --git a/source/org/codecoop/mir/core/dao/QueryFailure.java b/source/org/codecoop/mir/core/dao/QueryFailure.java new file mode 100755 index 00000000..394700f3 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/QueryFailure.java @@ -0,0 +1,49 @@ +/* + * $Id: QueryFailure.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao; + +import org.apache.commons.lang.exception.NestableException; + +/** + * QueryFailure + * @author idefix + * @version $Revision: 1.1 $ + */ +public class QueryFailure extends NestableException { + + /** + * @param arg0 + */ + public QueryFailure(Throwable e) { + super("An Exception occured", e); + } +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/AbstractDAO.java b/source/org/codecoop/mir/core/dao/hibernate/AbstractDAO.java new file mode 100755 index 00000000..faebe061 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/AbstractDAO.java @@ -0,0 +1,434 @@ +/* + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Calendar; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import net.sf.hibernate.Criteria; +import net.sf.hibernate.HibernateException; +import net.sf.hibernate.Query; +import net.sf.hibernate.Session; +import net.sf.hibernate.SessionFactory; +import net.sf.hibernate.Transaction; +import net.sf.hibernate.expression.Criterion; +import net.sf.hibernate.expression.Example; +import net.sf.hibernate.expression.Expression; +import net.sf.hibernate.expression.Order; + +import org.codecoop.mir.core.dao.DatabaseFailure; +import org.codecoop.mir.core.dao.IDAO; +import org.codecoop.mir.core.dao.IQueryCriteria; + +/** + * AbstractDAO + * @author idefix + * @version $Id: AbstractDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + */ +public abstract class AbstractDAO implements IDAO { + + private static SessionFactory sessionFactory; + + /** + * Return the specific Object class that will be used for class-specific + * implementation of this DAO. + * @return the reference Class + * + */ + protected abstract Class getReferenceClass(); + + /** + * Execute a query. + * @param query a query expressed in Hibernate's query language + * @return a distinct list of instances (or arrays of instances) + */ + public List find(String query) throws DatabaseFailure { + System.out.println(query); + try { + List list = find(query, HibernateSessionManager.getSession()); + for (Iterator iter = list.iterator(); iter.hasNext();) { + initializeCollections(iter.next()); + } + return list; + } catch (HibernateException e) { + throw new DatabaseFailure(e); + } + } + + protected List find(Criteria c) throws DatabaseFailure { + try { + List returnList; + returnList = c.list(); + for (Iterator iter = returnList.iterator(); iter.hasNext();) { + initializeCollections(iter.next()); + } + return returnList; + } catch (Throwable e) { + throw new DatabaseFailure(e); + } + } + + public List find(int limit, int offset) throws DatabaseFailure { + return find(limit, offset, null, null); + } + + public List find(int limit, int offset, Object example) throws DatabaseFailure { + Example ex = Example.create(example); + ex.excludeZeroes(); + ex.excludeNone(); + ex.ignoreCase(); + return find(limit, offset, ex, null); + } + + protected List find(int limit, int offset, Criterion crit, Order order) + throws DatabaseFailure { + try { + Session s = HibernateSessionManager.getSession(); + Criteria c = s.createCriteria(getReferenceClass()); + if(crit != null){ + c.add(crit); + } + if(order != null){ + c.addOrder(order); + } + c.setFirstResult(offset); + c.setMaxResults(limit); + return find(c); + } catch (Throwable e) { + throw new DatabaseFailure(e); + } + } + + /** + * @see org.codecoop.mir.core.dao.IArticleDAO#findById(java.lang.Integer) + */ + protected Object findById(Integer id) throws DatabaseFailure{ + try { + Session s = HibernateSessionManager.getSession(); + Criteria c = s.createCriteria(getReferenceClass()); + c.add(Expression.eq("id", id)); + return find(c).get(0); + } catch (Throwable e) { + throw new DatabaseFailure(e); + } + } + + /** + * Perform a find but use the session given instead of creating a new one. + * @param query a query expressed in Hibernate's query language + * @s the Session to use + */ + protected List find(String query, Session s) throws HibernateException { + return s.find(query); + } + + /** + * Return all objects related to the implementation of this DAO with no filter. + */ + public List findAll() throws DatabaseFailure { + try { + return findAll(HibernateSessionManager.getSession()); + } catch (Throwable e) { + throw new DatabaseFailure(e); + } + } + + /** + * Return all objects related to the implementation of this DAO with no filter. + * Use the session given. + * @param s the Session + */ + protected List findAll(Session s) throws DatabaseFailure { + try { + Criteria crit = s.createCriteria(getReferenceClass()); + return find(crit); + } catch (Throwable e) { + throw new DatabaseFailure(e); + } + } + + + + public List find(IQueryCriteria criteria) throws DatabaseFailure { + if(criteria instanceof QueryCriteria){ + QueryCriteria c = (QueryCriteria)criteria; + return find(c.criteria()); + } + throw new DatabaseFailure("No applicable implementation of IQueryCriteria"); + } + + /** + * Obtain an instance of Query for a named query string defined in the mapping file. + * @param name the name of a query defined externally + * @return Query + */ + protected List getNamedQuery(String name) throws DatabaseFailure { + try { + return getNamedQuery(name, HibernateSessionManager.getSession()); + } catch (Exception e) { + throw new DatabaseFailure(e); + } + } + + /** + * Obtain an instance of Query for a named query string defined in the mapping file. + * Use the session given. + * @param name the name of a query defined externally + * @param s the Session + * @return Query + */ + protected List getNamedQuery(String name, Session s) throws HibernateException { + Query q = s.getNamedQuery(name); + return q.list(); + } + + /** + * Obtain an instance of Query for a named query string defined in the mapping file. + * Use the parameters given. + * @param name the name of a query defined externally + * @param params the parameter array + * @return Query + */ + protected List getNamedQuery(String name, Serializable[] params) + throws DatabaseFailure { + try { + return getNamedQuery(name, params, HibernateSessionManager.getSession()); + } catch (Exception e) { + throw new DatabaseFailure(e); + } + } + + /** + * Obtain an instance of Query for a named query string defined in the mapping file. + * Use the parameters given and the Session given. + * @param name the name of a query defined externally + * @param params the parameter array + * @s the Session + * @return Query + */ + protected List getNamedQuery(String name, Serializable[] params, Session s) + throws HibernateException { + Query q = s.getNamedQuery(name); + for (int i = 0; i < params.length; i++) { + setParameterValue(q, i, params[i]); + } + return q.list(); + } + + /** + * Convenience method to set paramers in the query given based on the actual object type in passed in as the value. + * You may need to add more functionaly to this as desired (or not use this at all). + * @param query the Query to set + * @param position the ordinal position of the current parameter within the query + * @param value the object to set as the parameter + */ + protected void setParameterValue(Query query, int position, Object value) { + if (null == value) { + return; + } else if (value instanceof Boolean) { + query.setBoolean(position, ((Boolean) value).booleanValue()); + } else if (value instanceof String) { + query.setString(position, (String) value); + } else if (value instanceof Integer) { + query.setInteger(position, ((Integer) value).intValue()); + } else if (value instanceof Long) { + query.setLong(position, ((Long) value).longValue()); + } else if (value instanceof Float) { + query.setFloat(position, ((Float) value).floatValue()); + } else if (value instanceof Double) { + query.setDouble(position, ((Double) value).doubleValue()); + } else if (value instanceof BigDecimal) { + query.setBigDecimal(position, (BigDecimal) value); + } else if (value instanceof Byte) { + query.setByte(position, ((Byte) value).byteValue()); + } else if (value instanceof Calendar) { + query.setCalendar(position, (Calendar) value); + } else if (value instanceof Character) { + query.setCharacter(position, ((Character) value).charValue()); + } else if (value instanceof Timestamp) { + query.setTimestamp(position, (Timestamp) value); + } else if (value instanceof Date) { + query.setDate(position, (Date) value); + } else if (value instanceof Short) { + query.setShort(position, ((Short) value).shortValue()); + } + } + + /** + * Used by the base DAO classes but here for your modification + * Load object matching the given key and return it. + */ + protected Object load(Class refClass, Serializable key) throws DatabaseFailure { + try { + return load(refClass, key, HibernateSessionManager.getSession()); + } catch (Exception e) { + throw new DatabaseFailure(e); + } + } + + /** + * Used by the base DAO classes but here for your modification + * Load object matching the given key and return it. + */ + protected Object load(Class refClass, Serializable key, Session s) + throws DatabaseFailure { + try { + return s.load(refClass, key); + } catch (HibernateException e) { + throw new DatabaseFailure(e); + } + } + + /** + * Used by the base DAO classes but here for your modification + * Persist the given transient instance, first assigning a generated identifier. + * (Or using the current value of the identifier property if the assigned generator is used.) + */ + public Serializable save(Object obj) throws DatabaseFailure { + try { + return save(obj, HibernateSessionManager.getSession()); + } catch (Throwable e) { + throw new DatabaseFailure(e); + } + } + + /** + * Used by the base DAO classes but here for your modification + * Persist the given transient instance, first assigning a generated identifier. + * (Or using the current value of the identifier property if the assigned generator is used.) + */ + protected Serializable save(Object obj, Session s) throws HibernateException { + Serializable key = null; + Transaction transaction = s.beginTransaction(); + try { + key = s.save(obj); + transaction.commit(); + } catch (HibernateException e) { + if(transaction != null){ + transaction.rollback(); + } + } + return key; + } + + /** + * Used by the base DAO classes but here for your modification + * Either save() or update() the given instance, depending upon the value of its + * identifier property. + */ + public void saveOrUpdate(Object obj) throws DatabaseFailure { + saveOrUpdate(obj, HibernateSessionManager.getSession()); + } + + /** + * Used by the base DAO classes but here for your modification + * Either save() or update() the given instance, depending upon the value of its + * identifier property. + */ + protected void saveOrUpdate(Object obj, Session s) throws DatabaseFailure { + try { + s.saveOrUpdate(obj); + } catch (Throwable e) { + throw new DatabaseFailure(e); + } + } + + /** + * Used by the base DAO classes but here for your modification + * Update the persistent state associated with the given identifier. An exception is thrown if there is a persistent + * instance with the same identifier in the current session. + * @param obj a transient instance containing updated state + * @throws + */ + public void update(Object obj) throws DatabaseFailure { + try { + update(obj, HibernateSessionManager.getSession()); + } catch (Throwable e) { + throw new DatabaseFailure(e); + } + } + + /** + * Used by the base DAO classes but here for your modification + * Update the persistent state associated with the given identifier. An exception is thrown if there is a persistent + * instance with the same identifier in the current session. + * @param obj a transient instance containing updated state + * @param s the Session + */ + protected void update(Object obj, Session s) throws DatabaseFailure { + try { + s.update(obj); + } catch (HibernateException e) { + throw new DatabaseFailure(e); + } + } + + /** + * Used by the base DAO classes but here for your modification + * Remove a persistent instance from the datastore. The argument may be an instance associated with the receiving + * Session or a transient instance with an identifier associated with existing persistent state. + */ + public void delete(Object obj) throws DatabaseFailure { + delete(obj, HibernateSessionManager.getSession()); + } + + /** + * Used by the base DAO classes but here for your modification + * Remove a persistent instance from the datastore. The argument may be an instance associated with the receiving + * Session or a transient instance with an identifier associated with existing persistent state. + */ + protected void delete(Object obj, Session s) throws DatabaseFailure { + try { + s.delete(obj); + } catch (HibernateException e) { + throw new DatabaseFailure(e); + } + } + + /** + * Used by the base DAO classes but here for your modification + * Re-read the state of the given instance from the underlying database. It is inadvisable to use this to implement + * long-running sessions that span many business tasks. This method is, however, useful in certain special circumstances. + */ + protected void refresh(Object obj, Session s) throws DatabaseFailure { + try { + s.refresh(obj); + } catch (HibernateException e) { + throw new DatabaseFailure(e); + } + } + + protected abstract void initializeCollections(Object o) throws DatabaseFailure; +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/AllEqExpression.java b/source/org/codecoop/mir/core/dao/hibernate/AllEqExpression.java new file mode 100755 index 00000000..3033a38f --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/AllEqExpression.java @@ -0,0 +1,54 @@ +/* + * $Id: AllEqExpression.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import java.util.Map; + +import net.sf.hibernate.expression.Expression; + +import org.codecoop.mir.core.dao.IQueryExpression; + +/** + * AllEqExpression + * @author idefix + * @version $Revision: 1.1 $ + */ +public class AllEqExpression extends QueryExpression implements IQueryExpression { + + /** + * @param propertyNameValue + */ + public AllEqExpression(Map propertyNameValue) { + _expression = Expression.allEq(propertyNameValue); + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/ArticleDAO.java b/source/org/codecoop/mir/core/dao/hibernate/ArticleDAO.java new file mode 100755 index 00000000..9c28433d --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/ArticleDAO.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import net.sf.hibernate.Hibernate; +import net.sf.hibernate.HibernateException; + +import org.codecoop.mir.core.dao.DatabaseFailure; +import org.codecoop.mir.core.dao.IArticleDAO; +import org.codecoop.mir.core.model.Article; + +/** + * ArticleDAO + * @author idefix + * @version $Id: ArticleDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + */ +public class ArticleDAO extends MediaDAO implements IArticleDAO { + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#getReferenceClass() + */ + protected Class getReferenceClass() { + return Article.class; + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#initializeCollections(java.lang.Object) + */ + protected void initializeCollections(Object o) throws DatabaseFailure { + super.initializeCollections(o); + if (o instanceof Article) { + Article article = (Article) o; + try { + Hibernate.initialize(article.getTypedCategories()); + } catch (HibernateException e) { + throw new DatabaseFailure(e); + } + } + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.IArticleDAO#findById(java.lang.Integer) + */ + public Article findArticleById(Integer id) throws DatabaseFailure{ + return (Article) findById(id); + } +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/ArticleStatusDAO.java b/source/org/codecoop/mir/core/dao/hibernate/ArticleStatusDAO.java new file mode 100755 index 00000000..36906c6d --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/ArticleStatusDAO.java @@ -0,0 +1,60 @@ +/* + * $Id: ArticleStatusDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import org.codecoop.mir.core.dao.DatabaseFailure; +import org.codecoop.mir.core.dao.IArticleStatusDAO; +import org.codecoop.mir.core.model.ArticleStatus; + +/** + * CommentStatusDAO + * @author idefix + * @version $Revision: 1.1 $ + */ +public class ArticleStatusDAO extends AbstractDAO implements IArticleStatusDAO { + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#getReferenceClass() + */ + protected Class getReferenceClass() { + return ArticleStatus.class; + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#initializeCollections(java.lang.Object) + */ + protected void initializeCollections(Object o) throws DatabaseFailure { + // TODO Auto-generated method stub + + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/ArticleTypeDAO.java b/source/org/codecoop/mir/core/dao/hibernate/ArticleTypeDAO.java new file mode 100755 index 00000000..1f157e8f --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/ArticleTypeDAO.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import org.codecoop.mir.core.dao.IArticleTypeDAO; +import org.codecoop.mir.core.model.ArticleType; + +/** + * ArticleTypeDAO + * @author idefix + * @version $Id: ArticleTypeDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + */ +public class ArticleTypeDAO extends AbstractDAO implements IArticleTypeDAO { + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#getReferenceClass() + */ + protected Class getReferenceClass() { + return ArticleType.class; + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#initializeCollections(java.lang.Object) + */ + protected void initializeCollections(Object o) { + // TODO Auto-generated method stub + + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/BreakingDAO.java b/source/org/codecoop/mir/core/dao/hibernate/BreakingDAO.java new file mode 100755 index 00000000..f4c4f314 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/BreakingDAO.java @@ -0,0 +1,60 @@ +/* + * $Id: BreakingDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import org.codecoop.mir.core.dao.DatabaseFailure; +import org.codecoop.mir.core.dao.IBreakingDAO; +import org.codecoop.mir.core.model.BreakingNewsItem; + +/** + * BreakingDAO + * @author idefix + * @version $Revision: 1.1 $ + */ +public class BreakingDAO extends AbstractDAO implements IBreakingDAO { + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#getReferenceClass() + */ + protected Class getReferenceClass() { + return BreakingNewsItem.class; + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#initializeCollections(java.lang.Object) + */ + protected void initializeCollections(Object o) throws DatabaseFailure { + // TODO Auto-generated method stub + + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/CategoryDAO.java b/source/org/codecoop/mir/core/dao/hibernate/CategoryDAO.java new file mode 100755 index 00000000..e454003a --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/CategoryDAO.java @@ -0,0 +1,44 @@ +/* + * Created on 28.08.2004 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Generation - Code and Comments + */ +package org.codecoop.mir.core.dao.hibernate; + +import net.sf.hibernate.Hibernate; + +import org.codecoop.mir.core.dao.DatabaseFailure; +import org.codecoop.mir.core.dao.ICategoryDAO; +import org.codecoop.mir.core.model.Category; + +/** + * CategoryDAO + * @author idefix + * $Id: CategoryDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + */ +public class CategoryDAO extends AbstractDAO implements ICategoryDAO { + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#getReferenceClass() + */ + protected Class getReferenceClass() { + return Category.class; + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#initializeCollections(java.lang.Object) + */ + protected void initializeCollections(Object o) throws DatabaseFailure { + if(o instanceof Category){ + Category c = (Category)o; + try { + Hibernate.initialize(c.getArticles()); + Hibernate.initialize(c.getChildCategories()); + } catch (Throwable e) { + throw new DatabaseFailure(e); + } + } + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/CategoryTypeDAO.java b/source/org/codecoop/mir/core/dao/hibernate/CategoryTypeDAO.java new file mode 100755 index 00000000..d5d9a5d5 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/CategoryTypeDAO.java @@ -0,0 +1,60 @@ +/* + * $Id: CategoryTypeDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import org.codecoop.mir.core.dao.DatabaseFailure; +import org.codecoop.mir.core.dao.ICategoryTypeDAO; +import org.codecoop.mir.core.model.CategoryType; + +/** + * CategoryTypeDAO + * @author idefix + * @version $Revision: 1.1 $ + */ +public class CategoryTypeDAO extends AbstractDAO implements ICategoryTypeDAO { + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#getReferenceClass() + */ + protected Class getReferenceClass() { + return CategoryType.class; + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#initializeCollections(java.lang.Object) + */ + protected void initializeCollections(Object o) throws DatabaseFailure { + // TODO Auto-generated method stub + + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/EqExpression.java b/source/org/codecoop/mir/core/dao/hibernate/EqExpression.java new file mode 100755 index 00000000..ef26bb4a --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/EqExpression.java @@ -0,0 +1,62 @@ +/* + * $Id: EqExpression.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import net.sf.hibernate.expression.Expression; + +import org.codecoop.mir.core.dao.IQueryExpression; + +/** + * EqExpression + * @author idefix + * @version $Revision: 1.1 $ + */ +public class EqExpression extends QueryExpression implements IQueryExpression { + + /** + * @param property + * @param value + * @param ignoreCase + */ + public EqExpression(String property, Object value, boolean ignoreCase) { + _expression = + new net.sf.hibernate.expression.EqExpression(property, value, ignoreCase); + } + + /** + * @param property + * @param value + */ + public EqExpression(String property, Object value) { + _expression = Expression.eq(property, value); + } +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/GeExpression.java b/source/org/codecoop/mir/core/dao/hibernate/GeExpression.java new file mode 100755 index 00000000..33ac4c9d --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/GeExpression.java @@ -0,0 +1,53 @@ +/* + * $Id: GeExpression.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import net.sf.hibernate.expression.Expression; + +import org.codecoop.mir.core.dao.IQueryExpression; + +/** + * GeExpression + * @author idefix + * @version $Revision: 1.1 $ + */ +public class GeExpression extends QueryExpression implements IQueryExpression { + + /** + * @param property + * @param value + */ + public GeExpression(String property, Object value) { + _expression = Expression.ge(property, value); + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/GtExpression.java b/source/org/codecoop/mir/core/dao/hibernate/GtExpression.java new file mode 100755 index 00000000..390ba638 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/GtExpression.java @@ -0,0 +1,53 @@ +/* + * $Id: GtExpression.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import net.sf.hibernate.expression.Expression; + +import org.codecoop.mir.core.dao.IQueryExpression; + +/** + * GtExpression + * @author idefix + * @version $Revision: 1.1 $ + */ +public class GtExpression extends QueryExpression implements IQueryExpression { + + /** + * @param property + * @param value + */ + public GtExpression(String property, Object value) { + _expression = Expression.gt(property, value); + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/HibernateDAOFactory.java b/source/org/codecoop/mir/core/dao/hibernate/HibernateDAOFactory.java new file mode 100755 index 00000000..732f20ce --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/HibernateDAOFactory.java @@ -0,0 +1,164 @@ +/* + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import org.codecoop.mir.core.dao.IArticleDAO; +import org.codecoop.mir.core.dao.IArticleTypeDAO; +import org.codecoop.mir.core.dao.IBreakingDAO; +import org.codecoop.mir.core.dao.ICategoryDAO; +import org.codecoop.mir.core.dao.ICategoryTypeDAO; +import org.codecoop.mir.core.dao.IArticleStatusDAO; +import org.codecoop.mir.core.dao.IDAOFactory; +import org.codecoop.mir.core.dao.ILanguageDAO; +import org.codecoop.mir.core.dao.IMediaDAO; +import org.codecoop.mir.core.dao.IMediaFolderDAO; +import org.codecoop.mir.core.dao.IMediaRelationTypeDAO; +import org.codecoop.mir.core.dao.IMessageDAO; +import org.codecoop.mir.core.dao.ITransactionManager; +import org.codecoop.mir.core.dao.IUploadedMediaDAO; +import org.codecoop.mir.core.dao.IUserDAO; + +/** + * DAOFactory + * @author idefix + * @version $Id: HibernateDAOFactory.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + */ +public class HibernateDAOFactory implements IDAOFactory { + private static IDAOFactory factory; + + public static synchronized IDAOFactory instance(){ + if(null == factory){ + factory = new HibernateDAOFactory(); + } + return factory; + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.IDAOFactory#createArticleDAO() + */ + public IArticleDAO createArticleDAO() { + return new ArticleDAO(); + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.IDAOFactory#createUserDAO() + */ + public IUserDAO createUserDAO() { + return new UserDAO(); + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.IDAOFactory#createArticleTypeDAO() + */ + public IArticleTypeDAO createArticleTypeDAO() { + return new ArticleTypeDAO(); + } + + public ICategoryDAO createCategoryDAO(){ + return new CategoryDAO(); + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.IDAOFactory#createBreakingDAO() + */ + public IBreakingDAO createBreakingDAO() { + return new BreakingDAO(); + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.IDAOFactory#createCategoryTypeDAO() + */ + public ICategoryTypeDAO createCategoryTypeDAO() { + return new CategoryTypeDAO(); + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.IDAOFactory#createCommentStatusDAO() + */ + public IArticleStatusDAO createCommentStatusDAO() { + return new ArticleStatusDAO(); + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.IDAOFactory#createLanugaeDAO() + */ + public ILanguageDAO createLanugaeDAO() { + return new LanguageDAO(); + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.IDAOFactory#createMediaDAO() + */ + public IMediaDAO createMediaDAO() { + return new MediaDAO(); + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.IDAOFactory#createMediaFolderDAO() + */ + public IMediaFolderDAO createMediaFolderDAO() { + return new MediaFolderDAO(); + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.IDAOFactory#createMessageDAO() + */ + public IMessageDAO createMessageDAO() { + return new MessageDAO(); + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.IDAOFactory#createUploadedMediaDAO() + */ + public IUploadedMediaDAO createUploadedMediaDAO() { + return new UploadedMediaDAO(); + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.IDAOFactory#createArticleStatusDAO() + */ + public IArticleStatusDAO createArticleStatusDAO() { + return new ArticleStatusDAO(); + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.IDAOFactory#createMediaRelationTypeDAO() + */ + public IMediaRelationTypeDAO createMediaRelationTypeDAO() { + return new MediaRelationTypeDAO(); + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.IDAOFactory#createTransactionManager() + */ + public ITransactionManager createTransactionManager() { + return new TransactionManager(); + } +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/HibernateQueryFactory.java b/source/org/codecoop/mir/core/dao/hibernate/HibernateQueryFactory.java new file mode 100755 index 00000000..b6c45e69 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/HibernateQueryFactory.java @@ -0,0 +1,133 @@ +/* + * $Id: HibernateQueryFactory.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import java.util.Map; + +import org.codecoop.mir.core.dao.IQueryCriteria; +import org.codecoop.mir.core.dao.IQueryExpression; +import org.codecoop.mir.core.dao.IQueryFactory; +import org.codecoop.mir.core.dao.IQueryOrder; +import org.codecoop.mir.core.dao.QueryFailure; + +/** + * HibernateQueryFactory + * @author idefix + * @version $Revision: 1.1 $ + */ +public class HibernateQueryFactory implements IQueryFactory { + + /** + * @see org.codecoop.mir.core.dao.IQueryFactory#createCriteria(java.lang.Class) + */ + public IQueryCriteria createCriteria(Class persistentClass) throws QueryFailure { + return new QueryCriteria(persistentClass); + } + + /** + * @see org.codecoop.mir.core.dao.IQueryFactory#descOrder(java.lang.String) + */ + public IQueryOrder descOrder(String property) { + return new QueryOrder(property, QueryOrder.DESC); + } + + /** + * @see org.codecoop.mir.core.dao.IQueryFactory#ascOrder(java.lang.String) + */ + public IQueryOrder ascOrder(String property) { + return new QueryOrder(property, QueryOrder.ASC); + } + + /** + * @see org.codecoop.mir.core.dao.IQueryFactory#allEq(java.util.Map) + */ + public IQueryExpression allEq(Map propertyNameValue) { + return new AllEqExpression(propertyNameValue); + } + + /** + * @see org.codecoop.mir.core.dao.IQueryFactory#eq(java.lang.String, java.lang.Object, boolean) + */ + public IQueryExpression eq(String property, Object value, boolean ignoreCase) { + return new EqExpression(property, value, ignoreCase); + } + + /** + * @see org.codecoop.mir.core.dao.IQueryFactory#eq(java.lang.String, java.lang.Object, boolean) + */ + public IQueryExpression eq(String property, Object value) { + return new EqExpression(property, value); + } + + /** + * @see org.codecoop.mir.core.dao.IQueryFactory#not(org.codecoop.mir.core.query.IQueryExpression) + */ + public IQueryExpression not(IQueryExpression expression) { + return new NotExpression(expression); + } + + /** + * @see org.codecoop.mir.core.dao.IQueryFactory#gt(java.lang.String, java.lang.Object) + */ + public IQueryExpression gt(String property, Object value) { + return new GtExpression(property, value); + } + + /** + * @see org.codecoop.mir.core.dao.IQueryFactory#ge(java.lang.String, java.lang.Object) + */ + public IQueryExpression ge(String property, Object value) { + return new GeExpression(property, value); + } + + /** + * @see org.codecoop.mir.core.dao.IQueryFactory#lt(java.lang.String, java.lang.Object) + */ + public IQueryExpression lt(String property, Object value) { + return new LtExpression(property, value); + } + + /** + * @see org.codecoop.mir.core.dao.IQueryFactory#le(java.lang.String, java.lang.Object) + */ + public IQueryExpression le(String property, Object value) { + return new LeExpression(property, value); + } + + /** + * @see org.codecoop.mir.core.dao.IQueryFactory#like(java.lang.String, java.lang.Object) + */ + public IQueryExpression like(String property, Object value) { + return new LikeExpression(property, value); + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/HibernateSessionManager.java b/source/org/codecoop/mir/core/dao/hibernate/HibernateSessionManager.java new file mode 100755 index 00000000..1eb051c1 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/HibernateSessionManager.java @@ -0,0 +1,210 @@ +/* + * $Id: HibernateSessionManager.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import net.sf.hibernate.HibernateException; +import net.sf.hibernate.Interceptor; +import net.sf.hibernate.Session; +import net.sf.hibernate.SessionFactory; +import net.sf.hibernate.cfg.Configuration; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codecoop.mir.core.dao.DatabaseFailure; + +/** + * HibernateUtil + * + * @author idefix + * @version $Revision: 1.1 $ + */ +class HibernateSessionManager { + + private static Log log = LogFactory.getLog(HibernateSessionManager.class); + + private static Configuration configuration; + private static SessionFactory sessionFactory; + private static final ThreadLocal threadSession = new ThreadLocal(); + private static final ThreadLocal threadInterceptor = new ThreadLocal(); + + // Create the initial SessionFactory from the default configuration files + static { + try { + configuration = new Configuration(); + sessionFactory = configuration.configure().buildSessionFactory(); + log.debug("SessionFactory built."); + } catch (Throwable ex) { + log.error("Building SessionFactory failed.", ex); + throw new ExceptionInInitializerError(ex); + } + } + + /** + * Returns the SessionFactory used for this static class. + * + * @return SessionFactory + */ + static SessionFactory getSessionFactory() { + return sessionFactory; + } + + /** + * Returns the original Hibernate configuration. + * + * @return Configuration + */ + static Configuration getConfiguration() { + return configuration; + } + + /** + * Rebuild the SessionFactory with the static Configuration. + * + */ + static void rebuildSessionFactory() throws DatabaseFailure { + synchronized (sessionFactory) { + try { + sessionFactory = getConfiguration().buildSessionFactory(); + } catch (Exception ex) { + throw new DatabaseFailure(ex); + } + } + } + + /** + * Rebuild the SessionFactory with the given Hibernate Configuration. + * + * @param cfg + */ + static void rebuildSessionFactory(Configuration cfg) throws DatabaseFailure { + synchronized (sessionFactory) { + try { + sessionFactory = cfg.buildSessionFactory(); + configuration = cfg; + } catch (Exception ex) { + throw new DatabaseFailure(ex); + } + } + } + + /** + * Retrieves the current Session local to the thread.

If no Session is + * open, opens a new Session for the running thread. + * + * @return Session + */ + static Session getSession() throws DatabaseFailure { + Session s = (Session) threadSession.get(); + try { + if (s == null) { + log.debug("Opening new Session for this thread."); + if (getInterceptor() != null) { + log.debug("Using interceptor: " + getInterceptor().getClass()); + s = getSessionFactory().openSession(getInterceptor()); + } else { + s = getSessionFactory().openSession(); + } + threadSession.set(s); + } + } catch (HibernateException ex) { + throw new DatabaseFailure(ex); + } + return s; + } + + /** + * Closes the Session local to the thread. + */ + static void closeSession() throws DatabaseFailure { + try { + Session s = (Session) threadSession.get(); + threadSession.set(null); + if (s != null && s.isOpen()) { + log.debug("Closing Session of this thread."); + s.close(); + } + } catch (HibernateException ex) { + throw new DatabaseFailure(ex); + } + } + + /** + * Reconnects a Hibernate Session to the current Thread. + * + * @param session + * The Hibernate Session to be reconnected. + */ + static void reconnect(Session session) throws DatabaseFailure { + try { + session.reconnect(); + threadSession.set(session); + } catch (HibernateException ex) { + throw new DatabaseFailure(ex); + } + } + + /** + * Disconnect and return Session from current Thread. + * + * @return Session the disconnected Session + */ + static Session disconnectSession() throws DatabaseFailure { + + Session session = getSession(); + try { + threadSession.set(null); + if (session.isConnected() && session.isOpen()) + session.disconnect(); + } catch (HibernateException ex) { + throw new DatabaseFailure(ex); + } + return session; + } + + /** + * Register a Hibernate interceptor with the current thread. + *

+ * Every Session opened is opened with this interceptor after registration. + * Has no effect if the current Session of the thread is already open, + * effective on next close()/getSession(). + */ + static void registerInterceptor(Interceptor interceptor) { + threadInterceptor.set(interceptor); + } + + private static Interceptor getInterceptor() { + Interceptor interceptor = (Interceptor) threadInterceptor.get(); + return interceptor; + } + +} + diff --git a/source/org/codecoop/mir/core/dao/hibernate/LanguageDAO.java b/source/org/codecoop/mir/core/dao/hibernate/LanguageDAO.java new file mode 100755 index 00000000..618b445b --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/LanguageDAO.java @@ -0,0 +1,60 @@ +/* + * $Id: LanguageDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import org.codecoop.mir.core.dao.DatabaseFailure; +import org.codecoop.mir.core.dao.ILanguageDAO; +import org.codecoop.mir.core.model.Language; + +/** + * LanguageDAO + * @author idefix + * @version $Revision: 1.1 $ + */ +public class LanguageDAO extends AbstractDAO implements ILanguageDAO { + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#getReferenceClass() + */ + protected Class getReferenceClass() { + return Language.class; + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#initializeCollections(java.lang.Object) + */ + protected void initializeCollections(Object o) throws DatabaseFailure { + // TODO Auto-generated method stub + + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/LeExpression.java b/source/org/codecoop/mir/core/dao/hibernate/LeExpression.java new file mode 100755 index 00000000..dd4eb4f3 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/LeExpression.java @@ -0,0 +1,53 @@ +/* + * $Id: LeExpression.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import net.sf.hibernate.expression.Expression; + +import org.codecoop.mir.core.dao.IQueryExpression; + +/** + * LeExpression + * @author idefix + * @version $Revision: 1.1 $ + */ +public class LeExpression extends QueryExpression implements IQueryExpression { + + /** + * @param property + * @param value + */ + public LeExpression(String property, Object value) { + _expression = Expression.le(property, value); + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/LikeExpression.java b/source/org/codecoop/mir/core/dao/hibernate/LikeExpression.java new file mode 100755 index 00000000..78d1012c --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/LikeExpression.java @@ -0,0 +1,53 @@ +/* + * $Id: LikeExpression.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import net.sf.hibernate.expression.Expression; + +import org.codecoop.mir.core.dao.IQueryExpression; + +/** + * LikeExpression + * @author idefix + * @version $Revision: 1.1 $ + */ +public class LikeExpression extends QueryExpression implements IQueryExpression { + + /** + * @param property + * @param value + */ + public LikeExpression(String property, Object value) { + _expression = Expression.like(property, value); + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/LtExpression.java b/source/org/codecoop/mir/core/dao/hibernate/LtExpression.java new file mode 100755 index 00000000..1371956c --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/LtExpression.java @@ -0,0 +1,53 @@ +/* + * $Id: LtExpression.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import net.sf.hibernate.expression.Expression; + +import org.codecoop.mir.core.dao.IQueryExpression; + +/** + * LtExpression + * @author idefix + * @version $Revision: 1.1 $ + */ +public class LtExpression extends QueryExpression implements IQueryExpression { + + /** + * @param property + * @param value + */ + public LtExpression(String property, Object value) { + _expression = Expression.lt(property, value); + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/MediaDAO.java b/source/org/codecoop/mir/core/dao/hibernate/MediaDAO.java new file mode 100755 index 00000000..f6e201c1 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/MediaDAO.java @@ -0,0 +1,94 @@ +/* + * $Id: MediaDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import java.util.Iterator; + +import net.sf.hibernate.Hibernate; +import net.sf.hibernate.HibernateException; + +import org.codecoop.mir.core.dao.DatabaseFailure; +import org.codecoop.mir.core.dao.IMediaDAO; +import org.codecoop.mir.core.model.Media; + +/** + * MediaDAO + * @author idefix + * @version $Revision: 1.1 $ + */ +public class MediaDAO extends AbstractDAO implements IMediaDAO { + + /** + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#getReferenceClass() + */ + protected Class getReferenceClass() { + return Media.class; + } + + /** + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#initializeCollections(java.lang.Object) + */ + protected void initializeCollections(Object o) throws DatabaseFailure { + if (o instanceof Media) { + Media media = (Media) o; + try { + Hibernate.initialize(media.getRelatedMedias()); + } catch (HibernateException e) { + throw new DatabaseFailure(e); + } + } + } + + /** + * @see org.codecoop.mir.core.dao.IDAO#delete(java.lang.Object) + */ + public void delete(Object obj) throws DatabaseFailure { + if (obj instanceof Media) { + Media media = (Media) obj; + //TODO perhaps there could be a smarter way + //delete all media relations which have the media to be deleted as target + for (Iterator iter = media.getRelatedMedias().keySet().iterator(); + iter.hasNext();) { + Media target = (Media) iter.next(); + for (Iterator iterator = target.getRelatedMedias().keySet().iterator(); + iterator.hasNext();) { + Media m = (Media) iterator.next(); + if(m.equals(media)){ + target.getRelatedMedias().remove(m); + saveOrUpdate(target); + } + } + } + } + super.delete(obj); + } +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/MediaFolderDAO.java b/source/org/codecoop/mir/core/dao/hibernate/MediaFolderDAO.java new file mode 100755 index 00000000..8b4e2372 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/MediaFolderDAO.java @@ -0,0 +1,60 @@ +/* + * $Id: MediaFolderDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import org.codecoop.mir.core.dao.DatabaseFailure; +import org.codecoop.mir.core.dao.IMediaFolderDAO; +import org.codecoop.mir.core.model.MediaFolder; + +/** + * MediaFolderDAO + * @author idefix + * @version $Revision: 1.1 $ + */ +public class MediaFolderDAO extends AbstractDAO implements IMediaFolderDAO { + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#getReferenceClass() + */ + protected Class getReferenceClass() { + return MediaFolder.class; + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#initializeCollections(java.lang.Object) + */ + protected void initializeCollections(Object o) throws DatabaseFailure { + // TODO Auto-generated method stub + + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/MediaRelationTypeDAO.java b/source/org/codecoop/mir/core/dao/hibernate/MediaRelationTypeDAO.java new file mode 100755 index 00000000..187faede --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/MediaRelationTypeDAO.java @@ -0,0 +1,61 @@ +/* + * $Id: MediaRelationTypeDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import org.codecoop.mir.core.dao.DatabaseFailure; +import org.codecoop.mir.core.dao.IMediaRelationTypeDAO; +import org.codecoop.mir.core.model.MediaRelationType; + +/** + * MediaRelationDAO + * + * @author idefix + * @version $Revision: 1.1 $ + */ +public class MediaRelationTypeDAO extends AbstractDAO implements IMediaRelationTypeDAO { + + /** + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#getReferenceClass() + */ + protected Class getReferenceClass() { + return MediaRelationType.class; + } + + /** + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#initializeCollections(java.lang.Object) + */ + protected void initializeCollections(Object o) throws DatabaseFailure { + // TODO Auto-generated method stub + + } + +} \ No newline at end of file diff --git a/source/org/codecoop/mir/core/dao/hibernate/MessageDAO.java b/source/org/codecoop/mir/core/dao/hibernate/MessageDAO.java new file mode 100755 index 00000000..ebb08fbc --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/MessageDAO.java @@ -0,0 +1,60 @@ +/* + * $Id: MessageDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import org.codecoop.mir.core.dao.DatabaseFailure; +import org.codecoop.mir.core.dao.IMessageDAO; + +/** + * MessageDAO + * @author idefix + * @version $Revision: 1.1 $ + */ +public class MessageDAO extends AbstractDAO implements IMessageDAO { + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#getReferenceClass() + */ + protected Class getReferenceClass() { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#initializeCollections(java.lang.Object) + */ + protected void initializeCollections(Object o) throws DatabaseFailure { + // TODO Auto-generated method stub + + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/NotExpression.java b/source/org/codecoop/mir/core/dao/hibernate/NotExpression.java new file mode 100755 index 00000000..28487624 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/NotExpression.java @@ -0,0 +1,54 @@ +/* + * $Id: NotExpression.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import net.sf.hibernate.expression.Expression; + +import org.codecoop.mir.core.dao.IQueryExpression; + +/** + * NotExpression + * @author idefix + * @version $Revision: 1.1 $ + */ +public class NotExpression extends QueryExpression implements IQueryExpression { + + /** + * @param expression + */ + public NotExpression(IQueryExpression expression) { + if(expression instanceof QueryExpression){ + _expression = Expression.not(((QueryExpression)expression).expression()); + } + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/QueryCriteria.java b/source/org/codecoop/mir/core/dao/hibernate/QueryCriteria.java new file mode 100755 index 00000000..fa2a918e --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/QueryCriteria.java @@ -0,0 +1,128 @@ +/* + * $Id: QueryCriteria.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import net.sf.hibernate.Criteria; +import net.sf.hibernate.HibernateException; + +import org.codecoop.mir.core.dao.DatabaseFailure; +import org.codecoop.mir.core.dao.IQueryCriteria; +import org.codecoop.mir.core.dao.IQueryExpression; +import org.codecoop.mir.core.dao.IQueryOrder; +import org.codecoop.mir.core.dao.QueryFailure; + +/** + * QueryCriteria + * @author idefix + * @version $Revision: 1.1 $ + */ +public class QueryCriteria implements IQueryCriteria { + private Criteria _criteria; + + /** + * @param persistentClass + * @throws QueryFailure + */ + public QueryCriteria(Class persistentClass) throws QueryFailure { + try { + _criteria = HibernateSessionManager.getSession().createCriteria(persistentClass); + } catch (DatabaseFailure e) { + throw new QueryFailure(e); + } + } + + /** + * @param criteria + */ + private QueryCriteria(Criteria criteria) { + _criteria = criteria; + } + + /** + * @see org.codecoop.mir.core.dao.IQueryCriteria#add(org.codecoop.mir.core.query.IQueryExpression) + */ + public IQueryCriteria add(IQueryExpression expression) { + if(expression instanceof QueryExpression){ + _criteria.add(((QueryExpression)expression).expression()); + } + return this; + } + + /** + * @see org.codecoop.mir.core.dao.IQueryCriteria#addOrder(org.codecoop.mir.core.query.IQueryOrder) + */ + public IQueryCriteria addOrder(IQueryOrder order) { + if(order instanceof QueryOrder){ + _criteria.addOrder(((QueryOrder)order).order()); + } + return this; + } + + /** + * @see org.codecoop.mir.core.dao.IQueryCriteria#setLimit(int) + */ + public IQueryCriteria setLimit(int limit) { + _criteria.setMaxResults(limit); + return this; + } + + /** + * @see org.codecoop.mir.core.dao.IQueryCriteria#setOffset(int) + */ + public IQueryCriteria setOffset(int offset) { + _criteria.setFirstResult(offset); + return this; + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.query.IQueryCriteria#createCriteria(java.lang.String) + */ + public IQueryCriteria createCriteria(String property) throws DatabaseFailure { + try { + Criteria c = _criteria.createCriteria(property); + QueryCriteria queryCriteria = new QueryCriteria(c); + return queryCriteria; + } catch (HibernateException e) { + throw new DatabaseFailure(e); + } + } + + /** + * @return + */ + public Criteria criteria() { + return _criteria; + } + + + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/QueryExpression.java b/source/org/codecoop/mir/core/dao/hibernate/QueryExpression.java new file mode 100755 index 00000000..9dae292d --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/QueryExpression.java @@ -0,0 +1,53 @@ +/* + * $Id: QueryExpression.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import net.sf.hibernate.expression.Criterion; + +import org.codecoop.mir.core.dao.IQueryExpression; + +/** + * QueryExpression + * @author idefix + * @version $Revision: 1.1 $ + */ +public abstract class QueryExpression implements IQueryExpression { + protected Criterion _expression; + + /** + * @return + */ + public Criterion expression() { + return _expression; + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/QueryOrder.java b/source/org/codecoop/mir/core/dao/hibernate/QueryOrder.java new file mode 100755 index 00000000..93229d32 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/QueryOrder.java @@ -0,0 +1,62 @@ +/* + * $Id: QueryOrder.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import net.sf.hibernate.expression.Order; + +import org.codecoop.mir.core.dao.IQueryOrder; + +/** + * QueryOrder + * @author idefix + * @version $Revision: 1.1 $ + */ +public class QueryOrder implements IQueryOrder { + public static boolean ASC = true; + public static boolean DESC = false; + private Order _order; + + public QueryOrder(String property, boolean asc){ + if(asc == ASC){ + _order = Order.asc(property); + } else { + _order = Order.desc(property); + } + } + + /** + * @see org.codecoop.mir.core.dao.IQueryOrder#order() + */ + public Order order() { + return _order; + } +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/Transaction.java b/source/org/codecoop/mir/core/dao/hibernate/Transaction.java new file mode 100755 index 00000000..18907386 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/Transaction.java @@ -0,0 +1,109 @@ +/* + * $Id: Transaction.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import net.sf.hibernate.HibernateException; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codecoop.mir.core.dao.DatabaseFailure; +import org.codecoop.mir.core.dao.ITransaction; + +/** + * Transaction + * + * @author idefix + * @version $Revision: 1.1 $ + */ +public class Transaction implements ITransaction { + + private static Log log = LogFactory.getLog(Transaction.class); + private static final ThreadLocal threadTransaction = new ThreadLocal(); + + public Transaction() throws DatabaseFailure { + net.sf.hibernate.Transaction tx = + (net.sf.hibernate.Transaction) threadTransaction.get(); + try { + if (tx == null) { + log.debug("Starting new database transaction in this thread."); + tx = HibernateSessionManager.getSession().beginTransaction(); + threadTransaction.set(tx); + } + } catch (HibernateException ex) { + throw new DatabaseFailure(ex); + } + } + + /** + * @throws DatabaseFailure + * @see org.codecoop.mir.core.dao.ITransaction#commit() + */ + public void commit() throws DatabaseFailure { + net.sf.hibernate.Transaction tx = + (net.sf.hibernate.Transaction) threadTransaction.get(); + try { + threadTransaction.set(null); + if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) { + log.debug("Committing database transaction of this thread."); + tx.commit(); + } else { + throw new DatabaseFailure("Commiting the transaction was not possible"); + } + } catch (HibernateException ex) { + rollback(); + throw new DatabaseFailure(ex); + } + } + + /** + * @throws DatabaseFailure + * @see org.codecoop.mir.core.dao.ITransaction#rollback() + */ + public void rollback() throws DatabaseFailure { + net.sf.hibernate.Transaction tx = + (net.sf.hibernate.Transaction) threadTransaction.get(); + try { + threadTransaction.set(null); + if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) { + log.debug("Tyring to rollback database transaction of this thread."); + tx.rollback(); + } else { + throw new DatabaseFailure("Commiting the transaction was not possible"); + } + } catch (HibernateException ex) { + throw new DatabaseFailure(ex); + } finally { + HibernateSessionManager.closeSession(); + } + } + +} \ No newline at end of file diff --git a/source/org/codecoop/mir/core/dao/hibernate/TransactionManager.java b/source/org/codecoop/mir/core/dao/hibernate/TransactionManager.java new file mode 100755 index 00000000..eec00fd5 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/TransactionManager.java @@ -0,0 +1,53 @@ +/* + * $Id: TransactionManager.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import org.codecoop.mir.core.dao.DatabaseFailure; +import org.codecoop.mir.core.dao.ITransaction; +import org.codecoop.mir.core.dao.ITransactionManager; + + +/** + * TransactionManager + * @author idefix + * @version $Revision: 1.1 $ + */ +public class TransactionManager implements ITransactionManager { + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.ITransactionManager#beginTransaction() + */ + public ITransaction beginTransaction() throws DatabaseFailure { + return new Transaction(); + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/UploadedMediaDAO.java b/source/org/codecoop/mir/core/dao/hibernate/UploadedMediaDAO.java new file mode 100755 index 00000000..7853304c --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/UploadedMediaDAO.java @@ -0,0 +1,58 @@ +/* + * $Id: UploadedMediaDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import org.codecoop.mir.core.dao.DatabaseFailure; +import org.codecoop.mir.core.dao.IUploadedMediaDAO; + +/** + * UploadedMediaDAO + * @author idefix + * @version $Revision: 1.1 $ + */ +public class UploadedMediaDAO extends MediaDAO implements IUploadedMediaDAO { + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#getReferenceClass() + */ + protected Class getReferenceClass() { + return IUploadedMediaDAO.class; + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#initializeCollections(java.lang.Object) + */ + protected void initializeCollections(Object o) throws DatabaseFailure { + super.initializeCollections(o); + } + +} diff --git a/source/org/codecoop/mir/core/dao/hibernate/UserDAO.java b/source/org/codecoop/mir/core/dao/hibernate/UserDAO.java new file mode 100755 index 00000000..43da2a82 --- /dev/null +++ b/source/org/codecoop/mir/core/dao/hibernate/UserDAO.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.dao.hibernate; + +import org.codecoop.mir.core.dao.IUserDAO; +import org.codecoop.mir.core.model.User; + +/** + * UserDAO + * @author idefix + * @version $Id: UserDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + */ +public class UserDAO extends AbstractDAO implements IUserDAO { + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#getReferenceClass() + */ + protected Class getReferenceClass() { + return User.class; + } + + /* (non-Javadoc) + * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#initializeCollections(java.lang.Object) + */ + protected void initializeCollections(Object o) { + // TODO Auto-generated method stub + + } +} diff --git a/source/org/codecoop/mir/core/model/Article.hbm.xml b/source/org/codecoop/mir/core/model/Article.hbm.xml new file mode 100755 index 00000000..736b9124 --- /dev/null +++ b/source/org/codecoop/mir/core/model/Article.hbm.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/org/codecoop/mir/core/model/Article.java b/source/org/codecoop/mir/core/model/Article.java new file mode 100755 index 00000000..be1cb358 --- /dev/null +++ b/source/org/codecoop/mir/core/model/Article.java @@ -0,0 +1,215 @@ +/* + * $Id: Article.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.model; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; + +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; + +/** + * An Article object is used to save the main content objects. + * It has references to Media objects and Comment objects. An Article can be in + * different Categories and has one ArticleType. + * + * @author idefix + */ +public class Article extends Media implements Serializable { + + /** persistent field */ + private String date; + + /** nullable persistent field */ + private String subtitle; + + /** nullable persistent field */ + private String edittitle; + + /** nullable persistent field */ + private String content; + + /** persistent field */ + private boolean html; + + /** nullable persistent field */ + private User lockingUser; + + /** nullable persistent field */ + private Language language; + + /** nullable persistent field */ + private ArticleStatus status; + + /** persistent field */ + private Set typedCategories; + + /** persistent field */ + private Set medias; + + private int hashCode; + + /** default constructor */ + public Article() { + super(); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd"); + date = simpleDateFormat.format(new Date()); + } + + public String getDate() { + return this.date; + } + + public void setDate(String date) { + this.date = date; + } + + public String getSubtitle() { + return this.subtitle; + } + + public void setSubtitle(String subtitle) { + this.subtitle = subtitle; + } + + public String getEdittitle() { + return this.edittitle; + } + + public void setEdittitle(String edittitle) { + this.edittitle = edittitle; + } + + public String getContent() { + return this.content; + } + + public void setContent(String content) { + this.content = content; + } + + public boolean isHtml() { + return this.html; + } + + public void setHtml(boolean html) { + this.html = html; + } + + public User getLockingUser() { + return this.lockingUser; + } + + public void setLockingUser(User lockingUser) { + this.lockingUser = lockingUser; + } + + public Language getLanguage() { + return this.language; + } + + public void setLanguage(Language language) { + this.language = language; + } + + public ArticleStatus getStatus() { + return status; + } + + public void setStatus(ArticleStatus status) { + this.status = status; + } + + public Set getTypedCategories() { + return this.typedCategories; + } + + public void setTypedCategories(Set topics) { + this.typedCategories = topics; + } + + public void addTypedCategory(TypedCategory typedCategory){ + if(null == typedCategories){ + typedCategories = new HashSet(); + } + typedCategories.add(typedCategory); + } + + public Set getMedias() { + return this.medias; + } + + public void setMedias(Set medias) { + this.medias = medias; + } + + public boolean equals(Object obj) { + if (null == obj) { + return false; + } + if (!(obj instanceof Article)) { + return false; + } else { + Article mObj = (Article) obj; + if (null == this.getId() || null == mObj.getId()) { + return false; + } else { + return (this.getId().equals(mObj.getId())); + } + } + } + + public int hashCode() { + if (Integer.MIN_VALUE == this.hashCode) { + if (null == this.getId()){ + return super.hashCode(); + } else { + String hashStr = this.getClass().getName() + ":" + + this.getId().hashCode(); + this.hashCode = hashStr.hashCode(); + } + } + return this.hashCode; + } + + /** + * @see java.lang.Object#toString() + */ + public String toString() { + return new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE) + .append("id", this.getId()) + .toString(); + } +} \ No newline at end of file diff --git a/source/org/codecoop/mir/core/model/ArticleStatus.hbm.xml b/source/org/codecoop/mir/core/model/ArticleStatus.hbm.xml new file mode 100755 index 00000000..6c73673c --- /dev/null +++ b/source/org/codecoop/mir/core/model/ArticleStatus.hbm.xml @@ -0,0 +1,26 @@ + + + + + + + + comment_status_id_seq + + + + + + diff --git a/source/org/codecoop/mir/core/model/ArticleStatus.java b/source/org/codecoop/mir/core/model/ArticleStatus.java new file mode 100755 index 00000000..56b9aeb1 --- /dev/null +++ b/source/org/codecoop/mir/core/model/ArticleStatus.java @@ -0,0 +1,111 @@ +/* + * $Id: ArticleStatus.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.model; + +import java.io.Serializable; + +import org.apache.commons.lang.builder.ToStringBuilder; + +/** + * CommentStatus + * + * @author idefix + */ +public class ArticleStatus implements Serializable { + + /** identifier field */ + private Integer id; + + /** persistent field */ + private String name; + + private int hashCode; + + /** full constructor */ + public ArticleStatus(String name) { + this.name = name; + } + + /** default constructor */ + public ArticleStatus() { + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean equals(Object obj) { + if (null == obj) { + return false; + } + if (!(obj instanceof ArticleStatus)) { + return false; + } else { + ArticleStatus mObj = (ArticleStatus) obj; + if (null == this.getId() || null == mObj.getId()) { + return false; + } else { + return (this.getId().equals(mObj.getId())); + } + } + } + + public int hashCode() { + if (Integer.MIN_VALUE == this.hashCode) { + if (null == this.getId()){ + return super.hashCode(); + } else { + String hashStr = this.getClass().getName() + ":" + + this.getId().hashCode(); + this.hashCode = hashStr.hashCode(); + } + } + return this.hashCode; + } + + public String toString() { + return new ToStringBuilder(this).append("id", getId()).toString(); + } + +} \ No newline at end of file diff --git a/source/org/codecoop/mir/core/model/ArticleType.hbm.xml b/source/org/codecoop/mir/core/model/ArticleType.hbm.xml new file mode 100755 index 00000000..8ca249e3 --- /dev/null +++ b/source/org/codecoop/mir/core/model/ArticleType.hbm.xml @@ -0,0 +1,23 @@ + + + + + + article_type_id_seq + + + + + diff --git a/source/org/codecoop/mir/core/model/ArticleType.java b/source/org/codecoop/mir/core/model/ArticleType.java new file mode 100755 index 00000000..18d8880b --- /dev/null +++ b/source/org/codecoop/mir/core/model/ArticleType.java @@ -0,0 +1,110 @@ +/* + * $Id: ArticleType.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.model; + +import java.io.Serializable; +import org.apache.commons.lang.builder.ToStringBuilder; + +/** + * An ArticleType object describes the type of an Article. Possible ArticleTypes + * could be e.g. "feature" or "newswire". + * + * @author idefix + */ +public class ArticleType implements Serializable { + + /** identifier field */ + private Integer id; + + /** persistent field */ + private String name; + + private int hashCode; + + /** full constructor */ + public ArticleType(String name) { + this.name = name; + } + + /** default constructor */ + public ArticleType() { + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + public boolean equals(Object obj) { + if (null == obj) { + return false; + } + if (!(obj instanceof ArticleType)) { + return false; + } else { + ArticleType mObj = (ArticleType) obj; + if (null == this.getId() || null == mObj.getId()) { + return false; + } else { + return (this.getId().equals(mObj.getId())); + } + } + } + + public int hashCode() { + if (Integer.MIN_VALUE == this.hashCode) { + if (null == this.getId()){ + return super.hashCode(); + } else { + String hashStr = this.getClass().getName() + ":" + + this.getId().hashCode(); + this.hashCode = hashStr.hashCode(); + } + } + return this.hashCode; + } + + public String toString() { + return new ToStringBuilder(this).append("id", getId()).toString(); + } + +} \ No newline at end of file diff --git a/source/org/codecoop/mir/core/model/BreakingNewsItem.hbm.xml b/source/org/codecoop/mir/core/model/BreakingNewsItem.hbm.xml new file mode 100755 index 00000000..80616dbb --- /dev/null +++ b/source/org/codecoop/mir/core/model/BreakingNewsItem.hbm.xml @@ -0,0 +1,31 @@ + + + + + + breaking_id_seq + + + + + + + diff --git a/source/org/codecoop/mir/core/model/BreakingNewsItem.java b/source/org/codecoop/mir/core/model/BreakingNewsItem.java new file mode 100755 index 00000000..0e3c1421 --- /dev/null +++ b/source/org/codecoop/mir/core/model/BreakingNewsItem.java @@ -0,0 +1,118 @@ +/* + * $Id: BreakingNewsItem.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.model; + +import java.io.Serializable; +import java.util.Date; + +import org.apache.commons.lang.builder.ToStringBuilder; + +/** + * Breaking + * + * @author idefix + */ +public class BreakingNewsItem implements Serializable { + + /** identifier field */ + private Integer id; + + /** persistent field */ + private String text; + + /** persistent field */ + private Date creationDate; + + private int hashCode; + + /** default constructor */ + public BreakingNewsItem() { + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getText() { + return this.text; + } + + public void setText(String text) { + this.text = text; + } + + public Date getCreationDate() { + return this.creationDate; + } + + public void setCreationDate(Date creationDate) { + this.creationDate = creationDate; + } + + public boolean equals(Object obj) { + if (null == obj) { + return false; + } + if (!(obj instanceof BreakingNewsItem)) { + return false; + } else { + BreakingNewsItem mObj = (BreakingNewsItem) obj; + if (null == this.getId() || null == mObj.getId()) { + return false; + } else { + return (this.getId().equals(mObj.getId())); + } + } + } + + public int hashCode() { + if (Integer.MIN_VALUE == this.hashCode) { + if (null == this.getId()){ + return super.hashCode(); + } else { + String hashStr = this.getClass().getName() + ":" + + this.getId().hashCode(); + this.hashCode = hashStr.hashCode(); + } + } + return this.hashCode; + } + + + public String toString() { + return new ToStringBuilder(this).append("id", getId()).toString(); + } +} \ No newline at end of file diff --git a/source/org/codecoop/mir/core/model/Category.hbm.xml b/source/org/codecoop/mir/core/model/Category.hbm.xml new file mode 100755 index 00000000..89cd9399 --- /dev/null +++ b/source/org/codecoop/mir/core/model/Category.hbm.xml @@ -0,0 +1,45 @@ + + + + + category_id_seq + + + + + + + + + + + + + + + + diff --git a/source/org/codecoop/mir/core/model/Category.java b/source/org/codecoop/mir/core/model/Category.java new file mode 100755 index 00000000..f8428f6f --- /dev/null +++ b/source/org/codecoop/mir/core/model/Category.java @@ -0,0 +1,188 @@ +/* + * $Id: Category.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.model; + +import java.io.Serializable; +import java.util.HashSet; +import java.util.Set; + +import org.apache.commons.lang.builder.ToStringBuilder; + +/** + * Category + * + * @author idefix + */ +public class Category implements Serializable { + + /** identifier field */ + private Integer id; + + /** persistent field */ + private String title; + + /** nullable persistent field */ + private String description; + + /** persistent field */ + private String filename; + + /** nullable persistent field */ + private CategoryType categoryType; + + /** nullable persistent field */ + private Category parentCategory; + + /** persistent field */ + private Set childCategories; + + /** persistent field */ + private Set articles; + + private int hashCode; + + /** default constructor */ + public Category() { + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getTitle() { + return this.title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getFilename() { + return this.filename; + } + + public void setFilename(String filename) { + this.filename = filename; + } + + public org.codecoop.mir.core.model.CategoryType getCategoryType() { + return this.categoryType; + } + + public void setCategoryType( + org.codecoop.mir.core.model.CategoryType categoryType) { + this.categoryType = categoryType; + } + + public Category getParentCategory() { + return this.parentCategory; + } + + public void setParentCategory(Category parentCategory) { + this.parentCategory = parentCategory; + } + + public void addChildCategory(Category category){ + if(childCategories == null){ + childCategories = new HashSet(); + } + childCategories.add(category); + } + + public Set getChildCategories() { + return this.childCategories; + } + + public void setChildCategories(Set childTopics) { + this.childCategories = childTopics; + } + + public Set getArticles() { + return this.articles; + } + + public void setArticles(Set articles) { + this.articles = articles; + } + + public void addArticle(Article article){ + if(articles == null){ + articles = new HashSet(); + } + articles.add(article); + } + + public boolean equals(Object obj) { + if (null == obj) { + return false; + } + if (!(obj instanceof Category)) { + return false; + } else { + Category mObj = (Category) obj; + if (null == this.getId() || null == mObj.getId()) { + return false; + } else { + return (this.getId().equals(mObj.getId())); + } + } + } + + public int hashCode() { + if (Integer.MIN_VALUE == this.hashCode) { + if (null == this.getId()){ + return super.hashCode(); + } else { + String hashStr = this.getClass().getName() + ":" + + this.getId().hashCode(); + this.hashCode = hashStr.hashCode(); + } + } + return this.hashCode; + } + + public String toString() { + return new ToStringBuilder(this).append("id", getId()).toString(); + } +} \ No newline at end of file diff --git a/source/org/codecoop/mir/core/model/CategoryType.hbm.xml b/source/org/codecoop/mir/core/model/CategoryType.hbm.xml new file mode 100755 index 00000000..3ba0da24 --- /dev/null +++ b/source/org/codecoop/mir/core/model/CategoryType.hbm.xml @@ -0,0 +1,23 @@ + + + + + + category_type_id_seq + + + + + diff --git a/source/org/codecoop/mir/core/model/CategoryType.java b/source/org/codecoop/mir/core/model/CategoryType.java new file mode 100755 index 00000000..37f406a9 --- /dev/null +++ b/source/org/codecoop/mir/core/model/CategoryType.java @@ -0,0 +1,111 @@ +/* + * $Id: CategoryType.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.model; + +import java.io.Serializable; + +import org.apache.commons.lang.builder.ToStringBuilder; + +/** + * CategoryType + * + * @author idefix + */ +public class CategoryType implements Serializable { + + /** identifier field */ + private Integer id; + + /** persistent field */ + private String name; + + private int hashCode; + + /** full constructor */ + public CategoryType(String name) { + this.name = name; + } + + /** default constructor */ + public CategoryType() { + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean equals(Object obj) { + if (null == obj) { + return false; + } + if (!(obj instanceof CategoryType)) { + return false; + } else { + CategoryType mObj = (CategoryType) obj; + if (null == this.getId() || null == mObj.getId()) { + return false; + } else { + return (this.getId().equals(mObj.getId())); + } + } + } + + public int hashCode() { + if (Integer.MIN_VALUE == this.hashCode) { + if (null == this.getId()){ + return super.hashCode(); + } else { + String hashStr = this.getClass().getName() + ":" + + this.getId().hashCode(); + this.hashCode = hashStr.hashCode(); + } + } + return this.hashCode; + } + + public String toString() { + return new ToStringBuilder(this).append("id", getId()).toString(); + } + +} \ No newline at end of file diff --git a/source/org/codecoop/mir/core/model/Group.hbm.xml b/source/org/codecoop/mir/core/model/Group.hbm.xml new file mode 100755 index 00000000..7fe3eb2e --- /dev/null +++ b/source/org/codecoop/mir/core/model/Group.hbm.xml @@ -0,0 +1,34 @@ + + + + + + group_id_seq + + + + + + + + + + + diff --git a/source/org/codecoop/mir/core/model/Group.java b/source/org/codecoop/mir/core/model/Group.java new file mode 100755 index 00000000..61926060 --- /dev/null +++ b/source/org/codecoop/mir/core/model/Group.java @@ -0,0 +1,146 @@ +/* + * $Id: Group.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.model; + +import java.util.HashSet; +import java.util.Set; + +import org.apache.commons.lang.builder.ToStringBuilder; + +/** + * Group + * + * @author idefix + * @version $Revision: 1.1 $ + */ +public class Group { + + private Integer _id; + private Set _users; + private Role _role; + + private transient int hashCode; + + /** + * @return Returns the id. + */ + public Integer getId() { + return _id; + } + + /** + * @param id + * The id to set. + */ + public void setId(Integer id) { + _id = id; + } + + /** + * @return Returns the role. + */ + public Role getRole() { + return _role; + } + + /** + * @param role + * The role to set. + */ + public void setRole(Role role) { + _role = role; + } + + /** + * @return Returns the users. + */ + public Set getUsers() { + return _users; + } + + /** + * @param users + * The users to set. + */ + public void setUsers(Set users) { + _users = users; + } + + public void addUser(User user){ + if(_users == null){ + _users = new HashSet(); + } + _users.add(user); + } + + /** + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object obj) { + if (null == obj) { + return false; + } + if (!(obj instanceof Group)) { + return false; + } else { + Group mObj = (Group) obj; + if (null == this.getId() || null == mObj.getId()) { + return false; + } else { + return (this.getId().equals(mObj.getId())); + } + } + } + + /** + * @see java.lang.Object#hashCode() + */ + public int hashCode() { + if (Integer.MIN_VALUE == this.hashCode) { + if (null == this.getId()){ + return super.hashCode(); + } else { + String hashStr = this.getClass().getName() + ":" + + this.getId().hashCode(); + this.hashCode = hashStr.hashCode(); + } + } + return this.hashCode; + } + + /** + * @see java.lang.Object#toString() + */ + public String toString() { + return new ToStringBuilder(this).append("id", getId()).toString(); + } +} \ No newline at end of file diff --git a/source/org/codecoop/mir/core/model/Language.hbm.xml b/source/org/codecoop/mir/core/model/Language.hbm.xml new file mode 100755 index 00000000..72a27195 --- /dev/null +++ b/source/org/codecoop/mir/core/model/Language.hbm.xml @@ -0,0 +1,29 @@ + + + + + language_id_seq + + + + + + diff --git a/source/org/codecoop/mir/core/model/Language.java b/source/org/codecoop/mir/core/model/Language.java new file mode 100755 index 00000000..023d2041 --- /dev/null +++ b/source/org/codecoop/mir/core/model/Language.java @@ -0,0 +1,123 @@ +/* + * $Id: Language.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.model; + +import java.io.Serializable; + +import org.apache.commons.lang.builder.ToStringBuilder; + +/** + * Language + * + * @author idefix + */ +public class Language implements Serializable { + + /** identifier field */ + private Integer id; + + /** persistent field */ + private String name; + + /** persistent field */ + private String code; + + private int hashCode; + + /** full constructor */ + public Language(String name, String code) { + this.name = name; + this.code = code; + } + + /** default constructor */ + public Language() { + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCode() { + return this.code; + } + + public void setCode(String code) { + this.code = code; + } + + public boolean equals(Object obj) { + if (null == obj) { + return false; + } + if (!(obj instanceof Language)) { + return false; + } else { + Language mObj = (Language) obj; + if (null == this.getId() || null == mObj.getId()) { + return false; + } else { + return (this.getId().equals(mObj.getId())); + } + } + } + + public int hashCode() { + if (Integer.MIN_VALUE == this.hashCode) { + if (null == this.getId()){ + return super.hashCode(); + } else { + String hashStr = this.getClass().getName() + ":" + + this.getId().hashCode(); + this.hashCode = hashStr.hashCode(); + } + } + return this.hashCode; + } + + public String toString() { + return new ToStringBuilder(this).append("id", getId()).toString(); + } + +} \ No newline at end of file diff --git a/source/org/codecoop/mir/core/model/Media.hbm.xml b/source/org/codecoop/mir/core/model/Media.hbm.xml new file mode 100755 index 00000000..f5dd7ce6 --- /dev/null +++ b/source/org/codecoop/mir/core/model/Media.hbm.xml @@ -0,0 +1,111 @@ + + + + + + + + media_id_seq + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/org/codecoop/mir/core/model/Media.java b/source/org/codecoop/mir/core/model/Media.java new file mode 100755 index 00000000..56afd91e --- /dev/null +++ b/source/org/codecoop/mir/core/model/Media.java @@ -0,0 +1,262 @@ +/* + * $Id: Media.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.model; + +import java.io.Serializable; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; + +/** + * Media + * + * @author idefix + */ +public class Media implements Serializable { + + /** identifier field */ + private Integer id; + + /** nullable persistent field */ + private String title; + + /** nullable persistent field */ + private String description; + + /** nullable persistent field */ + private String creator; + + /** nullable persistent field */ + private String creatorMainUrl; + + /** nullable persistent field */ + private String creatorEmail; + + /** nullable persistent field */ + private String creatorAddress; + + /** nullable persistent field */ + private String creatorPhone; + + /** nullable persistent field */ + private String internalComment; + + /** persistent field */ + private boolean produced; + + /** persistent field */ + private Date creationDate; + + /** nullable persistent field */ + private Date lastChange; + + /** nullable persistent field */ + private User publisher; + + private Map relatedMedias; + + /** holds hashCode for hashCode() */ + private transient int hashCode = Integer.MIN_VALUE; + + /** default constructor */ + public Media() { + creationDate = new Date(); + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getTitle() { + return this.title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreator() { + return this.creator; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public String getCreatorMainUrl() { + return this.creatorMainUrl; + } + + public void setCreatorMainUrl(String creatorMainUrl) { + this.creatorMainUrl = creatorMainUrl; + } + + public String getCreatorEmail() { + return this.creatorEmail; + } + + public void setCreatorEmail(String creatorEmail) { + this.creatorEmail = creatorEmail; + } + + public String getCreatorAddress() { + return this.creatorAddress; + } + + public void setCreatorAddress(String creatorAddress) { + this.creatorAddress = creatorAddress; + } + + public String getCreatorPhone() { + return this.creatorPhone; + } + + public void setCreatorPhone(String creatorPhone) { + this.creatorPhone = creatorPhone; + } + + public String getInternalComment() { + return this.internalComment; + } + + public void setInternalComment(String internalComment) { + this.internalComment = internalComment; + } + + public boolean isProduced() { + return this.produced; + } + + public void setProduced(boolean produced) { + this.produced = produced; + } + + public Date getCreationDate() { + return this.creationDate; + } + + public void setCreationDate(Date creationDate) { + this.creationDate = creationDate; + } + + public Date getLastChange() { + return this.lastChange; + } + + public void setLastChange(Date lastChange) { + this.lastChange = lastChange; + } + + public User getPublisher() { + return this.publisher; + } + + public void setPublisher(User publisher) { + this.publisher = publisher; + } + + /** + * @return Returns the relatedMedias. + */ + public Map getRelatedMedias() { + return relatedMedias; + } + + /** + * @param relatedMedias The relatedMedias to set. + */ + public void setRelatedMedias(Map relatedMedias) { + this.relatedMedias = relatedMedias; + } + + /** + * @param mediaRelation + */ + public void addRelatedMedia(Media target, MediaRelationType relationType) { + if(relatedMedias == null){ + relatedMedias = new HashMap(); + } + relatedMedias.put(target, relationType); + } + + /** + * @see java.lang.Object#toString() + */ + public String toString() { + return new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE) + .append("id", this.getId()).toString(); + } + + public boolean equals(Object obj) { + if (null == obj) { + return false; + } + if (!(obj instanceof Media)) { + return false; + } else { + Media mObj = (Media) obj; + if (null == this.getId() || null == mObj.getId()) { + return false; + } else { + return (this.getId().equals(mObj.getId())); + } + } + } + + public int hashCode() { + if (Integer.MIN_VALUE == this.hashCode) { + if (null == this.getId()) + return super.hashCode(); + else { + String hashStr = this.getClass().getName() + ":" + + this.getId().hashCode(); + this.hashCode = hashStr.hashCode(); + } + } + return this.hashCode; + } +} \ No newline at end of file diff --git a/source/org/codecoop/mir/core/model/MediaFolder.hbm.xml b/source/org/codecoop/mir/core/model/MediaFolder.hbm.xml new file mode 100755 index 00000000..289eda53 --- /dev/null +++ b/source/org/codecoop/mir/core/model/MediaFolder.hbm.xml @@ -0,0 +1,62 @@ + + + + + + + media_folder_id_seq + + + + + + + + + + + diff --git a/source/org/codecoop/mir/core/model/MediaFolder.java b/source/org/codecoop/mir/core/model/MediaFolder.java new file mode 100755 index 00000000..2300efae --- /dev/null +++ b/source/org/codecoop/mir/core/model/MediaFolder.java @@ -0,0 +1,174 @@ +/* + * $Id: MediaFolder.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.model; + +import java.io.Serializable; +import java.util.Date; + +import org.apache.commons.lang.builder.ToStringBuilder; + +/** + * MediaFolder + * + * @author idefix + */ +public class MediaFolder implements Serializable { + + /** identifier field */ + private Integer id; + + /** persistent field */ + private String name; + + /** persistent field */ + private String date; + + /** nullable persistent field */ + private String place; + + /** nullable persistent field */ + private String keywords; + + /** nullable persistent field */ + private String internalComment; + + /** persistent field */ + private Date creationDate; + + /** nullable persistent field */ + private Date lastChange; + + private int hashCode; + + /** default constructor */ + public MediaFolder() { + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDate() { + return this.date; + } + + public void setDate(String date) { + this.date = date; + } + + public String getPlace() { + return this.place; + } + + public void setPlace(String place) { + this.place = place; + } + + public String getKeywords() { + return this.keywords; + } + + public void setKeywords(String keywords) { + this.keywords = keywords; + } + + public String getInternalComment() { + return this.internalComment; + } + + public void setInternalComment(String internalComment) { + this.internalComment = internalComment; + } + + public Date getCreationDate() { + return this.creationDate; + } + + public void setCreationDate(Date creationDate) { + this.creationDate = creationDate; + } + + public Date getLastChange() { + return this.lastChange; + } + + public void setLastChange(Date lastChange) { + this.lastChange = lastChange; + } + + public boolean equals(Object obj) { + if (null == obj) { + return false; + } + if (!(obj instanceof MediaFolder)) { + return false; + } else { + MediaFolder mObj = (MediaFolder) obj; + if (null == this.getId() || null == mObj.getId()) { + return false; + } else { + return (this.getId().equals(mObj.getId())); + } + } + } + + public int hashCode() { + if (Integer.MIN_VALUE == this.hashCode) { + if (null == this.getId()){ + return super.hashCode(); + } else { + String hashStr = this.getClass().getName() + ":" + + this.getId().hashCode(); + this.hashCode = hashStr.hashCode(); + } + } + return this.hashCode; + } + + + public String toString() { + return new ToStringBuilder(this).append("id", getId()).toString(); + } + +} \ No newline at end of file diff --git a/source/org/codecoop/mir/core/model/MediaRelationType.hbm.xml b/source/org/codecoop/mir/core/model/MediaRelationType.hbm.xml new file mode 100755 index 00000000..9f5bdd63 --- /dev/null +++ b/source/org/codecoop/mir/core/model/MediaRelationType.hbm.xml @@ -0,0 +1,21 @@ + + + + + + + + + media_relation_type_id_seq + + + + + + diff --git a/source/org/codecoop/mir/core/model/MediaRelationType.java b/source/org/codecoop/mir/core/model/MediaRelationType.java new file mode 100755 index 00000000..1d2f7a2a --- /dev/null +++ b/source/org/codecoop/mir/core/model/MediaRelationType.java @@ -0,0 +1,97 @@ +/* + * $Id: MediaRelationType.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.model; + +import org.apache.commons.lang.builder.ToStringBuilder; + +/** + * MediaRelationType + * @author idefix + * @version $Revision: 1.1 $ + */ +public class MediaRelationType { + private Integer _id; + private String _name; + + private transient int hashCode; + + + public Integer getId() { + return _id; + } + + public void setId(Integer id) { + _id = id; + } + + public String getName() { + return _name; + } + + public void setName(String name) { + _name = name; + } + + public boolean equals(Object obj) { + if (null == obj) { + return false; + } + if (!(obj instanceof MediaRelationType)) { + return false; + } else { + MediaRelationType mObj = (MediaRelationType) obj; + if (null == this.getId() || null == mObj.getId()) { + return false; + } else { + return (this.getId().equals(mObj.getId())); + } + } + } + + public int hashCode() { + if (Integer.MIN_VALUE == this.hashCode) { + if (null == this.getId()){ + return super.hashCode(); + } else { + String hashStr = this.getClass().getName() + ":" + + this.getId().hashCode(); + this.hashCode = hashStr.hashCode(); + } + } + return this.hashCode; + } + + public String toString() { + return new ToStringBuilder(this).append("id", getId()).toString(); + } + +} diff --git a/source/org/codecoop/mir/core/model/MediaType.hbm.xml b/source/org/codecoop/mir/core/model/MediaType.hbm.xml new file mode 100755 index 00000000..95964e63 --- /dev/null +++ b/source/org/codecoop/mir/core/model/MediaType.hbm.xml @@ -0,0 +1,49 @@ + + + + + media_type_id_seq + + + + + + + + + diff --git a/source/org/codecoop/mir/core/model/MediaType.java b/source/org/codecoop/mir/core/model/MediaType.java new file mode 100755 index 00000000..7da0d63d --- /dev/null +++ b/source/org/codecoop/mir/core/model/MediaType.java @@ -0,0 +1,149 @@ +/* + * $Id: MediaType.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.model; + +import java.io.Serializable; +import org.apache.commons.lang.builder.ToStringBuilder; + +/** + * MediaType + * + * @author idefix + */ +public class MediaType implements Serializable { + + /** identifier field */ + private Integer id; + + /** persistent field */ + private String name; + + /** persistent field */ + private String mimeType; + + /** persistent field */ + private String classname; + + /** persistent field */ + private String tablename; + + /** nullable persistent field */ + private String dcname; + + private int hashCode; + + /** default constructor */ + public MediaType() { + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getMimeType() { + return this.mimeType; + } + + public void setMimeType(String mimeType) { + this.mimeType = mimeType; + } + + public String getClassname() { + return this.classname; + } + + public void setClassname(String classname) { + this.classname = classname; + } + + public String getTablename() { + return this.tablename; + } + + public void setTablename(String tablename) { + this.tablename = tablename; + } + + public String getDcname() { + return this.dcname; + } + + public void setDcname(String dcname) { + this.dcname = dcname; + } + + public boolean equals(Object obj) { + if (null == obj) { + return false; + } + if (!(obj instanceof MediaType)) { + return false; + } else { + MediaType mObj = (MediaType) obj; + if (null == this.getId() || null == mObj.getId()) { + return false; + } else { + return (this.getId().equals(mObj.getId())); + } + } + } + + public int hashCode() { + if (Integer.MIN_VALUE == this.hashCode) { + if (null == this.getId()) { + return super.hashCode(); + } else { + String hashStr = this.getClass().getName() + ":" + + this.getId().hashCode(); + this.hashCode = hashStr.hashCode(); + } + } + return this.hashCode; + } + + public String toString() { + return new ToStringBuilder(this).append("id", getId()).toString(); + } + +} \ No newline at end of file diff --git a/source/org/codecoop/mir/core/model/Message.hbm.xml b/source/org/codecoop/mir/core/model/Message.hbm.xml new file mode 100755 index 00000000..6105435a --- /dev/null +++ b/source/org/codecoop/mir/core/model/Message.hbm.xml @@ -0,0 +1,41 @@ + + + + breaking_id_seq + + + + + + + + diff --git a/source/org/codecoop/mir/core/model/Message.java b/source/org/codecoop/mir/core/model/Message.java new file mode 100755 index 00000000..140c2ac1 --- /dev/null +++ b/source/org/codecoop/mir/core/model/Message.java @@ -0,0 +1,140 @@ +/* + * $Id: Message.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.model; + +import java.io.Serializable; +import java.util.Date; + +import org.apache.commons.lang.builder.ToStringBuilder; + +/** + * Message + * + * @author idefix + */ +public class Message implements Serializable { + + /** identifier field */ + private Integer id; + + /** nullable persistent field */ + private String title; + + /** persistent field */ + private String description; + + /** persistent field */ + private String creator; + + /** persistent field */ + private Date creationDate; + + private int hashCode; + + /** default constructor */ + public Message() { + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getTitle() { + return this.title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreator() { + return this.creator; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public Date getCreationDate() { + return this.creationDate; + } + + public void setCreationDate(Date creationDate) { + this.creationDate = creationDate; + } + + public boolean equals(Object obj) { + if (null == obj) { + return false; + } + if (!(obj instanceof Message)) { + return false; + } else { + Message mObj = (Message) obj; + if (null == this.getId() || null == mObj.getId()) { + return false; + } else { + return (this.getId().equals(mObj.getId())); + } + } + } + + public int hashCode() { + if (Integer.MIN_VALUE == this.hashCode) { + if (null == this.getId()){ + return super.hashCode(); + } else { + String hashStr = this.getClass().getName() + ":" + + this.getId().hashCode(); + this.hashCode = hashStr.hashCode(); + } + } + return this.hashCode; + } + + public String toString() { + return new ToStringBuilder(this).append("id", getId()).toString(); + } + +} \ No newline at end of file diff --git a/source/org/codecoop/mir/core/model/Right.hbm.xml b/source/org/codecoop/mir/core/model/Right.hbm.xml new file mode 100755 index 00000000..9d26ff9b --- /dev/null +++ b/source/org/codecoop/mir/core/model/Right.hbm.xml @@ -0,0 +1,27 @@ + + + + + + right_id_seq + + + + + + diff --git a/source/org/codecoop/mir/core/model/Right.java b/source/org/codecoop/mir/core/model/Right.java new file mode 100755 index 00000000..15d49390 --- /dev/null +++ b/source/org/codecoop/mir/core/model/Right.java @@ -0,0 +1,117 @@ +/* + * $Id: Right.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.model; + +import java.io.Serializable; + +import org.apache.commons.lang.builder.ToStringBuilder; + +/** + * Right + * + * @author idefix + */ +public class Right implements Serializable { + + /** identifier field */ + private Integer id; + + /** persistent field */ + private String name; + + /** nullable persistent field */ + private String description; + + private int hashCode; + + /** default constructor */ + public Right() { + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public boolean equals(Object obj) { + if (null == obj) { + return false; + } + if (!(obj instanceof Right)) { + return false; + } else { + Right mObj = (Right) obj; + if (null == this.getId() || null == mObj.getId()) { + return false; + } else { + return (this.getId().equals(mObj.getId())); + } + } + } + + public int hashCode() { + if (Integer.MIN_VALUE == this.hashCode) { + if (null == this.getId()){ + return super.hashCode(); + } else { + String hashStr = this.getClass().getName() + ":" + + this.getId().hashCode(); + this.hashCode = hashStr.hashCode(); + } + } + return this.hashCode; + } + + public String toString() { + return new ToStringBuilder(this).append("id", getId()).toString(); + } + +} \ No newline at end of file diff --git a/source/org/codecoop/mir/core/model/Role.hbm.xml b/source/org/codecoop/mir/core/model/Role.hbm.xml new file mode 100755 index 00000000..0aad4007 --- /dev/null +++ b/source/org/codecoop/mir/core/model/Role.hbm.xml @@ -0,0 +1,36 @@ + + + + + + role_id_seq + + + + + + + + + + + diff --git a/source/org/codecoop/mir/core/model/Role.java b/source/org/codecoop/mir/core/model/Role.java new file mode 100755 index 00000000..be19cb96 --- /dev/null +++ b/source/org/codecoop/mir/core/model/Role.java @@ -0,0 +1,161 @@ +/* + * $Id: Role.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.model; + +import java.io.Serializable; +import java.util.HashSet; +import java.util.Set; + +import org.apache.commons.lang.builder.ToStringBuilder; + +/** + * Role + * + * @author idefix + */ +public class Role implements Serializable { + + /** identifier field */ + private Integer id; + + /** persistent field */ + private String name; + + /** persistent field */ + private String description; + + /** persistent field */ + private Set _users; + + /** persistent field */ + private Set _rights; + + private transient int hashCode; + + /** default constructor */ + public Role() { + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * @return Returns the rights. + */ + public Set getRights() { + return _rights; + } + + /** + * @param rights The rights to set. + */ + public void setRights(Set rights) { + _rights = rights; + } + + public void addRight(Right right){ + if(null == _rights){ + _rights = new HashSet(); + } + _rights.add(right); + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Set getUsers() { + return _users; + } + + public void setUsers(Set users) { + _users = users; + } + + public void addUser(User user){ + if(_users == null){ + _users = new HashSet(); + } + _users.add(user); + } + + public boolean equals(Object obj) { + if (null == obj) { + return false; + } + if (!(obj instanceof Role)) { + return false; + } else { + Role mObj = (Role) obj; + if (null == this.getId() || null == mObj.getId()) { + return false; + } else { + return (this.getId().equals(mObj.getId())); + } + } + } + + public int hashCode() { + if (Integer.MIN_VALUE == this.hashCode) { + if (null == this.getId()){ + return super.hashCode(); + } else { + String hashStr = this.getClass().getName() + ":" + + this.getId().hashCode(); + this.hashCode = hashStr.hashCode(); + } + } + return this.hashCode; + } + + public String toString() { + return new ToStringBuilder(this).append("id", getId()).toString(); + } + +} \ No newline at end of file diff --git a/source/org/codecoop/mir/core/model/TypedCategory.hbm.xml b/source/org/codecoop/mir/core/model/TypedCategory.hbm.xml new file mode 100755 index 00000000..25db6b87 --- /dev/null +++ b/source/org/codecoop/mir/core/model/TypedCategory.hbm.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + diff --git a/source/org/codecoop/mir/core/model/TypedCategory.java b/source/org/codecoop/mir/core/model/TypedCategory.java new file mode 100755 index 00000000..c605e9ff --- /dev/null +++ b/source/org/codecoop/mir/core/model/TypedCategory.java @@ -0,0 +1,126 @@ +/* + * $Id: TypedCategory.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.model; + +import java.io.Serializable; + +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; + +/** + * TypedCategory + * @author idefix + * @version $Revision: 1.1 $ + */ +public class TypedCategory implements Serializable { + private ArticleType _articleType; + private Category _category; + + private transient int hashCode; + + /** + * @return Returns the articleType. + */ + public ArticleType getArticleType() { + return _articleType; + } + + /** + * @param articleType The articleType to set. + */ + public void setArticleType(ArticleType articleType) { + _articleType = articleType; + } + + /** + * @return Returns the category. + */ + public Category getCategory() { + return _category; + } + + /** + * @param category The category to set. + */ + public void setCategory(Category category) { + _category = category; + } + + /** + * + */ + public boolean equals(Object obj) { + if (null == obj) { + return false; + } + if (!(obj instanceof TypedCategory)) { + return false; + } else { + TypedCategory mObj = (TypedCategory) obj; + if ((null == this.getArticleType() || null == mObj.getArticleType()) + && (null == this.getCategory() || null == mObj.getCategory())) { + return false; + } else { + return + (this.getArticleType().equals(mObj.getArticleType()) + & this.getCategory().equals(mObj.getCategory())); + } + } + } + + /** + * + */ + public int hashCode() { + if (Integer.MIN_VALUE == this.hashCode) { + if (null == this.getArticleType() || null == this.getCategory()){ + return super.hashCode(); + } else { + String hashStr = this.getClass().getName() + ":" + + this.getArticleType().hashCode() + + this.getCategory().hashCode(); + this.hashCode = hashStr.hashCode(); + } + } + return this.hashCode; + } + + /** + * + */ + public String toString() { + return new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE) + .append("articleType", this.getArticleType()) + .append("category", this.getCategory()) + .toString(); + } +} diff --git a/source/org/codecoop/mir/core/model/UploadedMedia.hbm.xml b/source/org/codecoop/mir/core/model/UploadedMedia.hbm.xml new file mode 100755 index 00000000..f3e59508 --- /dev/null +++ b/source/org/codecoop/mir/core/model/UploadedMedia.hbm.xml @@ -0,0 +1,36 @@ + + + + + + + + + + diff --git a/source/org/codecoop/mir/core/model/UploadedMedia.java b/source/org/codecoop/mir/core/model/UploadedMedia.java new file mode 100755 index 00000000..4be23260 --- /dev/null +++ b/source/org/codecoop/mir/core/model/UploadedMedia.java @@ -0,0 +1,184 @@ +/* + * $Id: UploadedMedia.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.model; + +import java.io.Serializable; + +import org.apache.commons.lang.builder.ToStringBuilder; + +/** + * UploadedMedia + * + * @author idefix + */ +public class UploadedMedia extends Media implements Serializable { + + /** nullable persistent field */ + private String publishServer; + + /** nullable persistent field */ + private String publishPath; + + /** nullable persistent field */ + private String storagePath; + + private MediaFolder mediaFolder; + + private MediaType mediaType; + + /** persistent field */ + private boolean iconProduced; + + /** nullable persistent field */ + private String iconPath; + + /** nullable persistent field */ + private Integer size; + + private int hashCode; + + /** default constructor */ + public UploadedMedia() { + } + + public String getPublishServer() { + return this.publishServer; + } + + public void setPublishServer(String publishServer) { + this.publishServer = publishServer; + } + + public String getPublishPath() { + return this.publishPath; + } + + public void setPublishPath(String publishPath) { + this.publishPath = publishPath; + } + + public String getStoragePath() { + return this.storagePath; + } + + public void setStoragePath(String storagePath) { + this.storagePath = storagePath; + } + + public boolean isIconProduced() { + return this.iconProduced; + } + + public void setIconProduced(boolean iconProduced) { + this.iconProduced = iconProduced; + } + + public String getIconPath() { + return this.iconPath; + } + + public void setIconPath(String iconPath) { + this.iconPath = iconPath; + } + + public Integer getSize() { + return this.size; + } + + public void setSize(Integer size) { + this.size = size; + } + + /** + * @return Returns the mediaFolder. + */ + public MediaFolder getMediaFolder() { + return mediaFolder; + } + + /** + * @param mediaFolder + * The mediaFolder to set. + */ + public void setMediaFolder(MediaFolder mediaFolder) { + this.mediaFolder = mediaFolder; + } + + /** + * @return Returns the mediaType. + */ + public MediaType getMediaType() { + return mediaType; + } + + /** + * @param mediaType + * The mediaType to set. + */ + public void setMediaType(MediaType mediaType) { + this.mediaType = mediaType; + } + + public boolean equals(Object obj) { + if (null == obj) { + return false; + } + if (!(obj instanceof UploadedMedia)) { + return false; + } else { + UploadedMedia mObj = (UploadedMedia) obj; + if (null == this.getId() || null == mObj.getId()) { + return false; + } else { + return (this.getId().equals(mObj.getId())); + } + } + } + + public int hashCode() { + if (Integer.MIN_VALUE == this.hashCode) { + if (null == this.getId()){ + return super.hashCode(); + } else { + String hashStr = this.getClass().getName() + ":" + + this.getId().hashCode(); + this.hashCode = hashStr.hashCode(); + } + } + return this.hashCode; + } + + public String toString() { + return new ToStringBuilder(this).append("id", getId()).toString(); + } + +} \ No newline at end of file diff --git a/source/org/codecoop/mir/core/model/User.hbm.xml b/source/org/codecoop/mir/core/model/User.hbm.xml new file mode 100755 index 00000000..c785acf6 --- /dev/null +++ b/source/org/codecoop/mir/core/model/User.hbm.xml @@ -0,0 +1,69 @@ + + + + + + users_id_seq + + + + + + + + + + + + + diff --git a/source/org/codecoop/mir/core/model/User.java b/source/org/codecoop/mir/core/model/User.java new file mode 100755 index 00000000..c0e2f23f --- /dev/null +++ b/source/org/codecoop/mir/core/model/User.java @@ -0,0 +1,195 @@ +/* + * $Id: User.java,v 1.1 2004/11/06 16:20:48 idfx Exp $ + * + * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package org.codecoop.mir.core.model; + +import java.io.Serializable; +import java.util.Date; + +import org.apache.commons.lang.builder.ToStringBuilder; + +/** + * User + * + * @author idefix + */ +public class User implements Serializable { + + /** identifier field */ + private Integer id; + + /** persistent field */ + private String login; + + /** persistent field */ + private String password; + + /** nullable persistent field */ + private String internalComment; + + /** persistent field */ + private boolean disabled; + + /** persistent field */ + private String email; + + /** nullable persistent field */ + private String profile; + + /** persistent field */ + private Date creationDate; + + /** nullable persistent field */ + private Date lastlogin; + + /** nullable persistent field */ + private Role role; + + private int hashCode; + + /** default constructor */ + public User() { + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getLogin() { + return this.login; + } + + public void setLogin(String login) { + this.login = login; + } + + public String getPassword() { + return this.password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getInternalComment() { + return this.internalComment; + } + + public void setInternalComment(String internalComment) { + this.internalComment = internalComment; + } + + public boolean isDisabled() { + return this.disabled; + } + + public void setDisabled(boolean disabled) { + this.disabled = disabled; + } + + public String getEmail() { + return this.email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getProfile() { + return this.profile; + } + + public void setProfile(String profile) { + this.profile = profile; + } + + public Date getCreationDate() { + return this.creationDate; + } + + public void setCreationDate(Date creationDate) { + this.creationDate = creationDate; + } + + public Date getLastlogin() { + return this.lastlogin; + } + + public void setLastlogin(Date lastlogin) { + this.lastlogin = lastlogin; + } + + public Role getRole() { + return this.role; + } + + public void setRole(Role role) { + this.role = role; + } + + public boolean equals(Object obj) { + if (null == obj) { + return false; + } + if (!(obj instanceof User)) { + return false; + } else { + User mObj = (User) obj; + if (null == this.getId() || null == mObj.getId()) { + return false; + } else { + return (this.getId().equals(mObj.getId())); + } + } + } + + public int hashCode() { + if (Integer.MIN_VALUE == this.hashCode) { + if (null == this.getId()) { + return super.hashCode(); + } else { + String hashStr = this.getClass().getName() + ":" + + this.getId().hashCode(); + this.hashCode = hashStr.hashCode(); + } + } + return this.hashCode; + } + + public String toString() { + return new ToStringBuilder(this).append("id", getId()).toString(); + } + +} \ No newline at end of file -- 2.11.0