X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2Fmircoders%2Fstorage%2FDatabaseOther.java;h=dd641f927d7aaa4f33912fd531c2d346fa62b57a;hb=d06e23e638f2538f263af76bd32da6b140f20ac6;hp=167ba857d3b520b5347bc731c256b930d64317ba;hpb=855ecf8acedb12afbab7a621b2e2c0cf45b2f98f;p=mir.git diff --git a/source/mircoders/storage/DatabaseOther.java b/source/mircoders/storage/DatabaseOther.java index 167ba857..dd641f92 100755 --- a/source/mircoders/storage/DatabaseOther.java +++ b/source/mircoders/storage/DatabaseOther.java @@ -36,25 +36,11 @@ import mir.entity.Entity; import mir.log.LoggerWrapper; import mir.misc.StringUtil; import mir.storage.Database; -import mir.storage.StorageObject; -import mir.storage.StorageObjectFailure; +import mir.storage.DatabaseFailure; -/** - * - *

Title:

- *

Description:

- *

Copyright: Copyright (c) 2003

- *

Company:

- * @author not attributable - * @version 1.0 - */ - -public class DatabaseOther extends Database implements StorageObject{ +public class DatabaseOther extends Database { private static DatabaseOther 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 DatabaseOther getInstance() { if (instance == null) { instance = new DatabaseOther(); @@ -66,32 +52,30 @@ public class DatabaseOther extends Database implements StorageObject{ super(); logger = new LoggerWrapper("Database.OtherMedia"); - - hasTimestamp = true; - theTable = "other_media"; - theCoreTable = "media"; - theEntityClass = mircoders.entity.EntityOther.class; + mainTable = "other_media"; + entityClass = mircoders.entity.EntityOther.class; } - public void update(Entity theEntity) throws StorageObjectFailure { - String date = theEntity.getValue("date"); + public void update(Entity theEntity) throws DatabaseFailure { + String date = theEntity.getFieldValue("date"); if (date == null) { date = StringUtil.date2webdbDate(new GregorianCalendar()); - theEntity.setValueForProperty("date", date); + theEntity.setFieldValue("date", date); } super.update(theEntity); } - public String insert(Entity theEntity) throws StorageObjectFailure { - String date = theEntity.getValue("date"); + public String insert(Entity theEntity) throws DatabaseFailure { + String date = theEntity.getFieldValue("date"); if (date == null) { date = StringUtil.date2webdbDate(new GregorianCalendar()); - theEntity.setValueForProperty("date", date); + theEntity.setFieldValue("date", date); } return super.insert(theEntity); } - // initialisierungen aus den statischen Tabellen - + protected String getPrimaryKeySequence() { + return "media_id_seq"; + } }