X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2Fmircoders%2Fstorage%2FDatabaseContentToTopics.java;h=3a6bdd837a256060a2d2d4cccb8d085375de2792;hb=1dc7fa03037c7e3e212286bd9e4d012694600f64;hp=a5a511b6b60a4923e782709e82d508eef29e0adf;hpb=198a670a8d27f18357e201bf0ec797239b627cd6;p=mir.git diff --git a/source/mircoders/storage/DatabaseContentToTopics.java b/source/mircoders/storage/DatabaseContentToTopics.java index a5a511b6..3a6bdd83 100755 --- a/source/mircoders/storage/DatabaseContentToTopics.java +++ b/source/mircoders/storage/DatabaseContentToTopics.java @@ -21,198 +21,200 @@ import mircoders.entity.*; public class DatabaseContentToTopics extends Database implements StorageObject{ - private static DatabaseContentToTopics instance; - - public static DatabaseContentToTopics getInstance() - throws StorageObjectException { - if (instance == null) { - instance = new DatabaseContentToTopics(); - instance.myselfDatabase = instance; - } - return instance; - } - - private DatabaseContentToTopics() - throws StorageObjectException { - - super(); - this.hasTimestamp = false; - this.theTable="content_x_topic"; - /** + private static DatabaseContentToTopics instance; + + public static DatabaseContentToTopics getInstance() + throws StorageObjectException { + if (instance == null) { + instance = new DatabaseContentToTopics(); + instance.myselfDatabase = instance; + } + return instance; + } + + private DatabaseContentToTopics() + throws StorageObjectException { + + super(); + this.hasTimestamp = false; + this.theTable="content_x_topic"; + /** try { - this.theEntityClass = Class.forName("mircoders.entity.EntityGruppen"); - } catch (Exception e) { - throw new StorageObjectException(e.toString()); - } + this.theEntityClass = Class.forName("mircoders.entity.EntityGruppen"); + } catch (Exception e) { + throw new StorageObjectException(e.toString()); + } */ - } - - - public EntityList getTopics(EntityContent content) { - EntityList returnList=null; - if (content != null) { - // get all to_topic from content_x_topic - String id = content.getId(); - String subselect = "id in (select topic_id from " + theTable + " where content_id=" + id+")"; - - try { - returnList = DatabaseTopics.getInstance().selectByWhereClause(subselect,-1); - } catch (Exception e) { - theLog.printDebugInfo("-- get topics failed " + e.toString()); - } - } - return returnList; - } - - - public void setTopics(String contentId, String[] topicId) { - if (contentId == null && topicId == null) { - return; - } - //first delete all row with content_id=contentId - String sql = "delete from "+ theTable +" where content_id=" + contentId; - - Connection con=null;Statement stmt=null; - try { - con = getPooledCon(); - // should be a preparedStatement because is faster - stmt = con.createStatement(); - ResultSet rs = executeSql(stmt,sql); - } catch (Exception e) { - theLog.printDebugInfo("-- set topics failed -- delete"); - } finally { - freeConnection(con,stmt); - } - - //now insert - //first delete all row with content_id=contentId - - for (int i=0;i