X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2Fmircoders%2Fstorage%2FDatabaseTopics.java;h=e18e92eb59f5adc8089155eb0cc218fb3ac6a74c;hb=855ecf8acedb12afbab7a621b2e2c0cf45b2f98f;hp=f39226147b6ed83f7f8a9c88f76e3620e7803026;hpb=a459f111d85598df56c6ab711cec11632676b39c;p=mir.git diff --git a/source/mircoders/storage/DatabaseTopics.java b/source/mircoders/storage/DatabaseTopics.java index f3922614..e18e92eb 100755 --- a/source/mircoders/storage/DatabaseTopics.java +++ b/source/mircoders/storage/DatabaseTopics.java @@ -18,42 +18,47 @@ * 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. + * 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 mircoders.storage; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import mir.entity.Entity; +import mir.entity.EntityBrowser; import mir.log.LoggerWrapper; import mir.storage.Database; import mir.storage.StorageObject; import mir.storage.StorageObjectFailure; -import freemarker.template.SimpleList; /** - * Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle - * * + *

Title:

+ *

Description:

+ *

Copyright: Copyright (c) 2003

+ *

Company:

+ * @author not attributable + * @version 1.0 */ public class DatabaseTopics extends Database implements StorageObject{ - private static DatabaseTopics instance; - // the following *has* to be sychronized cause this static method - // could get preemted and we could end up with 2 instances of DatabaseFoo.. - // see the "Singletons with needles and thread" article at JavaWorld -mh - public synchronized static DatabaseTopics getInstance() throws - StorageObjectFailure { + public synchronized static DatabaseTopics getInstance() { if (instance == null) { instance = new DatabaseTopics(); - instance.myselfDatabase = instance; } return instance; } @@ -68,7 +73,19 @@ public class DatabaseTopics extends Database implements StorageObject{ theEntityClass = mircoders.entity.EntityTopics.class; } - public SimpleList getPopupData() throws StorageObjectFailure { - return getPopupData("title", true); + public List getPopupData() throws StorageObjectFailure { + List result = new Vector(); + Iterator i = new EntityBrowser(this, "", "title", 100, -1, 0); + + while (i.hasNext()) { + Entity e = (Entity) i.next(); + Map entry = new HashMap(); + entry.put("key", e.getId()); + entry.put("value", e.getValue("title")); + + result.add(entry); + } + + return result; } }