--- /dev/null
+/*
+ * 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);
+ }
+
+}
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * $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 {
+
+}
--- /dev/null
+/*
+ * 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 {
+
+}
--- /dev/null
+/*
+ * $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 {
+
+}
--- /dev/null
+/*
+ * $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 {
+
+}
--- /dev/null
+/*
+ * $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 {
+
+}
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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();
+}
--- /dev/null
+/*
+ * $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 {
+
+}
--- /dev/null
+/*
+ * $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 {
+
+}
--- /dev/null
+/*
+ * $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 {
+
+}
--- /dev/null
+/*
+ * $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 {
+
+}
--- /dev/null
+/*
+ * $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 {
+
+}
--- /dev/null
+/*
+ * $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);
+}
--- /dev/null
+/*
+ * $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 {
+}
--- /dev/null
+/*
+ * $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);
+
+
+
+}
--- /dev/null
+/*
+ * $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 {
+}
--- /dev/null
+/*
+ * $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;
+}
--- /dev/null
+/*
+ * $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;
+}
--- /dev/null
+/*
+ * $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 {
+
+}
--- /dev/null
+/*
+ * 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 {
+
+}
--- /dev/null
+/*
+ * $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);
+ }
+}
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * $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);
+ }
+
+}
--- /dev/null
+/*
+ * 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);
+ }
+}
--- /dev/null
+/*
+ * $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
+
+ }
+
+}
--- /dev/null
+/*
+ * 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
+
+ }
+
+}
--- /dev/null
+/*
+ * $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
+
+ }
+
+}
--- /dev/null
+/*
+ * 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);
+ }
+ }
+ }
+
+}
--- /dev/null
+/*
+ * $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
+
+ }
+
+}
--- /dev/null
+/*
+ * $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);
+ }
+}
--- /dev/null
+/*
+ * $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);
+ }
+
+}
--- /dev/null
+/*
+ * $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);
+ }
+
+}
--- /dev/null
+/*
+ * 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();
+ }
+}
--- /dev/null
+/*
+ * $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);
+ }
+
+}
--- /dev/null
+/*
+ * $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. <p/>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.
+ * <p>
+ * 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;
+ }
+
+}
+
--- /dev/null
+/*
+ * $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
+
+ }
+
+}
--- /dev/null
+/*
+ * $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);
+ }
+
+}
--- /dev/null
+/*
+ * $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);
+ }
+
+}
--- /dev/null
+/*
+ * $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);
+ }
+
+}
--- /dev/null
+/*
+ * $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);
+ }
+}
--- /dev/null
+/*
+ * $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
+
+ }
+
+}
--- /dev/null
+/*
+ * $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
--- /dev/null
+/*
+ * $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
+
+ }
+
+}
--- /dev/null
+/*
+ * $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());
+ }
+ }
+
+}
--- /dev/null
+/*
+ * $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;
+ }
+
+
+
+}
--- /dev/null
+/*
+ * $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;
+ }
+
+}
--- /dev/null
+/*
+ * $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;
+ }
+}
--- /dev/null
+/*
+ * $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
--- /dev/null
+/*
+ * $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();
+ }
+
+}
--- /dev/null
+/*
+ * $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);
+ }
+
+}
--- /dev/null
+/*
+ * 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
+
+ }
+}
--- /dev/null
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" > \r
+
+<hibernate-mapping>
+ <joined-subclass extends="org.codecoop.mir.core.model.Media"
+ name="org.codecoop.mir.core.model.Article"
+ table="article">
+
+ <key column="media_id" foreign-key="fk_article_media"/>
+
+ <property
+ column="date"
+ length="8"
+ name="date"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <property
+ column="subtitle"
+ length="255"
+ name="subtitle"
+ type="java.lang.String"
+ />
+ <property
+ column="edittitle"
+ length="255"
+ name="edittitle"
+ type="java.lang.String"
+ />
+ <property
+ name="content"
+ type="java.lang.String">
+ <column name="content"
+ sql-type="text"
+ not-null="true"/>
+ </property>
+ <property
+ column="is_html"
+ length="1"
+ name="html"
+ not-null="true"
+ type="boolean"
+ />
+ <!-- Associations -->
+ <many-to-one
+ class="org.codecoop.mir.core.model.ArticleStatus"
+ column="to_article_status"
+ name="status"
+ foreign-key="fk_article_articlestatus"
+ />
+ <many-to-one
+ class="org.codecoop.mir.core.model.User"
+ column="to_locking_user"
+ name="lockingUser"
+ foreign-key="fk_article_lockinguser"
+ />
+ <many-to-one
+ class="org.codecoop.mir.core.model.Language"
+ column="to_language"
+ name="language"
+ foreign-key="fk_article_language"
+ />
+ <set name="typedCategories" table="article_x_category" inverse="false" cascade="save-update">
+ <key column="article_id"
+ foreign-key="fk_article_category"/>
+ <!--
+ <composite-element class="org.codecoop.mir.core.model.TypedCategory">
+ <many-to-one
+ class="org.codecoop.mir.core.model.ArticleType"
+ column="article_type_id"
+ name="articleType"
+ foreign-key="fk_articlexcategory_article_type"
+ />
+ <many-to-one
+ class="org.codecoop.mir.core.model.Category"
+ column="category_id"
+ name="category"
+ foreign-key="fk_articlexcategory_category"
+ />
+ </composite-element>
+ -->
+ <many-to-many class="org.codecoop.mir.core.model.TypedCategory"
+ foreign-key="fk_articlexcategory">
+ <column name="article_type_id"/>
+ <column name="category_id"/>
+ </many-to-many>
+ </set>
+ </joined-subclass>
+</hibernate-mapping>
--- /dev/null
+/*
+ * $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
--- /dev/null
+<?xml version="1.0"?>\r
+<!DOCTYPE hibernate-mapping PUBLIC\r
+ "-//Hibernate/Hibernate Mapping DTD 2.0//EN"\r
+ "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >\r
+ \r
+<hibernate-mapping>
+ <class \r name="org.codecoop.mir.core.model.ArticleStatus" \r table="comment_status">
+ <id
+ column="id"
+ name="id"
+ type="java.lang.Integer"
+ >
+ <generator class="native">
+ <param name="sequence">comment_status_id_seq</param>
+ </generator>
+ </id>
+ <property
+ column="name"
+ length="40"
+ name="name"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <!-- Associations -->
+ </class>
+</hibernate-mapping>
--- /dev/null
+/*
+ * $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
--- /dev/null
+<?xml version="1.0"?>\r
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
+<hibernate-mapping>
+ <class name="org.codecoop.mir.core.model.ArticleType" table="article_type">
+ <id
+ column="id"
+ name="id"
+ type="java.lang.Integer"
+ >
+ <generator class="native">\r <param name="sequence">article_type_id_seq</param>\r </generator>
+ </id>
+ <property
+ column="name"
+ length="40"
+ name="name"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <!-- Associations -->
+ </class>
+</hibernate-mapping>
--- /dev/null
+/*
+ * $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
--- /dev/null
+<?xml version="1.0"?>\r
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >\r\r<hibernate-mapping>
+ <class name="org.codecoop.mir.core.model.BreakingNewsItem" table="breaking_news_items">
+ <id
+ column="id"
+ name="id"
+ type="java.lang.Integer"
+ >
+ <generator class="native">
+ <param name="sequence">breaking_id_seq</param>
+ </generator>
+ </id>
+ <property
+ column="text"
+ length="255"
+ name="text"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <property
+ column="creationDate"
+ length="8"
+ name="creationDate"
+ not-null="true"
+ type="java.sql.Timestamp"
+ />
+ <!-- Associations -->
+ </class>
+</hibernate-mapping>
--- /dev/null
+/*
+ * $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
--- /dev/null
+<?xml version="1.0"?>\r
+<!DOCTYPE hibernate-mapping PUBLIC\r "-//Hibernate/Hibernate Mapping DTD 2.0//EN"\r "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >\r\r<hibernate-mapping>
+ <class \r name="org.codecoop.mir.core.model.Category" \r table="category">
+ <id
+ column="id"
+ name="id"
+ type="java.lang.Integer"
+ >
+ <generator class="native">\r <param name="sequence">category_id_seq</param>\r </generator>
+ </id>
+ <property
+ column="title"
+ length="80"
+ name="title"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <property
+ column="description"
+ name="description"
+ type="java.lang.String"
+ />
+ <property
+ column="filename"
+ length="20"
+ name="filename"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <!-- Associations -->\r <many-to-one \r class="org.codecoop.mir.core.model.CategoryType"\r column="category_type"\r name="categoryType"\r foreign-key="fk_category_categorytype"\r />
+ <many-to-one
+ class="org.codecoop.mir.core.model.Category"
+ column="parent_id"
+ name="parentCategory"\r foreign-key="fk_category_parentcategory"
+ />
+ <set name="childCategories">
+ <key column="parent_id" \r foreign-key="fk_topic_childcategories"/>
+ <one-to-many class="org.codecoop.mir.core.model.Category" />
+ </set>
+ <set name="articles" table="article_x_category" lazy="true">
+ <key column="category_id" \r foreign-key="fk_category_article"/>
+ <many-to-many \r class="org.codecoop.mir.core.model.Article"\r foreign-key="fk_article_category_2" \r column="article_id" />
+ </set>
+ </class>
+</hibernate-mapping>
--- /dev/null
+/*
+ * $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
--- /dev/null
+<?xml version="1.0"?>\r
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
+\r<hibernate-mapping>
+ <class \r name="org.codecoop.mir.core.model.CategoryType" \r table="category_type">
+ <id
+ column="id"
+ name="id"
+ type="java.lang.Integer"
+ >
+ <generator class="native">\r <param name="sequence">category_type_id_seq</param>\r </generator>
+ </id>
+ <property
+ column="name"
+ length="40"
+ name="name"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <!-- Associations -->
+ </class>
+</hibernate-mapping>
--- /dev/null
+/*
+ * $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
--- /dev/null
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
+
+<hibernate-mapping>
+ <class name="org.codecoop.mir.core.model.Group" table="Group">
+ <id
+ column="id"
+ name="id"
+ type="java.lang.Integer"
+ >
+ <generator class="native">
+ <param name="sequence">group_id_seq</param>
+ </generator>
+ </id>
+
+ <many-to-one
+ name="role"
+ column="to_role"
+ foreign-key="fk_group_role"
+ class="org.codecoop.mir.core.model.Role"/>
+
+ <set
+ lazy="true"
+ name="users"
+ table="users_x_group"
+ >
+ <key column="group_id" />
+ <many-to-many class="org.codecoop.mir.core.model.User"
+ foreign-key="fk_group_user"
+ column="user_id"/>
+ </set>
+ </class>
+</hibernate-mapping>
--- /dev/null
+/*
+ * $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
--- /dev/null
+<?xml version="1.0"?>\r
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >\r\r<hibernate-mapping>
+ <class \r name="org.codecoop.mir.core.model.Language" \r table="language">
+ <id
+ column="id"
+ name="id"
+ type="java.lang.Integer"
+ >
+ <generator class="native">\r <param name="sequence">language_id_seq</param>\r </generator>
+ </id>
+ <property
+ column="name"
+ length="40"
+ name="name"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <property
+ column="code"
+ length="2"
+ name="code"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <!-- Associations -->
+ </class>
+</hibernate-mapping>
--- /dev/null
+/*
+ * $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
--- /dev/null
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
+
+<hibernate-mapping>
+ <class
+ name="org.codecoop.mir.core.model.Media"
+ table="media">
+ <id
+ column="id"
+ name="id"
+ type="java.lang.Integer"
+ >
+ <generator class="native">
+ <param name="sequence">media_id_seq</param>
+ </generator>
+ </id>
+ <property
+ column="title"
+ length="255"
+ name="title"
+ type="java.lang.String"
+ />
+ <property
+ name="description"
+ type="java.lang.String">
+ <column name="description" sql-type="text"/>
+ </property>
+ <property
+ column="creator"
+ length="80"
+ name="creator"
+ type="java.lang.String"
+ />
+ <property
+ column="creator_main_url"
+ length="255"
+ name="creatorMainUrl"
+ type="java.lang.String"
+ />
+ <property
+ column="creator_email"
+ length="80"
+ name="creatorEmail"
+ type="java.lang.String"
+ />
+ <property
+ column="creator_address"
+ length="80"
+ name="creatorAddress"
+ type="java.lang.String"
+ />
+ <property
+ column="creator_phone"
+ length="80"
+ name="creatorPhone"
+ type="java.lang.String"
+ />
+ <property
+ column="internal_comment"
+ length="255"
+ name="internalComment"
+ type="java.lang.String"
+ />
+ <property
+ column="is_produced"
+ length="1"
+ name="produced"
+ not-null="true"
+ type="boolean"
+ />
+ <property
+ column="creation_date"
+ length="8"
+ name="creationDate"
+ not-null="true"
+ type="java.sql.Timestamp"
+ />
+ <property
+ column="last_change"
+ length="8"
+ name="lastChange"
+ type="java.sql.Timestamp"
+ />
+ <many-to-one
+ class="org.codecoop.mir.core.model.User"
+ column="to_publisher"
+ name="publisher"
+ foreign-key="fk_media_user"
+ />
+ <map
+ name="relatedMedias"
+ table="media_x_media"
+ lazy="true"
+ inverse="false"
+ cascade="save-update">
+ <key
+ column="source_media_id"
+ foreign-key="fk_mediaxmedia_sourcemedia"/>
+ <index-many-to-many
+ column="related_media_id"
+ class="org.codecoop.mir.core.model.Media"
+ foreign-key="fk_mediaxmedia_relatedmedia"/>
+ <many-to-many
+ column="media_relation_type_id"
+ class="org.codecoop.mir.core.model.MediaRelationType"
+ foreign-key="fk_mediaxmedia_mediarelationtype"/>
+ </map>
+ </class>
+</hibernate-mapping>
--- /dev/null
+/*
+ * $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
--- /dev/null
+<?xml version="1.0"?>\r
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
+
+<hibernate-mapping>
+ <class \r name="org.codecoop.mir.core.model.MediaFolder" \r table="media_folder">
+ <id
+ column="id"
+ name="id"
+ type="java.lang.Integer"
+ >
+ <generator class="native">\r <param name="sequence">media_folder_id_seq</param>\r </generator>
+ </id>
+ <property
+ column="name"
+ length="255"
+ name="name"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <property
+ column="date"
+ length="8"
+ name="date"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <property
+ column="place"
+ length="80"
+ name="place"
+ type="java.lang.String"
+ />
+ <property
+ column="keywords"
+ length="255"
+ name="keywords"
+ type="java.lang.String"
+ />
+ <property
+ column="internal_comment"
+ length="255"
+ name="internalComment"
+ type="java.lang.String"
+ />
+ <property
+ column="creationDate"
+ length="8"
+ name="creationDate"
+ not-null="true"
+ type="java.sql.Timestamp"
+ />
+ <property
+ column="last_change"
+ length="8"
+ name="lastChange"
+ type="java.sql.Timestamp"
+ />
+ <!-- Associations -->
+ </class>
+</hibernate-mapping>
--- /dev/null
+/*
+ * $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
--- /dev/null
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
+
+<hibernate-mapping>
+ <class
+ name="org.codecoop.mir.core.model.MediaRelationType"
+ table="media_relation_type">
+
+ <id name="id"
+ type="java.lang.Integer"
+ column="id">
+ <generator class="native">
+ <param name="sequence">media_relation_type_id_seq</param>
+ </generator>
+ </id>
+
+ <property name="name" column="name" type="java.lang.String"/>
+ </class>
+</hibernate-mapping>
--- /dev/null
+/*
+ * $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();
+ }
+
+}
--- /dev/null
+<?xml version="1.0"?>\r
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >\r
+<hibernate-mapping>\r <class \r name="org.codecoop.mir.core.model.MediaType" \r table="media_type">
+ <id
+ column="id"
+ name="id"
+ type="java.lang.Integer"
+ >
+ <generator class="native">\r <param name="sequence">media_type_id_seq</param>\r </generator>
+ </id>
+ <property
+ column="name"
+ length="80"
+ name="name"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <property
+ column="mime_type"
+ length="40"
+ name="mimeType"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <property
+ column="classname"
+ length="80"
+ name="classname"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <property
+ column="tablename"
+ length="80"
+ name="tablename"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <property
+ column="dcname"
+ length="20"
+ name="dcname"
+ type="java.lang.String"
+ />
+ <!-- Associations -->
+ </class>
+</hibernate-mapping>
--- /dev/null
+/*
+ * $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
--- /dev/null
+<?xml version="1.0"?>\r
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >\r\r<hibernate-mapping>\r <class \r name="org.codecoop.mir.core.model.Message" \r table="messages">
+ <id
+ column="id"
+ name="id"
+ type="java.lang.Integer"
+ >
+ <generator class="native">\r <param name="sequence">breaking_id_seq</param>\r </generator>
+ </id>
+ <property
+ column="title"
+ length="30"
+ name="title"
+ type="java.lang.String"
+ />
+ <property
+ column="description"
+ length="255"
+ name="description"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <property
+ column="creator"
+ length="30"
+ name="creator"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <property
+ column="creation_date"
+ length="8"
+ name="creationDate"
+ not-null="true"
+ type="java.sql.Timestamp"
+ />
+ <!-- Associations -->
+ </class>
+</hibernate-mapping>
--- /dev/null
+/*
+ * $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
--- /dev/null
+<?xml version="1.0"?>\r
+<!DOCTYPE hibernate-mapping PUBLIC\r "-//Hibernate/Hibernate Mapping DTD 2.0//EN"\r "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >\r
+<hibernate-mapping>
+ <class \r name="org.codecoop.mir.core.model.Right" \r table="rights">
+ <id
+ column="id"
+ name="id"
+ type="java.lang.Integer"
+ >
+ <generator class="native">\r <param name="sequence">right_id_seq</param>\r </generator>
+ </id>
+ <property
+ column="name"
+ length="80"
+ name="name"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <property
+ column="description"
+ length="255"
+ name="description"
+ type="java.lang.String"
+ />
+ <!-- Associations -->
+ </class>
+</hibernate-mapping>
--- /dev/null
+/*
+ * $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
--- /dev/null
+<?xml version="1.0"?>\r
+<!DOCTYPE hibernate-mapping PUBLIC\r "-//Hibernate/Hibernate Mapping DTD 2.0//EN"\r "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >\r\r<hibernate-mapping>
+ <class \r name="org.codecoop.mir.core.model.Role" \r table="roles">
+ <id
+ column="id"
+ name="id"
+ type="java.lang.Integer"
+ >
+ <generator class="native">
+ <param name="sequence">role_id_seq</param>
+ </generator>
+ </id>
+ <property
+ column="name"
+ length="16"
+ name="name"
+ not-null="true"
+ type="java.lang.String"
+ unique="true"
+ />
+ <property
+ column="description"
+ length="255"
+ name="description"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <!-- Associations -->\r <set name="users">\r <key column="to_role" foreign-key="fk_role_user"/>\r <one-to-many class="org.codecoop.mir.core.model.User"/>\r </set>\r
+ <set name="rights" table="role_x_rights">\r
+ <key column="role_id" foreign-key="fk_role_right"/>\r
+ <many-to-many class="org.codecoop.mir.core.model.Right"\r
+ foreign-key="fk_right_role"\r
+ column="right_id"/>\r
+ </set>
+ </class>
+</hibernate-mapping>
--- /dev/null
+/*
+ * $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
--- /dev/null
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
+
+<hibernate-mapping>
+ <class
+ name="org.codecoop.mir.core.model.TypedCategory"
+ table="article_x_category">
+
+ <composite-id>
+ <key-many-to-one
+ class="org.codecoop.mir.core.model.ArticleType"
+ column="article_type_id"
+ name="articleType"
+ foreign-key="fk_articlexcategory_article_type"
+ />
+ <key-many-to-one
+ class="org.codecoop.mir.core.model.Category"
+ column="category_id"
+ name="category"
+ foreign-key="fk_articlexcategory_category"
+ />
+ </composite-id>
+
+ </class>
+</hibernate-mapping>
--- /dev/null
+/*
+ * $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();
+ }
+}
--- /dev/null
+<?xml version="1.0"?>\r
+<!DOCTYPE hibernate-mapping PUBLIC\r "-//Hibernate/Hibernate Mapping DTD 2.0//EN"\r "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >\r\r<hibernate-mapping>\r <joined-subclass \r name="org.codecoop.mir.core.model.UploadedMedia" \r extends="org.codecoop.mir.core.model.Media" \r table="uploaded_media">\r\r <key \r column="media_id" \r foreign-key="fk_uploadedmedia_media"\r />\r
+ <property
+ column="publish_server"
+ length="255"
+ name="publishServer"
+ type="java.lang.String"
+ />
+ <property
+ column="publish_path"
+ length="255"
+ name="publishPath"
+ type="java.lang.String"
+ />\r <property\r column="storage_path"\r length="255"\r name="storagePath"\r type="java.lang.String"\r />
+ <property
+ column="icon_produced"
+ length="1"
+ name="iconProduced"
+ not-null="true"
+ type="boolean"
+ />
+ <property
+ column="icon_path"
+ length="255"
+ name="iconPath"
+ type="java.lang.String"
+ />
+ <property
+ column="size"
+ length="4"
+ name="size"
+ type="java.lang.Integer"
+ />
+ <!-- Associations -->\r <many-to-one \r column="to_media_folder"\r name="mediaFolder"\r class="org.codecoop.mir.core.model.MediaFolder"\r foreign-key="fk_uploadedmedia_mediafolder"\r />\r <many-to-one \r column="to_media_type"\r name="mediaType"\r class="org.codecoop.mir.core.model.MediaType"\r foreign-key="fk_uploadedmedia_mediatype" \r />
+ </joined-subclass>
+</hibernate-mapping>
--- /dev/null
+/*
+ * $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
--- /dev/null
+<?xml version="1.0"?>\r
+<!DOCTYPE hibernate-mapping PUBLIC\r "-//Hibernate/Hibernate Mapping DTD 2.0//EN"\r "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >\r\r<hibernate-mapping>
+ <class \r name="org.codecoop.mir.core.model.User" \r table="users">
+ <id
+ column="id"
+ name="id"
+ type="java.lang.Integer"
+ >
+ <generator class="native">
+ <param name="sequence">users_id_seq</param>
+ </generator>
+ </id>
+ <property
+ column="login"
+ length="16"
+ name="login"
+ not-null="true"
+ type="java.lang.String"
+ unique="true"
+ />
+ <property
+ column="password"
+ length="255"
+ name="password"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <property
+ column="internal_comment"
+ length="255"
+ name="internalComment"
+ type="java.lang.String"
+ />
+ <property
+ column="is_disabled"
+ length="1"
+ name="disabled"
+ not-null="true"
+ type="boolean"
+ />
+ <property
+ column="email"
+ length="255"
+ name="email"
+ not-null="true"
+ type="java.lang.String"
+ />
+ <property
+ column="profile"
+ length="255"
+ name="profile"
+ type="java.lang.String"
+ />
+ <property
+ column="creationDate"
+ length="8"
+ name="creationDate"
+ not-null="true"
+ type="java.sql.Timestamp"
+ />
+ <property
+ column="lastlogin"
+ length="8"
+ name="lastlogin"
+ type="java.sql.Timestamp"
+ />
+ <!-- Associations -->\r <many-to-one \r class="org.codecoop.mir.core.model.Role" \r name="role" \r column="to_role"\r foreign-key="fk_user_role"\r />
+ </class>
+</hibernate-mapping>
--- /dev/null
+/*
+ * $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