X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2Fmircoders%2Fmodule%2FModuleContent.java;h=cd4142e5d0b14d61d0ceff2598d9d33ab1bd8b0b;hb=d7429fe1376f25d0c4420c35c69dc9edd651ab25;hp=d6b8c93fbed2a4a1dc715b39bc0c15ffbd9588d6;hpb=c6a2204d8d75293256fd17c07e54971d7672359a;p=mir.git diff --git a/source/mircoders/module/ModuleContent.java b/source/mircoders/module/ModuleContent.java index d6b8c93f..cd4142e5 100755 --- a/source/mircoders/module/ModuleContent.java +++ b/source/mircoders/module/ModuleContent.java @@ -1,201 +1,73 @@ -package mircoders.module; - -import java.io.*; -import java.util.*; -import java.sql.*; -import javax.servlet.*; -import javax.servlet.http.*; - -import mir.servlet.*; -import mir.module.*; -import mir.entity.*; -import mir.misc.*; -import mir.storage.*; - -import mircoders.entity.*; -import mircoders.storage.*; - /* - * ContentObjekt - + * Copyright (C) 2001, 2002 The Mir-coders group * + * This file is part of Mir. * - * @author RK + * 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 the com.oreilly.servlet library, 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. */ -public class ModuleContent extends AbstractModule -{ - static Logfile theLog; +package mircoders.module; - public ModuleContent() { - super(); - if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Content.Logfile")); - } +import mir.entity.EntityList; +import mir.log.LoggerWrapper; +import mir.module.AbstractModule; +import mir.module.ModuleExc; +import mir.module.ModuleFailure; +import mir.storage.StorageObject; - public ModuleContent(StorageObject theStorage) { - this.theStorage = theStorage; - if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Content.Logfile")); - } +/** + * + *

Title: ModuleContent

+ *

Description: helper routines to manage articles

+ *

Copyright: Copyright (c) 2003

+ *

Company:

+ * @author not attributable + * @version 1.0 + */ - // - // methoden, um an ContentEntities zu kommen +public class ModuleContent extends AbstractModule +{ + static LoggerWrapper logger = new LoggerWrapper("Module.Content"); - public EntityList getFeatures(int offset, int limit) throws ModuleException - { - return getContent("is_published=true AND to_article_type=2", "date desc, webdb_create desc", - offset, limit); + public ModuleContent() { + super(); } - public EntityList getNewsWire(int offset, int limit) throws ModuleException - { - return getContent("is_published=true AND to_article_type = 1", - "date desc, webdb_create desc",offset,limit); + public ModuleContent(StorageObject theStorage) { + this.theStorage = theStorage; } - public EntityList getStartArticle() throws ModuleException - { - EntityList returnList = getContent("is_published=true AND to_article_type=4", - "date desc, webdb_create desc",0,1); - //if no startspecial exists - if (returnList==null || returnList.size()==0) - returnList = getContent("is_published=true AND to_article_type=3", - "date desc, webdb_create desc",0,1); - - return returnList; + public EntityList getContent(String whereClause, String orderBy,int offset, int limit) throws ModuleExc, ModuleFailure { + try { + return theStorage.selectByWhereClause(whereClause, orderBy, offset, limit); + } + catch (Throwable e){ + throw new ModuleFailure(e); + } } - - public EntityList getContent(HashMap searchValues, boolean concat, int offset, EntityUsers user) - throws ModuleException { - - try { - - String whereClause ="", aField, aValue; - boolean first = true; - - Set set = searchValues.keySet(); - Iterator it = set.iterator(); - for (int i=0;i